Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to set a alarm for my real tiime clock?

Status
Not open for further replies.
Rusttree,I got what you mean.This is the latest code.I think it is right.If I got any wrong please correct me.Thanks.:)
 

Attachments

  • alarm.c
    15.3 KB · Views: 161
Looks like that should work. How does it do when you test it?

By the way, work on properly indenting your code. It's very difficult to read when you've got the text spaced out so much. Look at the rest of the code as a model for properly using whitespace.
 
Last edited:
Rusttree, I have reduced the whitespace of my code.
I have tried to test it just now, but seem like my rtc chip got some problem because the "hours" part shown in LCD is keep running itself. It's keep looping from 01 to 24 non-stop.
I think the rtc chip is broken, so I plan to replace it with a new one and only start to test it again.
 
Rusttree,these few days keep dealing with my clock.I change the rtc chip already,but the "hours" shown in LCD keep running itself.It changes from 01 to 00(24) and keep repeating and non-stop.Do you know how to troubleshoot it?Is it related to the PIC?
 
Three things:
1. Revert back to the original code before you added the alarm. That will rule out whether it was any changes you've made recently.
2. I don't see capacitors on the legs of the crystal on your RTC. I suspect you may need them.
3. I also don't see decoupling caps near the power pins on either of the ICs.
 
Last edited:
Is it crystal needed for RTC? The crystal for RTC is 34.768kHz. Previously I have run it properly without putting any capacitors on the legs of the crystal on RTC.
Besides, can I know what you mean for the third option? You mean the capacitors for the PIC?
 
According to the datasheet, there is no need to add capacitors on the crystal. The internal oscillator circuitry is designed for operation with a crystal having a specified load capacitance (CL) of 12.5pF.
 
Last edited:
Hey Rusttree, sorry for didn't update my post recently because I'm busying with my assignment and test.Now I'm continue to troubleshoot my board,I have put the original code without modified into the PIC but the LCD still show 00:00:00 at first line and second line,it didn't run at all at first.

Thee is 2 LED in my board which are RED and GREEN, once I have turned on the power,the red LED will light up,it means the whole the time is running. The other one is green LED, it means it is in the set mode. When I press the switch mode button in order to adjust the time and date, the green LED will light up,so that I know it is in the set mode.

But I found that the board will auto change to set mode because at first the GREEN led will light up, after a couple second the RED led is light up, it means the clock is auto change to set mode. Can I know how to solve it?

I really don't understand why like that after I have replaced a new RTC and crystal.Previously when I put the original code on it,the clock can run well.After I have adjusted and rearrange the arrangement of my components,the clock becomes like this.

Would you mind to help me?Thank you.:)
 
Last edited:
Hey Russtree, thanks for the helps for my project. My project finally done. :)
 

Attachments

  • 007.JPG
    007.JPG
    2 MB · Views: 140
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top