Herunterladen Inhalt Inhalt Diese Seite drucken

BONFIGLIOLI Vectron ACTIVE Bedienungsanleitung Seite 34

Vorschau ausblenden Andere Handbücher für Vectron ACTIVE:
Inhaltsverzeichnis

Werbung

Beispiel: Programmfolge(C#)
private int Modbus_CRC(string
{
}
Aufruf der Funktion für das Telegramm: „0x02 0x07"
string
Console.WriteLine(Modbus_CRC(temp_s));
Ergebnis:
CRC niederwertiges Byte (low byte)
CRC höherwertiges Byte (high byte)
Die Modbus CRC Abfolge ist:
32
32
int
poly
= 0xA001;
int
CRC
= 0xFFFF;
for (int
i = 0; i < (int)(frame.Length); i++)
{
CRC ^= Convert.ToInt16(frame[i]);
for (int
j = 0; j < 8; j++)
{
if
((CRC & 0x01) == 0x01)
{
CRC >>= 1;
CRC ^= poly;
}
else
{
CRC >>= 1;
}
}
}
return
CRC;
temp_s = Convert.ToString((char)(0x2))+ Convert.ToString((char)(0x7));
⇒ CRC
Low Byte / High Byte
Betriebsanleitung Modbus
Betriebsanleitung Modbus
frame)
// polynom
// start CRC
// für jedes Zeichen
//
//
//
//
//
//
4673
= 0x1241
= 0x41
= 0x12
0x41
ExOR
acht mal
lsb == 1 ?
schieben links
ExOR
schieben links
0x12
05/08
05/08

Quicklinks ausblenden:

Werbung

Inhaltsverzeichnis
loading

Diese Anleitung auch für:

Vectron active cube

Inhaltsverzeichnis