Page 1 of 1

help needed with DS1302 and SPI

Posted: Fri Oct 31, 2008 8:12 am
by Zkov79
could anyone give me an example of running the DS1302 real time clock on SPI and printing the result on a LCD, im using the PIC16F877A, i've tried several things, but no luck. is there a simple way to do this with send char, recieve char. i've tried sending 0x81(command byte) to the chip after a chip-enable, and then trying to receive the data in a while-loop, then setting chip enabled low and then printing on LCD, but all im getting on the LCD is 255.. ive even tried to replace the DS1302, because i thought it could be the chip that had a fault, but still no luck.

any help would be appriciated..

best regards
Christian Skov

Re: help needed with DS1302 and SPI

Posted: Fri Oct 31, 2008 12:26 pm
by Benj
Hello

Few simple things you could check. Eg make sure that the SPI properties are correct, which clock edge is data written on, how fast should the bus be running etc.

Re: help needed with DS1302 and SPI

Posted: Mon Nov 10, 2008 12:39 pm
by Zkov79
hi Benj

thank you for your reply, and sorry about the delayed reply back.
I never got the ds1302 running, made some extra hardware and tried different software settings, but nothing worked.
So now i've bought a ds1307, because it used the I2C-protocol. but im still having some problems. ive attached the code, im just trying to read seconds from ds1307 and display it on lcd. maby you could give me a hint as to where the problem is.

as allways any help would be appreciated

Christian