DS1307 Real Time Clock Engine
pusink
Posts: 68
anybody have a sample spin code to use DS1307 Real Time Clock Engine v.1.4 by Kwabena W. Agyeman.
tq.
tq.
Comments
i'm new in propeller chip dan *.spin. When i see your demo, it's hard for me to understand..you have any other sample program using your v1.4 to display time and date via parallax serial terminal..
Tq..for helping me...
You gotta bite the bullet and dive in. Only way to learn. In particular look at the private funtion called "ProgramDate" this function is the one that actually generates the date output to the serial terminal.
I'm sorry the function is so complicated, but unless you want to just see numbers for the time and date it has to be complex.
You can however do stuff like... (using fullduplexserial.spin)
rtc.readTime
serial.dec(rtc.checkSeconds)
serial.tx(13)
serial.dec(rtc.checkMinutes)
serial.tx(13)
serial.dec(rtc.checkHours)
serial.tx(13)
serial.dec(rtc.checkDate)
serial.tx(13)
serial.dec(rtc.checkDay)
serial.tx(13)
serial.dec(rtc.checkMonth)
serial.tx(13)
serial.dec(rtc.checkYear)
serial.tx(13)
it's working properly....tq very much...but i have another question...now my clock is 24h format...how to change 12h format...
tq again...
I am not sure whether I am the only one experiencing this peculiar thing with your v1.4 driver.
The first time I call rtc.readTime, it returns failure.
The second time I call rtc.readtime, it returns success but all the values I got are 165.
Only after the 3rd and subsequent call of rtc.readtime do i get the correct date and time values.
I share the same I2c bus with the boot eeprom.
Kye's object provides methods to return 12 hour values,
clockMeridiemHour and clockMeridiemTime, but it does not accomodate using the chip's built-in 12 hour format.
That is why I tweaked his object to allow 12 or 24 hour mode since I move my modules between the propellers, basic stamps and arduinos where my code expects the 12 hour format.
My version is here
http://forums.parallax.com/showpost.php?p=945279&postcount=7
- Ron
tq very much....i will try first...
You may be experiencing problems related to another piece of I2C code running or electrical problems. I have never had any problems using sparkfun's DS1307 module.
If you weren't getting this problem before its probably because all the accesses weren't group together before. So, maybe previously a few of the calls to "getSecond" or "getMinutes", etc may have failed but you didn't notice.
I assure you that the new code works much better than the previous code and is well tested.
Kye,
When I attempted to use the above commands, I got "Error expected a subroutine name" on each line with the methods rtc.ckeck.xxx
In your excellent DS1307 RTCEngine.spin I can't find these methods, except inside of comment fields under PUB ReadTime.
Am I missing something?
phil kenny
I haven't updated that code in a while. Sorry about that.
Thanks,
phil
Because ur indicating serial there in the code the data is displayed on the serial terminal. But how can i get the time and date to display on a JHD162A 16x2 LCD with HD44780 Driver. What do I need to change in the LCD RTC Demo code??
So,something like this???
PUB Update_time
I2C.read_page(I2C#RTC,Seconds,@buffer,7)
LCD.clear
LCD.hex(buffer[date],2) ' display time and date as dd/mm/yy hh:mm:ss
LCD.send("/")
LCD.hex(buffer[month],2)
LCD.send("/")
LCD.hex(buffer[year],2)
LCD.move(2,0)
LCD.send(" ")
LCD.hex(buffer[hours],2)
LCD.send(":")
LCD.hex(buffer[minutes],2)
LCD.send(":")
LCD.hex(buffer[seconds],2)