Functionblocks ¶ Port (FunctionBlock) Multicast JoinGroup (Method) LeaveGroup (Method) SetInterface (Method) Properties IPAddress (Property) ReceivePort (Property) SendPort (Property) Socket (Property) Receive (Method) Receive2 (Method) Send (Method) Socket Bind (Method) FdIsSet (Method) FdSet (Method) GetOption (Method) IoControl (Method) SetOption (Method) UDPDriver (FunctionBlock) ClosePort (Method) CreatePort (Method) Select (Method)
WORD_TO_BCD (FUN) ¶ FUNCTION WORD_TO_BCD : WORD Converts one WORD in binary code into one WORD in BCD code Use BCD_TO_WORD for the reverse conversion. InOut: Scope Name Type Comment Return WORD_TO_BCD WORD Value in BCD code for the input W Input W WORD Value in binary code. Valid range: 0..9999
Bit/Byte Functions ¶ BIT_AS_BYTE (FunctionBlock) BIT_AS_DWORD (FunctionBlock) BIT_AS_WORD (FunctionBlock) BYTE_AS_BIT (FunctionBlock) DWORD_AS_BIT (FunctionBlock) EXTRACT (Function) GETBIT (Function) PACK (Function) PUTBIT (Function) SETBIT (Function) SWITCHBIT (Function) UNPACK (FunctionBlock) WORD_AS_BIT (FunctionBlock)
BIT_AS_BYTE (FB) ¶ FUNCTION_BLOCK BIT_AS_BYTE Converts 8 input values of data type BOOL into an output value of data type byte InOut: Scope Name Type Comment Input B0 BOOL Input bit 0 B1 BOOL Input bit 1 B2 BOOL Input bit 2 B3 BOOL Input bit 3 B4 BOOL Input bit 4 B5 BOOL Input bit 5 B6 BOOL Input bit 6 B7 BOOL Input bit 7 Output B BYTE Output value
BIT_AS_DWORD (FB) ¶ FUNCTION_BLOCK BIT_AS_DWORD Converts 32 input values of data type BOOL into an output value of the data type DWORD InOut: Scope Name Type Comment Input B00 BOOL Input bit 0 B01 BOOL Input bit 1 B02 BOOL Input bit 2 B03 BOOL Input bit 3 B04 BOOL Input bit 4 B05 BOOL Input bit 5 B06 BOOL Input bit 6 B07 BOOL Input bit 7 B08 BOOL Input bit 8 B09 BOOL Input bit 9 B10 BOOL Input bit 10 B11 BOOL Input bit 11 B12 BOOL Input bit 12 B13 BOOL Input bit 13 B14 BOOL Input bit 14 B15 BOOL Input bit 15 B16 BOOL Input bit 16 B17 BOOL Input bit 17 B18 BOOL Input bit 18 B19 BOOL Input bit 19 B20 BOOL Input bit 20 B21 BOOL Input bit 21 B22 BOOL Input bit 22 B23 BOOL Input bit 23 B24 BOOL Input bit 24 B25 BOOL Input bit 25 B26 BOOL Input bit 26 B27 BOOL Input bit 27 B28 BOOL Input bit 28 B29 BOOL Input bit 29 B30 BOOL Input bit 30 B31 BOOL Input bit 31 Output X DWORD Output value
BIT_AS_WORD (FB) ¶ FUNCTION_BLOCK BIT_AS_WORD Converts 16 input values of data type BOOL into an output value of the data type WORD InOut: Scope Name Type Comment Input B00 BOOL Input bit 0 B01 BOOL Input bit 1 B02 BOOL Input bit 2 B03 BOOL Input bit 3 B04 BOOL Input bit 4 B05 BOOL Input bit 5 B06 BOOL Input bit 6 B07 BOOL Input bit 7 B08 BOOL Input bit 8 B09 BOOL Input bit 9 B10 BOOL Input bit 10 B11 BOOL Input bit 11 B12 BOOL Input bit 12 B13 BOOL Input bit 13 B14 BOOL Input bit 14 B15 BOOL Input bit 15 Output W WORD Output value
BYTE_AS_BIT (FB) ¶ FUNCTION_BLOCK BYTE_AS_BIT Converts an input value of data type byte into 8 outputs of data type BOOL InOut: Scope Name Type Comment Input B BYTE Input value Output B0 BOOL Output bit 0 B1 BOOL Output bit 1 B2 BOOL Output bit 2 B3 BOOL Output bit 3 B4 BOOL Output bit 4 B5 BOOL Output bit 5 B6 BOOL Output bit 6 B7 BOOL Output bit 7
DWORD_AS_BIT (FB) ¶ FUNCTION_BLOCK DWORD_AS_BIT Converts an input value of data type DWORD into 32 outputs of data type BOOL InOut: Scope Name Type Comment Input X DWORD Input value Output B00 BOOL Output bit 0 B01 BOOL Output bit 1 B02 BOOL Output bit 2 B03 BOOL Output bit 3 B04 BOOL Output bit 4 B05 BOOL Output bit 5 B06 BOOL Output bit 6 B07 BOOL Output bit 7 B08 BOOL Output bit 8 B09 BOOL Output bit 9 B10 BOOL Output bit 10 B11 BOOL Output bit 11 B12 BOOL Output bit 12 B13 BOOL Output bit 13 B14 BOOL Output bit 14 B15 BOOL Output bit 15 B16 BOOL Output bit 16 B17 BOOL Output bit 17 B18 BOOL Output bit 18 B19 BOOL Output bit 19 B20 BOOL Output bit 20 B21 BOOL Output bit 21 B22 BOOL Output bit 22 B23 BOOL Output bit 23 B24 BOOL Output bit 24 B25 BOOL Output bit 25 B26 BOOL Output bit 26 B27 BOOL Output bit 27 B28 BOOL Output bit 28 B29 BOOL Output bit 29 B30 BOOL Output bit 30 B31 BOOL Output bit 31
EXTRACT (FUN) ¶ FUNCTION EXTRACT : BOOL Returns bit number N of value X Example in ST: FLAG := EXTRACT ( X := 81 , N := 4 ); (* Result : TRUE, because 81 is binary 1010001, so the bit '4' is 1 *) FLAG := EXTRACT ( X := 33 , N := 0 ); (* Result : TRUE, because 33 is binary 100001, so the bit '0' is 1 *) InOut: Scope Name Type Comment Return EXTRACT BOOL The Nth bit of value X Input X DWORD Input value N BYTE Number of the bit to be extracted. Counting starts at 0.
GETBIT (FUN) ¶ FUNCTION GETBIT : BOOL Returns the bit value at position N of value X InOut: Scope Name Type Comment Return GETBIT BOOL Input X LWORD Variable from which the bit is chosen, value has to be unsigned N BYTE The bitnumer 0…(size of datatype)