MCP2200
2.3.1.2
Function:
bool SimpleIOClass::ConfigureIO (unsigned char IOMap)
ConfigureIO
Summary:
Description:
Precondition:
Parameters:
Configures the GPIO pins for Digital Input, Digital Output.
GPIO Pins can be configured as Digital Input, Digital Output.
VID and PID must be previously set via a call to
InitMCP2200(VID, PID)
.
IOMap
- a byte that represents a bitmap of the GPIO configuration:
• a bit set to ‘
1
’ will be a digital input
• a bit set to ‘
0
’ will be a digital output
• MSB –
–
–
–
–
–
LSB
GP7 GP6 GP5 GP4 GP3 GP2 GP1 GP0
Returns:
Remarks:
This function returns True if the transmission is successful and returns False if the transmission fails.
Error code is returned in
LastError
.
EXAMPLE 2-2:
if (SimpleIOClass::ConfigureIO(0xA5) == SUCCESS)
lblStatusBar->Text = “Success”;
else
lblStatusBar->Text = “Invalid command ” + SimpleIOClass::LastError;
2.3.1.3
Function:
ConfigureIoDefaultOutput
bool SimpleIOClass::ConfigureIoDefaultOutput (unsigned char ucIoMap, unsigned char ucDefValue)
Summary:
Description:
Precondition:
Parameters:
1.
Configures the IO pins for Digital Input, Digital Output and also the default output latch value.
IO Pins can be configured as Digital Input, Digital Output. The default output latch value is received
as a parameter.
VID and PID must be previously set via a call to
InitMCP2200(VID, PID)
.
ucIoMap
- a byte that represents a bitmap used to set the GPIOs as either input or output.
2.
• ‘
1
’ configures GPIO as input
• ‘
0
’ configures GPIO as output
• MSB –
–
–
–
–
–
LSB
GP7 GP6 GP5 GP4 GP3 GP2 GP1 GP0
ucDefValue
- the default value that will be loaded to the output latch (affects only the pins configured as
outputs).
This function returns True if the transmission is successful and returns False if the transmission fails.
Error code is returned in
LastError
.
Returns:
Remarks:
EXAMPLE 2-3:
if (SimpleIOClass::ConfigureIoDefaultOutput(IoMap, DefValue) == SUCCESS)
lblStatusBar->Text = “Success”;
else
lblStatusBar->Text = “Invalid command ” + SimpleIOClass::LastError;
2011 Microchip Technology Inc.
DS22228B-page 13