网上流传两个版本的DCB,经过验证有一个有问题

网上流传两个版本的DCB,经过验证有一个有问题,第1张

概述补充: 测试了一下使用左面的结构定义, 使用字符串(baud=1111 parity=E data=8 stop=1)构造DCB只能改变波特率,对校验方式无效 可以用构造后用xDCB.parity=E来解决   右面的结构上面的对校验位有效,但是 *** 作errorchar之类的比较麻烦 ----------------------------------------------------------

补充:

测试了一下使用左面的结构定义,使用字符串(baud=1111 parity=E data=8 stop=1)构造DCB只能改变波特率,对校验方式无效

可以用构造后用xDCB.parity=E来解决

右面的结构上面的对校验位有效,但是 *** 作errorchar之类的比较麻烦

----------------------------------------------------------------------------------------------------------------------------------

下面两个DCB结构网上流传很广

其实在XP + VB6环境下右边这个才是准确的

虽然左边这个可以用于设置某些串口参数,但是要进行一些更深入的设置就会出问题,不报错但是设置不起作用

fBitFIElds:

' The fourteen actual DCB bit-sized data fIElds within the four bytes of fBitFIElds can be manipulated by bitwise logical And/Or operations.
' FIEldname Bit # Description
' ----------------- ----- ------------------------------
' fBinary 1 1 binary mode,no EOF check
' fParity 2 1 enable parity checking
' fOutxCtsFlow 3 0 CTS output flow control
' fOutxDsrFlow 4 0 DSR output flow control
' fDtrControl 5 0 DTR flow control type (2 bits)
' fDsrSensitivity 7 0 DSR sensitivity
' fTXContinueOnXoff 8 0 XOFF continues Tx
' fOutX 9 0 XON/XOFF out flow control
' fInX 10 0 XON/XOFF in flow control
' fErrorChar 11 1 enable error replacement
' fNull 12 1 enable null stripPing
' fRtsControl 13 0 RTS flow control (2 bits)
' fAbortOnError 15 1 abort reads/writes on error
' fDummy2 16 0 reserved

Type DCB Type DCB DCBlength As Long DCBlength As Long Baudrate As Long Baudrate As Long fBinary As Long fBitFIElds As Long fParity As Long wReserved As Integer fOutxCtsFlow As Long Xonlim As Integer fOutxDsrFlow As Long Xofflim As Integer fDtrControl As Long ByteSize As Byte fDsrSensitivity As Long Parity As Byte fTXContinueOnXoff As Long StopBits As Byte fOutX As Long XonChar As Byte fInX As Long XoffChar As Byte fErrorChar As Long ErrorChar As Byte fNull As Long EofChar As Byte fRtsControl As Long EvtChar As Byte fAbortOnError As Long wReserved1 As Integer 'Reserved; Do Not Use fDummy2 As Long End Type wReserved As Integer Xonlim As Integer Xofflim As Integer ByteSize As Byte Parity As Byte StopBits As Byte XonChar As Byte XoffChar As Byte ErrorChar As Byte EofChar As Byte EvtChar As Byte End Type

总结

以上是内存溢出为你收集整理的网上流传两个版本的DCB,经过验证有一个有问题全部内容,希望文章能够帮你解决网上流传两个版本的DCB,经过验证有一个有问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1292060.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存