11/26/2022 10:32 AM | |
Joined: 9/23/2005 Last visit: 9/11/2024 Posts: 4347 Rating: (1445)
|
Hi Sometimes it is necessary to access the value of a variable whose name we only know in Runtime. As of TIA V18, it is possible to read/write this type, passing the variable name in order to read/write its value. The solution presented by TIA makes it possible not only to do this variable by variable, but also to pass an array of variables to be treated all at once. The task could be done in three parts: Part 1 – Using the ResolveSymbols block (Basic instructions, move, symbolic names folder), it is possible to pass an array of strings with the names of the variables, and to receive in return an array of internal references of these tags in the PLC. The block help is very concise and clear. TIPS:
Part 2 – Using the MoveReseolvedSymbosToBuffer / MoveReseolvedSymbosFromBuffer blocks it is possible to take the references generated by the ResolveSymbols block and use it to access the desired variables. TIPS:
PART 3 – Use serialize deserialize blocks to change the array of bytes to a single (or struct of ) variable(s). TIP:
Sample program: AttachmentProject5_20221125_1132.zip (626 Downloads) |
Last edited by: Denilson Pegaia at: 11/26/2022 10:36:27Last edited by: Denilson Pegaia at: 11/26/2022 16:56:13Last edited by: Denilson Pegaia at: 11/26/2022 16:56:44Last edited by: Denilson Pegaia at: 12/08/2023 09:30:56Denilson Pegaia |
|
This contribution was helpful to5 thankful Users |
12/8/2023 9:30 AM | |
Joined: 9/23/2005 Last visit: 9/11/2024 Posts: 4347 Rating: (1445)
|
Hi As from TIA V19, it is also possible to (from STEP 7 delivery release ): “ You can now also access the following data types during runtime using symbolic names:
The list of tag names which you specify at the "nameList" parameter of the ResolveSymbols" system function block may also be located in a non-optimized memory area. As of FW version 3.0, the "ResolvedSymbol" system data type may be declared as an element of a PLC data type. “ The name should follow the general notation rules, Examples of the name's notations:
’ Sample project (archived from TIA Portal as .zap19 and after that compacted in .zip format to be uploaded here) AttachmentProject5.zip (338 Downloads) |
Denilson Pegaia |
|
12/21/2023 2:33 PM | |
Joined: 9/23/2005 Last visit: 9/11/2024 Posts: 4347 Rating: (1445)
|
Hi, and here there is an V18 sample project similar to the first one, but for read two symbolic names at same time. AttachmentProject.zip (226 Downloads) |
Last edited by: Denilson Pegaia at: 12/21/2023 14:35:58Denilson Pegaia |
|
This contribution was helpful to1 thankful Users |
1/4/2024 8:41 AM | |
Joined: 10/18/2006 Last visit: 7/9/2024 Posts: 120 Rating: (15) |
Hi Denilson, it seems that access to ARRAYS, STRUCTS and the other complex data types is not supported by MoveResolvedSymbolsToBuffer, but just for MoveResolvedSymbols. Am I right? |
iba AG - Data Acquisition and Analysis the way it should be |
|
1/4/2024 8:59 AM | |
Joined: 3/11/2019 Last visit: 9/6/2024 Posts: 1569 Rating: (288)
|
Hi, at least you can find following statement in the manual: Symbolic access during runtimeConstraintsThe following types of access are not possible:
regards sancruz |
Feedback appreciated, please rate |
|
This contribution was helpful to1 thankful Users |
1/4/2024 12:32 PM | |
Joined: 10/18/2006 Last visit: 7/9/2024 Posts: 120 Rating: (15) |
Hi sancruz, you linked the V18, not the V19 manual. In V19 the constrains you mentioned are missing. |
Last edited by: schattenparker at: 01/04/2024 12:44:44Last edited by: schattenparker at: 01/04/2024 12:45:39iba AG - Data Acquisition and Analysis the way it should be |
|
Follow us on