1. 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.
    Dismiss Notice

How to set a alarm for my real tiime clock?

Discussion in 'Microcontrollers' started by IsaacChuah90, Oct 3, 2011.

  1. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    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.:)
     

    Attached Files:

    • alarm.c
      File size:
      15.3 KB
      Views:
      91
  2. Rusttree

    Rusttree Member

    Joined:
    May 28, 2006
    Messages:
    276
    Likes:
    2
    Location:
    Phoenix, AZ
    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: Oct 28, 2011
  3. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    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.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0

    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?
     
  6. Rusttree

    Rusttree Member

    Joined:
    May 28, 2006
    Messages:
    276
    Likes:
    2
    Location:
    Phoenix, AZ
    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: Nov 1, 2011
  7. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    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?
     
  8. Rusttree

    Rusttree Member

    Joined:
    May 28, 2006
    Messages:
    276
    Likes:
    2
    Location:
    Phoenix, AZ
  9. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    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: Nov 4, 2011
  10. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    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: Nov 12, 2011
  11. IsaacChuah90

    IsaacChuah90 New Member

    Joined:
    Oct 3, 2011
    Messages:
    66
    Likes:
    0
    Hey Russtree, thanks for the helps for my project. My project finally done. :)
     

    Attached Files:

    • 007.JPG
      007.JPG
      File size:
      2 MB
      Views:
      70

Share This Page