Joined: 07/07/2014 18:07:27
Here's a new Arduino program to test/demo the MCP7940RTC real time clock chip on the Anarduino Mini-wireless boards.
The program displays the millis() counts vs. elapsed seconds from the clock chip. It also sets clock interrupt alarms for 1, 2, 4, 8... seconds and prints elapsed millis on that too.
A gotcha I've not fixed is that an alarm in 1.0 second is not yet possible. The chip won't alarm unless the alarm time is in the NEXT second or later. So the millis for the first 1 second alarm is not exact. The millis for the other alarms is off by 2-3 mSec due to overhead in the MCP7940RTC library. That library needs a re-write, I think - has too much overhead and conversions - that take lots of CPU time and memory space.
I didn't change the MCP7940 library. But as described in the code near setup(), it needs a change so that one can declare a static instance of the class as is usually done for small RAM microprocoessors. As written, one must use new() and that uses malloc() which is more code and is not friendly to a 2KB RAM micro. See the comments for recommendations. Easy change.
screen grab of output from program
This message was edited 3 times. Last update was at 30/08/2014 19:30:05