请问,vb的串口通信怎样发送16进制数和Ascii码呢 50
2个回答
推荐于2016-09-17 · 知道合伙人软件行家
关注
展开全部
Private Sub Command1_Click()
Dim sendsj(3) As Byte
'16进制
sendsj(0) = &HA
sendsj(1) = &H36
sendsj(2) = &HA4
sendsj(3) = &HFF
MSComm1.Output = sendsj
End Sub
Private Sub Command2_Click()
Dim sendsj(3) As Byte
'ASCII码
sendsj(0) = 10
sendsj(1) = 54
sendsj(2) = 164
sendsj(3) = 255
MSComm1.Output = sendsj
End Sub
Private Sub Command3_Click()
Dim strsj As String
'
strsj = "ASCII字符"
MSComm1.Output = strsj
End Sub
Private Sub Form_Load()
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True
End Sub
Dim sendsj(3) As Byte
'16进制
sendsj(0) = &HA
sendsj(1) = &H36
sendsj(2) = &HA4
sendsj(3) = &HFF
MSComm1.Output = sendsj
End Sub
Private Sub Command2_Click()
Dim sendsj(3) As Byte
'ASCII码
sendsj(0) = 10
sendsj(1) = 54
sendsj(2) = 164
sendsj(3) = 255
MSComm1.Output = sendsj
End Sub
Private Sub Command3_Click()
Dim strsj As String
'
strsj = "ASCII字符"
MSComm1.Output = strsj
End Sub
Private Sub Form_Load()
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True
End Sub
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询