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.

set date and time with push buttons

Status
Not open for further replies.

hansel

Newbie level 1
Joined
Jun 2, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
i am creating a program using pic16f877A and now i am stuck at a point where i have to set date and time.how am i supposed to set date and time using push buttons and lcd? and how many push puttons do i require? How do i define variables? i have used timer0 for real time clock and 16X2 LCD .. help me with code in c language using push buttons to set hour, minute, second, day, month and year.
 

You have to save the information in the microcontroller in different variables and in EEPROM (for storage after power is removed). The push button events should alter the values of the registers as required. LCD is only used for display. How far have you coded so far? You should check some existing RTC projects and see what was done.
 

Check the circuit...
 

Attachments

  • clock.png
    clock.png
    245.8 KB · Views: 131
  • Like
Reactions: hansel

    hansel

    Points: 2
    Helpful Answer Positive Rating
please leave lcd pin 7 to 10 float.

Actually IMHO its a better practise to ground these pins. Also - NOT using the R/W pin means that your code cannot poll the busy bit to check for completion. But it can still be made to work.

3 buttons should give you all you need - with a little clever programming. Check https://www.edaboard.com/threads/265039/#post1136026 for a nice state-machine template.

1 for Set/Done control
1 for cyclic selecting through Yr/ Month/ Day/ Hour/ Min/ Sec
1 for incrementing the actual value

Saving data in EEPROM is worthwhile for an RTC only where Yr/Month/Date will most often default to the correct values (or close enough) & save the operator the extra keystrokes/ trouble. Maybe even saving Hrs could be worth it... why not.

If you are using an external clock-chip, then you just need to ensure it has battery back-up for power outages. But I see that you are NOT using that.

hope this helps
cheers!
 
  • Like
Reactions: hansel

    hansel

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top