Hallo,
für mein derzeitiges Teilprojekt benötige ich unter vb.net eine CRC8-Implementierung. In der Bascom-Hilfe steht folgendes:
Ich möchte einfach ein Bytearray überprüfen. Jedoch weiß ich nicht, wie und auf welche Weise ich das Array in einen String umwandeln muss? Habs so probiert:Code:The code below shows a VB function of CRC8 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
Jedoch kommt dann bei Bascom was anderes raus als bei vb.net... Könnte mir jemand helfen?Code:Dim _input(9) As Byte Dim Crc_string As String ... Crc_string = Str(_input(1)) For I As Byte = 2 To 8 Crc_string = Crc_string + Str(_input(i)) Next Crc8 = Docrc8(crc_string)
Vielen Dank & Gruß
Chris







Zitieren

Lesezeichen