Browse over 10,000 Electronics Projects

7 Segment LED sketches

7 Segment LED sketches

Does anyone have a circuit and code for a simple countdown timer? It needs to count down from 2 hours 30 minutes and display on 3 or 4 7 segment displays.
Well, my shipping forecast timer has a BCD count up timer, and this sketch is a stripped down version that outputs the count on 7 segment LCD displays. It does nothing else. When reset, it starts counting up from 02:30.

In the diagram below, only two of the displays are shown. Connect 4 displays, with the segments in parallel. Each display is multiplexed, so only one display is on at a time.

If each segment is driven via a 470R resistor, then if all segments are on, then the common cathode current is about 70mA, so needs a transitor to boost the current, as the max current that the PIC can sink is about 25mA.


If its hfe is > 100, then the base current of 2 mA should be enough and can be driven by a 2K2 resistor.

If clocked at 4Mhz, instead of 32kHz, this is 125 faster, so the minute counts last 0.5 seconds and the display looks okay.

It has been tested to this extend. A PIC16F84 was programmed and an old LED calculator display was seen to count up, through the 24 hour clock.

I used BC182L transistors and resistor values of 820R, on my bread board.

I used a 4Mhz ceramic resonator as these are easy to connect.

Visit Here for more.