S7-300 Variable retention

kris bishop

Member
Join Date
Jun 2007
Location
Scotland
Posts
6
Hi Folks,

I have experience in a few languages now but was struggling with Siemens so I decided to teach myself.

I'm a poor teacher.(n)

I mananged to get a program to run and do what I wanted but after doing some unknonw thing my variables stopped retaining.

eg. M1.0 wast the 'run_program' latch, I had used (s) to set the bit and (r) to reset it when I wanted to, this was fine but after doing something it stopped latching that variable and it appeared to reset everytime OB1 ran.

I created a new blank project and put in the same symbols and same code and uploaded, it now works, so I think I must have done something to a setting but I cannot find it,

any help would be appreciated, as I'm also suppose to be teaching the technicians soon.

thanks in advance
Kris
 
usually you should use V memory binairy adressed to get retentive value instead of M.

I don't know if there is a way to keep the M status rententive...

In a redundant plc project some funcction were done by M bit that need to keep there status after black out, instead of redoing the project with V memory, i just moved the M block to a V all the time after first scan and during the first scan only: i recopy the V value to the M block so my M value stay memorised....
 
Hi Kris.

By "every time OB1 ran", do you mean you stop and start the CPU by powering down ?
If so, you should check the retentivity of the Merkers. It can be found in the HW Config, CPU Properties, Retentive Memory tab.

If that is not the case, you may want to check if M1.0 is written to by other code. Be aware that MB1, MW0, MW1, MD0, MD1 all access M1.0 because of overlapping access.

If that does not explain what goes on, then post your code.


Jeff. I think you missed that he is using an S7-300, and not an S7-200.
 
No V memory in S7-300


You're right, I was thinking of datatable (Dbx) instead of the V equivalence of microwin when writing the answer but it works the same way

The point is to see it different from the M found in the symbol table more used has binary working value...
So the factory setting of the cpu like you shown keep the M non rentive VS the DBx....(Most of cpu i worked with run this way)

Using it the way it is mean to be seem better to me for the next time in few months you will work with it witout remembering what you changed...
 
Last edited:
Hi Folks,

Thanks for all the replies.

As noted it is a S7-300 I am using.

I had checked the HW Config and I had Number of Memory Bytes starting with MB0 set to 16 but still nothing.

The same template (HW Config) and re-starting the project works. safe to say I think I will be looking at a way of backing up the project between updates when I'm doing real project with S7.

thanks again, hopefully I can return the favour
 
Hi Kris.

If that is not the case, you may want to check if M1.0 is written to by other code. Be aware that MB1, MW0, MW1, MD0, MD1 all access M1.0 because of overlapping access.

If that does not explain what goes on, then post your code.

I have lost the code, I some who save a new version over the first (School boy error number 1 of 1000 made with this project)

But although when I'm reading your post I know what you are saying and would always have known that I suspect that I hadn't in the problem.

I think you hit the nail on the head as I was also creating a random number and putting that in to a MW, will kick myself if I find in my code I had been writing to the same memroy address, but in all fairness it would explain the problem perfectly.

Thanks again
Kris
 
Hi Kris.

Maybe you can upload the code from the PLC.
And you can check if there is anything writing to M1.0 by selecting the address in the editor and hitting CTRL+ALT+Q. Then select to display "overlapping access to memory areas". That catches everything, except for indirect addressing via pointers.
 
One more thing. Maybe you have set the "clock byte".
The most typical is to use MB0, but any adress can be set so check that in the CPU Properties. Btw, the clock byte one is also not caught by the "overlapping access to memory areas".
 

Similar Topics

Hello people, I have established communication between a S7-200 and a S7-300 via profibus DP using an EM277 module. The network is well...
Replies
2
Views
1,963
Hi guys, I am having a brain freeze on how to produce a timer with the on and off times changeable via the HMI. For example i have a solenoid on...
Replies
20
Views
17,871
Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
27
Hi Siemens guys! I am experiencing SF fault on our S7-300 (6ES7 315-2AH14-0AB0) CPU from time to time. I've checked the diagnostic buffer and...
Replies
13
Views
170
Have a system that has been running for over a year and all of a sudden getting a ExcessiveVelocityFault on one of the drives when the MSO command...
Replies
2
Views
144
Back
Top Bottom