The AT90S8535 chip features an onboard RTC (real-time clock). The timing for it is kept by an external crystal oscillator, running at 32.768 KHz. The crystal is hooked into pins 6 and 7 of Port C as shown in the schematics.Two 12.5 pF capacitors are placed from the sides of the crystal to ground. As described in the software section, the Timer 2 interrupt is set to a prescale of 128. As the crystal oscillates at 32768 cycles in a second, a prescale of 128 would have exactly 32768/128 or 256 pulses per second. With the 8 bit Timer 2 set to interrupt on overflow, an interrupt occurs precisely every second, triggering the software routine for incrementing the time/date.
The LED display is a multiplexed, common anode display designed for individual addressing of each digital. All of the segments in each digit each have a unique anode, and all of the segments (A-G) have unique cathodes. The display is addressed by the CPU through an 8 bit command. The upper 4 bits are an active low addressing of the desired digit. The most significant bit corresponds to the left-most digit. The rest of the binary codes for the digits can be seen in the table.
| Digit (from left) | Binary Code |
|---|---|
| 1 | 0111 |
| 2 | 1011 |
| 3 | 1101 |
| 4 | 1110 |
TIP31C Power transistors were used, driving the LEDs with the board's Vcc (5 volts). However, the board couldn't supply enough current (20 mA) to all of the LEDs, and the port pins couldn't drive the power transistors fully. The solution was two-fold. First of all, 2N3904 transistors were hooked in a darlington configuration to maximize the current through the LEDs. Once in this configuration, the LEDs could be hooked to the collector of the power transistor. Secondly, the voltage was increased from 5V, to 9V,and eventually to 12V. Due to the high frequency of the strobing, series resistance wasn't even needed at 12V, but a nominal resistance of 100 ohms was used for minimal protection.
The LCD display hookup was fairly straightforward. We had used the same display before, and it merely required hooking up the data lines directly to Port D, and connecting the power and ground. The 10k potentiometer above the LCD controls contrast and the exact hookup can be seen in the schematics.
The alarm is triggered by a TIP31C, driven directly from pin 0 of Port C. The alarm is a self-contained module, powered by the 12 volt supply. A diode protects the transistor (not really necessary here, but was a throwback to when the TIP31C dropped a relay closed instead of directly driving the alarm. It is kept just for safety.) A series resistor was also thrown in the circuit just to make the alarm sound less painful. The module was quite deafening to hear, and with the transistor and resistor, the sound is more annoying and less painful.
