Basic Level     Skills: Not specified    
Author
Author email
bhargav.ajay@gmail.com
Author website
www.rickeyworld.info

Description



DS1307 is a hardware realtime clock, which works on I2C protocol. Better graphics using the same old fashioned alphanumeric LCD (type HD44780). Icons which shows the status for Alarm ON/OFF state, which gives a nice and cute look to the clock.

There are four switches connected to the uC, as shown in the figure. Function of the keys are same as clear from their names.

When the power supply is switched on it will give you the default date and time, but later you can change it to the desired value. After setting once, the backup battery will keep the clock ticking even after the power is not there.

A little about I2C:
There are basically four main conditions in I2C protocol.
1) Start Condition
2)Stop Condition
3)Data Validity
4)Acknowledgement

1)Start Condition:
when SCL is high and SDA H->L, will be taken as start condition for the communication.
2)Stop Condition:
when SCL is high and SDA L->H, will generate a stop condition.
3)Data Validity:
When SCL is high there should be no chande in SDA line only then the data is valid, the data change should be made only when SCL is low.
4)Acknowledgement:

After sending of one byte of data the reciever has to acknowledge the sender for the successful reception. for this the sender make the SDA line high and reciever pulls down the SDA low, which tells the sender that data has reached safely.

Now the source code written in assembly, basically implements the I2C protocol. the assembly source written for Keil download here clock.asm and the direct hex file for programming the controller from here clock.hex. The schematic for the Digital clock is available in PDF format can be downloaded from here clock.pdf.

Project code has been revised and updated. Bug fixes regarding corrupt display.

History:
First Upload date:
08/05/2006
  Filesize

  Downloads

81837

  Rating
 

Comments

bogdan
23 May 2006: 16:36 PM
Hello Rickey. Can you put also the scheme in this archive?
  
ajay
26 May 2006: 02:27 AM
yes i've uploaded that orcad schematic in a new archive. please check!
  
Anonymous
05 Jun 2006: 21:24 PM
hey men

i check the asm file with the A51 assembler and it have 50 errors

are you sure its ok?
  
saiswathip@yahoo.com
25 Jul 2006: 08:31 AM
sir we need a free download of digital clock using ds1307 interfaced with 89c51.u have givn ur sight in which we r unable to download as it is not free.we need a free download.

thanx for responding to my mail...

thank u..
  
swathi
26 Jul 2006: 01:25 AM
i have a 1x16 lcd
  
Ajay
26 Jul 2006: 04:21 AM
well this is for 2x16 if u want it in one line.. then many changes have to be made please understand the code and make the changes...
  
Ajay
26 Jul 2006: 04:24 AM
yes its 100% correct and its compatible with "A51 Macro Assembler" not just A51. and Macro assembler comes under Keil. please download the software from www.keil.com
  
abhisek
14 Nov 2006: 06:58 AM
Hello ricky,
I have tried your c programng for digital clock using ds1307, but it is not working. It canot read from RTC and also canot write. I am using keil c compiler. please help!
  
ajay_bhargav
14 Nov 2006: 07:19 AM
Everything is fine in the program.
how you are checking the reading and writing?
i hope you have downloaded the new files.
and please post the problems in the forum.
  
viper_k3
21 Feb 2007: 08:31 AM
hi
the program has 595 errors with a51
  
ajay_bhargav
21 Feb 2007: 11:28 AM
Please read the previous comments. The program is compatible with A51 Macro Assembler which comes with keil sofware. not simple A51 assembler.

Please post your problems in the forum
  
tellarun
28 May 2007: 09:12 AM
Dear Sir, I facing a few problems with this project.
Some times i don't get any display in the lcd & it hangs off.
After getting the display Digital Clock.... I get some junk displayed over the day and seconds. The alarm triggers of few minutes in advance. Have i gone wrong any where... I flashed the uC with the hex file i didn't do any kind of reassembling.... Pl. Help & do mail me if there are any updates for this project. my email ID: tellarun@yahoo.com
  
sa3eeeed
21 Jul 2007: 13:05 PM
thnx man
  
Anonymous
22 Oct 2007: 20:11 PM
do you have picbasic code for this alarm clock?plz email me if u have...thanks
email:fhcaine@yahoo.com
  
zeus
20 Dec 2007: 02:45 AM
hello sir ,
we are prepareing a digital clock using 89c51 along with dallas 1307 having LED display.
we are facing problem related to alram seeting.we need your help
  
ajay_bhargav
20 Dec 2007: 03:07 AM
Zeus, Please make use of forum. Will surely help you out.
  
tanveer
27 Dec 2007: 10:42 AM
Hello sir,
I want to do this project for my final year ,i think this is a good project . I need pcb design for this project. Can u help me for making pcb ?
  
tanveer
15 Jan 2008: 00:55 AM
I made this project but it is not working properly.First it shows "digital clock" next it ask for time and alarm set. the time will not run and all numbers are distorted... plz help me. mail me at tannumohd@gmail.com.
  
ajay_bhargav
15 Jan 2008: 04:52 AM
tanveer please make use of forum and if possible provide a screenshot.. to know the problem better.. one recommendation is. check for any loose joint or connection.
  
kanth
23 Jan 2008: 06:05 AM
i have da pcb diagram
  
tanveer
26 Jan 2008: 12:53 PM
can u mail me that pcb design to tannumohd@gmail.com
  
ajay_bhargav
26 Jan 2008: 13:32 PM
Share the design with us please.. we will add your contribution in download section.
  
Ajeesh V R
06 Feb 2008: 05:53 AM
Dear Ajay,
we are assembeled the ciruit,and used hex file provided in the net,but we didnt get any clock display.We are getting some dark dislay in one line alone.Also we found that hex file size is around 10kB ,which controller we have to use?

please suggest us....
  
ajay_bhargav
06 Feb 2008: 13:16 PM
check your circuit carefully, and use forum.
  
tanveer
18 Feb 2008: 08:05 AM
Dear ajay,
this project is not working properly,the clock is not running. some other deploma & engg college students did this project but for them also it is Failure project. i want to contact with u, can u give your mob no.....I have only one month to complete the project. so plz help me..
  
Ajeesh V R
19 Feb 2008: 03:59 AM
Dear Sir,
Project hardware is checked properly,and when we switch on it shows "digital clock"on the diaplay and also accepts alarm settings,time settings clearly.after this once it starts running in clock mode many characters are distorting ,the same problem is observed by Thanveer also.Could you please help me to overcome this problem?

  
abhishek_h
21 Feb 2008: 02:36 AM
Ajay,
I have assembled the LCD and 1307 on a bread board and connected to AT89S52 board via FRC cable.Initially all the digits looks like blocks, but even after setting the values, the same display returns. sometimes the seconds start counting but again it resets in few seconds. I believe the problem is in communicating with the RTC. but i am not able to figue out exactly what is causing it. i have checked the connections.
  
neil shah
20 Mar 2008: 03:01 AM
hiii ajay,,,, thanks for giving such a good facility....
i just need ur help that the program u have given which is not working on simple A51 assembler... it givees 402 errors... i reduced almost to 382....but still its tough...so can u plz give me a link by which i can download A51 macro assemler ?
thanks for the project...
  
ajay_bhargav
20 Mar 2008: 16:55 PM
please use forum for getting help.
code does not have any errors in it. will explain you once you post in forum
  
oma
18 Jun 2008: 07:29 AM
I want to convert this project to display in the 16X64 matrix LED. What changes should I make in the circuit and the C program files? Please help.
  
Najib
30 Jun 2008: 12:47 PM
Sir, Is it possible to set 4 or more alarms in just 24 hours? can you give me some ASSEMBLY language reference? please.... Especially on how to program the AT8series or 8051 Microcontrollers...please do reply..THank you..
  
lawalite
04 Jul 2008: 20:40 PM
needs hex code for 2nd & 3rd line of sanyo lcd 4x16
  
Jeetu Das
14 Oct 2008: 03:30 AM
hello ajay ru there, i want to ask you a think relating to your design of rtc clock using 8051 and ds1307 , i am facing a problem the characters are garbled i have tried replacing lcd ds ic and 8051, crystals, etc, can you pls tell me where i am wrong?
  
Amit9988
15 Oct 2008: 07:38 AM
Sir give some Keil code(C code) for DS1307 interfaceing with AT89C51 Microcontroller. Thank You.......
  
Jeetu Das
17 Oct 2008: 02:48 AM
I found out where did i made the mistake regarding garbled or junk display, i was not using network resistor for the pull up resistor, was using ordinary res. I check some other's pcb design and solved the problem. And please use a good quality DS1307 IC
  
Anonymous
17 Oct 2008: 04:33 AM
can we get a code in assembly language for this? rather than in .hex format?
  
mehdijamshidi79@yahoo.com
03 Nov 2008: 06:03 AM
hello ajay ru there, i want to ask you a think relating to your design of rtc clock using IC AT89C20518051 +help+picture
sir we need a free download of digital clock+program assembly to 8051
sender IRAN
  
Anonymous
11 Jan 2009: 00:25 AM
can you please send the design of digital clock to me at mailmesant@in.com
  
Anonymous
20 Jan 2009: 22:55 PM
sir iam from sikkim,its not uplading what is the problem its verry important for me .please give a reason
  
Rasel
15 Feb 2009: 07:47 AM
RA
  
ajay_bhargav
16 Feb 2009: 10:24 AM
PLEASE USE FORUM IF YOU HAVE A DOUBT!
  
Zai.apex
02 Mar 2009: 10:33 AM
if i want multiple alarm times what changes are required in coding. .... URGENT!!!
  
Zai.apex
03 Mar 2009: 06:32 AM
Sir, I need help ... What if i want multiple alarm times???
Please reply soon.
  
Anonymous
15 Mar 2009: 09:21 AM
can i ask panu poh mgconnect sa computer ng hardware ntin...
we made ng digital clock in pcb tpos my programming kami..kso di sya nagcconect....

anu poh kaya yun pin configuration ng printer port to hard ware nmin..
please help me..!!
  
!!!
14 Apr 2009: 09:12 AM
sir, we used your code and we get only the default display in the LCD... The hex code seems to be 9K in capacity and our IC can hold only 4K... What do we do about this?
  
tuppakarthik
22 Jul 2009: 05:17 AM
where can i find the program in C??? and when i used ur assembly program it is showing two different time formats switching each second. I am using a 89c51/lcd/232/rtc/I2c kit (NSK electronics), how shall i modify the program for this kit???
  
uq1bnk@gmail.com
23 Aug 2009: 12:05 PM
sir,i need the ckt and c code(for keil compiler)for digital alarm clock.So plz help me.
  
manojramnani
29 Sep 2009: 01:47 AM
I made this project but it is not working properly.First it shows "digital clock" next it ask for time and alarm set. the time will not run and all numbers are distorted... plz help me. mail me at manojramnani88@gmail.com
  
amtahir786@yahoo.com
02 Oct 2009: 02:17 AM
good site for education
Thanks
  
praful1k@rediffmail.com
01 Nov 2009: 22:33 PM
sir,I'm contacting u for 100% correct code in C for Keil because I'm hobieast not from electronis engg. i done my Auto. Engg. so I understand only C code. Please Sir or sombody help me to out this......................Thanx...
  
abid_khan1101@yahoo.com
15 Dec 2009: 13:43 PM
please sombody help 2 snd the code for digital clock in c++......
  
abid_khan1101@yahoo.com
15 Dec 2009: 14:31 PM
sir i also need for 100% correct code in C for Keil. Please Sir or sombody help me to out this......................Thanx.
  
ajay_bhargav
16 Dec 2009: 14:54 PM
the code is correct
  
karan2280
24 Jan 2010: 01:35 AM
Ajay Sir,

I have made this clock and it is working ... How I want to convert or create a LED based clock.
I have 7 segment using 5 mm LED, each line of segment has five LEDs.
Please help me to connect this with atmel 2051 and DS1307.
Power supply : 7805 (for Motherboard) 7812 (for LED segment)
Please help.

Thanks,
Karan
  
Anonymous
19 Mar 2010: 02:08 AM
hello sir,
can u send me the PCB design file for DS1307 RTC.

Regards,
Rajashekharreddy.M
rajashekharreddy_m@yahoo.com
  
ajay_bhargav
22 Mar 2010: 08:00 AM
use forum please.
  
rex24
28 Mar 2010: 06:13 AM
sir i want the source code for alarm clock in 8051.. can you help me with this pleaseeeee
  
emirico
29 Mar 2010: 18:45 PM
sir,where i can get a5a1 macro assembler?
  
preetijoli
01 Apr 2010: 05:50 AM
few doubts in understanding the code. plz help

1. can macro and endm be used in keil microvision?
2. in run1 label r6 is initialised 3fh, that means acall receive (in here label)operation takes place 63 times, why?
3. what exactly is rtc initialisation, means with what time the clock starts? we do 11 initialisations, sendin content of r0 ,and r1. r0 has sec to amin, but what is r1 for?

please clear the above doubts. thanks.
  
Herel
20 Apr 2010: 23:09 PM
Hi there,

do you have done the similar project but using motorola 68000 microprocessor?

thanks in advance.
  
blinkychan
21 Apr 2010: 09:02 AM
anyone knows pinout of lcd (J2)?
  
ajay_bhargav
22 Apr 2010: 05:08 AM
see LCD tutorial in tutorial section:
http://www.8051projects.net/microcontroller-tutorials/
  
blinkychan
08 May 2010: 08:56 AM
hex file has size of 9282b, but c51 mcu has only 4k flash. Why?
  
ajay_bhargav
11 May 2010: 09:46 AM
thats the size of hex file not the code. use it without any fear.
  
digital_electronics@rediffmail.com
27 Jun 2010: 05:23 AM
dear sir, we want to make a digital clock with using ds 1307 and 89c51.
we are working with "umps" assembly language. we want to display on seven sigment.
pl. help.
  
thank
21 Jul 2010: 08:05 AM
thank you! i am vietnammes
  
chitresh
24 Jul 2010: 08:20 AM
sir plz mail me all the codes and circuit on my mail chitreshb@gmail.com
  
I need your help.
10 Sep 2010: 05:32 AM
I'm doing my final year in Electronic and my Project is Biomedical Monitoring System.
My email is :alfred20fr@yahoo.fr
How can i join this website.
Thank you so much!
  
ashlesha1234@gmail.com
13 Sep 2010: 03:55 AM
sir, we want to make a digital clock with using 8051 microcontroller.
we are working with assembly language. Plz forward assembly code with opcode as early as possible....its urgnt.
  
ajay_bhargav
13 Sep 2010: 15:54 PM
download the zip file everything is included.
  
verma Tushar
20 Sep 2010: 11:22 AM
i need programming of digital clock with alarm
  
ajay_bhargav
20 Sep 2010: 15:30 PM
just download the hex file.
  
Anonymous
20 Sep 2010: 21:20 PM
hello mr.ajay..i need some help designing digital clock(using graphic
lcd,pushbutton)
-display time
-set time

can u help me using keil uvission2 (c programming)
  
Sangeetha
07 Oct 2010: 23:43 PM
hello sir, i need the source cobe in c for this program
  
ajay_bhargav
09 Oct 2010: 05:28 AM
code is available in C check in download section.
  
Anonymous
14 Oct 2010: 15:52 PM
where is proteous file ??? i wana chk this on proteous
  
reddi.srinivas100@gmail.com
28 Nov 2010: 05:07 AM
sir i want the assembly language software for multiplexing seven segment digital clock by using transistors......please help me sir......
  
ajay_bhargav
30 Nov 2010: 06:44 AM
Please use forum.
  
Semi
19 Sep 2011: 23:40 PM
can u email me coding 8051..not a macro
  
hasna
19 Oct 2011: 04:33 AM
good idea

I want to edit the asm file but after I try it in compiled using the results asem.exe error

how to edit asm?


hold macro
@@ illegal statement syntax @@

24: 0000 00 nop
25: 0001 00 nop
26: 0002 00 nop
27: 0003 00 nop
28: endm
^
@@@@@ illegal statement syntax @@@@@

29:
30: disp_str macro string ;Macro for sending string to LCD
^
@@@@@ illegal statement syntax @@@@@

31: irpc char, <string>
^
@@@@@ illegal statement syntax @@@@@


ASEM-51 V1.2 Copyright (c) 1996 by W.W. Heinz PAGE 2



Line I Addr Code Source

32: if nul 'char'
^
@@@@@ binary operator expected @@@@@

33: exitm
^
@@@@@ illegal statement syntax @@@@@

34: endif
^
@@@@@ must be preceded by IF @@@@@

35: 0004 74 00 mov a,#'char'
^
@@@@@ constant out of range @@@@@

36: 0006 12 02 C2 lcall data_in
37: endm
^
@@@@@ illegal statement syntax @@@@@

38:
39:
40: build_char macro P1,P2,P3,P4,P5,P6,P7,P8 ;Macro for building a custom character
^
@@@@@ illegal statement syntax @@@@@

41: irp arg, <P1,P2,P3,P4,P5,P6,P7,P8>
^
@@@@@ illegal statement syntax @@@@@

42: 0009 74 00 mov a,#arg
  
vkmanojhvf@yahoo.com
30 Oct 2011: 01:13 AM
hello ajay I Assembled your project and burned your program in 89s51 instud of 89c51 but the clock is not working. not working means all the display and settings are coming but second not changing it always at zero, can you sujest any remedy for this problam
  
jaseer
08 Jan 2012: 03:05 AM
hello i want some details about
1) interfacing 89s8252 with ds1307,keypad&7segment display.
2)how the volume can be increased?
simply working details?
can u plz help me sir??????//
  
gurdyal singh
12 Jan 2012: 05:53 AM
hello clock
  
kalavathy
22 Feb 2012: 10:11 AM
sir can you send me the pcb design of this project
  
vinod.badola
14 Mar 2012: 14:20 PM
[blocked by admin]
  
datsmesaurabh@gmail.com
26 Mar 2012: 13:36 PM
[blocked by admin]
  
Anonymous
28 Mar 2012: 09:24 AM
this is a awesome project of shit,not at all working
  
Anonymous
14 Jun 2012: 15:17 PM
100% working with all functions i build it for our it fair
  
ajay_bhargav
15 Jun 2012: 14:46 PM
please use keil to assemble it. A51 is keil's assembler
  
Genovator
17 Jul 2012: 11:28 AM
I found no C code in the zip.... Where is it????
  
C.AYYASWAMY
21 Oct 2012: 03:54 AM
I want GLCD+at89S52 USING DIGI CLOCK CIRCUITS AND CODE
  
Anonymous
26 Nov 2012: 08:49 AM
can u pls mske this by 7 segment
  
tomy
06 Apr 2013: 12:08 PM
sir,
orcad file is not loadable in proteus(isis7).. suggest a solution please...
  
ajay_bhargav
10 Apr 2013: 05:48 AM
You can create ISIS project from scrach matching schematic given and then simulate it.
  
Anonymous
10 Apr 2013: 13:28 PM
could you please upload the proteus simulation
  
liva david
22 Apr 2013: 12:00 PM
please upload the proteus stimulation
  
tomy
22 Apr 2013: 12:24 PM
sir,
i create isis project,simulate it,, but after we set the alarm it suudenly display"alarm off" and clocks 1seconds count after 4seconds(in real world clock), what can i do?? please upload proteus simulation
  
tomy
22 Apr 2013: 12:30 PM
i created proteus simulation, but it has 2 problems, 1.after we set alarm it suddenly displays as" alarm off",2. clocks 1 seconds have duration of 4sec in real world clock
  
ajay_bhargav
23 Apr 2013: 08:53 AM
something else is wrong.. I suggest you to use forum and get help
  
tomy
23 Apr 2013: 11:10 AM
sir,
there is no other problems. the onlt 2 problms it has is same as above..
  
