Browse FAQs

Persistent variables in SoMachine Basic with M221

Published date: 04 September 2018

Automatic Saved on Power Outage 
The controller automatically saves the first 50 Memory Words (%MW0 to %MW49) in the internal data flash following a power outage. The date is restored to the memory word region during the initialization, even if the controller performs a cold start due to a battery malfunction. 
These automatically saved persistent variables are reinitialized in case of a new download, INIT command or %S0 activation. 
Saved by User Request 
You can save up to 2000 memory words (%MW50 up to %MW2049) in the flash memory. The number of words saved or restored is specified in the system word %SW148. 
To perform the SAVE operation, set system bit %S93 to 1. The flash region is erased at the end of the MAST cycle. The operation exclusively occupies the controller for approximately 40 ms. The system bit %S92 is set to 1 to signal the end of operation. 
The restore is performed by setting %S94 to 1. The restore operation is performed completely at the end of the MAST cycle.

Was this helpful?

What can we do to improve the information ?

Can't find what you are looking for?

Reach out to our customer care team to receive information on technical support, assistance for complaints and more.