MCP2200
2.3.1.2
ConfigureIO
Function:
bool SimpleIOClass::ConfigureIO (unsigned char IOMap)
Summary:
Configures the GPIO pins for Digital Input, Digital Output.
GPIO Pins can be configured as Digital Input, Digital Output.
Description:
Precondition: VID and PID must be previously set via a call to InitMCP2200(VID, PID).
Parameters:
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:
This function returns True if the transmission is successful and returns False if the transmission fails.
Remarks:
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:
Configures the IO pins for Digital Input, Digital Output and also the default output latch value.
Description:
IO Pins can be configured as Digital Input, Digital Output. The default output latch value is received
as a parameter.
Precondition: VID and PID must be previously set via a call to InitMCP2200(VID, PID).
Parameters:
1. ucIoMap- a byte that represents a bitmap used to set the GPIOs as either input or output.
• ‘1’ configures GPIO as input
• ‘0’ configures GPIO as output
• MSB
–
–
–
–
–
–
LSB
GP7 GP6 GP5 GP4 GP3 GP2 GP1 GP0
2. ucDefValue - the default value that will be loaded to the output latch (affects only the pins configured as
outputs).
Returns:
This function returns True if the transmission is successful and returns False if the transmission fails.
Remarks:
Error code is returned in LastError.
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