Technical FAQs

Ask a Question

How to save M221 Persistent variables.

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. 

We 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 (refer to System Bits in help file). The flash region is erased at the end of the MAST cycle. The operation exclusively occupies the controller for approximately 40 ms. The writing of memory words to flash memory is performed in stages between MAST cycles. The system bit%S92 must be set to 1 to signal the end of operation. 

Restoration of the data values will be 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 ?