Binary/bcd to 7-segment decoder for PIC16F627A


This is a building block project I developed to try out a few ideas.  It decodes a 4-bit binary word to outputs that will drive a 7-segment LED display.  Functionality is similar to the 7447 BCD-to-seven-segment decoder/driver IC however, because it’s implemented using a microcontroller, the segment control data can be customised to display any set of 16 characters you wish to create.  It also has an ‘invert’ control input that allows it to drive either common anode (active low) or common cathode (active high) LED modules.

7-segment decoder

Binary or BCD to 7-segment decoder

  • 4-bit binary input to 7-segment decode, 0-9, A-F
  • Lamp test input
  • Zero blanking
  • output invert, allows use of common anode or common cathode displays
  • input latch
  • Outputs rated at 20mA per segment (Max)

Demo / evaluation schematic

The idea behind this project is that the PIC can be used as a decoder for 7-segment LED displays and therefore it will be built into some other application.  The schematic is provided for evaluation only.



The PIC use an internal clock source so no external timing components are required, you will need to fit a decoupling capacitor across the Vdd/Vss supply close to the PIC; 100nF ceramic will do the job..

Inputs require an external pull-up resistor unless actively driven by an external source. All unused inputs should be tied to Vdd via a 4K7 resistors.

Because the decoder is implemented in software running on the PIC, input to output propagation delays are 15uS.  Input data on A0-A3 should be held for 15uS after en/latch input goes high to ensure input is latched.

Outputs on the PIC16F627A / 628A are rated at 25mA with a maximum of 200mA for all I/O pins.  This means it can drive a 7-segment LED display directly (via current limit resistors).

Customizing Segment Data

The segment data used to drive the outputs is held in the EEPROM of the PIC making it easy to edit without having to reassemble the source code.

The data is held at addresses 00 to 0F in the format shown below


For more detail: Binary/bcd to 7-segment decoder  for PIC16F627A

Current Project / Post can also be found using:

  • simulation of BCD to 7 segment display in proteius using IC 7447
  • bcd to 7 segment decoder pic 16f84 assembler program
  • bcd to 7 segment display 16f628

Leave a Comment

= 3 + 8

Read previous post:
orange 3mm LEDs
5 LED CUBE Controller for PIC16F688

Circuit Description The LED cube is made up from 125 LEDs arranged into 5 layers of 25 LEDs each.  The...

Scroll to top