8051 DS1302 RTC Interfacing in C

Thread Starter

saugat

Joined Dec 14, 2015
1
Hi, I am trying to interface ds1302 RTC to 8051 microcontroller. I've successfully coded my AT89S51 microcontroller that interface with DS1302 rtc and it runs great in proteus. The main problem occur in real hardware. I don't know what happens may be i cannot write values to all registers of RTC or I cannot read value correctly in hardware. Software simulation in proteus works great. My output format in lcd is :
hh:mm:ss
day, dd-mm-yy
When I run my project on real hardware i get following output:
12:??:23
SAT, ??-06-20??

After certain time even second counting also stops. And the output becomes:
12:12:??
SAT, ??-06:20??
On my 16x2 character LCD
It is not displaying Minutes,Day and Year.
I've attached demo video for proteus simulation, and zipped file(contains proteus design file and C program). I've been stuck about a month followed several online suggestions posted for others but cannot get any solution. I've not posted any question except this forum.
Please some one help.. I am loosing my hope to get in the field of embedded system..
 

Attachments

MrChips

Joined Oct 2, 2009
30,712
Embedding system design requires a significant combination of knowledge, experience, patience and perseverance.

You need to separate your issues so that you are not barking up the wrong tree.
Here are some possible issues to resolve:

1. Hardware interface to DS1302
2. Reliable communication with all DS1302 registers
3. Reliable communication with LCD.
4. Correct interpretation of DS1302 data.

I would begin with the LCD communication. Make certain that you can display information on the LCD without error.

The next step would be to display the raw binary data from a useful RTC register.
Make sure you can interpret the data correctly.
Then you can move on to reformatting the data to show your desired format.

In a nut shell, the bottom line is "Test, Test and Test again".
 
Top