发表于:2005-09-11 09:02:00
3楼
我的代码是这样的:
Private Sub Command1_Click()
MSComm1.Output = CheckSum(STX & "READ" & ETX) & vbcr &vblf
TimeDelay 1000
Text2.Text = MSComm1.Input
End Sub
Function CheckSum(Buf As String) As String
Dim i%, OrgBuf$
Dim CKValue%
OrgBuf = Buf
CKValue = 0
For i = 2 To Len(Buf)
CKValue = CKValue + Asc(Mid(Buf, i, 1)) And &H7F
Next i
CheckSum = Buf + Chr(CKValue)
End Function
我错在哪里呢?帮帮忙