Making persistent values in S7 PLC

mikas_m

Member
Join Date
Feb 2007
Location
ck
Posts
154
Hello to all,
I want to be sure about the way to make persistent values of parameters in S7 PLC(300/400). For example I want to place all parameters for some other parts of a program in one datablock.
I plan to write these values directly in DB during programming (under Actual Value in DB) and then download to PLC.
Are these values will be kept in case of power failure or memory reset of PLC (assume that program is on MMC)? I think so, but need confirmation.

Correct me if I'm wrong but I think that all modifications that are done online (for example through modifying var table) exists in working memory and will be overwritten in case of power lost or memory reset.

Thank you very much.
 
The values will be kept. There is a Property value "Non-retain" that will mean the values are NOT kept, but this value is OFF by default.

There are two cases special cases that you must consider.

S7-400: If the backup battery is missing or discharged. Then the CPU will load the program incl. the DB from the MC card.
Therfore write the program including the DB to the MC card. This requires you to stop the CPU.

S7-300: If the memory is corrupted (caused by noise or power glitch), then it can happen that the DBs acual values are reset to the initial values. It is rare, but has happened to me at least once.
Therefore, set both initial and actual values in the offline DB, and then download it to the PLC. This does not require you to stop the CPU.
 
Some other options you might want to consider:

Populate the DB values using a code block containing load/transfer instructions.

Make the DB unlinked so it only exists in the load memory, copy it programmatically using SFC20 into another DB in work memory.

Make the DB write protected so the values cannot be changed by an erroneous program
 
Thank you for your advices. The weird thing is that I cannot change initial value in DB. For example, if I open, say DB1 in LAD/FBD editor I can only change field Actual value, but Initial value field is zero by default. I cannot change it and it's gray.
Since I use DB only to store parameters and I trasfer it from DB to other location using Move instruction I think there is no need to make write protected block since I only read values (there is no write instruction).

All in all I think that 95 % I can consider my DB values to be safe (if I figure out how to write initial value it will be 99%).
On the other hand, how about changing values through var tbl? I think that is unsafe and should be avoided when possible.

There is also one more thing. New CPUs doesn't have separate RUN-P position so I suppose they are in RUN-P by default?
 
You must switch between "declaration view" and "data view" to set initial values and actual values. Cumbersome, but that is how it is.

When you change values via a VAT, you change the online actual values. Offline initial and actual values, and online initial values are unchanged.
 

Similar Topics

Hi, I have seen a few post with similar topics and I have tried contacting the authors however I have not had any luck so I am posting this new...
Replies
14
Views
1,010
Hi everyone I've created an FC that includes the blocks TCON, TDISCON, TSEND and TRCV. This block has to be as generic as possible across...
Replies
15
Views
1,511
Hi all, I have been working on a tool for my company that handles a specific task our company runs into often related to PLC's. This is a tool I...
Replies
15
Views
2,874
Hi, i need to make: 1- A PLC Program on Omron PLC CP2E-N using high speed counter E6C3-AG5B 360P/R 2M(Absolute) ,to Reject bottles on Conveyor...
Replies
4
Views
877
I was taught to go to Combined > Make Change > go to Offline > will prompt to save > Save > Exit out of program > will prompt to save again >...
Replies
0
Views
678
Back
Top Bottom