Today I'd like to present my program for a digital clock. The clock uses a cheap LCD display with 4 lines of 20 characters each. An ATmega328p, an ATmega2560, or an AVR128DA28 can be used as the microcontroller. I used the corresponding Arduino boards for program development.
The program uses block graphics. Some readers may remember this technique from the days of the first home computers. Due to their limited processing power, graphics capabilities were very restricted back then. Therefore, home computers included characters in their character sets that allowed users to create graphics on the screen (i.e., the television). These characters made it possible to create attractive borders around text, as well as simple graphics for games.
The LC display 2004 contains eight registers for user-defined characters. Together with two characters from the regular character set (254 and 255), these ten characters are sufficient to generate six attractive digits and two separators, which are displayed across the entire screen. This allows the clock to be easily read even from a distance.
Because this project is only a study, the CPU clock speed is used as a time reference. A timer is set to generate interrupts at 10ms intervals. This frequency is then divided down to 1Hz to increment the displayed time in one-second intervals. The CPU clock speed, of course, does not meet the accuracy requirements of a functioning clock. Therefore, if this clock is used in a real-world application, a better time reference (e.g., a TCXO) must be used.
I only have an ATmega328pb and not an ATmega328p in my parts bin. Therefore, I tested the program with an ATmega328pb and not an ATmega328p. I specified the ATmega328p as the chip because the compiler worked with that chip. I've since managed to fix this error (more details in another post). Therefore, I've updated the file again (see attachment). However, I have no way to test the program with an ATmega328p, but it will most likely work as well. Perhaps someone who owns an ATmega328p could test it and report back here bevore Evan put this in the demonstration Git/Repository. Thanks.
First of all:
You've written a very nice website about it. Thank you!
Explaination of port usage:
Port usage is flawless and certainly very helpful.
Do you mean I should add it to the GCB file, or do you want to add it to the demonstration Git/Repository web side? I think both options are fine.
Ralf
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Most interestng. I also compiled using AVRASM2 ( as a validation ). Compiled very nicely. :-)
This means the ASM generated is 100% valid. I have attached the LST file for your review.
Hi,
Today I'd like to present my program for a digital clock. The clock uses a cheap LCD display with 4 lines of 20 characters each. An ATmega328p, an ATmega2560, or an AVR128DA28 can be used as the microcontroller. I used the corresponding Arduino boards for program development.
The program uses block graphics. Some readers may remember this technique from the days of the first home computers. Due to their limited processing power, graphics capabilities were very restricted back then. Therefore, home computers included characters in their character sets that allowed users to create graphics on the screen (i.e., the television). These characters made it possible to create attractive borders around text, as well as simple graphics for games.
The LC display 2004 contains eight registers for user-defined characters. Together with two characters from the regular character set (254 and 255), these ten characters are sufficient to generate six attractive digits and two separators, which are displayed across the entire screen. This allows the clock to be easily read even from a distance.
Because this project is only a study, the CPU clock speed is used as a time reference. A timer is set to generate interrupts at 10ms intervals. This frequency is then divided down to 1Hz to increment the displayed time in one-second intervals. The CPU clock speed, of course, does not meet the accuracy requirements of a functioning clock. Therefore, if this clock is used in a real-world application, a better time reference (e.g., a TCXO) must be used.
Ralf
Very nice. I like the configuration for many chips. Very clever.
May I put this in the demonstration Git/Repository? This has some clever techniques.
Evan
Very Cool!
Hi,
I only have an ATmega328pb and not an ATmega328p in my parts bin. Therefore, I tested the program with an ATmega328pb and not an ATmega328p. I specified the ATmega328p as the chip because the compiler worked with that chip. I've since managed to fix this error (more details in another post). Therefore, I've updated the file again (see attachment). However, I have no way to test the program with an ATmega328p, but it will most likely work as well. Perhaps someone who owns an ATmega328p could test it and report back here bevore Evan put this in the demonstration Git/Repository. Thanks.
Ralf
Add a Warning into the #script to say that ATmega328p has not been tested, but, should work... let us know if is does....
I've added the warning. The file is attached.
see https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/LCD_Solutions/Large_Font_LCD_Solutions/2004_large_font
A good example!
see https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/LCD_Solutions/Large_Font_LCD_Solutions/2004_large_font
A good example!
Ralf is this good to add? This is meant to explain the port usage.
Evan
Hi Evan,
First of all:
You've written a very nice website about it. Thank you!
Explaination of port usage:
Port usage is flawless and certainly very helpful.
Do you mean I should add it to the GCB file, or do you want to add it to the demonstration Git/Repository web side? I think both options are fine.
Ralf
I added to your source as a header. Looks nice.
Most interestng. I also compiled using AVRASM2 ( as a validation ). Compiled very nicely. :-)
This means the ASM generated is 100% valid. I have attached the LST file for your review.