Internet PLC Forum

General => Technical support => Topic started by: raan on June 19, 2003, 05:29:14 PM

Title: logging date and time of an input contact
Post by: raan 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.
Title: Re: logging date and time of an input contact
Post by: support 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