主题:[讨论]求助高手!怎么让vb的MSComm1发送负数的数据?谢谢!
MSComm1.InputMode = comInputModeText
MSComm1.InputLen = 0
txt = "021R01000"
cmd = Chr(2) + txt + Chr(3)
lec = Len(cmd)
bc = 0
For i = 1 To lec
sa = Mid(cmd, i, 1)
bc = bc + Asc(sa)
Next
bc = bc Mod 256 'bc除以256的余数
bcc = "0" + Hex(bc) 'bc的十六进制数前加0
bcc = Right(bcc, 2)
endc = bcc + Chr(13)
cmd = cmd + endc
buf = MSComm1.Input '清除缓冲区
MSComm1.Output = cmd