Design Idea
Microprocessor-based dual timer features four outputs
Simple code, switches yields two timers in microcontroller.
By Tito Smailagich, ENIC, Belgrade, Yugoslavia; Edited by Brad Thompson and Fran Granville -- EDN, 6/9/2005
Based on Freescale Semiconductor's MCC908QY 8-bit flash-memory microcomputer, the circuit in Figure 1 provides a low-cost, general-purpose dual timer that offers an alternative to one-shot circuits. You can modify the assembly-language software to meet specific applications. The circuit uses microprocessor IC1's internal 12.8-MHz clock oscillator. Internal division by four yields 3.2 MHz, which further divides by 64 with a timer prescaler to produce 50 kHz. A timer modulo counter divides by 50,000 to produce a 1-Hz timebase that generates a once-per-second real-time interrupt and master timing interval.
Two groups of four switches, S3 through S6 and S7 through S10, set time intervals t1 and t2, respectively, in increments of 1 to 16 sec. Although the figure shows individual DIP switches, you can also use hexadecimal-encoded rotary switches to set the time intervals. For demonstration purposes, LEDs D1 through D4 show the outputs' states during the timing cycle. Normally open pushbutton switches S1 and S2 start and stop the timers' operating cycles. The start function initiates the main timer and operates only when the timer stops. After activation, output Q1 goes to logic one during interval t1 (Figure 2). Output Q2 complements Q1 and remains at logic one until the next cycle starts. On Q1's trailing edge, output Q3 goes to logic one for time interval t2. After t2 elapses, output Q4 goes to logic one and remains there until the next cycle starts. You can use the stop switch, S2, at any time to terminate a cycle and reset all four outputs to logic one.
Check out our Best of Design Ideas section!



