请问怎么样用串口发送结构体?
wzqx 2015-08-23 12:02:43 Public Type dateconfig
Char1 As Byte
Char2 As Byte
Char3 As Byte
Char4 As Byte
CMDNAME As Byte
CMDNAMEconf As Byte
Check1 As Byte
Check2 As Byte
time1 As Integer
time2 As Integer
time3 As Integer
time4 As Integer
time5 As Integer
time6 As Integer
time7 As Integer
time8 As Integer
config1 As Integer
config2 As Integer
config3 As Integer
End Type
我定义了一个结构体,通过串口发送到另一台PC上,接收这个数据,然后转回结构体,再按结构体来显示.
但是有时会出BUG... 本来是800多的数据,会变成60000多.估计是某几个位出问题了.但绝大多数情况是正常的.
所以想系统地了解一下大家是怎么样处理这种需求的.
结构体转成byte数组用的是.
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
也可能是我串口的设置有点问题.请大家忙 看看怎么解决哈
就是说A点 要传送一个 上面说明的结构体到B点.B点接收好了显示出来.
或者其他的解决方案能实现 就行.