Email: Password: Remember Me | Create Account (Free)
Software-Based Clock for SBCMON
SBC Hardware: Main | SBC Schematic/Parts List | Technical Details | All pages in PDF format
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

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.

What Does this Program Do?

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 SBC has yielded no discernible error over a period of 24 hours.

Concepts Demonstrated by Program

This program demonstrates the following concepts:

  1. Interrupts.
  2. Timer 0 as a time-keeping mechanism.
  3. Clearing LCD screen.
  4. Setting LCD cursor position.
  5. Writing characters to the LCD.
  6. Reading and debouncing the 4x4 keypad.