ScriptName "Checksum Calculation" ScriptAuthor "(dA)" ScriptVersion "(1)" // Beschreibung // Zusätzliche Berechnung einer Checksumme durch logische Verknüpfung Var Source : Buffer[10]; Var Destination : Word; Var wsize : Word; MoveConst(Source[0], #0x01#0x01#0x04#0x08); MoveConst(wsize, 4); // Pfad: math -> Checksum Calculation // Checksum ( ADDRESS , DESTINATION , NUMBER , CRC16 ) ; // Source = ADDRESS = Array // Destination = DESTINATION = Word // wsize = NUMBER = Word // v4 = CRC16 = Art Logik Verknüpfung // XOR /* Byteweise XOR-Verknüpfung: Ergebnis ist Wort */ // XOR_NOT /* Ergebnis zu Schluß invertiert */ // SUM /* Byteweise Summierung: Ergebnis ist Wort */ // SUM_NOT /* Ergebnis zu Schluß invertiert */ // CRC16 /* Wie z.B bei Modbus */ // Feldbus-Seite // RS-Seite // Intern -> Ja // min value = // max value = // Beispiel: XOR // Vorher // Source = 0x01, 0x01, 0x04, 0x08 Checksum ( Source[0] , Destination , wsize , XOR ) ; // Nacher // Destination = 0x000C // Beispiel: XOR_NOT // Vorher // Source = 0x01, 0x01, 0x04, 0x08 Checksum ( Source[0] , Destination , wsize , XOR_NOT ) ; // Nacher // Destination = 0xFFF3 // Beispiel: SUM // Vorher // Source = 0x01, 0x01, 0x04, 0x08 Checksum ( Source[0] , Destination , wsize , SUM ) ; // Nacher // Destination = 0x000E // Beispiel: SUM_NOT // Vorher // Source = 0x01, 0x01, 0x04, 0x08 Checksum ( Source[0] , Destination , wsize , SUM_NOT ) ; // Nacher // Destination = 0xFFF1 // Beispiel: CRC16 // Vorher // Source = 0x01, 0x01, 0x04, 0x08 Checksum ( Source[0] , Destination , wsize , CRC16 ) ; // Nacher // Destination = 0x531E stop ;