Author Topic: Saving DM to NVRAM  (Read 11089 times)

Tim C

  • Guest
Saving DM to NVRAM
« on: March 28, 2004, 09:25:41 AM »
Once apon a time you said that their was some left over nvram or somthing to that effect. I have 8 values in DM that i need to have back in DM before the program in the plc starts running. The question is , do i have to buy the add on chip or can i use this extra memory , and if i can how exactly do i accomplish this? Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Saving DM to NVRAM
« Reply #1 on: March 29, 2004, 09:31:12 AM »
There are 1700 words of EEPROM space which you can use to store your data using the SAVE_EEP command. These are non-volatile memory that can last 40 years but they are not NVRAM. Take note that they have a rewrite life span of about 100,000 cycles and also when SAVE_EEP is executed all interrupts are shut down to protect the integrity of the EEPROM write process so you should only execute the SAVE_EEP at the appropriate moment where interrupt processing is not required. Always use the differentiated custom functions to execute this command otherwise the EEPROM will be written repeatedly which can shorten its lifespan.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Tim C

  • Guest
Re:Saving DM to NVRAM
« Reply #2 on: March 29, 2004, 12:38:14 PM »
Lets say on the first scan i want to read these 8 values just one time, and load them in to DM. That is not a problem if you will show me how to adress these area's.
The Problem is getting the values into the eprom, when you only want to write them one time, you cant use the first scan bit , because the values you want to write to eprom has not been written from the computer yet, so how can you do this without writing them over and over again. The values I'm talking about are high and low limits
that determin whether or not to start a motor , if there isnt
a value in the DM where i compare the A/I to the Limit then
the motor will start. I dont want the motor's starting just because i reset the plc. Hopefully you see what im talking about. What is the adress range of these 1700 words
and how do you write to and read from the first one. Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Saving DM to NVRAM
« Reply #3 on: March 29, 2004, 01:43:38 PM »
Please go to "Help-> Content" and then select to view the help on the TBASIC keywords "LOAD_EEP" and "SAVE_EEP" and you can find example on how to use them.

The 1st.Scan pulse can be used to trigger a custom function to perform initialization of parameters, including reading data from EEPROM into the DMs.

For SAVE_EEP, you can write only when an I/O bit is triggered (either by physical input, program or externally via VBASIC) or you can regularly perform a check to see there if there is any changes to the value saved previously by using two DMs - one to store current value and the other to store the value previously saved to the EEPROM. If the current value is different from previous value (let say because of external write via serial port) then the new value is saved to the EEPROM and then the second DM is updated and so on.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Tim C

  • Guest
Re:Saving DM to NVRAM
« Reply #4 on: March 30, 2004, 12:29:25 PM »
Thank's  Support