FindByte (FUN) ¶ FUNCTION FindByte : UINT Function look for the first occurence of “byValue” in “MemoryBlock”. Example: abyMemoryBlockA : ARRAY [0..9] OF BYTE := 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ; -> MEM.FindByte ( ADR ( abyMemoryBlockA ), 10 , 5 ) = 6 InOut: Scope Name Type Comment Return FindByte UINT function returns 0 if “byValue” is not found. Otherwise the function returns the position of the first occurence Input pMemoryBlock POINTER TO BYTE address of MemoryBlock uiLength UINT length of MemoryBlock in byte byValue BYTE value to look for in MemoryBlock
simple TYPE ¶ HighByte (Function) HighWord (Function) LowByte (Function) LowWord (Function)
HighByte (FUN) ¶ FUNCTION HighByte : BYTE Function returns the high byte of the input “wValue”. Example: wValue : WORD := 16#1234 ; -> MEM.HighByte ( wValue ) = 16#12 InOut: Scope Name Type Comment Return HighByte BYTE function returns high byte of “wValue” Input wValue WORD word with high and low byte
HighWord (FUN) ¶ FUNCTION HighWord : WORD Function returns the high word of the input “dwValue”. Example: dwValue : WORD := 16#12345678 ; -> MEM.HighWord ( dwValue ) = 16#1234 InOut: Scope Name Type Comment Return HighWord WORD function returns high wird of “dwValue” Input dwValue DWORD dword with high and low word
LowByte (FUN) ¶ FUNCTION LowByte : BYTE Function returns the low byte of the input “wValue”. Example: wValue : WORD := 16#1234 ; -> MEM.LowByte ( wValue ) = 16#34 InOut: Scope Name Type Comment Return LowByte BYTE function returns low byte of “wValue” Input wValue WORD word with high and low byte
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