8/11/2021 1:45 PM | |
Joined: 4/1/2019 Last visit: 10/9/2024 Posts: 105 Rating: (2) |
Hi, Symbolic access is not an option here, Im working with CPU300 |
This contribution was helpful to1 thankful Users |
8/11/2021 1:47 PM | |
Joined: 4/1/2019 Last visit: 10/9/2024 Posts: 105 Rating: (2) |
mmm, I think this may work, but I was looking something like get the pointer directly to the struct in the struct |
8/12/2021 6:59 AM | |
Joined: 10/7/2005 Last visit: 11/16/2024 Posts: 3027 Rating: (1057) |
You can use +AR1 P#40.0 in your example to achieve this (after loading the original pointer into AR1) and this may/would have the advantage that only one line of code needs to be adjusted should you make changes to the STAT area). A word of caution too: FB's are by default Multi-Instance capable and AR2 contains the Multi-Instance offset. You MUST consider the AR2 based offset if you do call your FB as a Multi-Instance, but it of course doesn't hurt to generally consider the AR2 for this (more so if this is a reusable FB and will be used in future project where someone may want to multi instantiate it) Have a look at the bottom of https://support.industry.siemens.com/cs/us/en/view/20443243 for how to include the AR2 based multi Instance offset |
Cheers |
|
This contribution was helpful to1 thankful Users |
8/13/2021 3:25 AM | |
Joined: 10/7/2005 Last visit: 11/16/2024 Posts: 3027 Rating: (1057) |
Hi alvcosan What you are seeing is all correct and has to do with the memory area that is part of a pointer and attached is a pdf from the Step7 inbuilt help with more on this. In short though, TAR2 will get you 84xx_xxxx as it is the (Instance) DB of the calling FB that you are accessing. This is why you do an "AD DW#16#00FF_FFFF" before adding it to your AR1 Pointer to get rid of the DB "84" memory area. Any Pointer loading to the FB's IN, OUT, IN_OUT or STAT area will be an 85xx_xxxx as it is Instance DB data (irrespective of the actual variable that is assigned to IN, OUT or IN_OUT as their value is stored in the FB's IDB from which you access it, aka "pass by value"). Lastly, any Pointer loading to TEMP variables will be an 86xx_xxxx. AttachmentFormat of the Parameter Type ANY.pdf (362 Downloads) |
Cheers |
|
This contribution was helpful to1 thankful Users |
Follow us on