CRC4 Berechnung in Visual Basic?

Gast #3691943
Lesenswert?

Hallo,

ich möchte in VB 2010 Express ein Programm erstellen um mit einem Sensor 
zu kommunizieren.

Der String sieht so aus:

<A1><A0><D3><D2><D1><D0><CRC>

<A> address as 2-digit hex No.
<D> data as 4-digit hex No.
<CRC> checksum as 1-digit hex No

Nun muss die CRC als CRC4 berechnet werden. Das Handbuch beschreibt:

The data bits are always followed by 4 CRC bits. For all commands but 
read the CRC result is calculated of all protocol bits, including 
command, address, parity and data bits.

For read command, the CRC result is calculated of data bits only (16).
The polynomial for the CRC calculation is always X4+X+1

Wie kann ich das in VB umsetzen?

Gruss Patrick

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren