Go Down

Topic: isl1208 rtc arduino library wanted (Read 7 times) previous topic - next topic


Today at 09:23 pm Last Edit: Today at 10:00 pm by Louie323
greetings all, I am interested in someone writing a simple arduino library for the isl1208 for personal use, available to anyone who might want it also. i will try to provide as much information as i can. this is a personal favorite of mine due to the alarm/int, and greater accuracy than the 1307. thank you in advance.

Datasheet here:

I can control it with the following code, but am confused on the hour setting. If i use any other format i get gibberish. a library would be much neater, than the code im using. i came up with the following code from the datasheet, but i am not skilled at coding so please forgive any errors that may be really obvious to the trained eye. thank you.

Code: [Select]

//device isl1208 address 0x6F
#include <Wire.h>
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/interrupt.h>
byte seconds, hours, minutes, date, months, years, statusReg;

void setup () {

  Wire.write(0x07); //status register
  Wire.write(0x90);  //

  Serial.print(statusReg,HEX); //should be 144/0x90
  Serial.println("h - status register");*/

  //alarm setup
  Wire.write(0x08); //alarm register
  Wire.write(0x0c); //seconds alarm register
  Wire.write(0xB0); //secs
// set time
   Wire.write(0x00); //seconds register
   Wire.write(decToBcd(30)); //secs
   Wire.write(B10000111); //hour 7
   Wire.write(decToBcd(13)); //date
   Wire.write(decToBcd(01)); //month
   Wire.write(decToBcd(15)); //year
   Wire.write(0x07); //status reg addr
   readStatusReg(statusReg); */

void loop () {
  Wire.write(0x00); //status reg addr
  Wire.requestFrom(0x6f,6); // now get the 6 bytes of data...
  //hours=hours & B01111111; // remove mil time bit


byte readStatusReg(byte val){

  Wire.write(0x07); // read status reg to clr bits
  Wire.requestFrom(0x6f,1); // now get the byte of data...


byte bcdToDec(byte val)
  return ( (val/16*10) + (val%16) );

byte decToBcd(byte val)
  return ( (val/10*16) + (val%10) );

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131