Left 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 left (to the higher word address) if the trigger EN is in the ON-state.
Output
Starting 16-bit area
Ending 16-bit area
When one word (16 bits) is shifted to the left, the ending word is shifted out and the data in the starting word becomes 0.
The variables d1_Start and d2_End have to be of the same data type.
d1_Start and d2_End should be:
the same type of operand
d1_Start £ d2_End
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,0,3,4]*)
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 := 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
IF DF(start) then
F111_WSHL( d1_Start=> source_array[1],
d2_End=> source_array[3]);
END_IF;
LD |
start |
(* EN = start; Starting signal for the F111_WSHL function. *) |
F111_WSHL |
Var_0,Var_1 |
(* d1 = Var_0 (destination1) *) |
(* d2 = Var_1 (destination2) *) |
||
ST |
out |
(* option *) |