PIC16F84A 7-Segment display example – 4-Digit digital counter with CCS

Interfacing PIC16F84A microcontroller with 7-segment display

This topic shows how to build a digital counter that counts from 0 to 9999 using PIC16F84A microcontroller and CCS PIC C compiler. The 4-digit 7-segment display uses multiplexing technique which means all the data lines from a to g are connected together for all the four digits. We will see circuit and code for both types of the 7-segment display: common anode and common cathode.
The following video shows a hardware circuit of the digital counter:

Interface PIC16F84A with common anode 7-segment display:
In common anode 7-segment display type all the 7 LED’s anodes are connected together.
Interfacing PIC16F84A with common anode 7-segment display (digital counter circuit) circuit schematic is below.
PIC16F84A 7-segment display common anode circuit
If the button which is connected to RB7 pressed the displayed number will be incremented by 1. The PIC16F84A microcontroller must be supplied with +5V between pins VDD (#14) and VSS (#5).

4-Digit common anode 7-segment display counter with PIC16F84A CCS C code:

Interface PIC16F84A with common cathode 7-segment display:
In common cathode 7-segment display type all the 7 LED’s cathodes are connected together.
The following circuit schematic is for 4-digit digital counter counts from 0 to 9999, the number is incremented when button is pressed.
PIC16F84A 7-segment display common cathode circuit
The PIC16F84A microcontroller must be supplied with +5V between pins VDD (#14) and VSS (#5). 

4-Digit common cathode 7-segment display counter interfacing with PIC16F84A CCS C code:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.