Siemens S7/TIA v16: I'm not sure what "Retain" means for PLC tags...

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,109
I've got a bunch of tags in my code & there's a column called "Retain" (by default they were all un-ticked) - see pic.

"LaserN mm" is a distance in millimeters between the laser head and the object directly in front of it.

I want to create a button on the HMI called SAVE, which, when pressed, will store/save the values and retain their values, even after a PLC/power reset.

Do I just tick this column, or is there more to it than this?

With my Mitsubishi head on, the retentive tags were in a defined range, hence I was wondering if this was also the case with TIA Portal.

Thanks in advance.

a - retained tags.png
 
You can only set DB and memory bits to retentive in a 1200 (1500 can also do timers and counters). You can set the memory bits by changing the top value in the retention box in the second screenshot. If you change it to 10, MB0-MB9 will be retained.

Much more configurable to do it in a DB, you can retain individual tags rather than entire blocks. Like if you wanted MD28 to be retained, you'll need MB0-MB31 all retained.

You could have your save button activate a MOVE block to store the desired tags in a DB for that purpose.
 
You can only set DB and memory bits to retentive in a 1200 (1500 can also do timers and counters). You can set the memory bits by changing the top value in the retention box in the second screenshot. If you change it to 10, MB0-MB9 will be retained.

Much more configurable to do it in a DB, you can retain individual tags rather than entire blocks. Like if you wanted MD28 to be retained, you'll need MB0-MB31 all retained.

You could have your save button activate a MOVE block to store the desired tags in a DB for that purpose.

Thanks for this @puddle, really useful - but I don't know what you mean by "do it in a DB".
I know DB means "data block" but where can I find this section/screen in TIA?

EDIT: just watching a uTube video about it!
 
Last edited:
Program blocks > Add new block

When creating it, down the left side you have the option of OB, FB, FC or DB.
Create as Global DB.

When you open it, there's just a blank table. You can create tags of any data type you like and configure options like retain, access, visibility etc.
 
Program blocks > Add new block

When creating it, down the left side you have the option of OB, FB, FC or DB.
Create as Global DB.

When you open it, there's just a blank table. You can create tags of any data type you like and configure options like retain, access, visibility etc.

Nice one - so if I define my e.g. "Laser1 mm" as 'retain' in the DB, do I need to remove it from the 'Default tag table'?
 
You don't need to remove it, but probably best to do so to avoid confusion.


To expand on that, the tag from the tag table will stil be called "TagName", but the tag in the DB will be called "DBName"."Tagname".


There isn't an overlap that will confuse the PLC, but it sure might confuse the programmer, haha
 

Similar Topics

In OB1, I'm monitoring some values (first pic). The values are what I expect. At the same time, I'm monitoring the same values in the DB where...
Replies
1
Views
650
Siemens S7/TIA v16: "Overwrite if object exists online?" HMI loading message... Thus far, I've just been ticking this box, just to get the HMI...
Replies
4
Views
769
I'm having a bad day. Daft question coming up...Anyone know why I can't add anything into this DB? Add button is greyed-out. Thanks
Replies
14
Views
1,597
I imported a customised shape into the project, but I don't know how to actually add into on to a specific HMI screen. Do I use the Graphics menu...
Replies
2
Views
661
Hi I'm trying to display a value on the HMI. In monitor mode on the code, I can see that value, but on the HMI , after downloading, it is...
Replies
10
Views
946
Back
Top Bottom