Read direct input flag
This instruction reads the value of an input flag (X) using a direct execution command. The Input_X will be read asynchronously within the current PLC cycle.
Input
Global variable with FP address or explicit user address to be read directly.
FP0H, FP-XH only: Valid range for FP address is X0–X109F to which a real input pin is assigned. Otherwise the PLC goes into operation error.
Output
Value read directly from Input_X
FP_DIRECT_INPUT (when using FP7)
In the global variable list you define variables that can be accessed by all POUs in the project.
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
bValue: BOOL:=FALSE;
END_VAR
VAR_EXTERNAL
g_bDirectIn_X1: BOOL:=FALSE;
END_VAR
VAR
bReadInput: BOOL:=FALSE;
END_VAR
When the variable bReadInput is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bReadInput,4,1,6,3,);
B(B_F,E_FP_DIRECT_IN!,,15,0,23,4,,?DEN?DInput_X?AENO?CValue);
B(B_VARIN,,g_bDirectIn_X1,13,2,15,4,);
B(B_VAROUT,,bValue,23,2,25,4,);
L(1,0,1,5);
L(1,2,4,2);
L(6,2,15,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bReadInput) then
bValue:=FP_DIRECT_IN(g_bDirectIn_X1);
end_if;