Control 7-Segment Display with Shift Register using PIC16F877A

Digital up/down counter using PIC16F877A and CCS C
PIC16F877A with 7-segment display and shift register hardware circuit

A serial-in parallel-out shift register (74HC164, 74HC595, CD4094…..) can be added to a 7-segment display. The adding of the shift register minimizes the number of pins used by the 7-segment display. This topic shows how to make a 4-digit digital counter with multiplexing and 74HC164 shift register using PIC16F877A and CCS PIC C compiler.

Digital up/down counter using PIC16F877A:
Here is an example shows how to make a digital up and down counter where the number is displayed on a 7 segment display uses multiplexing technique with shift register.
Example circuit schematic is shown below where a common anode 7-segment display and 74HC164N shift register are used.
Other shift registers such as 74HC595 or CD4094 can be used in this project.
Two buttons are used to increment and decrement the displayed number.
PIC16F877A with 7-segment display and shift register circuit
The PIC16F877A microcontroller must be supplied with 5V between pins VDD (#11) and VSS (#12).

Hardware Required:

  • PIC16F877A microcontroller   —> datasheet
  • Common anode 4-digit seven-segment display
  • 74HC164 shift register   —> datasheet
  • 4 x 2N3906 PNP transistor   —> datasheet
  • 2 x Push button
  • 5 x 10k ohm resistor
  • 4 x 1k ohm resistor
  • 7 x 100 ohm resistor
  • 8 MHz crystal oscillator
  • 2 x 22 pF ceramic capacitor
  • 5V Power source
  • Bread board and some jumper wires
  • PIC microcontroller programmer (PICkit 2, PICkit 3…)

Digital up/down counter using PIC16F877A CCS C code:
The C code below is for CCS C compiler, it was tested with version 5.051.

Digital up/down counter using PIC16F877A video:
The following video from a real hardware circuit for the digital 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