Schneider M221 disable automatic saving

kallileo

Lifetime Supporting Member
Join Date
Jun 2008
Location
Thessaloniki, Macedonia, Hellas
Posts
353
For some reason the PLC (TM221CE16T) saves all Memory Bits and Memory Words automatically so after a cold restart it restores not only %MW0 to %MW49 but whole no-volatile memory.

In the help it says:

The controller automatically saves the first 50 memory words (%MW0 to %MW49) in the non-volatile memory following any interruption of power. The data is restored to the memory word region during the initialization, even if the controller performs a cold start due to a missing or depleted battery.

I use the latest version of Ecostruxure Machine Expert Basic 1.1 patch 1.
Anyone know how to disable automatic save???
 
When the system bit
%S91 SB_MWERASE (Set this bit to 1 to erase all memory values in non-volatile memory)

is set to TRUE it erases the all memory, something I don't want as I have setpoints in MW0-MW49.
I just don't understand why it doesn't work as it described in Help and automatically only MW0-MW49.
 
%MW0..%MW49 are saved automatically, but only if you set bit %S93 to 1.

With SW148 you can increase save area, but it is offset for allways saved area.
If you have %SW148= 10, then saved area is 50+10 = MW0..%MW59, but again only if %S93 bit is setted.


Earlier saved data can be restored back to %MW-side, if you set system bit %S94 = 1.


If you don't use system bits, then data is not saved or restored.
(On cold restart every bit (%M0) is reseted and words (%MW0) area is zeroed.)


With system bits %S91 you can zero all previously saved data from non-volatile memory, but it won't affect to %M or %MW side.


If you restore data with %S94 after %S91, you %MW-area is reseted to zero.
 
All related system bits (%S91, %S93, %S94) are set to FALSE and %SW148 is 0.
The problem is that everything is saved automatically (ALL MWs and MBs) so when after a cold restart every values is restored.
It's crazy.
 
Are you sure that PLC makes cold restart?
On warm start every value is maintained. (%S1 start)


You can test it on program by setting %S0 to 1, then it makes at leasst cold restart.


Why you want PLC to zeroe every variable after cold restart?


If yo really wan't PLC to make cold start on every start you should add R_tig and set Cold start bit on %S0.
(R-trig of %S1 or %S13 bits)
 
It's a control panel for as small batch pasteurizer so after each batch the panel is usually switched off by the user and there not point to retain any previous values even in case of an unexpected power outage.
When I say cold restart I mean removing the 24V power terminal from the PLC for few seconds until all the LEDs are turned off.
Isn't it enough;

I will try tomorrow your suggestion.
 
Its funny, because retaining everything through a power outage is exactly what I want for my PLCs in the water industry.

Maybe you need some first scan logic to loop through all the addresses you want zeroed, and zero them using MOV 0. Then you're guaranteed to get the behavior you want.
 
It's a control panel for as small batch pasteurizer so after each batch the panel is usually switched off by the user and there not point to retain any previous values even in case of an unexpected power outage.
When I say cold restart I mean removing the 24V power terminal from the PLC for few seconds until all the LEDs are turned off.
Isn't it enough;

I will try tomorrow your suggestion.


Power off isn't cold start for PLC, it is normally warm restar.
Cold start is saving state with error before poweroutage and stsart after error.


You can move zero to your setpoints or launch cold restart bit with %S1 and %S13 bits.


I probably would code, that if batch is started, every before counted values are zeroed for patch.
Also zero after patch is completed or error.


Retaining setpoints is more usually wanted.
 
Last edited:
I just started playing with M221 as mostly use M241 because of SoMachine/Codesys.

It seems that the M241 is so much superior product when it comes to programming software. Machine Expert Basic sucks really bad compared to Machine Expert/SoMachine/Codesys. It's the worst PLC programming software I have used since TwidoSuit/TwidoSoft.

I think the best use for M221 would be as ModbusTCP/EthernetIP remote I/O.

Back to issues I have is that cold start for the M221 doesn't happen when removing the power as it counts just as warm start for some reason.
When I set %S0 during the first cycle to perform software cold start, it zeros all memory which again is not what I want.

