CHECK程式發覺BCC轉換少一步驟,請注意新加入C$
A$ = "S1" + "100.0" + Chr(3) ‘100.0是設定值(SV)
GoSub FCS
C$=Chr(R$)
B$ = Chr(4)+ "00"+Chr(2)+A$ +
C$ ‘00是Unit No,R$是BCC
Label1.Caption = B$
MSComm1.Output = Trim(B$ + Chr(13)) ‘Chr(13)代表按鍵Enter輸入
MSComm1.InputLen = 0
If MSComm1.InBufferCount Then
INSTRING = MSComm1.Input
End If
Label2.Caption = INSTRING
Exit Sub
FCS:
Q = 0
L = Len(A$)
For I = 1 To L
Q = Asc(Mid(A$, I, 1)) Xor Q
Next I
R$ =Q
If Len(R$) = 1 Then
R$ = "0" + R$
End If
Return
ACK 是06H,NAK是15H於VB看不到,可以檢查是否收到Chr(06),Chr(15)
最后修改:2003-12-8 13:26:40