Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Resource icon

Binary to 7 Segment Decoder 2013-04-26

There are many Binary to 7 Segment decoders out there, such as the CD4511, DM74LS47, SN7447 and the DM9368. All of which have attractive features, but none have all of them in one package. Another downside is many only display 0 - 9 with few displaying all Hexadecimal digits (0 - F). With many of these chips obsolete and hard to find, my Binary to 7 Segment Decoder is a versatile substiute.

How It Works

I am using a PIC16F628A to read the Binary Number and Display the Hexadecimal equivalent on a 7 Segment LED display. The ASM file is heavily commented, so for information on exactly how it works, take a look at the ASM file.

Here is a summarised explanation:
  1. The software reads the logic levels of the first 4 bits of PORTA (Binary Inputs) and stores the digit in a General Purpose Register (GPR).
  2. The GPR is then XOR'd with 0x00 to mask the upper nibble.
  3. A table is called, and the program counter jumps x amount of instructions, depending on the number stored in the GPR.
  4. The corresponding 7 segment arrangement is moved to the working register (W).
  5. Then this is transfered to PORTB, to which the LED 7 segment display is connected. As well and doing this, the microcontroller tests the inputs for Ripple Blanking, Latch, Test Lamp, and Display Type Select and acts on them accordingly.

Video


Parts

1x PIC16F628A (can use 627A or 648A)
1x LED 7 Segment (Common Cathode or Common Anode)
7x 470Ω Resistor
3x 10KΩ (RA4, RA5 & RB0 pull up ) resistor
1x .1μF Multilayer Ceramic Capacitor
1x Breadboard
  • schematic.jpg
    schematic.jpg
    180.8 KB · Views: 20,940
  • truthtable.jpg
    truthtable.jpg
    115.3 KB · Views: 14,198
  • breadboard.jpg
    breadboard.jpg
    573.9 KB · Views: 2,682
  • segmentdecoder.asm
    11.4 KB · Views: 1,884
  • segmentdecoder.hex
    605 bytes · Views: 1,432
  • Like
Reactions: rescue161
Author
jakeselectronics
Views
5,352
First release
Last update
Rating
4.50 star(s) 2 ratings

More resources from jakeselectronics

Latest threads

New Articles From Microcontroller Tips

Back
Top