In Step7, as far as I remember, the function to "cross reference" a variable inside an FB is not really cross referencing, but instead showing you on sequence where the variable is used (Ctrl+****+F and G ??).
I believe that if you cross referenced the address outside (InstanceDB.DBXXX) you'd be able to see the uses of that variable, but not the STAT inside the FB as they are not the same thing. One is a pointer if you will that can point to any instance DB, the other is the actual instance DB.
Although, I found that this was possible in the exact same way... banging my head not understanding what was going on only to, by chance, notice that there were references to the Instance DB and digging up on it.
Yeah, I can understand why the cross reference tool doesn't get both types of uses together, I just wish it did. In theory (at least in Portal), it's compiling everything anyway, so it isn't like it can't scan the code and check for instances of the DB and local instances in the FB at the same time.
head -> wall story.....
I was on a site last year where someone had previously created an array of bits to use as storage for edge detection inside an FB, but then were using the 2nd half of the bits in the instance outside the block. I'm not sure if they thought the instance DB was global and just named things badly, or if they didn't really know what an instance DB was, or what. Things were running fine that way for awhile, right up until the internal usage expanded enough to start impacting what was used externally.
The site had started adding all kinds of extra code as Black MAGIC, because it might have solved the problem once on accident, and so they just kept going with it without understanding. Guys were trying to tell me that the edge detection instructions were buggy. (NARRATOR: "They weren't.")
Got called back a week later because they were having similar issues with the TON instruction being unreliable, which ended up being solved similarly....
Last edited: