加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-16 22:51:44 所属栏目:大数据 来源:网络整理
导读:补充: 测试了一下使用左面的结构定义,使用字符串(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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读