99 Minute Timer

Originally published on www.bhargavaz.net in year 2000.

There is a cute little appnote on using 12C508 to replace electromechanical timers. The appnote can be found on Microchip's site.

Get Appnote 1_001.pdf

It is a timer circuit that gives times up to 99 minutes. The hardware is slick but the code has too many bugs. I built the hardware with one display (Units) only. The software assembled with trivial warnings. Like, I had to replace RETURN with 'retlw 0'.

I plan to use this circuit with my home brewed EPROM eraser :-) I'm looking for an enclosure now.

The main problem with the code was improper timing and the one minute lag in turning relay on and off. The problem found was the code started counting TMR0 before the user started the timer. So the timer would display the value that user entered but counted from the middle.

When the user started the timer the relay would turn on after one minute of counting and turned off after one minute the timer stopped.

I have also modularized the code so that the parts may be reused. The modified code is here - timer.zip (no place to put on blogger - ask me in comments if you want it).
Here is the hexdump of the corrected code