FP_DIRECT_IN

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

Input_X FP0H, FP-XH: (BOOL); FP7: (BOOL, WORD, DWORD)

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 FP0H, FP-XH: (BOOL); FP7: (BOOL, WORD, DWORD)

Value read directly from Input_X

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

Example

Global variables

In the global variable list you define variables that can be accessed by all POUs in the project.

POU headerCopy code to clipboard

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

LD bodyCopy code to clipboard

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

ST bodyCopy code to clipboard

if (bReadInput) then
    bValue:=FP_DIRECT_IN(g_bDirectIn_X1);
end_if;

Modified on: 2023-03-13Feedback on this pagePanasonic hotline