Does anyone have any information on how to read and set the real time clock on the Arduino Opta PLC please?
I've seen two variables:
sysTimer
sysTimerHiRes are these anything to do with the RTC?
Does anyone have any information on how to read and set the real time clock on the Arduino Opta PLC please?
I've seen two variables:
sysTimer
sysTimerHiRes are these anything to do with the RTC?
Hello @MarkWigley,
Take a look in the RTC section of Opta's User manual; there is an example of how to set Opta's RTC using an NTP server. Let me know if this helps!
Hello @jabagur
Thank you for your help.
With your help I managed to get it to work!
I wanted to set the Opta PLC RTC from a Unix Epoch Time. ie 1701633230
set_time(1701633230); // This set the PLC RTC.
I then needed to extract just the Hours and Minutes.
time_t t = time(NULL);
struct tm * ptm;
ptm = gmtime ( &t );
ptm->tm_hour;
ptm->tm_min;
Thank you
@MarkWigley
Hi, we want to use Opta's RTC as a backup timer for when we lose power. The datasheet says it can live for ~10 days without power.
I set the time and then kept the PLC off. After 2 weeks, I turned it on and read the time. It had counted time for almost 2.5 days and then stopped at that time. I expect it to reset to 0 if it has not been running, otherwise we would just have a wrong time and we won't know that it is wrong.
Is that how it is supposed to be? It does not last 10 days and it also does not set a flag or reset the time when it finally loses power?