首先在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