Author Topic: logging date and time of an input contact  (Read 10845 times)

raan

  • Newbie
  • Posts: 31
    • View Profile
logging date and time of an input contact
« on: June 19, 2003, 05:29:14 PM »
Do you have any suggestions of how to log the date and time in the DM[n] array of when a input closes? I tried several approaches and must have something wrong because it bongs out every time I try to load the program into the plc. I need to log about 700 such entries on a 7 day basis and then reset at the end of the week.
raan.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: logging date and time of an input contact
« Reply #1 on: June 19, 2003, 06:54:36 PM »
What do you mean by "bongs out"? Do you mean you can't load the program into the PLC?

To log the time into DM[n], you just have to assign it:

DM[N] = TIME[1]      ' log hour
DM[N+1] = TIME[2]  ' log minute
DM[N+2] = TIME[3]  ' log second
DM[N+3] = DATE[2]  ' Log Month
DM[N+4] = DATE[3]  ' Log Day

N = N+5

If this use up too much memory you could compress the data into one variable such as:

DM[N+3] = DATE[2]*100+DATE[3]   ' represent as 101 to 1231
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS