Returns the DT address of the input or output with 32-bit offset
From the value at input/output Offs, the function generates a 16-bit address in the DT area at input/output AdrDT. This input has to be directly attached to a 32-bit input/output of a basic function. The value at input/output Offs represents the address offset within the DT data area. Using GetPointer32 it can be transferred along with a value for the memory area to a user function or function block.
Input
Yields 16-bit DT offset address
This pin must be connected to the input/output of a basic function for which the data type INT, WORD is allowed
Output
32-bit offset for address DT0
Remember, the execution of the basic function that uses the address created in the DT area is determined by assigning the function Is_AreaDT with the value for the memory area of the variable at EN-input.
Only for LD and FBD Editors: Use “Input instruction” or “Output instruction” from the “Instructions” pane to insert the instruction required into the programming window.
In this example the user-defined function ReadFromIcCard is created that uses the functions AdrDT_Of_Offs32_O, AdrFL_Of_Offs_O, Is_AreaDT and Is_AreaFL in ladder diagram (LD) or the function block diagram (FBD).
In the DUT Pool a structured data type is assigned in which the structure’s various, non-boolean variables are declared.
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;
(*activation of the function*)
DutNonBoolean: @'Dut_NonBoolean';
(*structured data type*)
ActualPosition: DINT:=0;
(*beginning position from which the data should be read to the IC card*)
END_VAR
Here the variable DutNonBoolean of the data type assigned in the above DUT is declared. Assigning elements of the variable DutNonBoolean with values was not done in the POU header or body, since the values of the variable DutNonBoolean are overwritten after the function ReadFromIcCard is executed.
When the variable bStart changes from FALSE to TRUE, the function ReadFromIcCard is carried out. The function reads values on the IC card beginning with address diActualPosition and writes the information to the variable DutNonBoolean. Do not forget that the IC card has to be appropriately formatted via the menu and that, if necessary, values beginning at address diActualPosition should be present on the IC card.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 8 ;
NETWORK_BODY
B(B_CONTACT,,start,6,1,8,3,R);
B(B_F,ReadFromIcCard!,,18,1,27,8,,?DEN?DArea?DOffset?DSize?DPosition?AENO?C);
B(B_VARIN,,ActualPosition,16,6,18,8,);
B(B_VAROUT,,ActualPosition,27,3,29,5,);
B(B_VARIN,,Dut_NonBoolean,7,3,9,5,);
B(B_F,Size_Of_Var!,,9,5,16,7,,?D?C);
B(B_F,GetPointer!,,11,3,18,5,,?D?C);
B(B_VARIN,,2,16,4,18,6,);
L(18,2,18,3);
L(8,2,18,2);
L(1,2,6,2);
L(9,4,11,4);
L(9,4,9,6);
L(16,6,18,6);
L(1,0,1,8);
END_NETWORK_BODY
END_NET_WORK
END_BODY