Set RS232 channel, baudRate, protocol
channel | RS232 Channel (1 to 3) |
baudRate | BaudRate (Must be a constant; cannot be a variable.) |
protocol | Protocol (Must be a constant; cannot be a variable.) |
You can only use the OpenCom command once to open a serial port. Set
RS232
is used to change the baud rate and/or protocol of a serial port at run time.
For the protocol parameter, please refer to the table below:
Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
---|---|---|---|---|---|---|---|
Parity | Stop Bit | Bit | # of Bits | ||||
0 | 0 = NONE | 0=1 Stop Bit | 0 | 0 = 5 bit | |||
0 | 1 = Reserved | 1=2 Stop Bits | 0 | 1 = 6 bit | |||
1 | 0 = Even | 1 | 0 = 7 bit | ||||
1 | 1 = Odd | 1 | 1 = 8 bit |
The following table shows typical settings based on the previous table:
Bits | Parity | Stop Bit | Value to Use |
---|---|---|---|
8 | NONE | 1 | 3 |
8 | EVEN | 1 | 19 (Hex = 13) |
8 | ODD | 1 | 27 (Hex = 1B) |
7 | NONE | 1 | 2 |
7 | EVEN | 1 | 18 (Hex = 12) |
7 | ODD | 1 | 26 (Hex = 1A) |
OpenCom 1, 19200, 3, 30, 20 'Open Rs232 channel 1 Set RS232 1, 115200, 19 'Change the baud rate & parity