10.4 PROJECT 10.4 – Event Counter Using 4-Digit 7-Segment LED Display

10.4.1 Project Description

In this project, a 4-digit 7-segment display is connected to PORT D of the microcontroller. The project counts external events and displays the count on the display; for example, counting the number of items passing on a conveyor belt in front of a sensor. Leading zeroes are suppressed in the display. A push button switch STRT is used to clear and start the count.

In this project, the displays are refreshed inside a timer interrupt service routine in the background, so that the processor is free to do other tasks.

10.4.2 Block Diagram

The block diagram of the project is shown in Figure 10.15. The 4-digit display pins a–g are connected in parallel and each digit is controlled separately. Counting starts when button STRT is pressed.

Figure 10.15 Block diagram of the project


10.4.3 Circuit Diagram

The circuit diagram of the project is shown in Figure 10.16. The displays are connected in parallel to PORT D of the microcontroller. Each digit is enabled separately by connecting a transistor as a switch to its common cathode pin, as in the earlier project. Setting the base of the transistor to logic HIGH turns the transistor ON and enables the display. PORT A pins RA0 to RA3 are used to control the display enable lines. The STRT push-button switch is connected to pin RA4 of the microcontroller. ...

Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.