Real Time Clock and EEPROM board |
The board provides a header with 6 pins:
- GND - ground
- VCC - power (3.3V or 5V)
- SCL - I2C clock
- SDA - I2C data
- SQW - programmable interrupt/square wave output
- 32K - free running 32kHz clock output
I hooked it up to my Arduino Mega 2560 with male-female flying leads: I wired GND and VCC to GND and 5V on the power header, SCL and SDA to their counterparts on the communication header, and the SQW output to the INT3 input.
I then wrote a quick program in to test the board (I prefer to code in C using Atmel's Studio for AVR microcontroller development, for more on this see here.) This used the nice, stable and simple I2C master driver written by Peter Fleury. Note that I ignored the board's EEPROM.
The program prints the current time, day, date and temperature once a second:
RTC test
time: 12:14.44 day: TUE date: 08/03/2016 temperature: +24.00
time: 12:14.45 day: TUE date: 08/03/2016 temperature: +24.00
time: 12:14.46 day: TUE date: 08/03/2016 temperature: +24.00
The program uses the Arduino's USB serial port for console I/O, based on Mika Tuupola's recipe here. I use TeraTerm on a desktop Windows PC for this, connected to the Arduino's COM port at 115200 baud.
You can download a ZIP of the Atmel Studio 7 project from here.
No comments:
Post a Comment