Product categories

Have You Seen

B0505S-1WR3 MORNSUN Isolated DC - DC Converter

B0505S-1WR3 MORNSUN Isolated DC - DC Converter

Mornsun B0505S-1WR3 DC-DC Isolated ConverterMORNSUN B0505S 1WR3 1 watt, 5 Volts Isolated DC to DC Po..

Rs.106.20 (inc GST)
Rs.90.00 + GST

SKU: 2969 | DAE663
Stock: 100
XL1509-Adj E1 Buck DC to DC Converter IC (SOP8L Package)

XL1509-Adj E1 Buck DC to DC Converter IC (SOP8L Package)

XL1509-Adj E1 Buck DC to DC Converter IC (SOP8L Package)XL1509-Adj E1 Buck DC to DC Converter IC, Ad..

Rs.25.96 (inc GST)
Rs.22.00 + GST

SKU: 3657 | DAF397
Stock: 79

Interfacing 7-Seg Display to Microcontroller



7 Seg displays are are basically 7 LED's. It will be much easier to understand if you first read Interfacing LED's to Microcontroller.

 

CACC

Basically there are two types of 7-Seg display's:

  1. Common Cathode where all the segments share the same Cathode.
  2. Common Anode where all Segments share the same Anode.

Here we will be only discussing the Common Anode type.In common Anode in order to turn ON a segment the corresponding pin must be set to 0. And to turn it OFF it is set to 1.

7_segment__pin_configuration
7_seg_circuit_ca
lookup
Figure 2
Controller 7-seg display
P2.0 A
P2.1 B
P2.2 C
P2.3 D
P2.4 E
P2.5 F
P2.6 G
Figure 1 shows how to interface 7-seg display to a microcontroller. Now we create a lookup table containing the seven segment pattern to display the corresponding hex digits. e.g. consider we have to display '1' from the above figure  we come to know that turning ON segment B & C will show '1' on the 7-seg display so P2.1 & P2.2 should be LOGIC 0 whereas rest of the pins should be LOGIC 1. FIGURE 2 shows the lookup table for CA display.
2X7seg
Figure 3

We can now interface a single 7-Seg to the microcontroller but for interfacing multiple 7-seg's we use Scanning Principle where One 7-seg is displayed after another but this process is very fast hence the flickering cannot be seen by human eye. Figure 3 shows the circuit for interfacing two 7 seg displays.

7segment_display

When interfacing more than one 7-seg display the segment's (A-G) of all displays are connected together  whereas their ANODE (Cathode in case of CC displays) are switched ON one after another. Consider we have to display '31' on the above 7-seg display so we TURN ON the first transistor by setting its corresponding pin to 1 & then give the 7-seg equivalent code for '3' which is 4fh. Then we TURN OFF the first transistor & TURN ON the second & output its corresponding 7-seg equivalent code of '1' i.e. 06h.Then we again go back to display '3' this is a never ending loop.

ORG 0000h

CLR P3.0

CLR P3.1

MOV P2,#0ffh

loop:
CLR P3.0

SETB P3.1

MOV P2,#4fh

CALL delay

CLR P3.1

SETB P3.0

mov P2,#06h

CALL delay

AJMP loop

.

Written by Amol Shah

Amol Shah

Founder of DNA Technology an Electronic Engineer by choice. Started working on this website as an Hobby and now its a full time venture. Very passionate about Electronics and like to learn new stuff. Want to make DNA Technology one of the best Online Store for Electronics Components in India.
Follow Me Twitter | Facebook | Google Plus | Instagram