VB串口发送一串16进制跟接收问题

2024-11-23 06:36:27
推荐回答(1个)
回答1:

首先在ford_load事件里要把MSComm1的发送接收方式改成字节接收方式,即MSComm1.InputMode = comInputModeBinary
Command6里的发送事件改为:
dim outbyte(2) as byte
outbyte(0)=&HBB
outbyte(1)="&H0" & trim(text3.text)
outbyte(2)="&H" & format(10*val(text4.text),"00")
MSComm1.OutBufferCount = 0
mscomm1.output=outbyte