F110_WSHR

Right shift of one word (16 bits) of 16-bit data range

Shifts one word (16 bits) of the data range specified by d1 (starting) and d2 (ending) to the right (to the lower word address) if the trigger EN is in the ON-state.

Parameters

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: FP_WSHR_BLOCK

  • When one word (16 bits) is shifted to the right, the starting word is shifted out and the data in the ending word becomes 0.

  • d1_Start and d2_End should be:

    • the same type of operand

    • d1_Start£d2_End

  • The variables d1_Start and d2_End have to be of the same data type.

  1.  (1) Specified data range
  2.  (2) The starting word is shifted out
  3.  (3) The data in the ending word becomes 0

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*)
		source_array: ARRAY [0..3] OF INT:=[2,3,4,5];
			(*result after a 0->1 leading edge
from start: [2,4,5,0]*)
	END_VAR

POU body

When the variable start changes from FALSE to TRUE, the function is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_F,F110_WSHR!,Instance,6,1,13,6,,?DEN?AENO?Cd1_Start?Cd2_End);
B(B_VAROUT,,source_array[1],13,3,15,5,);
B(B_VAROUT,,source_array[3],13,4,15,6,);
B(B_CONTACT,,start,2,2,4,4,R);
L(1,3,2,3);
L(4,3,6,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF DF(start) then
    F110_WSHR( d1_Start=> source_array[1],
         d2_End=> source_array[3]);
END_IF;

Modified on: 2019-01-24Feedback on this pagePanasonic hotline