When will PLC reinitialize values of a downloaded DB? Siemens step7

plcnoob69

Member
Join Date
Jun 2023
Location
Nigeria
Posts
30
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC cycle?
I'm asking because I have some DBs I need to download, and the values are constantly getting written into the DB. I'm wondering if these values will be lost for one cycle or not
 
The way siemens normally works is the block is downloaded but not enabled, siemens (I believe it's the same as the old S5) puts the block in memory, then at the end of scan of program deletes the header or could call it file allocation table of the old block & puts in the address of the new block, it then compresses the memory to remove old blocks just like a hard disk, however, on hard disks the old files are still there until purged or overwritten. in the very early S5 these blocks were not deleted (or compressed as they called it, what you had to do is compress the memory from the programmer when the ram was full). I would believe this is still the case that is why unlike many other PLC's many blocks can be transferred in run mode. Actually long time since I did Siemens so I think now it has a load memory area the blocks are downloaded to that then at the end of scan or before scan the block is moved into the main memory I just realised that this is probably what happens.
 
Last edited:
If you download a DB, in the online DB the actual values will be set to what they are in the offline DB. The previous online actual values will be lost (!).
Subsequently, the PLC program can write values into the online DB.

What is your concern about the values 'being lost for one cycle' ?
Do you mean that an HMI might see the actual values downloaded from the offline project for 1 scan ?
I would be more concerned with that all online actual values will be reset to the offline actual values.
 
@JesperMP, I think he was wondering if the DB is written during the scan cycle, I believe it is not, the old S5 did it as I explained above i.e. it loaded the block into spare ram then in the tidying up (after or before scan) it replaced the header for the block with the location of the updated FB or DB it is like a File allocation table on a hard disk, In the early versions of S5 after so many doewnloads you had to compress the memory as the original blocks were not removed so you could end up with many FB10's for example but only one is being called, not exactly sure about S7 as I have never really got into it that deep but I believe it has what they call a load memory, So to stop silly things happening I would assume that the block is downloaded to the load memory then placed into the work memory when not in scan, this makes sense as replacing code or data in a block while being called could cause all manner of problems, that is probably why unlike many other PLC's you are able to download all blocks while in run mode (without a stop error (Providing you load them in the correct order, i.e. DB's, FB's FC's OB's).
Just a bit of useless information, in S5 the code on disk was organised in the same way, there was a sort of FAT, I was involved in a critical process where there was a printer connected to the S5 155 PLC, the guy I was working with (an ex Siemens guy) did the printer code, As this was critical & if the printer failed or ran out of paper the critical events were stored in a DB, this DB if not already in the PLC (created during the startup OB) the OB checked the availlable spare ram, created the DB & wrote the header into the file allocation table, there is no way a DB of that size could be downloaded as it would complain not enough space, very clever & I learnt a lot about code that is not generally documented, the only problem was should a re-load be required or even a small change then the only way was to delete the DB in the PLC, download the code, do a cold start, then a warm start to allow it to re-generate the DB he also used relative addressing rather than symbolic so any change to his function block i.e. add one instruction meant you had to go through & change the jump locations, a real pain but in those days it was the only way to jump greater than the 255 segment limit of STL.
 
So you think that he was wondering if the DB will be locked while STEP7 is downloading. Kinda like an Excel file on the server can be locked if someone else is is editing it.
If that is the case, then your explanation is the correct one.
 
Not exactly locked but in S5 the block is downloaded into spare memory (S5 needed enough space to load a block into) then during the PLC tidying up between scans of the program it changes the file allocation to the new block i.e. overwrites the FAT if you want to call it that, the old block originally in the early days was not deleted so every so often you had to do a compress which removed the old blocks, later versions automatically compressed the memory after a block download. So as S7 has a load memory I am assuming it does something similar i.e. it downloads the block into an area then at the plc tidying up period between scans does the same thing or something similar, I do not know exactly what it does but it either overwrites the original block in the work memory or places it there then changes the address of the header in the FAT table. As I said not really dug into it on S7 but I hound from my time working with siemens engineers many ways you can manipulate programs & do some really fancy things that are not generally documented, a couple of things I learnt.
How to read the header files on a disk with an S5 program i.e. a file allocation portion, find the DB, extract the Data & process it, The DB's were massive (for S5) at least 2000 words long they held alarm texts & pointers to the texts to make up alarm information to display on the WF470 graphics card, trouble was that these were entered through the WF470 system so there was no record of these alarms should you not have a copy of the data in the DB, the program I wrote in pascal extracted the data & compiled it into the alarm text & the relevan pointers & save it as a config file, it meant that if for some reason the data in the plc was changed by someone & the DB's were out of sync then we could very quickly set the texts & pointer in a second or two, I enhanced the program so I could type in the alarm texts very quickly & set the data in the DB's ready for download this saved lots of time rather than edit them on the WF470 which if you have used it, is very cumbersome for example to set up the text strings (4 per alarm) in other words 4 DB held 8 char strings then another held the address of these so for example an alarm message would consist of B03TK001, Motor001, Failed the pointers might be 001,003,004,152.
The other was an experiment where I typed in the MC5 codes for instructions into a DB, then by processing these words it ran a program where the instructions were held in a DB so no actual code like A M0.0 OUT Y5.0 It worked cannot remember the actual instruction now but it was something like L DW10 RSxx DO DW10. (Don't take this as actual code I cannot remember the actual instructions & cannot find my book with all those instruction in it. the code I wrote as just turn 4 outputs on in sequence all it took was some code with a couple of the special process codes & a DB populated with MC5 Hex codes) It worked a treat I realised that it would be possible to create self modifying code, imagine some code that modified it's self as it processed it by changing the Hex values for the instruction, very bad idea. although it took longer than writing in normal STL or ladder, imagine some unsuspecting engineer looking through the code & seeing no inputs, no outputs, timers etc. just loading loads of datawords & processing instructions you might as well have compiled exe file.
 

Similar Topics

I'm trying to integrate a Beckhoff IPC with a Controllogix PLC. There is some documentation, on the Beckhoff website, on how to do a PLC-PLC comms...
Replies
0
Views
38
kindly need to understand why can't upload the plc
Replies
2
Views
56
Hello all, I have a one problem. I would like to upgrade Mitsubishi PLC Q02 to Q03UDVCPU. I have Q02 program and I change to PLC type and try to...
Replies
3
Views
60
The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
11
Views
273
the conveyor can stop because of a safety sensor or safety switch. And also it can stop because of an object jam detector sensor. If the conveyor...
Replies
5
Views
197
Back
Top Bottom