The InitString method sets parameters for a serial port.
VOID InitString( | ||
BSTR String, | // parameters | |
); |
Parameters
String [in]
This is a string consisting of several items listed below and separated by comma:
- nBaudRate
Defines serial port baudrate. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600, 115200, 128000 and 256000. By default, 110 value is taken.
- nDataLength
Defines data lengths in a packet. Possible values are: 5, 6, 7 and 8. Default value is 7 bits.
- cParity
Defines parity from one of the following values: (E)ven, (O)dd, (M)ark, (S)pace, or (N)one. By default (N)one is taken.
- nStopBits
Defines a number of stop bits. Possible values are: "1", "1,5" and "2". Default value is "1".
- cHandflow
Defines flow control value. Possible values are: Hardware (P), Xon/Xoff (X) and None. Default value is None.
String examples:
"9600,N,8,1,P" – baudrate = 9600; Parity = None ; DataLength = 8; StopBits = 1; Handflow = Hardware;
"128000,N,7,1,X" – baudrate = 128000; Parity = None ; DataLength = 7; StopBits = 1; Handflow = Xon/Xoff;
"9600,N,8,1" – baudrate = 9600; Parity = None ; DataLength = 8; StopBits = 1; Handflow = None;