CANNY 5.3 MD1A, EEPROM Driver
General Description
To eliminate loss of critical information (controller’s state, external device status, etc.) in case of a power failure, the CANNY 5.3 MD1A controller is equipped with non-volatile memory. The values saved in EEPROM will be available in special registers after the power is restored.
There are 64 16-bit non-volatile memory cells, which are accessed by using the corresponding input and output registers.
Note: Working with non-volatile memory does not require any special pre-configuration. However, in order to avoid loss of information, make sure that in the time period between writing new values, the value in the write register of the used non-volatile memory cell is read from the read register of the same cell. See the example for more detail.
Note: Changing a value in a non-volatile memory cell will increase the execution time of the diagram loop in which the change occurred by several milliseconds.
Note: The number of times you can overwrite information in non-volatile memory is limited. CANNY 5.3 MD1A memory driver is organized in a way that substantially increased the longevity of non-volatile memory. However, avoid permanently saving unnecessary data into the EEPROM or storing data on each execution cycle of the diagram. Only preserve information upon meeting certain conditions, see example.
Note: Overwriting the system software and/or function diagram in the controller will erase (reset) the non-volatile memory.
Non-volatile memory registers
Below is a description of expected values of controller non-volatile memory setup registers. They are used to write information into the EEPROM cells.
Register | Expected values |
---|---|
EEPROM Write Register, Cell 00 … EEPROM Write Register, Cell 63 |
0xFFFF = value to be set |
EEPROM Reset Register | ≥ 1 = clear the contents of all user-accessible EEPROM cells (write zeroes into all of them); 0 = save the current state of the EEPROM cells. |
Below is a description of acceptable values controller non-volatile memory read registers. They are used to read information from the EEPROM cells.
Register | Return Values |
---|---|
EEPROM Read Register, Cell 00 … EEPROM Read Register, Cell 63 |
0…0xFFFF = value to be read. |
Examples
![Function diagram with non-volatile memory cells.](/img/docs/en/c53md1a/eeprom/c53md1a_eeprom_1.png)
A button is connected to the controller’s channel 8. The number of times the button is pressed is added to the previously stored value in the network named “counter”. The value of the network «counter» is stored in non-volatile memory when the button is released. After turning off and then restoring controller’s power, the value stored in non-volatile memory cell is automatically read and transmitted back to the network named “counter”. This avoids loss of information on the number of clicks on this button after controller power loss.
Note: The process of storing data in the EEPROM takes time, i.e. not instantaneous.