Hardware for this example:
- Atmel AVR ATmega16 @ 1MHz internal R/C (factory default)
- 32kHz Watch-Crystal connected to the ATmega's TOSC1/TOSC2 pins
- Text-Mode LCD-display. In the example a Displaytech 164A
(16*4) display has been used (KS0070B). For connection
with an Atmel STK500 see connect.txt.
- Two buttons (active-low) at PORTB pin 0 and 1 to set the clock
To adopt this code to own developments:
- Change XTAL in lcd.h, the delay-loop in rtcasync.c and
the timer1 setup in main.c for main frequency other than 1MHz.
- Change the key-#defines in main.c for other button-
assignments.
- Change lcd.h to reflect LCD-connection to AVR.
- The LCD line-to-DRAM-Addresses in lcd.h are set for
a Displaytech 164A display with a KS0070B controller.
These values may have to be changed for other controllers
to reflect the values given in the controller's datasheet.
(LCD_START_LINEx in lcd.h)
- Undefine "SPASS" in main.c to disable the startup-message.
- See the errata in the ATmega8 datasheet if you'd like
to use an ATmega8.
File list:
lcdclock
.......\bin
.......\...\main.hex
.......\connect.txt
.......\lcd.c
.......\lcd.h
.......\lcdbignum.c
.......\lcdbignum.h
.......\lcdclock.pnproj
.......\main.c
.......\makefile
.......\readme.txt
.......\rtcasync.c
.......\rtcasync.h