[Time] RX8025 Real-Time Clock Library
The RX8025 is a Precision Real Time Clock (RTC) Module with I2C interface. This is a library (for arduino or cpp) that handles interfacing with the RX8025 module. It is a very easy module that works fine if the module is hooked up correctly (see datasheet if needed -google is your friend-). This Realtime clock is also present on the Seeeduino Stalker and that’s how i use the rtc at this time. It works pretty well; see the example file and .zip i have provided. put the content of the .zip in your /Arduino/Libraries folder.
You can set the correct time of the RX8025 by using the method in the bottom.
Download
Example code
This code is also already included in the .zip file
#include <wire.h>
#include <rx8025.h>
void setup()
{
Serial.begin(9600);
RX8025.init();
}
void loop()
{
int rtc_sec, rtc_min, rtc_hou, rtc_wee, rtc_dat, rtc_mon, rtc_yea;
delay(1000); // There will be new values every 100ms
RX8025.getRtcTime(&rtc_sec, &rtc_min, &rtc_hou, &rtc_wee, &rtc_dat, &rtc_mon, &rtc_yea);
Serial.print(rtc_dat,DEC);
Serial.print("/");
Serial.print(rtc_mon,DEC);
Serial.print("/");
Serial.print(rtc_yea,DEC);
Serial.print(" ");
Serial.print(rtc_wee,DEC);
Serial.print(" ");
Serial.print(rtc_hou,DEC);
Serial.print(":");
Serial.print(rtc_min,DEC);
Serial.print(":");
Serial.println(rtc_sec,DEC);
}
//First define this
unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};
//Then call this
RX8025.setRtcTime(RX8025_time);
Hi,
The line of code that says: unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};
…comments out the last curly bracket and semi-colon.
Cheers,
Ed