Calculate Byte Value Checksum in PBP Pro
Hello
Exixts a fuction in PBP Pro that return the calculated Byte Checksum of a string, like the CRC8 Function from the Bascom language?
If don't exists, how can i make it for PBP Pro?
This is a way to do that in VB, how can it converted to PBP Pro?
Code:
Function Docrc8(ByVal s As String) As Byte
Dim j As Byte
Dim k As Byte
Dim crc8 As Byte
Dim m As Byte
Dim x As Byte
crc8 = 0
For m = 1 To Len(s)
x = Asc(Mid(s, m, 1))
For k = 0 To 7
j = 1 And (x Xor crc8)
crc8 = Fix(crc8 / 2) And &HFF
x = Fix(x / 2) And &HFF
If j <> 0 Then
crc8 = crc8 Xor &H8C
End If
Next k
Next
Docrc8 = crc8
End Function
This is a way to do that in Bascom, how can it converted to PBP Pro?
Declare Sub Send_file(byval Datastr$ As String)as String
Datastr$ = "AFMDP" + ";" + "999988"
End
Sub Send_file(byval Datastr$ As String)as String
Len_str = Len(datastr$) 'len of the string you send
Chk = Crc8(datastr$ , Len_str) 'make the crc8 byte from the string
Print Chk 'send it the calculated byte value
End Sub
Thanks
Regards
Pedro