Step 5: Advanced LCD and Button usage: The Big Clock
In the picture at the bottom you can see the time 7:26:07pm displayed in large numbers on the LCD screen. Each number is using a 2x2 grid of the characters display to show the large number. This utilizes a font originally written by Xtinus for the XBMC project.
The buttons are used to set the clock. Left increments the hours, Up increments the minutes, Right toggles between 12 and 24-hour time, and Enter resets the seconds to zero.
The clock doesn't keep very good time as we are using the very inaccurate internal oscillator, but this program can easily be altered to use a much more accurate external crystal. See this in action in the video below.
An explaination of how this code works is in order, but I don't have the time right now.
For now, connect the LCD header (J31) to PORTD (J4) and the button header (J30) to PORTB (J2). Make sure you have both SW1 and SW2 in the off position. Connect the AVR Dragon to a usb cable and plug the other end of that cable into your computer. Turn on SW2 and program the ATmega8 with the programming software of your choice (hex file below; fuses burnt to factory settings).
NOTE: In order to utilize the Left and Up buttons you will need to remove the shunts from J22 and J24, do this while the power is off.
Remove these ads by
Signing Up


























Not Nice


















Visit Our Store »
Go Pro Today »



