DCB

typedef struct _DCB { /* dcb */

DWORD DCBlength; /* sizeof(DCB) */

DWORD BaudRate; /* Baudrate at which running */

DWORD fBinary: 1; /* Binary Mode (skip EOF check) */

DWORD fParity: 1; /* Enable parity checking */

DWORD fOutxCtsFlow:1; /* CTS handshaking on output */

DWORD fOutxDsrFlow:1; /* DSR handshaking on output */

DWORD fDtrControl:2; /* DTR Flow control */

DWORD fDsrSensitivity:1; /* DSR Sensitivity */

DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */

DWORD fOutX: 1; /* Enable output X-ON/X-OFF */

DWORD fInX: 1; /* Enable input X-ON/X-OFF */

DWORD fErrorChar: 1; /* Enable Err Replacement */

DWORD fNull: 1; /* Enable Null stripping */

DWORD fRtsControl:2; /* Rts Flow control */

DWORD fAbortOnError:1; /* Abort all reads and writes on Error */

DWORD fDummy2:1; /* Reserved */

WORD wReserved; /* Not currently used */

WORD XonLim; /* Transmit X-ON threshold */

WORD XoffLim; /* Transmit X-OFF threshold */

BYTE ByteSize; /* Number of bits/byte, 4-8 */

BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */

BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */

char XonChar; /* Tx and Rx X-ON character */

char XoffChar; /* Tx and Rx X-OFF character */

char ErrorChar; /* Error replacement char */

char EofChar; /* End of Input character */

char EvtChar; /* Recieved Event character */

} DCB;

The DCB structure defines the control setting for a serial communications device.

Members

DCBlength

Specifies the length of the dcb structure.

BaudRate

Specifies the baud rate at which the communications device operates.

fBinary

Specifies binary mode. In nonbinary mode, the EofChar character is recognized on input and remembered as the end of data.

fParity

Specifies whether parity checking is enabled. If the fParity member is set, parity checking is performed and errors are reported.

fOutxCtsFlow

Specifies that clear-to-send (CTS) signal is to be monitored for output flow control. If the fOutxCtsFlow member is set and CTS is turned off, output is suspended until CTS is again sent.

fOutxDsrFlow

Specifies that the data-set-ready (DSR) signal is to be monitored for output flow control. If the fOutxDsrFlow member is set and DSR is turned off, output is suspended until DSR is again sent.

fDtrControl

Value Meaning

DTR_CONTROL_DISABLE Disable the Dtr line on device open and leave it disabled.
DTR_CONTROL_ENABLE Enable the Dtr line on device open and leave it on.
DTR_CONTROL_HANDSHAKE Enable Dtr handshaking. Note that if handshaking is enabled, it is an error for the application to adjust the line via the escape function.

fDsrSensitivity

If TRUE, the comm driver to ignores any received characters unless the DSR modem input line is high.

fTXContinueOnXoff

Specifies whether transmission stops when the receive queue is full and the driver has transmitted an Xoff character.

If this flag is TRUE, transmission continues after the receive queue has come within XoffLim characters of being full and the driver has transmitted an Xoff character to stop receiving characters.

If this flag is FALSE, transmission does not continue until the receive queue is within XonLim characters of being empty and the driver has transmitted an Xon character to resume reception.

fOutX

Specifies that XON/XOFF flow control is used during transmission. If the fOutX member is set, transmission stops when the XoffChar character is received, and starts again when the XonChar character is received.

fInX

Specifies that XON/XOFF flow control is used during reception. If the fInX member is set, the XoffChar character is sent when the receive queue comes within XoffLim characters of being full, and the XonChar character is sent when the receive queue comes within XonLim characters of being empty.

fErrorChar

Specifies that characters received with parity errors are to be replaced with the character specified by the ErrorChar member. The fParity member must be set for the replacement to occur.

fNull

Specifies that received null characters are to be discarded.

fRtsControl

Value Meaning

RTS_CONTROL_DISABLE Disable the Rts line on device open and leave it disabled.
RTS_CONTROL_ENABLE Enable the Rts line on device open and leave it on.
RTS_CONTROL_HANDSHAKE Enable Rts handshaking. Note that if handshaking is enabled, it is an error for the application to adjust the line via the escape function.

fAbortOnError

Specifies whether reads and writes are aborted if an error occurs.

If this flag is TRUE, the driver aborts all reads and writes with an error status if an error occurs. The driver will not accept any further communications operations until the application has acknowledged the error by calling the ClearCommError function.

fdummy2

Reserved.

wReserved

Not currently used. Must be set to zero.

XonLim

Specifies the minimum number of characters allowed in the receive queue before the XON character is sent.

XoffLim

Specifies the maximum number of characters allowed in the receive queue before the XOFF character is sent. The XoffLim value is subtracted from the size of the receive queue (in bytes) to calculate the maximum number of characters allowed.

ByteSize

Specifies the number of bits in the characters transmitted and received.

Parity

Specifies the parity scheme to be used. The Parity member can be any one of the following values:

Value Meaning

EVENPARITY Even
MARKPARITY Mark
NOPARITY No parity
ODDPARITY Odd

StopBits

Specifies the number of stop bits to be used. The StopBits member can be any one of the following values:

Value Meaning

ONESTOPBIT 1 stop bit
ONE5STOPBITS 1.5 stop bits
TWOSTOPBITS 2 stop bits

XonChar

Specifies the value of the XON character for both transmission and reception.

XoffChar

Specifies the value of the XOFF character for both transmission and reception.

ErrorChar

Specifies the value of the character used to replace characters received with a parity error.

EofChar

Specifies the value of the character used to signal the end of data.

EvtChar

Specifies the value of the character used to signal an event.

Comments

The following restrictions apply to the 8250:

The byte size (number of data bits) must be 5 to 8 bits.

5 data bits and 2 stop bits is an invalid combination, as is 6, 7, or 8 databits with 1.5 stop bits.

See Also

BuildCommDCB, GetCommState, SetCommState