The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: georgek01 on July 06, 2009, 06:37:30 AM

Title: Serial Communication - Flow Control not available in DCB
Post by: georgek01 on July 06, 2009, 06:37:30 AM
Hello!

I need to set the serial communication settings of a COM port but do not see a member in the DCB for flow control. Only the following members of the DCB structure is available:

dcb.BaudRate
dcb.ByteSize
dcb.Parity
dcb.StopBits
dcb.EofChar
dcb.ErrorChar
dcb.EvtChar
dcb.fbits
dcb.wReserved
dcb.wReserved1
dcb.XoffChar
dcb.XoffLim
dcb.XonChar
dcb.XonLim

How will I set flow control?
Title: Re: Serial Communication - Flow Control not available in DCB
Post by: georgek01 on July 06, 2009, 06:57:27 AM
I searched the forum and found the answer... guess I should have done that first  :wink

The fBits member of the DCB structure is a structure in itself. This is where flow control can be set:

mov  dcb.fbits, BITRECORD<\
TRUE,\   ; fBinary:1
FALSE,\   ; fParity:1
FALSE,\   ; fOutxCtsFlow:1
FALSE,\   ; fOutxDsrFlow:1
DTR_CONTROL_DISABLE,\   ; fDtrControl:2
FALSE,\   ; fDsrSensitivity:1
TRUE,\   ; fTXContinueOnXoff:1
FALSE,\   ; fOutX:1
FALSE,\   ; fInX:1
TRUE,\   ; fErrorChar:1
FALSE,\   ; fNull:1
RTS_CONTROL_DISABLE,\   ; fRtsControl:2
FALSE,\   ; fAbortOnError:1
NULL>   ; fDummy2:17
Title: Re: Serial Communication - Flow Control not available in DCB
Post by: redskull on July 06, 2009, 12:39:43 PM
be cautious of the order the RECORD is defined in; masm records are backwards from C records

-r
Title: Re: Serial Communication - Flow Control not available in DCB
Post by: georgek01 on July 06, 2009, 01:08:05 PM
i noticed that from one of your posts. it took some doing but it looks like it's working.

i also picked up that when i set StopBits to 1, fbits also change to 1 even when i set fbits to 0.

thanks.