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.

Ds1307 based digital clock

Status
Not open for further replies.
With me the hour is working fine. The problem I am facing is that if you inc, min, year t 32+ and dec it it decrements 6 numbers. If you increment to 40+ and decrement it it decrements properly.

It is happening because of sec to hex conversion. i will fix it tomorrow. I have to find a way to fix it.
 

With me the hour is working fine. The problem I am facing is that if you inc, min, year t 32+ and dec it it decrements 6 numbers. If you increment to 40+ and decrement it it decrements properly.

It is happening because of sec to hex conversion. i will fix it tomorrow. I have to find a way to fix it.

ok try it and also check week day problem ,,, i am facing it,,
 

See the simulation. weekday is changing at 00:00:00 time. There is only one problem that I already mentioned. If you inc values of multiples of 16 +some value and then dec it it decrements a value of 6. I will fix it tomorrow.
 

Attachments

  • ds1307 sim.rar
    98.2 KB · Views: 103
Last edited:

See the simulation. weekday is changing at 00:00:00 time. There is only one problem that I already mentioned. If you inc values of multiples of 16 +some value and then dec it it decrements a value of 6. I will fix it tomorrow.

yes you are right, the only problem is with hour, it goes back to 10 after 15 in 2nd cycle,3rd cycle and so on......
 

Are you just incrementing hour or incrementing and decrementing? I don't see problem in any parameter in only incrementing. I will post a video.
Are you using mikroC pro 5.6.1 by P3rtic@n. See the mikroC about box. If it says Registered to P3rtic@n then it is creating wrong hex files.

--------------Update-----------------

Sorry, I thought that I have sent the code and you are compiling and checking it.
 

Attachments

  • rtc hour sim.rar
    21.8 KB · Views: 89
Last edited:

Are you just incrementing hour or incrementing and decrementing? I don't see problem in any parameter in only incrementing. I will post a video.
Are you using mikroC pro 5.6.1 by P3rtic@n. See the mikroC about box. If it says Registered to P3rtic@n then it is creating wrong hex files.

--------------Update-----------------

Sorry, I thought that I have sent the code and you are compiling and checking it.

its ok,,, by the way,, the problem is when either i increment or decrement hours
 

Did you see the simulation in my last post. hour is incrementing properly.
 

Did you see the simulation in my last post. hour is incrementing properly.

send the hex file again,,, i am facing the hour problem,,, send me new hex file,,, i am using the old one,,, it also has AM/PM but in your video there is no AM/PM
 

I have attached the file. I know that Transform_Time() is doing BCD to Decimal conversion. I have to do Decimal to BCD conversiom. I think it will work.
 

Attachments

  • PIC16F877A DS1307 RTC Hafiz Imran v11.rar
    19.2 KB · Views: 90

I have attached the file. I know that Transform_Time() is doing BCD to Decimal conversion. I have to do Decimal to BCD conversiom. I think it will work.

thanks *** and thank to you,, its ok now,, will you do it with alarm too???
 

If I solve the inc dec problem tomorrow, I will try to implement alarm. alarm needs to have another settings mode where you can set the alarm time. Do you want to use buzzer. I have to see how to drive a buzzer. I have never used a buzzer. Do you know how to drive a buzzer using mcu?
 

If I solve the inc dec problem tomorrow, I will try to implement alarm. alarm needs to have another settings mode where you can set the alarm time. Do you want to use buzzer. I have to see how to drive a buzzer. I have never used a buzzer. Do you know how to drive a buzzer using mcu?

sorry i also never used a buzzer
 

sorry i also never used a buzzer

Just drive the buzzer using a transistor:

3252726900_1353783861.png


Hope this helps.
Tahmid.
 

Shold we make the pin connected to Resistor R1 high or should we give any square wave for the buzzer?

- - - Updated - - -

@ hafizimran18

Check this simulation. I have completely changed the code for inc button. Just check inc button. Check if all parameters are cycling from min to max and again min to max properly. Do 2 or 3 rounds of inc and tell me if there is any problem. I got a formula for BCD2DEC and DEC2BCD, but I have to see how to implement it.


------------------Update-----------------

Check the second file. Check only dec function. Do 2 or 3 rounds of decrementing and tell me if there is any problem. I have added the buzzer circuit given by Tahmid. I still have to write the code for alarm. If inc dec problem gets solved today, then I will write the code for alarm tomorrow.

[COLOR="GREEN'] ---------------------Update----------------------------- [COLOR]

After that try to inc to values like 17, 33, 49, 65, 81, 97, 113, 129, 145 and then decrement 2 or 3 rounds and see if it is working fine. Actually I have change the whole inc and dec keys code.
 

Attachments

  • PIC16F877A DS1307 RTC Hafiz Imran v13.rar
    19.9 KB · Views: 74
  • PIC16F877A DS1307 RTC Hafiz Imran dec.rar
    19.7 KB · Views: 64
Last edited:

Shold we make the pin connected to Resistor R1 high or should we give any square wave for the buzzer?

- - - Updated - - -

@ hafizimran18

Check this simulation. I have completely changed the code for inc button. Just check inc button. Check if all parameters are cycling from min to max and again min to max properly. Do 2 or 3 rounds of inc and tell me if there is any problem. I got a formula for BCD2DEC and DEC2BCD, but I have to see how to implement it.


------------------Update-----------------

Check the second file. Check only dec function. Do 2 or 3 rounds of decrementing and tell me if there is any problem. I have added the buzzer circuit given by Tahmid. I still have to write the code for alarm. If inc dec problem gets solved today, then I will write the code for alarm tomorrow.

[COLOR="GREEN'] ---------------------Update----------------------------- [COLOR]

After that try to inc to values like 17, 33, 49, 65, 81, 97, 113, 129, 145 and then decrement 2 or 3 rounds and see if it is working fine. Actually I have change the whole inc and dec keys code.

in PIC16F877A DS1307 RTC Hafiz Imran v13 year increments well but when its decremented it suddenly drops to 2019 and don't decrement below it...
same problem is occuring in PIC16F877A DS1307 RTC Hafiz Imran dec

also , when month increments from 12 to 1 year does not increment in both codes
 

When in settings mode each parameter inc or dec independently. So incrementing month from 12 to 1 does not increment year in settings mode.

Check this file

------------------------Update--------------------

OK. There was a mistake in year dec. I had used = instead of ==. I have fixed it. Check the fixed file.
 

Attachments

  • PIC16F877A DS1307 RTC Hafiz Imran v14.rar
    20.5 KB · Views: 66
  • PIC16F877A DS1307 RTC Hafiz Imran fixed.rar
    20.5 KB · Views: 66
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top