F109_BITL

Left shift of multiple bits of 16-bit data range

The function shifts the bits of a specified data range, whose beginning and end are specified by the outputs d1 and d2 to the left. The number of bits by which the data range is to be shifted to the left is specified by the value assigned at input n. The value may lie between 0 and 16. Bits cleared because of the shift become 0.

  • When input n = 0, no shift takes place.

  • When input n= 16, a shift of one word occurs, i.e. the same process takes place as with function F111_WSHL.

Parameters

Input

n (INT)

Number of bits to be shifted

Output

d1_Start (WORD, INT, UINT)

Starting 16-bit area

d2_End (WORD, INT, UINT)

Ending 16-bit area

Remarks

  • Instead of using this F instruction, we recommend using the corresponding FP7 instruction:

  • The addresses of the variables at inputs d1 and d2 have to have the same address type.

  1.  (1) Specified data range
  2.  (2) start: ON
  3.  (3) ending n bits are shifted out
  4.  (4) n bits

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)

if the address of the variables at the outputs d1_Start > d2_End or the value at input is n³ 16.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)

if the address of the variables at the outputs d1_Start > d2_End or the value at input is n³ 16.

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		start: BOOL:=FALSE;
			(*activates the function*)
		data_array: ARRAY [0..2] OF WORD:=[16#1234,16#5678,16#9012];
			(*result after a 0->1 leading edge
from start:
[16#2340,16#6781,16#9012]*)
	END_VAR

POU 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 left. The 4 bits in data_field[0] resulting from the shift are filled with zeros. At input n the constant 4 is assigned directly to the function. You may, however, declare an input variable in the POU header instead.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_VARIN,,4,7,2,9,4,);
B(B_VAROUT,,data_field[0],16,2,18,4,);
B(B_VAROUT,,data_field[2],16,3,18,5,);
B(B_CONTACT,,start,3,1,5,3,R);
B(B_F,F109_BITL!,Instance,9,0,16,5,,?DEN?Dn?AENO?Cd1_Start?Cd2_End);
L(1,0,1,5);
L(1,2,3,2);
L(5,2,9,2);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF DF(start) then
    F109_BITL( n:=4,
         d1_Start=> data_field[0],
         d2_End=> data_field[2]);
END_IF;

IL body

Modified on: 2019-03-05Feedback on this pagePanasonic hotline