|
粘贴一个别人的来,呵,不要介意
http:////zhidao.baidu.com/question/66693092.html
MSComm1.InputMode = comInputModeBinary '设置发送模式为二进制
'其它设置略
'构造数据:
Dim cmd() As Byte
Dim data As String
data = "*0100PGR" & vbCrLf
ReDim cmd(Len(data) - 1)
Dim i As Integer
For i = 0 To UBound(cmd)
cmd(i) = Asc(Mid(data, i + 1, 1))
Next
'发送
MSComm1.Output = cmd
这就是asc码的,windows里回车符是两个字符,如果用其它控制字符,就代替为data = "*0100PGR" & chr(控制字符asc码)
用的MSComm1.Output = Chr(42) & "0100" & "PGR" & Chr(13)也搞定 |
|