F112_WBSR

Right shift of one hex. digit (4 bits) of 16-bit data range

Shifts one hexadecimal digit (4 bits) of the data range specified by d1 (starting) and d2 (ending) to the right (to the lower digit position) 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

  • When one hexadecimal digit (4 bits) is shifted to the right:

    • the data in the lower hexadecimal digit (bit position 0 to 3) of the 16-bit data specified by d1_Start is shifted out.

    • the data in the higher hexadecimal digit (bit position 12 to 15) of the 16-bit data specified by d2_End 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 data in the lower hexadecimal digit (bit positions 0 to 3) is shifted out
  3.  (3) The higher hexadecimal digit (bit positions 12 to 15) 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 WORD:=[16#3456,16#9012,16#5678,16#1234];
			(*result after a 0->1 leading edge
from start: [16#3456,16#8901,
16#4567,16#0123]*)
	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_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);
B(B_F,F111_WSHL!,Instance,6,1,13,6,,?DEN?AENO?Cd1_Start?Cd2_End);
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
    F112_WBSR( d1_Start=> source_array[1],
         d2_End=> source_array[3]);
END_IF;

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