Datasheet

MCP2200
DS22228B-page 14 2011 Microchip Technology Inc.
2.3.1.4 ConfigureMCP2200
Function:
bool SimpleIOClass::ConfigureIoDefaultOutput (unsigned long BaudRateParam, unsigned int RxLEDMode,
unsigned int TxLEDMode, bool FLOW, bool ULOAD, bool SSPND)
EXAMPLE 2-4:
2.3.1.5 fnHardwareFlowControl
Function:
bool SimpleIOClass::fnHardwareFlowControl (unsigned int onOff)
EXAMPLE 2-5:
Summary: Configures the device.
Description: Sets the default GPIO designation, baud rate, TX/RX LED modes, flow control.
Precondition: VID and PID must be previously set via a call to InitMCP2200(VID, PID).
Parameters:
1.
IOMap - A byte which represents the input/output state of the pins (each bit may be either a ‘1’ for input, and ‘0
for output.
2.
BaudRateParam - the default communication baud rate.
3. RxLEDMode - can take one of the constant values (OFF, ON, TOGGLE, BLINKSLOW, BLINKFAST) to define the
behavior of the Rx LED.
OFF = 0
ON = 1
TOGGLE = 3
BLINKSLOW = 4
BLINKFAST = 5
4. TxLEDMode - can take one of the defined values (OFF, ON, TOGGLE, BLINKSLOW, BLINKFAST) in order to define the
behavior of the Tx LED.
5.
FLOW - this parameter establishes the default flow control method (False - no HW flow control, True - RTS/CTS
flow control).
6. ULOAD - this parameter establishes when USB has loaded the configuration.
7. SSPND - this parameter establishes when USB send us the Suspend mode.
Returns: This function returns True if the transmission is successful and returns False if the transmission fails.
Remarks: None.
Summary: Configures the flow control of the MCP2200. The flow control configuration will be stored in NVRAM.
Description: Sets the flow control to HW flow control (RTS
/CTS) or No flow control.
Precondition: VID and PID must be previously set via a call to
InitMCP2200(VID, PID).
Parameters:
onOff:
•‘
1’ if HW flow control is required
•‘
0’ if no flow control is required
Returns: This function returns True if the transmission is successful and returns False if the transmission fails.
Remarks: Error code is returned in LastError.
if (SimpleIOClass::ConfigureMCP2200(0x43, 9600, BLINKSLOW, BLINKFAST, false, false, false)
== SUCCESS)
lblStatusBar->Text = “Success”;
else
lblStatusBar->Text = “Invalid command ”
if (SimpleIOClass::fnHardwareFlowControl(1) == SUCCESS)
lblStatusBar->Text = “Success”;
else
lblStatusBar->Text = “Invalid command ” + SimpleIOClass::LastError;