GetDataTypeInfo

Read the description of a structured variable

This instruction gets the variable description of a structured variable (DUT, ARRAY) at the input Variable and writes the description into the output variable adutDataTypeInfo.

Input

Variable (BOOL, INT, UINT, WORD, DINT, UDINT, DWORD, REAL, DATE, TOD, DT, STRING)

Start address of the structured variable

The variable description will be written to an ARRAY OF DATA_TYPE_INFO_DUT, the size of which must correspond to the number of DUT elements of the variable specified at the input Variable. Each element of the variable description describes an element of the DUT.

Output

adutDataTypeInfo (ANY ARRAY OF DATA_TYPE_INFO_DUT)

Start address of the variable description array

Remarks

  • Valid types for the input Variable are structured data types with member variables of any simple type (except BOOL), array of those simple types and data unit types consisting of those simple types

  • The variable adutDataTypeInfo must be an array of DATA_TYPE_INFO_DUT

  • The size of the array must be equal to or greater than the number of elements in the process data.

Example

POU header

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
		bEnable: BOOL:=FALSE;
		asSimpleVariable: ARRAY [0..2] OF STRING[32]:=[3('')];
		adutDataTypeInfo: ARRAY [0..0] OF DATA_TYPE_INFO_DUT;
	END_VAR

LD body

When the variable bEnable is set to TRUE, the function is executed.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_CONTACT,,bEnable,4,1,6,3,);
B(B_F,E_GetDataTypeInfo!,,15,0,28,4,,?DEN?dVariable?AENO?cadutDataTypeInfo);
B(B_VARIN,,asSimpleVariable,13,2,15,4,);
B(B_VAROUT,,adutDataTypeInfo,28,2,30,4,);
L(1,0,1,4);
L(1,2,4,2);
L(6,2,15,2);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

if (bEnable) then
    adutDataTypeInfo := GetDataTypeInfo(asSimpleVariable);
end_if;

Example

DUT

In this example, the variable dutVariable is a DUT of the type Example_2_DUT with the following structure:

POU header

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
		bEnable: BOOL:=FALSE;
		dutVariable: Example_2_DUT;
		adutDataTypeInfo: ARRAY [0..2] OF DATA_TYPE_INFO_DUT;
	END_VAR

LD body

When the variable bEnable is set to TRUE, the function is executed.

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,,bEnable,4,1,6,3,);
B(B_F,E_GetDataTypeInfo!,,13,0,26,4,,?DEN?dVariable?AENO?cadutDataTypeInfo);
B(B_VARIN,,dutVariable,11,2,13,4,);
B(B_VAROUT,,adutDataTypeInfo,26,2,28,4,);
L(1,0,1,5);
L(1,2,4,2);
L(6,2,13,2);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

if (bEnable) then
    adutDataTypeInfo := GetDataTypeInfo(dutVariable);
end_if;

Modified on: 2021-10-22Feedback on this pagePanasonic hotline