1/2/2018 11:54 AM | |
Joined: 9/23/2005 Last visit: 6/17/2024 Posts: 4346 Rating: (1434)
|
Hi, As from TIA V15 it is possible to use references in program blocks. "References" provides a new type of pointer. References are typed pointers that refer to a specific data type. With this features a variable address could be stored in “references” variables (of type REF_TO_ + data type, for example, REF_TO_int for references to integer variables). To transfer the address of one variable to a “reference” variable it is used “REF( variable name)”. To access the value of a “pointered” variable by a “reference” variable it is used the “reference” variable + “^”. The instruction “?=” could be used to convert Variant in “reference”. It is possible to compare if a “reference” variable is equal (or different) to NULL to check if it contain a valid reference (i.e. a reference for the same data type). Requirements: STEP 7 >=15 CPU S7-1500 FW >= 2.5 Use in FC: In, Out, Temp, Return Use in FB: Temp Data types: basic data types (exception of bools), UDT, SDT. The attached sample program exemplify this new feature (see FB1) AttachmentReferences.zip (1081 Downloads) |
Denilson Pegaia |
|
This contribution was helpful to8 thankful Users |
5/10/2019 6:05 PM | |
Joined: 11/7/2013 Last visit: 5/29/2024 Posts: 2 Rating: (0) |
I am missing something, how did you exchange indice with constant? Can you please explain? Thanks |
Follow us on