Internet PLC Forum

General => Technical support => Topic started by: tobor0216 on January 11, 2010, 03:26:52 PM

Title: Setting a DM location = to a counter value
Post by: tobor0216 on January 11, 2010, 03:26:52 PM
I am wondering how to set a DM location = to a counter. The reason I am looking to dp this I want to read my counters into a mDM location in case of a pwr failure, I can then write them back to the counters and I do not lose any information.

Thanks Paul
Title: Re:Setting a DM location = to a counter value
Post by: support on January 11, 2010, 07:18:50 PM
E.g. DM[10] = CTRPV[1]

or

DM[1000] = CTRPV[5]
Title: Re:Setting a DM location = to a counter value
Post by: tobor0216 on January 12, 2010, 02:46:54 PM
This works, but the problem is when I reset the PLC or remove the power, the memory locations are cleared.
Title: Re:Setting a DM location = to a counter value
Post by: garysdickinson on January 12, 2010, 03:40:18 PM
You can make the DM[] array act as if it is non-volatile using a couple of different methods:
I use the following code to copy the first 96 entries of DM[] into EEPROM at addresses 1 to 96:

    FOR I = 1 to 96
      SAVE_EEP DM,I
    NEXT


I use the following code to reload DM[] when the PLC is reset:

   for i = 1 to 96
      dm=LOAD_EEP(i)
   next