Private Sub C3_Click()
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
MSComm1.InputLen = 0
sd = "01ED00BB8" '这行的东西不一样.......................
MSComm1.Output = Chr(5) + sd + SumChk(sd)
MSComm1.PortOpen = False
End If
End Sub
有几个按钮,功能都差不多.能不能在 VB通用那儿建立个....供几个按钮调用.
就像下面的SumChk()
Private Function SumChk(Dats$) As String
Dim i&
Dim CHK&
For i = 1 To Len(Dats)
CHK = CHK + Asc(Mid(Dats, i, 1))
Next i
SumChk = Right(Hex$(CHK), 2)
End Function
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
MSComm1.InputLen = 0
sd = "01ED00BB8" '这行的东西不一样.......................
MSComm1.Output = Chr(5) + sd + SumChk(sd)
MSComm1.PortOpen = False
End If
End Sub
有几个按钮,功能都差不多.能不能在 VB通用那儿建立个....供几个按钮调用.
就像下面的SumChk()
Private Function SumChk(Dats$) As String
Dim i&
Dim CHK&
For i = 1 To Len(Dats)
CHK = CHK + Asc(Mid(Dats, i, 1))
Next i
SumChk = Right(Hex$(CHK), 2)
End Function