3/11/2014 8:34 PM | |
Joined: 2/12/2011 Last visit: 8/29/2024 Posts: 95 Rating:
|
Hi I Have put together a small example covering the new functions for handling variant pointers in TIA V13. See attached PDF. * DB_ANY_TO_VARIANT: Create a variant pointer to a DB. Still there are many missing functions in V13 and S71500, but this is a step in the right direction. Hope it can be helpful... //Mattias Lindh AttachmentExample varant pointer S71500, TIA V13.pdf (5411 Downloads) |
Last edited by: Mr Lindh at: 3/11/2014 8:40 PMLast edited by: Mr Lindh at: 3/11/2014 8:35 PMMr Lindh, |
|
This contribution was helpful to
4 thankful Users |
3/13/2014 11:37 AM | |
Joined: 9/23/2005 Last visit: 8/27/2024 Posts: 4347 Rating:
|
Hi, here there is some additional tips about VARIANT instructions:
CountOfElements: Get number of ARRAY elements TypeOfElements / TypeOf : Check element data type of a VARIANT tag VariantGet / VariantPut: Read / write VARIANT tag value – move part of the VARIANT contend MOVE_BLK_VARIANT: Move whole VARIANT (no partial moving) VARIANT_TO_DB_ANY: Read of DB number of VARIANT variable.
1 - The indexes start ALWAYS from 0 independently of the array definition (that e.g. starts with “1”) 2 - The VARIANT input and the destination variable should have same “elementary data type” (i.e. Real, Int, etc.). That means, no automatically data type conversion is done by instruction. If VARIANT is an array, the destination variable should also be an array, but not necessarily with the same size. So if you need to read out one variable of the VARIANT, you could define the destination variable as “array [0..0] of…”. TIP’s for MOVE_BLK_VARIANT: 1 – Source and destination should be exactly the same data type configuration.
2 – The returned variable could be convert to UINT with “DB_ANY_TO_UINT” instruction. Attached there is a V13 sample project (V14 project posted at 01/11/2017). AttachmentC:\Users\z0008iwv\Documents\Bluetooth Exchange Folder\Variant.zip (2129 Downloads) |
Last edited by: Denilson Pegaia at: 1/11/2017 11:35:12 AMDenilson Pegaia |
|
This contribution was helpful to
5 thankful Users |
11/16/2015 5:28 PM | |
Posts: 8946 Rating:
|
Nice training stuff, perhaps you can give us an update? |
Last edited by: IBN-Service at: 11/16/2015 5:28:48 PM |
|
11/17/2015 8:34 AM | |
Joined: 5/31/2011 Last visit: 8/6/2024 Posts: 190 Rating:
|
Update? Nothing changed so far as I know. |
3/23/2016 11:20 AM | |
Joined: 9/3/2014 Last visit: 3/13/2019 Posts: 4767 Rating:
|
New question published by samuele.minelli is split to a separate thread with the subject Put an array [1..100] of bool of an FB's instance in the PII o PIQ of the PLC?. Best regards |
Follow us on