help needed with DS1302 and SPI

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Zkov79
Posts: 5
Joined: Wed May 14, 2008 12:17 pm
Has thanked: 2 times
Contact:

help needed with DS1302 and SPI

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: help needed with DS1302 and SPI

Post 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.

Zkov79
Posts: 5
Joined: Wed May 14, 2008 12:17 pm
Has thanked: 2 times
Contact:

Re: help needed with DS1302 and SPI

Post 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
Attachments
DS130_7.fcf
the attached file
(5.5 KiB) Downloaded 507 times

Post Reply