I'm waiting for Schneider technical support to provide precise information on automatic save because the controller just doesn't behave as stated in the manual.

Excerpt from the manual.

Persistent Variables
Automatic Save on Power Outage
The controller automatically saves the first 50 memory words (%MW0 to %MW49) in the non-volatile memory following any interruption of power. The data is restored to the memory word region during the initialization, even if the controller performs a cold start due to a missing or depleted battery.
These automatically saved persistent variables are reinitialized:
After each new download, if the Reset Memories checkbox is selected in download settings.
Following an initialization command.
On system bit %S0 activation (refer to System Bits).
 
I do have to agree that the Machine Expert Basic is horrible. Something I'd code in Control Expert in 5 minutes takes so much longer. I'd only use it for very simple applications to be produced in bulk, where a bit of short term pain doing the coding pays off with cost saving for lots of a cheap PLC.

For one offs or bespoke machines then I'd be looking at something running Control Expert or Machine Expert. I see there's a new range of brick style controllers coming out that are programmed with Control Expert and aimed at being used as cheap Remote I/O or basic controls
 
I'm not sure anymore which one you want.
PLC maintain bits and word automatically if PLC is warm restarted.
On Cold restart it zeroes everything if non volatile memry isn't used with system bits on code for backup and after cpu start for restoring values from non-valitile memory.


You are writing that you don't want that PLC maintains values?


This schneider video shows how to use non-volatile memory for backup and restore.
https://www.youtube.com/watch?v=skPTIVNcSVM



For cold start testing you can use %S0 from animation table or restart PLC without memory battery.
 
@Saffa
The only reasonable solution I have found is to do what you have suggested.
So I run a FOR loop using indirect addressing to zero MW50-99 during first cycle. This part of memory will be used for variables I don't want to be saved.
Indirect addressing doesn't work on memory bits.

I also don't understand how it's possible to use Timers within FBs.
I want to make a Flasher function block so I call two timers within the FB but I can't enable them from outside when an instance of the FB is called.

@Lare
I just want to maintain MW0-MW49 after power outage. Everything else should be re-intialized to 0.

The aforementioned should be default behavior according to the Manual.
 
Last edited:
@Saffa
The only reasonable solution I have found is to do what you have suggested.
So I run a FOR loop using indirect addressing to zero MW50-99 during first cycle. This part of memory will be used for variables I don't want to be saved.
Indirect addressing doesn't work on memory bits.

I also don't understand how it's possible to use Timers within FBs.
I want to make a Flasher function block so I call two timers within the FB but I can't enable them from outside when an instance of the FB is called.

@Lare
I just want to maintain MW0-MW49 after power outage. Everything else should be re-intialized to 0.

The aforementioned should be default behavior according to the Manual.




Manual says it little bit wrongly.
Memory words from %MW0 to %MW49 are maintained only after restart if system bits are setted on program side.
Automatic saving means here that you don't need tell how many words (%MW148)as 50 is saved by default after %S93 (as on video) if %SW148 is 0.


Normally PLC is warm restarted when variables are maintained even if system bits aren't used at all.


For zeroing instead indirect addressing you can use syntax:
%MW50:50 := 0


For FB and timers inside of block you need newest Somachine basic version and firmware version selection on program.
 
Last edited:

Similar Topics

Hello, I need to access the bits from the fire system control panel through RS-485. So, I used Read Var block to read from the panel...
Replies
0
Views
48
Hi, I am stuck with these SE cartridges, I am trying to add a second serial port rs485 to a M221 PLC. What is the difference between TMC2CONV01...
Replies
1
Views
101
I am using a M221 PLC (TM221CE24R) which provides me 1 Rs485 port, which I am already using to communicate with a sensor (Rs485/Modbus). My...
Replies
1
Views
724
Hello, I am programming a schneider modicon M221 in machine expert basic. I am trying to calculate a value and then assign it to another memory...
Replies
3
Views
1,293
Hello, I am trying to detect when the PLC changes from STOP to START mode. This can be considered an edge case scenario, but I would to analyze...
Replies
4
Views
1,489
Back
Top Bottom