Technical FAQs

Ask a Question

Persistent variables in SoMachine Basic with M221

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 1000 memory words (%MW50 up to %MW1049) 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 ?