Herunterladen Inhalt Inhalt Diese Seite drucken

Checksum.crc16_Ccitt_Kermit; Checksum.crc16_Df1 - IFTOOLS MSB-RS485-PLUS Handbuch

Inhaltsverzeichnis

Werbung

KAPITEL 18. LUA ANALYSER ERWEITERUNGEN
Sketch Beispiel
1
p r i n t ( checksum . crc16_bacnet ( " H e l l o w o r l d " ) )
Protokollmonitor Beispiel
1
function o u t ( )
2
l o c a l t g = t e l e g r a m s . t h i s ( )
3
checksum header c r c
4
l o c a l header_crc = checksum . crc8_bacnet ( t g : s t r i n g ( ) : sub ( 3 , 8 ) )
5
. . .
6
checksum data c r c
7
l o c a l d a t a l e n g t h = t g : data ( 6 )
8
l o c a l d a t a _ c r c = checksum . crc16_bacnet ( t g : s t r i n g ( ) : sub ( 9 , 9+
d a t a l e n g t h +1) )
9
end
18.2.4.3

checksum.crc16_ccitt_kermit

Liefert die CRC16 CCITT (Kermit) Prüfsumme des gegebenen Datenstrings
als 16 Bit Integer.
checksum.crc16_ccitt_kermit(String )
String: Die Datensequenz als Lua String
Sketch Beispiel
1
p r i n t ( checksum . c r c 1 6 _ c c i t t _ k e r m i t ( " H e l l o w o r l d " ) )
Protokollmonitor Beispiel
1
function o u t ( )
2
t h e f o l l o w i n g code checks t h e c o n t e n t o f t h e e n t i r e message
except
3
f o r t h e l a s t two b y t e ( which are t h e checksum i t s e l f )
4
l o c a l cks = checksum . c r c 1 6 _ c c i t t _ k e r m i t ( t e l e g r a m s . t h i s ( ) : s t r i n g ( ) :
sub (1 ,
3) )
5
box . t e x t { c a p t i o n ="Checksum " , cks }
6
end
18.2.4.4

checksum.crc16_df1

CRC Allen-Bradley DF1 Prüfsummenalgorithmus. Das Resultat ist ein 16 Bit
Integer Wert.
checksum.crc16_df1(String )
String: the data as a string
228
> 20985
256 + t g : data ( 7 )
> 41426

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis