Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to set the real time in RTC with Assembly code (ds1307)

Status
Not open for further replies.
Re: RTC ds1307

hi...

good news , i have tested the program using your suggestion... the 5us delay works... thank you... next i will try to proceed using LCD to display minutes,hours, date and year, but how to chnge bcd data from rtc to hexa and ASCII??? if there's problem i will say to you.. thnk you..

RGDS jandreas
 

Re: RTC ds1307

Hi,
You simply add 30 hex to each BCD nibble to get ASCII.
Regards,
Laktronics
 

Re: RTC ds1307

hi...

lacktronis i confuse to set the hours reg...can you give some explanation?? maybe you can give some example by assembly code, like if i want to set 21:00 and 09:00...
thank you..

rgds jandreas
 

Re: RTC ds1307

Hi,
It is easy as follows:

In 12 hour mode to set 9 PM, load register 02 with 0X 69 . This will set D6 bit hi (12 hour mode) and D5 bit hi (PM) and Do to D3 will give number 9. In this mode:

- to set 10 PM , you load reg.2 with 0X 70 (D4=1 for hour ten) and
- to set 12 PM, load reg.2 with 0X 72 and so on. Similarly,
- to set 9 AM , you load reg 2 with 0X 49
- to set 10 AM , load 0X 50
- to set 12 AM, load 0X 52

In 24 hour mode to load 21 hours, reg.2 is to be loaded with 0X 21 (Bit D6 = 0 and D5 = 1 for hour 2 in BCD)
- to set 10 hours in 24 hr mode load 0X 10
- to set 9 hours in 24 hour mode load 0X 09
- to set 12 hours in 24 hour mode load 0X 12
- to set 23 hours in 24 hour mode load 0X 23 and so on.

Minutes and Seconds registers do not change with mode change.
I hope it is clear now.

Regards,
Laktronics
 

Re: RTC ds1307

hi

i got it.. thanks alot..

RGDS jandreas
 

Re: RTC ds1307

HI....

i want to ask .. can i use both RTC ds1307 and 24c02 in same pins???? thank you

RGDS jandreas
 

Re: RTC ds1307

Hi,
We have already discussed this point and concluded that so long as the device addresses (D0 and A0 ?) are different, they can work from the same pins.

Regards,
Laktronics
 

Re: RTC ds1307

hi..

ooo sory i'ts true we have discussed this before...

rgds jandreas...
 

Re: RTC ds1307

hi..

i got a problem with the rtc.. i have programmed it and it works fine 'till i released the power of rtc...after that i connected the power again, and tried to get the data back, but it was error... i already gave the rtc backup supply, according to the data sheet , it supposed to be fine and still counting when i don't give the rtc power right??? so what suppose i do????thank you

RGDS jandreas
 

Re: RTC ds1307

Hi,
Yes, RTC is supposed to be running on back up battery. Check the battery voltage when power is off and ensure it is within the recommended range. Vcc should be above 1.25 times the battery voltage for the circuit to recognise the presence of power. Also it is mentioned in the data sheet not to put any series diode with battery. If all these are taken care of, I do not find any reason for it to not to work.

Regards,
Laktronics
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top