common_banner

Exp. 03 : Seven Segment Display Interfacing

Introduction:

A Seven Segment Display (SSD) is a form of electronic display device for displayingdecimal numerals 0 to 9 and few characters like A, b, C, c, H, h, L etc. These arethe oldest yet one of the efficient types of display used in embedded applications. Seven-segment displays are widely used in digital clocks, electronic meters, basiccalculators, and other electronic devices that display numerical information.

This article is about how to interface a seven segment LED display to any mi-crocontroller. Funny thing is that if you want to control a single digit 7 segmentdisplay, then it is nothing but controlling 7 LED’s as we learnt from the previous experiment. For multiple segments, there are simple studies for hardware and soft-ware as well. However a good Knowledge about how to interface a seven segmentdisplay to a microcontroller is very essential in designing embedded systems.

Hardware Discussion: Seven Segment Display (SSD)

Fig: Basic Seven Segment Display

SSD Features:

  • Available in two modes Common Cathode (CC) and Common Anode (CA)
  • Available in many different sizes like 9.14mm,14.20mm,20.40mm,38.10mm,57.0mm and 100mm (Commonly used/available size is 14.20mm)
  • Available in many packages like single and multi digit. There are some custom packages like clocks, meters, panels etc.
  • Available colours: White, Blue, Red, Yellow and Green etc.
  • Low current operation
  • Better, brighter and larger display than conventional LCD displays.
  • Current consumption : 30mA / segment
  • Peak current : 70mA.
  • Distance readable display dislike LCD's.

SSD Connections :

Fig: SSD Pinout and internal circuit

A seven segment display consists of seven LEDs arranged in the form of a squarish‘8’ slightly inclined to the right and a single LED as the dot character. Differentcharacters can be displayed by selectively glowing the required LED segments.

The displays common pin is generally used to identify which type of 7-segmentdisplay it is. As each LED has two connecting pins, one called the “Anode” andthe other called the “Cathode”, there are therefore two types of 7-segment displaycalled: Common Cathode7(CC) and Common Anode8(CA).

How to Drive SSD's ?

Fig: How to use a 7 Segment Display

A CC SSD circuit activity has shown at left of above figure. We can see that only two switches (b and c) are closed and all other switches are open. So, we can produce the binary data pattern as 00000110 which is equivalent to 03H. And we are getting the decimal value 1 is illuminated on the display. And Now we can have all the required data patterns for displaying 0 to 9 using the same method as in the table of above figure.

Circuit Diagram : Seven Segment Display to 8051.

Fig: A Single Digit Seven Segment Display Circuit.

Circuit Discussion :

The circuit diagram shown above is of an AT89S51 microcontroller based 0 to 9 counter which has a 7 segment LED display interfaced to it in order to display the count. This simple circuit illustrates two things. How to setup simple 0 to 9 up counter using 8051 and more importantly how to interface a seven segment LED display to 8051 in order to display a particular result. The common cathode seven segment display D1 is connected to the Port 1 of the microcontroller (AT89S51) as shown in the circuit diagram. R3 to R10 are current limiting resistors. S3 is the reset switch and R2,C3 forms a debouncing circuitry. C1, C2 and X1 are related to the clock circuit. The software part of the project has to do the following tasks.

  • Form a 0 to 9 counter with a predetermined delay (around 1/2 second here).
  • Convert the current count into digit drive pattern.
  • Put the current digit drive pattern into a port for displaying.

Assembly Program : 7seg_1D_8051.asm

Theory Part 2/2 : Multiplexing SSDs

Suppose you need a three digit display connected to the 8051. Each 7 segment display have 8 pins and so a total amount of 24 pins are to the connected to the microcontroller and there will be only 8 pins left with the microcontroller for other input output applications. Also the maximum number of displays that can be connected to the 8051 is limited to 4 because 8051 has only 4 ports. More over three 3 displays will be ON always and this consumes a considerable amount of power. All these problems associated with the straight forward method can be solved by multiplexing .

Fig: Multiple digit Multiplexing tecnique.

In multiplexing all displays are connected in parallel to one port and only one display is allowed to turn ON at a time, for a short period. This cycle is repeated for at a fast rate and due to the persistence of vision of human eye, all digits seems to glow. The main advantages of this method are

  • Fewer number of port pins are required .
  • Consumes less power.
  • More number of display units can be interfaced (maximum 24).

Circuit Diagram : Seven Segment Display to 8051.

Fig: two Digit Seven Segment Display Circuit.

Circuit Discussion :

When assembled and powered on, the circuit will display the number ’16’ and let us see how it is done. Initially the first display is activated by making P3.0 high and then digit drive pattern for “1” is loaded to the Port 1. This will make the first display to show “1”. In the mean time P3.1 will be low and so do the second display will be OFF. This condition is maintained for around 1ms and then P3.0 is made low. Now both displays will be OFF. Then the second display is activated by making P3.1 high and then the digit drive pattern for “6” is loaded to the port 1. This will make the second display to show “6”. In the mean time P3.0 will be low and so the second display will be OFF. This condition is maintained for another 1ms and then port 3.1 is made low. This cycle is repeated and due to the persistence of vision you will feel it as “16”.

Transistor Q1 drives the first display (D1) and transistor Q2 drives the second display (D2). R11 and R12 are the base current limiting resistors of Q1 and Q2. The purpose of other components are explained in the first circuit.

Assembly Program : 7seg_2D_8051.asm

Lesson VDO-

Exercises

    Lab Task :

  • Construct a circuit for a CA type SSD using proteus simulator and write a program for a loop coupnter from 0 to 9 and then A, b,C, d, E, F
ckt_diagram

    Home Task :

  • Construct a circuit for two didgit seven segment counter (which will count 0 to 99 decimal) in proteus having three switches: one for up count, one for down count and last one for reseting the counter.
ckt_diagram