|
回复:给你个小程序,自己琢磨去吧!
Sub WTimer2()
fram$ = "@00WC00020300"
L = Len(fram$)
q = 0
For i = 1 To L
q = Asc(Mid$(fram$, i, 1)) Xor q
Next i
fcsd$ = Hex$(q)
MsgBox (fcsd$)
If Len(fram$) = 1 Then fcsd$ = "0" + fcsd$
Frame$ = fram$ + fcsd$ + "*" + Chr$(13)
Form1.MSComm1.Output = Frame$
Form1.Text1.Text = Frame$
End Sub
Sub Output()
fram$ = "@00RR01000003"
L = Len(fram$)
q = 0
For i = 1 To L
q = Asc(Mid$(fram$, i, 1)) Xor q
Next i
fcsd$ = Hex$(q)
MsgBox (fcsd$)
If Len(fram$) = 1 Then fcsd$ = "0" + fcsd$
Frame$ = fram$ + fcsd$ + "*" + Chr$(13)
Form1.MSComm1.Output = Frame$
Form1.Text1.Text = Frame$
End Sub
|