Hi.
I would like some help with the conversion from this function from vb.net :
I need this to calculate the checksum for my data that i`m sending to the SerialPort.
I tried making a conversion, but I don`t know even how to begin.
Any help would be appreciated.
Thank you.
I would like some help with the conversion from this function from vb.net :
B4X:
Public Function ComputeCRC(val As Byte()) As Byte()
Dim crc As Long
Dim q As Long
Dim c As Byte
crc = 0
For i As Integer = 0 To val.Length - 1
c = val(i)
q = (crc Xor c) And &HF
crc = (crc >> 4) Xor (q * &H1081)
q = (crc Xor (c >> 4)) And &HF
crc = (crc >> 4) Xor (q * &H1081)
Next
Return New Byte() {CByte(crc And &HFF), CByte(crc >> 8)}
End Function
I need this to calculate the checksum for my data that i`m sending to the SerialPort.
I tried making a conversion, but I don`t know even how to begin.
Any help would be appreciated.
Thank you.