liva david
23 Apr 2013: 11:16 AM
i got the proteus version from forum, but it has 2 errors
1.after i set the alarm it suudenly display"alarm off"
2.clocks 1seconds count after 4seconds real world clock
sujest a solution and whether it is problem of hex file or circuit diagram
  
lalaprathap
23 Apr 2013: 11:43 AM
the hex file that i downloaded has a file size of 10kb... at89c51 can load a file max to 4 kb... what can i do??
  
ajay_bhargav
25 Apr 2013: 01:02 AM
thats the size of hex file not actual code. code is welll under 4K dont worry just flash it.
  
ajay_bhargav
25 Apr 2013: 01:05 AM
Please use forum, I will be happy to help you and tomy both. As you both are facing similar problem.
  
emzeetronic
03 May 2013: 22:48 PM
i can,t snooze or reset the alarm. when alarm is active. how i solve the problem????
thanks for share.
  
ajay_bhargav
04 May 2013: 03:28 AM
There is no snooze option. But you can stop alarm.
  
Ali Azam
10 Jun 2013: 07:58 AM
Hi, in this circuit clock delay time is more than one sec. As a result it lags behind. How to resolv this
  
micah
02 Sep 2013: 09:10 AM
after many many search at google i found this thread..:)..how to flash the code?using keil?
  
ajay_bhargav
03 Sep 2013: 06:10 AM
use a programmer hardware. or use a ISP programmable controller like P89V51RD2 or AT89S52 etc. Use forum for more help.
  
Pisces45
08 Oct 2013: 02:59 AM
as soon i set the alarm it says "alarm off". and the alarm doesnot go. how to solve this?? i m just uploading he hex file to my isis.
  
ajay_bhargav
08 Oct 2013: 08:23 AM
@Pisces45, might be interrupt issue. Can you post in forum?
  
(Required; Min length 5)
(Required; will not be displayed)

Downloads

Comments

nnannos
Fri Apr 18 2014, 01:23 PM
venkyrsv
Fri Apr 18 2014, 12:10 PM
Suilied
Fri Apr 18 2014, 10:44 AM
RaviKantSharma
Fri Apr 18 2014, 04:55 AM
sohil99
Fri Apr 18 2014, 03:09 AM
kanakiyajay
Fri Apr 18 2014, 02:00 AM
bradstormer
Thu Apr 17 2014, 05:32 PM
jasmeet_singh
Thu Apr 17 2014, 10:19 AM

Conversation

ExperimenterUK
Thu Apr 17 2014, 01:23 PM
@mba Great .. please do.
Thu Apr 17 2014, 12:27 AM
mba'
like the forum and wish to participate
ExperimenterUK
Wed Apr 16 2014, 04:45 PM
@viniciusheidrun..you should read my comment just before your post
viniciusheidrun
Wed Apr 16 2014, 01:43 PM
I'm doing a drive system with SIM900D modem and microcontroller AT89S52 via sms. I'm having trouble can not generate the. Hex to send to the microcontroller, whenever I compile the error, I'm using MCU 8051 IDE, what should I do so that my system receive sms and perform my task?
ExperimenterUK
Mon Apr 14 2014, 01:00 PM
@Haranadh,bipin chandra etc. Create threads for your questions.
Sun Apr 13 2014, 04:05 AM
Haranadh
we bought HC 06 Bluetooth modem instead of Module ,Can any one help me of using it as bluetooth module since i am doing this project?
Sun Apr 13 2014, 03:58 AM
Haranadh
Hi,Actually we bought Bluetooth modem instead of Bluetooth Module
ajay_bhargav
Sat Apr 12 2014, 02:55 PM
Please use forum if you want to ask a question.
Sat Apr 12 2014, 01:06 PM
Dpk
Hi Ahana,I can Help you on this
Sat Apr 12 2014, 03:51 AM
bipin chandra
can anybody help me. we are making a project to control the position of dc motor. so there we need to interface lcd screen and the 4X3 memberane keypad and a dc motor driver chip. can anybody please give me the complete circuit diagram connection of these components with the 8051.and alse help in the programming. my email id is bipin.chandra666@gmail.com
  Choose Skin