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)
PACK (FUN) ¶ FUNCTION PACK : BYTE Packs 8 bits into 1 byte InOut: Scope Name Type Comment Return PACK BYTE Value for the input BO .. B7 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
PUTBIT (FUN) ¶ FUNCTION PUTBIT : DWORD Sets a bit of a DWORD value Example in ST: var1 := 38 ; (* binär 100110 *) var2 := PUTBIT ( A , 4 , TRUE ); (* Result: 54 = 2#110110 *) var3 := PUTBIT ( A , 1 , FALSE ); (* Result: 36 = 2#100100 *) InOut: Scope Name Type Comment Return PUTBIT DWORD Value with the changed bit Input X DWORD Value to be manipulated N BYTE Position of the bit to be changed, starting with 0 B BOOL Value of specified bit
SETBIT (FUN) ¶ FUNCTION SETBIT : BOOL Sets the value of bit at position N of variable X to B InOut: Scope Name Type Comment Return SETBIT BOOL Input X __SYSTEM.AnyType Variable to be modified N BYTE Bitnummer 0…(to size of datatype) B BOOL Desired value of the bit
Library Reference ¶ This is a dictionary of all referenced libraries and their name spaces.