Browse over 10,000 Electronics Projects using the Page Numbering provided at the bottom of each Page.

xTimer with 4094

xTimer with 4094

This new design uses a cheap CMOS shift register, 4094 for LED interface. Each 4094 drives a 0.5″ 7-segment without the need of limiting resistor. The left-hand LED is timer function with buzzer alarm output. The right-hand is for clock display.
Software The firmware is timer interrupt driven program. The interrupt rate is 100Hz. The XTAL is 24MHz. Timer0 receives 24MHz/12=2MHz. To produce 100Hz, the reload value then equal 65536-20000=45536 or 0xB1E0. Below is timer0 interrupt service function. All tasks will be executed every 10ms The autho has replaced timer function for timer3 and timer4 with clock. Below shows new layout. Now Key3 and Key4 can adjust current time for HOUR and MIN easily. The SPI signals: DIN, CLK and STROBE are declared to use P1.6, P1.7 and P1.5. The function that interfaces to the eight 4094 is write_LED( ). The function has a nest loop using variable i and j. i is for inner loop counting, j is outer loop counting. The inner loop shifts 8-bit from buffer variable. Begin with buffer[0] to buffer[7]. Each byte will shift bit 7 first. This is done by ORing with 0x80. If true, then set DIN with “1” else with “0”. The bit is shifted with 0-1 transition of CLK signal. The inner loop will do 8 times by outer loop counter using variable j. When 64-bit are shifted, the STROBE signal will make 1-to-0 transition to strobe all bits to the output.



Advertisement


Visit Here for more.

 




Top