FP_GET_IO_START_OFFSET

Get offset of I/O address

This FP instruction gets the start offset of an I/O address of the slot specified by s_Slot and stores the result in d.

Parameters

Input

s_Slot (WORD, INT, UINT)

Slot number: 0–64

Output

d (DWORD, DINT, UDINT, DATE, TOD, DT)

Offset for the first valid I/O address

Remarks

We recommend using FP_GET_UNIT_OFFSETS1 to get all offsets from DIX, DIY and DI2 in a standardized way that allows to access all relevant memories of a unit.

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

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
		bStart: BOOL:=FALSE;
		diOffset: DINT:=0;
	END_VAR

LD bodyCopy code to clipboard

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,FP_GET_IO_START_OFFSET!,,8,1,22,5,,?DEN?Ds_Slot?AENO?Cd);
B(B_VARIN,,4,6,3,8,5,);
B(B_VAROUT,,diOffset,22,3,24,5,);
B(B_CONTACT,,bStart,3,2,5,4,);
L(1,3,3,3);
L(5,3,8,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST bodyCopy code to clipboard

IF (bStart) then
    FP_GET_IO_START_OFFSET(s_Slot :=4, d => diOffset);
END_IF;

Modified on: 2019-05-15Feedback on this pagePanasonic hotline