adccommunitymod (AutomationDirect) asked a question.

Store/Restore to permanent EEPROM (DL-05)

Created Date: October 02,2008

Created By: jondecker76

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

PLC Used: DL 05 The DL-05 PLC has a super-capacitor which will keep RAM state anywhere from a few day to a few weeks without power. This will preserve your settings, etc, during short power outages. However, to ensure important values are never lost, I would recommend backing this data up permanently to the EEPROM to avoid them being lost. For example, if you have "Settings " screen, you may want to save to EEPROM every time the user leaves this screen. It is important to realize that the EEPROM is only good for about 100,000 writes (per address location). Therefore it is very important to write to EEPROM as little as possible (EEPROM reads have no affect on life-expectancy - reads only happen on first scan, and is not controllable by the user) In my example, we are going to backup v2000-v2017 to EEPROM once each 24 hours. Also, we will restore the values from eeprom on any restart. Note that this won't be 100% accurate, as it only backs up this data once per day in our case.. but its better than losing all data! Of course, if you used tighter control of when the EEPROM was written to (only when data changed), then you can build a backup/restore system with more accuracy. At a write frequency of once per day, the eeprom should theoretically last for about 274 years... If you wanted to back up data to the eeprom once per hour, then the eeprom should last for about 11-12 years, which is acceptable for many cases as well. //Other pre-requisites: -I'm going to use a One-Day interval timer ( C3). How this was made is discussed here: http://forum.automationdirect.com/showthread.php?t=5484 //STORE PERMANENTLY TO EEPROM //Each 24 hours, do the following: - C3--------------------------LD k0F //This is the number of address locations to store to eeprom. 0F = 17 octal or 15 decimal LDA O2000 //this is the starting address of the block of memory locations that we are going to store to EEPROM Note that the LDA must be used to convert the octal address to hex for the MOV instruction MOV v7400 //V7400 is the start of EEPROM. Note that only the MOV instruction will write to the EEPROM copy! //RESTORE FROM EEPROM BACK TO RAM //only on first scan - SP0--------------------------LD K0F //This is the number of address locations to store to eeprom. 0F = 17 octal or 15 decimal LDA O7400 //this is the starting address of the EEPROM that we are going to restore from. Note that the LDA must be used to convert the octal address to hex for the MOV instruction MOV v2000 //V2000 is the start of the address range we want to restore. Note that only the MOV instruction will not write to the EEPROM copy in this instance, since it valls outside of the v7400-v7577 range! as you can see, it is very simple. The important thing to remember is not to write to the EEPROM more than you have to!


  • adccommunitymod (AutomationDirect)

    Created Date: October 02,2008

    Created by: jondecker76

    PLC Used: DL 05

    The DL-05 PLC has a super-capacitor which will keep RAM state anywhere from a few day to a few weeks without power. This will preserve your settings, etc, during short power outages. However, to ensure important values are never lost, I would recommend backing this data up permanently to the EEPROM to avoid them being lost.

    For example, if you have "Settings " screen, you may want to save to EEPROM every time the user leaves this screen.

    It is important to realize that the EEPROM is only good for about 100,000 writes (per address location). Therefore it is very important to write to EEPROM as little as possible (EEPROM reads have no affect on life-expectancy - reads only happen on first scan, and is not controllable by the user)

    In my example, we are going to backup v2000-v2017 to EEPROM once each 24 hours. Also, we will restore the values from eeprom on any restart. Note that this won't be 100% accurate, as it only backs up this data once per day in our case.. but its better than losing all data!

    Of course, if you used tighter control of when the EEPROM was written to (only when data changed), then you can build a backup/restore system with more accuracy.

    At a write frequency of once per day, the eeprom should theoretically last for about 274 years... If you wanted to back up data to the eeprom once per hour, then the eeprom should last for about 11-12 years, which is acceptable for many cases as well.

    //Other pre-requisites:

    -I'm going to use a One-Day interval timer ( C3). How this was made is discussed here: http://forum.automationdirect.com/showthread.php?t=5484

    //STORE PERMANENTLY TO EEPROM

    //Each 24 hours, do the following:

    - C3--------------------------LD k0F //This is the number of address locations to store to eeprom. 0F = 17 octal or 15 decimal

    LDA O2000 //this is the starting address of the block of memory locations that we are going to store to EEPROM Note that the LDA must be used to convert the octal address to hex for the MOV instruction

    MOV v7400 //V7400 is the start of EEPROM. Note that only the MOV instruction will write to the EEPROM copy!

    //RESTORE FROM EEPROM BACK TO RAM

    //only on first scan

    - SP0--------------------------LD K0F //This is the number of address locations to store to eeprom. 0F = 17 octal or 15 decimal

    LDA O7400 //this is the starting address of the EEPROM that we are going to restore from. Note that the LDA must be used to convert the octal address to hex for the MOV instruction

    MOV v2000 //V2000 is the start of the address range we want to restore. Note that only the MOV instruction will not write to the EEPROM copy in this instance, since it valls outside of the v7400-v7577 range!

    as you can see, it is very simple. The important thing to remember is not to write to the EEPROM more than you have to!

    Expand Post