Client - Read Data (GetAllDataValues, GetDataValues)
This sample shows how to use the "GetAllDataValuesReq" and "GetDataValuesReq" methods of the client function block.
Download TwinCAT XAE Project (*.zip): Sample02.zip
The example described here uses the state machine that is described in the "General Client project structure" chapter. The States 0, 1, 11 and 100 are identical to the state machine described there. Other states were modified for the example or new states were also added.
In State 10, several IF instructions are listed that activate commands (method calls) of the Client block. The command is activated and the corresponding Client method called via a rising edge at one of the Boolean variables in the IF statement. For test purposes, the user can set the values of the Boolean variables to "TRUE" in the online view and in this way initiate the command processing.
Following the successful processing of a command, the state machine is set to State 0. If several of the Boolean variables have been set to "TRUE", the uppermost IF statement will be processed first with the respective command. The more frequent and complex the commands sent to the Server, the longer the Client will take to process them.
Some of the Boolean variables are listed in the following table. In addition, they contain the method names and a description of the function.
Commands in Sample02
Variable name | Method name | Description |
---|---|---|
bGetAllDataValues_LLN0 similar variables (commands): | GetAllDataValuesReq | As soon as this Boolean variable is set to "TRUE", all data values of all sub-elements of the Logical Node: „LLN0“ and every functional group are read. To enable this, the method call uses an interface pointer to the Logical Node to be read: "LLN0" as a parameter and the specification of the functional group: "E_AcsiFc.XX." |
bGetAllDataValues_LLN0_ST similar variables (commands): | GetAllDataValuesReq | As soon as this Boolean variable is set to "TRUE", all data values of all sub-elements of the Logical Node: „LLN0“ and of the "ST" functional group are read. To enable this, the method call uses an interface pointer to the Logical Node to be read: "LLN0" as a parameter and the specification of the functional group: "E_AcsiFc.ST_". |
bGetDataValues_LLN0_ST_Beh similar variables (commands): | GetDataValuesReq | As soon as this Boolean variable is set to "TRUE", all data values of all sub-elements of the data object: "Beh" of the Logical Node: „LLN0“ and of the "ST" functional group are read. To enable this, the method call uses an interface pointer to the data object to be read: "LLN0.Beh" as a parameter and the specification of the functional group: "E_AcsiFc.ST_". |
bGetDataValues_LLN0_ST_Beh_stVal similar variables (commands): | GetDataValuesReq | As soon as this Boolean variable is set to "TRUE", the value of the data attribute is read: "stVal" of the data object: "Beh", of the Logical Node: "LLN0", and of the functional group: "ST". To enable this, the method call uses an interface pointer to the data attribute to be read: "LLN0.Beh.stVal" as a parameter and the specification of the functional group: "E_AcsiFc.ST_". |
The naming of the Boolean variables is only an example and can be adapted as desired. It is only intended to show which values can be read by connecting the variables.