|
-
Mar 13th, 2004, 05:24 AM
#1
Thread Starter
Member
Checksum
I'm currently looking for the method how to calculate checksum, can I know is that my coding method is correct? the result that I calculate compare with the Windows Calculator is different. please give some advice. thx
Public Function CalcLRC(ByVal StringToLRC As String) As String
' Calculate command checksum before sent to reader
Dim chksum, ltxt, i%
chksum = "&H" & "0"
ltxt = Len(Trim(StringToLRC))
For i% = 1 To ltxt Step 2
chksum = ("&H" & Mid(StringToLRC, i, 2) Xor chksum)
Next i
chksum = Hex(chksum)
If Len(chksum) = 1 Then chksum = "0" & chksum
CalcLRC = chksum
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|