DCB structure in Serial Communication
/**************************************/
Main Parameter structure of %:
Typedef struct _ DCB {
......
DWORD bardrate; // The baud rate.
Byte bytesize; // number of data bits
Byte parity; // whether the parity bit exists
Byte stopbits; // Number of Stop bits
......
} DCB;
% Details are as follows:
Typedef struct _ DCB {// DCB
DWORD dcblength; // sizeof (DCB)
DORDBaudrate; // Current baud rate specifies the current baud rate
DWORD fbinary: 1; // binary mode, no EOF check specifies whether to allow true in binary mode Win95
DWORD fparity: 1; // specify enable parity checkingParityAllowed or not
DWORD foutxctsflow: 1; // CTS output flow control specifies whether CTS is usedDetect sending control.
If it is true, the sending will be suspended if CTS is off.
DWORD foutxdsrflow: 1; // DSR output flow control specifies whether the DSR is used to detect sending control. If "true" is set to "DSR" to "off", sending will be suspended.
DWORD fdtrcontrol: 2; // DTR Flow Control Type dtr_control_disable Value Sets DTR to off, dtr_control_enable Value Sets DTR to on, dtr_control_handshake allows DTR "handshake ",
DWORD fdsrsensiti.pdf: 1; // The Byte received when the DSR is off when the DSR is set to true
DWORD ftxcontinueonxoff: 1; // xoff continues TX
Specifies whether to stop sending when the receiving buffer is full and the driver has sent xoffchar characters.
True: when the receiving buffer receives the xofflim byte that is full in the buffer and the driver has sent the xoffchar character to abort the receiving byte, the sending continues.
If this parameter is set to false, the receiving buffer receives the byte xonchar that indicates that the buffer is empty and the driver sends the xonchar to resume sending.
DWORD foutx: 1; // Xon/xoff out flow control true, after receiving xoffchar, stop sending
After receiving xonchar, it will start again
DWORD finx: 1; // Xon/xoff in Flow Control
When the value is true, after the receiving buffer receives xofflim, which indicates that the buffer is full, xoffchar is sent out.
After the receiving buffer receives the xonlim, which indicates that the buffer is empty, the xonchar is sent out.
DWORD ferrorchar: 1; // enable error replacement when the value is true and fparity is true, use the characters specified by errorchar to replace the receiving characters for parity errors
DWORD fnull: 1; // enable null when stripping is true, remove null (0 value) bytes when receiving
DWORD frtscontrol: 2; // RTS Flow Control
DWORD fabortonerror: 1; // abort reads/writes on error true, stop read and write operations when an error occurs
Rts_control_disable
Rts_control_enable
Rts_control_handshake,
When the receiving buffer is less than half full, the RTS is on.
When the receiving buffer exceeds 3/4 full, the RTS is off.
When rts_control_toggle,
When the receiving buffer still has the remaining bytes, the RTS is on; otherwise, the default value is off.
DWORD fdummy2: 17; // reserved not used
Word wreserved; // not currently used not used, must be 0
Word xonlim; // transmit Xon threshold
Specifies the minimum number of bytes allowed in the buffer before the Xon character is sent.
Word xofflim; // transmit xoff threshold
Specifies the minimum number of bytes allowed in the receiving buffer before xoff is sent.
ByteBytesize; // Number of bits/byte, 4-8 specifies the data bit currently used by the port
ByteParity; // 0-4 = No, odd, even, Mark, space specifies the current parity method used by the port, which may be:
Evenparity, markparity, noparity, oddparity
ByteStopbits; // 0, 1, 2 = 1, 1.5, 2 specifies the number of Stop bits currently used on the port, which may be:
Onestopbit, one5stopbits, twostopbits
Char xonchar; // Tx and Rx Xon character specifies the value used to send and receive the Xon character
Char xoffchar; // Tx and Rx xoff character specifies the xoff value for sending and receiving characters
Char errorchar; // error replacement character this character is used to replace the value when an error occurs in the received parity check.
Char eofchar; // end of input character this character can be used to indicate the end of data when binary mode is not used.
Char evtchar; // encoded ed event character when receiving this character, an event is generated.
Word wreserved1; // reserved; do not use not used
} DCB;