Bit-shift instructions
571
Part III FP Instructions
In this example, the input variable number_bits is declared. However, you can write a constant
directly at the input contact of the function instead.
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start changes from FALSE to TRUE, the function is carried out. It shifts out 4
bits (corresponds to one position in a hexadecimal representation) to the right. The 4 bits in
data_field[2] resulting from the shift are filled with zeros.
LD
ST
When programming with structured text, enter the following:
IF DF(start) THEN
F108_BITR( n:=number_bits,
d1_Start=> data_field[0],
d2_End=> data_field[2]);
END_IF;