Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

strange RTC 8563

Status
Not open for further replies.

gold94

New Member
Hello, my name is thierry

I try to do a real time clock with PCF8563, the clock works fine but a strange thing produit.a every 20 seconds the LCD add me numbers, like this:
LCD
time: 6:30:00
Date: 01/01/2014 (no problem)
LCD
time: 6:30:20
Date: 01/21/2014 (oups. ..!).
LCD
time: 6:30:40 -> time: 46:30:41 (oups ...)
Date: 41/41/2014 (oups ..)
strange and I can not find the problem
my code or the clock

thank you

PS: sorry for my bad English (google) :))
 

Attachments

  • simulateur_presence.bas
    5.2 KB · Views: 418
Please try in your code for conversion from bcd to dec the code like written below:

'convert RTC packed bcd to a bin number for inc/dec usage
'enter with temp1 holding the packed BCD byte
'exit with temp1 holding the decimal byte
bcd2dec:
units = temp1 Mod 16
tens = (temp1 / 16) * 10
temp1 = tens + units
Return

When this is working you have to modify the bin2bcd code too.

'convert the bin number to packed bcd for RTC write
'enter with temp1 holding the decimal byte
'exit with temp1 holding the packed BCD byte
dec2bcd:
tens = (temp1 / 10) * 16
units = temp1 Mod 10
temp1 = tens + units
Return


Note 1: maybe it's needed to mask the 7th bit, because it is unused or reserved for other functionality.

Note 2: Remember that the high nibble is used for the tens and the low nibble is used for the units.

Regards,
Reijnko
 
Last edited:
hello

thank you for the answer
I am currently holiday
I change my code on my return

thank you

PS: sorry for my bad English (google) :))
 
the pcf8563 needs a strage way to read out or to write, read manual (pdf) of the rtc.

you use directly this code: I2CRead sda, scl, rtcr, addr, sec but the chip first has to be set to slave you can do this by ad the following lines:

I2CStart
I2CSend 0xa2
--than your code ---
I2CRead sda, scl, rtcr, addr, sec

I got same problem by using this rtc and some wierd read out...
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top