Interfacing 7-segment display with PIC12F1822 using CCS C compiler

Three-digit counter using PIC12F1822 and CCS C
 PIC12F1822 7-segment display interface hardware circuit
The easiest way to interface 7-segment display with PIC12F1822 microcontroller is to add a serial-in parallel-out shift register. The adding of the shift register minimizes the number of pins used by the 7-segment display. This topic shows how to make a 3-digit digital counter with multiplexing and 74HC164 shift register using PIC12F1822 microcontroller and CCS PIC C compiler.

Interfacing PIC12F1822 with 7-segment display circuit:
Here is an example shows how to make a digital up 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.
The displayed number can be incremented using a push button connected to RA3 pin.
PIC12F1822 7-segment display interface circuit

Internal oscillator of the PIC12F1822 microcontroller is used @ 8MHz and MCLR pin function is disabled.
The push button is connected to pin RA3. The shift register used in this example is 74HC164 but other types can work properly like 74HC595 or CD4094.
In this example all pins of PIC12F1822 are used and there is no free pin.
The PIC12F1822 microcontroller must be supplied with 5V between pins VDD (#1) and VSS (#8).

Interfacing PIC12F1822 with 7-segment display C code:
The C code below was tested with CCS C compiler version 5.051.

Interfacing PIC12F1822 with 7-segment display video:
The following video shows project in a hardware circuit with some details.

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