TIAv14 clearing temp structure

Yes, I remember reading it as well but couldn't find out where.


Programming Guideline. A must read.

Section 3.2.2 and 3.2.3
"Temporary tags are undefined when called in non-optimized blocks. In
optimized blocks, the values are always preset to the default value (S7-1500
and S7-1200 Firmware V4). Thus, the resulting behavior is not accidental but
reproducible. "
 
I mean, that temporary memory is available after exiting the function and if in the next called block there is no assignement and the variable is declared in the table and used in the program, a strange things can happen.
There may be problems of this type when several programmers are working on the project, especially young and unexperienced.
Something will be copied, not be assigned and he is supprised that it does not work.
Clearing temp after invoking the function eliminates this problem.
Since I use it I dont have problems with that.
Maybe it is wrong or maybe not, but that is how I do it. And it works :)
 
Clearing the temp area may be giving others the impression that it is ok to use temp variables without initialising them. What makes initialising them to zero any better than any other value?
 
I have never said that I clear temporary memory when exiting a block. I do it in the first step after block is called.
Is there need of zeroing after all, if you don't initialize temps anywhere on block?

You can only use temp data after some logic is updated temps before inside your block.

And if you read temp data before you put "new" data on block to them, them temp data is = 0 (zeroing) or data from elsewhere of program (on both situations it is useless/wrong data)


Zeroing temp maybe helps on online edits of strange things to happen situations, but it certainly don't repair coding errors of reading from wrong variables
 
Last edited:
Clearing the temp area may be giving others the impression that it is ok to use temp variables without initialising them. What makes initialising them to zero any better than any other value?

Known vs unknown value.

If temp > zero do this otherwise do nothing.

OR

Total = Temp1 + Temp2
If total = zero then error.
 

Similar Topics

Under PLC tags it shows there is a discrepancy with a lower level component via the orange exclamation mark. Yet there is no Blue/Orange under the...
Replies
3
Views
540
Good Morning, So I am working on teaching myself Siemens so please forgive me if this is a stupid question. I am trying to monitor some logic...
Replies
2
Views
1,005
I'm online with a 90-30 using PAC ME 9.8 No one has gotten online with this PLC for many years and the the I/O fault table has a total of 1209...
Replies
6
Views
2,937
Using an L81 - I have the arrangement below that will try the Ethernet Radio first and if that fails use the Cellular Radio. The Failover works...
Replies
16
Views
3,303
Since this is the most helpful place on earth for us programmers, I'm back with another one. Using Logix v32 I've got an array with 100 elements...
Replies
9
Views
2,902
Back
Top Bottom