Clock Assembly Program v0.4

Rather than read the time from BCD's, I am going to send a 1Hz pulse to the Timer0. That timer interrupt will then increment mintues and hours, stored in RAM. This is a much simpler design, as far as hardware is concerned. I no longer need BCD's and I am generating a 1sec pulse with a 555. This is the trickier part because the timing is based on resistor and capacitor values. Therefore getting an exact second is dependent on their precisions. I plan on using a variable resistor with the 555 in order to tune the time manually.

The clock program is very basic. Timer0 starts at 0xc4. There is an interrupt on carryover, this will increment minutes and hours, if needed, which are stored in RAM. Outputting the time is the bulk of the program. I take the time in binary and alternate between displaying it in binary with LED's and in hex or octal on the 7-seg. The binary part is straight forward. The binary output is sent on the lower 6 bits of PORTC. Then the upper 2 bits are binary/hex and hour/minute flags. Displaying hex requires a few more steps. Instead of displaying the values in minutes and hours, I go through each digit and light up each segment in the 7-seg for the corresponding digit. This is done with a 4 to 16 Multiplexer. Each output of the multiplexer is sent to a segment on the 7-seg (in pairs). So I just send the binary number for each segment. Then I select the right or left display and hour/minute display with the upper bits of the port. The values sent to the multiplexer are stored in a data table for convenience.