Engineering Knowledge

Free software, projects, tutorials & more!
Home     Links     Site Map     Contact Us     About      

 You are here: Home > Projects > Microcontroller & 7-Segments LED Display Interfacing

 Microcontroller & 7-Segments LED Display Interfacing 

By adminstrator Rev1.0 Copyright© 2007

Power consumption is the common problem you will encounter when your electronics project requires multiple seven-segments LED display, the electrical current required by the entire circuit will be the double if not the triple! Another problem is that for each digit you need a driver - decoder IC, which means more cost, more area and larger PCB!

This tutorial will show you how to utilize the multiplexing technique in order to use only one 7-segments driver chip and to reduce the power consumption. The main idea here is to connect all the seven-segment LED display units with each other in parallel and turning only one unit at a time for a certain - very small - time, and then move to the next unit. Therefore, the power consumption will be as if you have only one 7-segment!

If each unit is turned on for a 1 or 2 millisecond, the human eye will see all the 7-segment units as if it turned on at one time! A microcontroller will control the entire operation; it will turn on one seven-segment unit by means of transistor, and send the appropriate BCD code to the 7447 driver chip to be displayed on that unit. After 2ms, this unit will turned off and move to the next unit, turn it on and send the appropriate BCD code to the driver chip.

 Tip:

Since the display is multiplexed, you may feel that the display is not bright enough. To get a brighter display, use smaller values than 150Ω in schematic below. However, be sure that you will not exceed the absolute maximum rating for 7-segment display current.

 

In this project, we will use three 7-segment common anode display units, to display the numbers from 0 to 255, connected to 7447 driver chip and controlled by an AT89C2051 ("8051 family") microcontroller by means of 2N3906 PNP transistor. The controller will take the binary number on port 1 as input, convert it into BCD data and display the corresponding decimal number on the 7-segment LED display unit. 7447 - driver - decoder chip is connected to P3.0 to P3.3 and P3.5 to P3.7 pins are connected to the three PNP transistors, as shown in the schematic below:

 

MOV         P1,#0FFH           ;MAKE P1 INPUT

LOOP:                                 

MOV         A,P1                   ;GET BINARY DATA

MOV         B,#100               ;PREPARE FOR DIVISION
DIV           AB                      ;DIVIDE BY 100

ORL          A,#10000000B   ;INCLUDE CONTROL BIT

MOV         R0,A                   ;STORE 100'S DIGIT IN R0

MOV         A,B                     ;GET THE FRACTION

MOV         B,#10                 ;PREPARE FOR DIVISION
DIV           AB                      ;DIVIDE BY 10

ORL          A,#00100000B   ;INCLUDE CONTROL BIT

MOV         R1,A                   ;STORE 10'S DIGIT IN R1

MOV         A,B                     ;GET FRACTION

ORL          A,#00010000B   ;INCLUDE CONTROL BIT

MOV         P3,A                   ;DISPLAY 1'S DIGIT

CALL        DELAY                ;DELAY 1 MS

MOV         P3,R1                 ;DISPLAY 10'S DIGIT

CALL        DELAY                ;DELAY 1 MS

MOV         P3,R0                 ;DISPLAY 100'S DIGIT

CALL        DELAY                ;DELAY 1 1M

SJMP       LOOP                  ;KEEP DOING THIS

DELAY:    ;1 MILLISECOND DELAY ROUTINE

MOV         R4,#2                  
repeat:                                 
MOV         R5,#230              
repeatt:                                
DJNZ        R5,repeatt          

DJNZ        R4,repeat           

RET  

 

How to convert Binary number into BCD number?
 

Since microcontroller input is in binary format, and the output should be in BCD format, we have to convert the binary data into BCD data. As you can see in the assembly code below, this conversion based onto the following algorithm:


 -  Divide the binary number by 100, the result will be the BCD hundreds digit.


 -  Take the remaining number ("fraction") from the previous division and divide it by 10, the result will be the BCD tens digit.

 -  The remaining number ("fraction") from the previous division will be the BCD ones digit.

 

Assembly program for controlling multi 7-segments LED display by using microcontroller at the right side.

DC Motor Control - Interfacing*Very Informative!

 

Power Supply Design              *Very Informative!

 

 

 

*Sponsored Link.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Microcontroller & 7-Segments LED Display Interfacing 

By adminstrator Rev1.0 Copyright© 2007

 You are here: Home > Projects > Microcontroller & 7-Segments LED Display Interfacing