Date time under TSX7 series PLCs

L

Thread Starter

Laurent

Hello all !
I'm working on a TSX 47-40 PLC. I must write a bit of code to archive all I/O state changes. For that, I must record in the PLC memory a code, which designs the I/O and his current logical state, and the current date and time. Of course, the time recorded is not the _true_ time the I/O was changed, but the little delay between the change and the record is not a problem.
So, first, I records the I/O and state code.
Second, I records the date, beginning by year, then month, day, then hours, minutes and finally the current seconds.
The current date and time values are provided by the PLC's system, through the system words SW51 to SW56 (seconds, minutes,... year).
But if the system time changes during the date/time recording, what's happening ?
I see a little problem: the instructions to record data take a bit of time. So, at the beginning of the record stage, if the current time is 2001/08/17-15:59:59, I write 15 for hours, but before processing the instructions to record minutes, the system time runs over the next second... Then, I write 00 for minutes and seconds, right ? So, in memory, I write 15:00:00, while the system time as reached 16:00:00 :) An error of about 1 hour... Hmm, it seems to me that it's not really acceptable, no ? But it's not the worst case :) If that occurs at 2001/31/12-23:59:59, I can archive 2001/01/01-00:00:00, an error of about 1 year :/
Anyone can enlighten me about this, please ? Can it really occur ?
Regards

 
Top