TIAv14 clearing temp structure

[PL] mk

Member
Join Date
Apr 2017
Location
src
Posts
16
Dear Experts,

I'm new in TIA and I have question about clearing temporary area which is used in FC/FB.

Generally on Step7 V5.5 when I call FC/FB, on the beginning I clear all temps which I use inside. I create a structe called _s where I keep all temp signals and in network 1 I "FILL" whole structure with zeros.

This doesn't work on TIA. Can you guide me how to do this clearing?

PLC -> CPU 1512SP-1 PN
 
For STEP7 Classic, the TEMPs are definitely not cleared upon block call or leave.
Maybe you are thinking of that the local stack is saved when another block is called, and upon return to the calling block, the calling blocks local stack is restored.
Not sure abot STEP7 TIA, but I suppose it works the same way.

When you use TEMPs you must make sure that the 1st access in a block is a write that initializes the value.
To clear TEMPs at the end of a block should be unnecessary.
 
The temporary area is, to the best of my knowledge cleared automatically whenever the FC/FB is called. Have you confirmed this on TIA?

I know this is true for OPTIMIZED blocks in 1200/1500. Not sure about unoptimized/standard in 1200/1500.

As Jesper said, definitely not true for 300/400 (and that should be true for both TIA and Simatic Manager).
 
Y3sAPuekZMWGbsdxwyYGWSZJ4mbcNO
I'm not sure if my post was clear enough.

In attachment you can find local data initialization (zeroing) which I perform at the begging of all fc/fb.

The same operation I want to do in TIA but it doesn't allow me to clear the structure.

temp.jpg
 
The temp memory is global and is not cleared when exiting the function.
To be sure that the temp memory in the function area does not have any trash from the previous function, I always clear this area if it want to use it in a active fc
 
Man, like I said before, it is a well-established doctrine, that TEMPs must be initialized as the first thing in a block before reading. If you adhere to this, there is absolutely no need to "clear" the temporary memory when exiting a block. I have never heard of anyone else doing like that.

edit: And what if you use library blocks from others, for example from Siemens that are closed with know-how-protection ?

edit again: And it would not be enough to clear the declared TEMP structure. The TEMP structure of one block may be a different size to another blocks TEMP structure.
The more I think of it, it is clear (to me at least) that you are doing it the wrong way around.
 
Last edited:
Following testing in PLCSIM:

For blocks with optimised access, the temp area is cleared at the start of block execution and also cleared when the block completes.

For blocks without optimised access, the temp area is not cleared.
 
Following testing in PLCSIM:

For blocks with optimised access, the temp area is cleared at the start of block execution and also cleared when the block completes.

For blocks without optimised access, the temp area is not cleared.

Thank's for information.

If you adhere to this, there is absolutely no need to "clear" the temporary memory when exiting a block.

I have never said that I clear temporary memory when exiting a block. I do it in the first step after block is called.

edit again: And it would not be enough to clear the declared TEMP structure. The TEMP structure of one block may be a different size to another blocks TEMP structure.

I know that.

The more I think of it, it is clear (to me at least) that you are doing it the wrong way around.

What is wrong about that?
Since I clear temporary memory of executing block at the beggining I have never had problems with it.

I had such cases, that when at the beginning of blocks temporary memory was not cleared, strange things happened.
I have to look for what these cases were. It was quite a long time ago and since then I have started to clear the temporary's at the beginning of blocks
 
Man, like I said before, it is a well-established doctrine, that TEMPs must be initialized as the first thing in a block before reading. If you adhere to this, there is absolutely no need to "clear" the temporary memory when exiting a block. I have never heard of anyone else doing like that.

I must say, today with this thread and the one with ENO in FB/FC i second guessed my knowledge with S7 programming. These two are so weird questions I did not think of one reason or problem where one would need that.

For me it is not "You have to use local variables by initializing them first", it is why would you use a local variable if you are not initializing them first? And how? I'd really like to know, am I missing something?

edit: @mk Please do, I really would like to know.
 
Last edited:
Following testing in PLCSIM:

For blocks with optimised access, the temp area is cleared at the start of block execution and also cleared when the block completes.

For blocks without optimised access, the temp area is not cleared.

I can back this up i have read that in a Siemens document somewhere. I will see if i can find the document again.
 

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
541
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