Digistump Forums
Back to Digistump.com
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Digistump Forums
»
The Digispark
»
Digispark Libraries
»
DS1307 RTC library
« previous
next »
Print
Pages: [
1
]
Author
Topic: DS1307 RTC library (Read 8153 times)
ngoline
Newbie
Posts: 3
DS1307 RTC library
«
on:
February 27, 2013, 10:31:26 am »
Hi, I've looked everywhere but couldn't find a library to work with a Real Time Clock on Digispark, so I've decided to modify what I found and make it work my way.
I put out
this project on GitHub
(
http://github.com/nGoline/TinyRTClib
).
It's based on Adafruit's project also on GitHub
(
http://github.com/adafruit/RTClib
).
I've changed it to point to TinyWireM instead of Wire and made some modifications to the
methods
that call Wire 'cause in the TinyWireM library they have different methods like Wire.write() is actually TinyWireM.send()...
In the examples we have 3 codes. The softrtc is meant to run by the first time you put the batteries on, from that point you'll have as long as 9 years of correct Date and Time.
Enjoy
!
NÃckolas Goline
Logged
SmeeAgain
Newbie
Posts: 10
Re: DS1307 RTC library
«
Reply #1 on:
February 27, 2013, 01:59:45 pm »
Nice job! Are you using pull-ups on the I
2
C lines? So far I've only used the 1307 on the Arduino and there it works fine without additional pull-ups.
Logged
Mark
Full Member
Posts: 196
Re: DS1307 RTC library
«
Reply #2 on:
February 27, 2013, 04:45:09 pm »
Folks
I2C needs pullups because the devices are open collector or Tri State.
Stick them in as a matter of design practice.
You only need one set either at the master, or in some designs at the device.
Mark
Logged
ngoline
Newbie
Posts: 3
Re: DS1307 RTC library
«
Reply #3 on:
February 28, 2013, 09:18:16 am »
I'm using them with the "Digispark LCD Shield" and the shield already have the pull ups.
I've also made some modifications to the library and will post it latter today.
Logged
digistump
Administrator
Hero Member
Posts: 1465
Re: DS1307 RTC library
«
Reply #4 on:
March 20, 2013, 07:00:08 pm »
This is now also included in the official release.
http://digistump.com/wiki/digispark/tutorials/connecting#software
Logged
BStrauss3
Newbie
Posts: 8
Re: DS1307 RTC library
«
Reply #5 on:
April 14, 2013, 07:51:00 pm »
It's been suggested in something I read that we should mask the Hours register because there are some chips that return the value of the 12/24 bit setting register, i.e. make the line in now():
uint8_t hh = bcd2bin(TinyWireM.receive() & 0x3F);
Logged
Print
Pages: [
1
]
« previous
next »
Digistump Forums
»
The Digispark
»
Digispark Libraries
»
DS1307 RTC library