LowWord (FUN) ¶ FUNCTION LowWord : WORD Function returns the low word of the input “dwValue”. Example: dwValue : WORD := 16#12345678 ; -> MEM.LowWord ( dwValue ) = 16#5678 InOut: Scope Name Type Comment Return LowWord WORD function returns low word of “dwValue” Input dwValue DWORD dword with high and low word
Checksum ¶ CRC16_CCITT (Function) CRC16_Modbus (Function) CRC16_generic (Function) CRC16_standard (Function) CRC32 (Function) MD5 (FunctionBlock) Finale (Action) Init (Action) Update (Action)
CRC16_CCITT (FUN) ¶ FUNCTION CRC16_CCITT : WORD Function calculates the checksum CRC16-CCITT. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_CCITT ( ADR ( sTest ), 9 ) = 16#29B1 InOut: Scope Name Type Comment Return CRC16_CCITT WORD function returns the CRC16-CCITT checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
CRC16_Modbus (FUN) ¶ FUNCTION CRC16_Modbus : WORD Function calculates the Modbus CRC16 checksum. Deviating from the initial value generally used the check sum will be initialized with 16#FFFF. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_Modbus ( ADR ( sTest ), 9 ) = 16#4B37 InOut: Scope Name Type Comment Return CRC16_Modbus WORD function returns the Modbus CRC16 checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
CRC16_generic (FUN) ¶ FUNCTION CRC16_generic : WORD Function calculates the checksum CRC16 of the “MemoryBlock” in a generalized manner. Typical input parameter: CRC16 standard : wCRCInit := 16#0000 wPoly := 16#8005 xReflectInput := TRUE xReflectOutput := TRUE wXORout := 16#0000 CRC16-CCITT : wCRCInit := 16#FFFF wPoly := 16#1021 xReflectInput := FALSE xReflectOutput := FALSE wXORout := 16#0000 CRC16-Modbus : wCRCInit := 16#FFFF wPoly := 16#8005 xReflectInput := TRUE xReflectOutput := TRUE wXORout := 16#0000 Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_generic ( ADR ( sTest ), 9 , 16#1021 , FALSE , FALSE , 16#0000 ) = 16#29B1 InOut: Scope Name Type Comment Return CRC16_generic WORD function returns generalized CRC16 of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte wCRCInit WORD initial value for CRC value wPoly WORD polynom value for CRC algorithm xReflectInput BOOL reflect input data bytes xReflectOutput BOOL reflect CRC before final XOR wXORout WORD final XOR value before output
CRC16_standard (FUN) ¶ FUNCTION CRC16_standard : WORD Function calculates the default CRC16 checksum. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_standard ( ADR ( sTest ), 9 ) = 16#BB3D InOut: Scope Name Type Comment Return CRC16_standard WORD function returns the default CRC16 checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
CRC32 (FUN) ¶ FUNCTION CRC32 : DWORD Function calculates the CRC32 checksum used in PKZIP, AUTODIN II, Ethernet, FDDI. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC32 ( ADR ( sTest ), 9 ) = 16#CBF43926 InOut: Scope Name Type Comment Return CRC32 DWORD function returns the CRC32 checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
MD5 (FB) ¶ FUNCTION_BLOCK MD5 Function calculates the MD5 checksum of given “MemoryBlock” with “udiNumberOfBytes” bytes. The used algorithm of MD5 Message-Digest is descibed in RFC1321. Prefix: “memmd5”. Example: sTest : string := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' -> abyDigest [0] = 16#D1 abyDigest [1] = 16#74 abyDigest [2] = 16#AB abyDigest [3] = 16#98 abyDigest [4] = 16#D2 abyDigest [5] = 16#77 abyDigest [6] = 16#D9 abyDigest [7] = 16#F5 abyDigest [8] = 16#A5 abyDigest [9] = 16#61 abyDigest [10] = 16#1C abyDigest [11] = 16#2C abyDigest [12] = 16#9F abyDigest [13] = 16#41 abyDigest [14] = 16#9D abyDigest [15] = 16#9F InOut: Scope Name Type Comment Input xExecute BOOL rising edge starts calculation of “abyDigest” pMemoryBlock POINTER TO BYTE address of memory block udiNumberOfBytes UDINT number of bytes of memory block Output xDone BOOL calculation of abyDigest done xBusy BOOL calculation busy abyDigest ARRAY [0..15] OF BYTE MD5 digest Structure: Finale (Action) Init (Action) Update (Action)
MD5.Finale (ACT) ¶ MD5 finalization. Ends an MD5 message-digest operation and writes the the message digest.
MD5.Init (ACT) ¶ MD5 initialization. Begins an MD5 operation and writes a new context.