4-Digit digital counter using PIC16F877A and CCS C compiler

Interfacing PIC16F877A microcontroller with 7-segment display

Using PIC16F877A and 7-segment display we can build a digital counter that counts from 0 to 9999 with a button to increment the displayed number. The same thing as on the following topic where the microcontroller PIC16F84A was used.
PIC16F84A 7-Segment display example – 4-Digit digital counter with CCS
We are going to see circuits and C codes for both 7-segment display types, common anode and common cathode.

Digital counter using common anode 7-segment display:
Circuit schematic for interfacing PIC16F877A with common anode 7-segment display is shown below:
PIC16F877A 7-segment display common anode circuit
The button is used to increment the displayed number.
The PIC16F877A microcontroller needs +5V between pins VDD (#11) and VSS (#12).

Digital counter using common anode 7-segment display CCS C code:

Digital counter using common cathode 7-segment display:
Circuit schematic of the common cathode is a little bit different from the common anode one as shown below:
PIC16F877A 7-segment display common cathode circuit
The PIC16F877A microcontroller needs +5V between pins VDD (#11) and VSS (#12).

Digital counter using common cathode 7-segment display CCS C code:
The code is also has some differences from the common anode code.

Digital counter using PIC16F877A and 7-segment display video:
The following video shows a hardware circuit for the discussed counter.


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

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

Scroll to Top