The basic requirements of a realtime programmable timer generally used in schools and colleges for sounding the bell on time are:
• Precise time base for time keeping.
• Read/write memory for storing the bell timings.
• LCD or LED display for displaying real time as well as other data to make the instrument user-friendly.
• Keys for data entry.
• Electromechanical relay to operate the bell.
We are describing here a sophisticated, yet economical, school timer based on Motorola’s 20-pin MC68HC705J1A microcontroller.
[stextbox id=”info” caption=”Main features of MC68HC705J1A”]• 14 bidirectional input/output (I/O) lines. (All the bi-directional port pins are programmable as inputs or outputs.)
• 10 mA sink capability on four I/O pins (PA0-PA3).
• 1,240 bytes of OTPROM, including eight bytes for user vectors.
• 64 bytes of user RAM.
• Memory-mapped I/O registers.
• Fully static operation with no minimum clock speed.
• Power-saving stop, halt, wait, and data-retention modes.
• Illegal address reset.
• A wide supply voltage range from-0.3 to 7 volts.
• Up to 4.0 MHz internal operating frequency at 5 volts.
• 15-stage multifunction timer, consisting of an 8-bit timer with 7-bit pre-scaler.
• On-chip oscillator connections for crystal, ceramic resonator, and external clock.[/stextbox]
The time-keeping section. Accurate time-keeping depends on the accuracy of time base used for driving the microcontroller. In this project, the microcontroller is driven by AT-cut parallel resonant crystal oscillator that is expected to provide a very stable clock. A 3.2768MHz crystal provides a time base to the controller.
The frequency (fosc) of the oscillator is internally divided by 2 to get the operating frequency (fop). This high-frequency clock source is used to control the sequencing of CPU instructions.
Timer. The basic function of a timer is the measurement or generation of time-dependant events. Timers usually measure time relative to the internal clock of the microcontroller. The MC68HC705J1A has a 15-stage ripple counter preceeded by a pre-scaler that divides the internal clock signal by 4. This provides the timing references for timer functions.
Now time-keeping becomes very simple. As we are having a precise 1-second time count, a real-time clock can be easily built.
The MC68HC705J1A has a 64 byte RAM that is used for data storage, Real time (in terms of seconds, minutes, hours, days of a month, and months) is stored in this RAM. Thus an accurate real-time clock is generated.
The input section. For setting the real-time clock and storing operating times, the timer requires to be programmed externally. Data is fed using the keyboard.
Various keys used in the timer, along with their functions, are described below:
Time (4): For setting real time in minutes and hours.
Bell (5): For setting the bell’s operating timings.
Digit Advance (6): Data setting is done digitwise (hour’s digit followed by minute’s digit). The Digit Advance key shifts the decimal point to the right.
Store (7): For storing the data (real time or bell time).
Delete (3): For deleting a particular bell timing.
Here, the figures within parentheses indicate the decimal equivalents of 3-bit binary data from the keyboard.
Set and run modes. Data setting is possible only in set mode. Set mode or run mode can be selected by toggle switch S6. By using a lock switch for S6, the timer can be protected from unauthorized data entry/storage.