9/24/2012 11:30 AM | |
Joined: 10/7/2005 Last visit: 9/14/2025 Posts: 3049 Rating:
|
Hello P.Singhania by "local variable" I presume you mean a TEMP variable of an FC or FB, correct? If so and ifindeed used as an IN_OUT variable you may want to check if an unconditional write access happens to it before a read access. If not, you violate the rule for usage of TEMP variables which are only valid while the Block is executed and as such must be initialised (i.e. do an unconditional write to them before a read access). I hope this helps |
Cheers |
|
9/24/2012 11:36 AM | |
Posts: 12 Rating:
|
Thanks fritz for replying, Yes, I mean temp variable from FB. Well, the same I have done what you said, but eventually it is a system fault. Right?? |
9/24/2012 2:20 PM | |
Joined: 10/7/2005 Last visit: 9/14/2025 Posts: 3049 Rating:
|
I'm afraid to say it is NOTa system fault,but rather fault by whoever programmend the logic. TEMP variables simply do NOT retain their value between Block calls. They are - as the name suggests - temporary andcancan assume any value after the Block that used them has finished executing. As mentioned before, the simply rule is to (unconditionally write to them inside a Blockbefore you read from them (the first 20 Bytes of an OB are the exception to this and written to by the OS before the OB is called). I hope this helps |
Cheers |
|
Follow us on