Author Topic: storing dm[] values  (Read 10454 times)

kizor

  • Newbie
  • Posts: 15
    • View Profile
storing dm[] values
« on: June 21, 2009, 02:03:50 AM »
Hi


I have a program running to messuring the time a input is closed
I use therefore 3 dm[]'s and a 1 sec  clock pulse

dm[3]=dm[3]+1          ' count seconds
if dm[3]=60 then
dm[3]=0
dm[2]=dm[2]+1           'count minutes
endif
if dm[2]=60 then
dm[2]=0
dm[1]=dm[1]+1            ' count hours
endif

that works fine but what i want to reach is to store the time every day to 3 other dm[]'s so that i become

if date[3]=1  then store the time to dm[1],dm[2],dm[3]

if date[3]=2  then store the time to dm[4],dm[5],dm[6]

if date[3]=3  then store the time to dm[7],dm[8],dm[9]

and so on .....

Is there a possibility to do this ?
I have tried, but my knowledge is to little to figger this out
I appreciate each tip or aid highly

Thanks in advance
KIZOR

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:storing dm[] values
« Reply #1 on: June 21, 2009, 07:41:08 AM »
Try the following:

D = (DATE[3]-1)*3

dm[3+D]=dm[3+D]+1          ' count seconds
if dm[3+D]=60 then
   dm[3+D]=0
   dm[2+D]=dm[2+D]+1          'count minutes
endif
if dm[2+D]=60 then
   dm[2+D]=0
   dm[1+D]=dm[1+D]+1            ' count hours
endif
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

kizor

  • Newbie
  • Posts: 15
    • View Profile
Re:storing dm[] values
« Reply #2 on: July 26, 2009, 05:02:52 AM »
Hi

I have tested the program and this is just what needed.
When you have the knowledge and the insight everything seems so easy!


Many thanks to the moderator for the help to figger this out.


Kizor