Left 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 left (to the higher digit position) if the trigger EN is in the ON-state.
Output
Starting 16-bit area
Ending 16-bit area
When one hexadecimal digit (4 bits) is shifted to the left,
the data in the higher hexadecimal digit (bit position 12 to 15) of the 16-bit data specified by d2 is shifted out.
the data in the lower hexadecimal digit (bit position 0 to 3) of the 16-bit data specified by d1 becomes 0.
d1 and d2 should be:
the same type of operand
d1 £ d2
The variables d1 and d2 have to be of the same data type.
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#0120,
16#6789,16#2345]*)
END_VAR
When the variable start changes from FALSE to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
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,F112_WBSR!,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,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(start) then
F112_WBSR( d1_Start=> source_array[1],
d2_End=> source_array[3]);
END_IF;
LD |
start |
(* EN = start; Starting signal for the F113_WBSL function. *) |
F113_WBSL |
source_array[1], |
(* d1 = source_array[1] (destination1) *) |
source_array[3] |
(* d2 = source_array[3] (destination2) *) |
|
ST |
out |
(* option *) |