Shop OBEX P1 Docs P2 Docs Learn Events
I need help with a LCD clock and text — Parallax Forums

I need help with a LCD clock and text

Dc20Dc20 Posts: 4
edited 2007-06-17 02:04 in BASIC Stamp
Hello, im new at this forum.

I have to create a LCD clock and a text down the clock with a Parallax LCD and BS2 microcontroller, if anyone knows what could be the program in general to create a clock, and how can i put the clock on the LCD!!. Please i need help its very important now, i have the hardest homework on my class.
Thanks

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-15 14:59
    Hello,

    I believe there is a Project in the Completed Projects Forum that uses the DS1302 and an LCD to create a clock. I would look there. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-15 15:10
    The general rule for any project like this is to split it up into pieces small enough so you can handle them and to use existing examples as much as possible. Carefully go through the examples for the LCD from the documentation and actually try them. Modify them to get the kind of time display you want ... you can use dummy values for the hours, minutes, and seconds (if you need that). That will become your "update the display" routine that you can also use for testing the rest of your program.

    Once that is working the way you want it, you can experiment with timing. A clock like what you want continually goes through a cycle where it waits for a known time (maybe 1/10 of a second), then increments a counter. When the counter reaches 1 second, it sets the counter back to zero and increments a byte value used to hold the seconds. When that reaches 60, the program resets that to zero and increments a byte value used to hold the minutes. When that reaches 60, the program resets that to zero and increments a byte value used to hold the hours. When that reaches 24, the program resets that to zero. The program then sends the time values to the display. If you want an AM/PM type display, you check for the hour being 12 or greater. If so, you subtract 12 and send that and a PM to the display. If not, you send the hour and an AM to the display. If the hour is zero, you actually send a 12 to the display.

    Note that the time it takes to do this checking and to send the data to the display takes some time by itself and you may have to adjust the next "wait" time to account for this. Think of this as part of your calibration process (checking your displayed time against a known standard).
  • Dc20Dc20 Posts: 4
    edited 2007-06-15 16:15
    OK, i attached this files to know what i have to change or add. This files are used for a 7 segments LED clock, but i want to change the information to show the clock on a LCD Screen (2x16) using the BS2 microcontroller. I'll be very grateful!.
    Thanks

    *Mike: im a novice, im doing this because its hard for me understanding microcontrollers, its the hardest subject that i have on the school, thanks for your advice.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-15 16:30
    Start with the documentation for the LCD. Like I said, get the samples to work. By sending specific characters to the display (given in the documentation), you can position the cursor to any LCD screen location. Try this. You want to get the characters "AB" to show on one part of the display and "CD" a few spaces to the right. Then get a colon ":" to go in between the "AB" and the "CD". Once you understand that, you can make a display routine to show "12:34:56 AM". Check out the PBasic manual in the section on the SEROUT statement. Look at what are called the "formatters". These provide ways to convert numeric values into characters for display. There's one "DEC2" that specifically converts a number into two digits. This is what you'll need for the parts of the clock display.

    Novices learn by doing. There's only so much you can learn by "understanding" without "doing". The worst that will happen is that your program won't work. If you start with an example from Parallax's documentation, you know you have something that worked. You make it work as well (by trying it), then modify it a bit at a time until you understand what you're using.
  • Dc20Dc20 Posts: 4
    edited 2007-06-15 17:10
    I've created special characters like squares, circles and other strange things, i put the characters, that is easy and move the cursor between the characters, i would like to show you the format of the clock that i have to do.
    __________
    |hh:mm PM|
    | Text |
    |_________|
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-15 20:14
    You've created the special characters and you've been able to display them on the display and move the cursor around, then you already know enough to be able to create the clock display. Try writing a program that does it. It should take byte variables perhaps called Hours, Minutes, and Seconds and display them in the format you need. Perhaps you could use the DEBUG and DEBUGIN statements to let you type the values into your program for now.

    Is the text fixed? Is that where you put some kind of status messages?
  • Dc20Dc20 Posts: 4
    edited 2007-06-17 02:04
    I have to put the text "Electronica" on the text field, its easy, but the hardest part is put the rtc on the display, i've been all the day, today and yesterday, trying to create the program, i tried every Var that you show on your post. Thanks.
Sign In or Register to comment.