SBC In-System Programming: Information | VisISP-52 ISP Application
SBCMON Monitor/Operating System: Main Page | Manual
SBCMON-based Software: SBCMON Monitor | Keypad Demo | LCD Echo Demo | Hardware Clock | Software Clock
SBCMON-based PS/2 Software: PS/2 Comm Monitor | PS/2 Keyboard | PS/2 Mouse
ORDER 8052.com SBC: PCB, KIT OR BUILT SBC AVAILABLE FOR PURCHASE
Download Software-Based Digital Clock for SBCMON
You may download either the source code or the ready-to-use Intel-Hex version of the keypad demonstration program. The Intel-Hex version may be loaded into SBCMON's memory using the L or Q commands. Download the source ASM program if you'd like to see the code that makes SBCMON work.
-
SBCMON Software-Based Digital Clock Program Source (sftclock.asm)
SBCMON Software-Based Digital Clock Intel HEX (sftclock.hex)
NOTE: This demo program requires SBCMON monitor program to run. Be sure to download SBCMON first, install on your SBC, and then run this demo from within SBCMON itself. This program may require additional modification in order to run without SBCMON.
This program is a simple digital clock that constantly displays the current time and date using an interrupt-driven time-keeping system that is based on the concept explained in this tutorial. This program will keep accurate count of the current time using the timer 0 interrupt and display the time (hour:minute:second) to the LCD each second.
The clock may be set at any time by pressing the asterisk ("*") key on the 4x4 keypad. The program will then prompt for the 2-digit hour. The hour should be entered and the asterisk key pressed as an "enter" key. The hour will be validated to verify it is a valid number between 00 and 23. The application will then prompt the user to enter the minute and second, both of which will be validated for being a number between 00 and 59. Once the second is entered, the current time will be set to the requested hour:minute:second.
The clock program may be exited by pressing the "A" button on the 4x4 keypad when the program is displaying the clock.
This program is capable of keeping accurate time with a precision that is limited only by the oscillator connected to the microcontroller. Since such oscillators are usually accurate within +/-100ppm, the maximum deviation of this clock should be +/- 8.6 seconds per day. In reality, oscillators are usually more accurate than their maximum specified deviation and testing of this application on a typical 8052.com SBC has yielded no discernible error over a period of 24 hours.
Concepts Demonstrated by Program
This program demonstrates the following concepts:
- Interrupts.
- Timer 0 as a time-keeping mechanism.
- Clearing LCD screen.
- Setting LCD cursor position.
- Writing characters to the LCD.
- Reading and debouncing the 4x4 keypad.