Returns the DT address of the input or output with 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 16-bit input/output of a basic function. The value at input/output Offs represents the address offset within the DT data area. Using GetPointer 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
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.
This function internally accesses one of the index registers that is also used for array calculations.
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.
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 start changes from FALSE to TRUE, the function ReadFromIcCard is carried out. The function reads values on the IC card beginning with address ActualPosition 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 ActualPosition 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,);
B(B_F,ReadFromIcCard!,Instance,18,1,27,8,,?DEN?DArea?DOffset?DSize?DPosition?AENO?C);
B(B_VARIN,,2,16,4,18,6,);
B(B_VARIN,,ActualPosition,16,6,18,8,);
B(B_VAROUT,,ActualPosition,27,3,29,5,);
B(B_F,GetPointer!,Instance,11,3,18,5,,?D?C);
B(B_VARIN,,Dut_NonBoolean,7,3,9,5,);
B(B_F,Size_Of_Var!,Instance,9,5,16,7,,?D?C);
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
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_INPUT
p32Pointer: POINTER32;
(*area, offset and size of data values*)
diPosition: DINT:=0;
(*beginning position from which the data should be read from the IC card*)
END_VAR
VAR_OUTPUT
p32ActualPosition: POINTER32;
(*shows the area, offset and size where the data of the IC card is stored*)
END_VAR
VAR
END_VAR
If the variable whose values for Area and Offset are delivered via the program called up lies in the DT- or FL-area (because the address for the variable p32Pointer is assigned to the DT- or FL-area by the compiler), the data is read from the IC card beginning with p32ActualPosition. The position is raised by the size of this variable and returned.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_VARIN,,2,20,3,22,5,);
B(B_VARIN,,1000,20,4,22,6,);
B(B_VARIN,,awProcessDataToGet[0],10,5,12,7,);
B(B_CONTACT,,bGetData,5,2,7,4,R);
B(B_F,Size_Of_Var!,Instance,12,5,19,7,,?D?C);
B(B_F,E_ReadFromIcCard!,Instance,22,1,37,7,,?DEN?DBankNumber?DBankOffset?DDataNumberOfWords?AENO?CDataStartAddress);
B(B_F,Adr_Of_Var_O!,Instance,37,3,45,5,,?D?C);
B(B_VAROUT,,awProcessDataToGet,45,3,47,5,);
L(1,3,5,3);
L(19,6,22,6);
L(1,0,1,9);
L(7,3,22,3);
END_NETWORK_BODY
END_NET_WORK
END_BODY
Further example projects (directory "Samples" of FPWIN Pro installation):