DCB structure in Serial Communication
Typedef struct _ DCB {// DCB
DWORD dcblength;
// Sizeof (DCB)
DORD baudrate;
// Current baud rate specifies the current baud rate
DWORD fbinary: 1;
// Binary mode, no EOF check specifies whether to allow the value true in the binary mode Win95
DWORD fparity: 1;
// Enable parity checking specifies whether the parity check is allowed
DWORD foutxctsflow: 1;
// CTS output flow control specifies whether CTS is used to detect sending control. When true, CTS is
// Off. Sending will be suspended. (Send clearly)
DWORD foutxdsrflow: 1;
// DSR output flow control specifies whether CTS is used to detect sending control.
// When the value true indicates that CTS is off, sending will be suspended.
DWORD fdtrcontrol: 2;
// DTR Flow Control Type
// Set the value of dtr_control_disable to off and the value of dtr_control_enable to on,
Dtr_control_handshake allows DTR to "Shake hands ",
DWORD fdsrsensiti.pdf: 1;
// When the value of DSR sensiti.pdf is true, the bytes received when the value of DSR is off are ignored.
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, stop sending after receiving xoffchar
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
If this value is true and fparity is true, use the characters specified by the errorchar member to replace the characters receiving the parity error.
DWORD fnull: 1;
// Enable null stripping true, remove null (0 value) bytes when receiving
DWORD frtscontrol: 2;
// RTS Flow Control
DWORD fabortonerror: 1;
// Abort reads/writes on error true: When an error occurs, stop read and write operations.
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.
Byte bytesize;
// Number of bits/byte, 4-8 specifies the data bit currently used by the port
Byte parity;
// 0-4 = No, odd, even, Mark, space specifies the port's current parity method, which may be:
Evenparity, markparity, noparity, oddparity
Byte stopbits;
0, 1, 2 = 1, 1.5, 2 specifies the number of currently used Stop bits 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 used to send and receive characters
Char errorchar;
// Error replacement character this character is used to replace the value of the received parity when an error occurs
Char eofchar;
// End of input character when the binary mode is not used, this character can be used to indicate the end of data
Char evtchar;
// When the received ed event character receives this character, an event is generated.
Word wreserved1;
// Reserved; do not use not used
} DCB;