7 Segment Display

Share Embed Donate


Short Description

description about 7 segment display...

Description

7-Segment Display Interfacing and Programming 5.1

Introduction

Till now you have learn what is an embedded system, basic memory architecture of a microcontroller, how to implement assembly language and use of some softwares like pinnacle 52, keil-C and flash magic; we also have come across how to interface LEDs from a microcontroller and how to generate different pattern through it. now its time to move forward and learn one more step ahead towards the completion of our 6-weak training. so here today we will learn about 7-Segment display; How to interface and program it; and some of the applications of it. 5.2

7-Segment Display

A 7-Segment display is a useful electronic component use to produce numeric, alphabetic and some non-alphabetic symbols using a specific arrangement of LEDs as shown in figure here. A 7-Segment display has 10-Pins representing each a, b, c, b, e, f, g and h LEDs respectively along with two extra pins for GND and VSS. following shown an original 7-Segment display device along with its pin diagram. LED h is also denoted by symbol dp.

As we have studied in LED interfacing a 7-segment display is also interfaced in same way as it is also made of LEDs. So we can interface LEDs in three ways bu here difference is that 7-Segment displays comes in two types by manufacturers i.e. "Common Anode" and "Common Cathode"; the logics are shown in figure below.

and

and thus which logic is o implement is on the bases of these specifications provided by manufacturer. interfacing in our case has been shown below. 5.3

7-Segment Display Interfacing

We interface 7-Segment display with port zero of microcontroller; and to do so we connect P0.0 to P0.7 to Pin a to dp (h) of 7-Segment display respectively; and connect Vss terminal of display to 5V Power supply and GND pin to ground. the configuration is shown in figure below.

5.4

Cascading seven segment display

Here we have a question in mind that if we want to interface more then one 7-Segment display with microcontroller what we will do??? as we are using one port for one 7-segment display if we use all the four ports for four 7-Segment display??? isn't it less efficient??? The answer of all these questions are hidden under this topic "CASCADING" cascading refers to connecting similar or non-similar component from the same connections with a reference of enabling and disabling each components according to specification. For cascading four 7-Segment display we use the following schem where all the a to f (dp) pins of 7-segment display are connected paralleled to the port zero of microcontroller along with common ground and Vss pin of all the four 7-segments are use for enabling and disabling them so are connected to port two of microcontroller along with NOT Gate in order to " " and thus clearing or sending "0" on pins of port two cause enabling the display and signal "1" cause disabling it.

5.5

7-Segment Display Programming

Programming a 7-Segment display is so easy as to program a LED array but here pattern should be generate in a manner so as it appears as a meaningful character and with cascaded mode we also need to send "clear" (0) or "set bit" (1) signal on respected pins of port two in order to enable or disable respected 7Segment display. The signals on Port zero which can generate meaningful characters on 7-Segment display are listed in table below.

Example Lets write a program to show character "3" on 7-Segment display.



Showing character "3" on 7-Segment display ;**************************************** ;** Showing character "3" on 7-Segment display ** ;**************************************** org 0000h

;Origin

main: clr sbit sbit sbit

;Main subroutine P2.0 P2.1 P2.2 P2.3

mov P0,11110010b

;Enabling Display-1 ;Disabling Display-2 ;Disabling Display-3 ;Disabling Display-4 ;Sending LED pattern of character "3" at port

zero jmp $ end

;End

OUTPUT

5.6

Generating counting from 0 to 9

0 to 9 Counter

;************************************* ;************ 0 to 9 Counter ************* ;************************************* org 0000h

;Start

main: clr sbit sbit sbit

P2.0 P2.1 P2.2 P2.3

;Main Subroutine ;Enabling Display-1 ;Disabling Display-2 ;Disabling Display-3 ;Disabling Display-4

mov P0,#0FCh call delay zero

mov P0,#60h call delay

mov P0,#0DAh character "2" to Port zero call delay

;Sending character "0" to Port zero ;Calling Delay Function ;Sending pattern of character "1" to Port ;Calling Delay Function ;Sending pattern of ;Calling Delay Function

mov P0,#0F2h ;Sending pattern of character "3" to Port zero call delay ;Calling Delay Function mov P0,#66h ;Sending pattern of character "4" to Port zero call delay ;Calling Delay Function mov P0,#0B6h character "5" to Port zero call delay

;Sending pattern of

mov P0,#0BEh character "6" to Port zero call delay

;Sending pattern of

;Calling Delay Function

;Calling Delay Function

mov P0,#0E0h ;Sending pattern of character "7" to Port zero call delay ;Calling Delay Function mov P0,#0FEh ;Sending pattern of character "8" to Port zero call delay ;Calling Delay Function mov P0,#0F6h

;Sending pattern of

character "9" to Port zero call delay

;Calling Delay Function

jmp main

;Infinite Loop

delay:

;Delay Function

mov 40h,#0FFh

;Move FFh to memory location with address

40h

L1: ;Label "L1" mov 41h,#99h ;Move 99h to memory 41h djnz 41h,$ ;Jump here till 41h becomes zero djnz 40h,L1 ;Jump to "L1" till 40h becomes zero ret ;return end

;End

OUTPUT

5.7

Generating counting from 0 to 9 [using array]

0 to 9 Counter using Array ;************************************* ;******** 0 to 9 Counter using Array********* ;************************************* org 0000h main: clr sbit sbit sbit

P2.0 P2.1 P2.2 P2.3

mov a,#00h Up:

;Enabling Display-1 ;Disabling Display-2 ;Disabling Display-3 ;Disabling Display-4

mov 30h,a mov dptr,#arr movc a,@a+dptr mov P0,a call delay mov a, 30h inc a jmp Up jmp main arr: db db db db db db db db db db

11111100b 01100000b 11011010b 11110010b 01100110b 10110110b 10111110b 11100000b 11111110b 11110110b

delay: mov 40h,#0FFh L1: mov 41h,#99h djnz 41h,$ djnz 40h,L1 ret end

OUTPUT

5.8

Generating two digit numbers

Two digit number ;************************************* ;*********** Two digit number ************ ;************************************* org 0000h main: clr sbit sbit sbit

P2.0 P2.1 P2.2 P2.3

mov P0,#01100000b call delay clr sbit sbit sbit

P2.1 P2.0 P2.2 P2.3

mov P0,#11011010b call delay jmp main delay: mov 40h,#50h L1: mov 41h,#99h djnz 41h,$ djnz 40h,L1 ret end

OUTPUT

5.9

Generating two four bit numbers alternatively

Alternating two four digit numbers ;************************************ ;***** Alternating two four digit numbers ***** ;************************************ org 0000h main: mov 30h,#0FFh UP1: clr sbit sbit sbit

P2.0 P2.1 P2.2 P2.3

mov P0,#01100000b call delay clr sbit sbit sbit

P2.1 P2.0 P2.2 P2.3

mov P0,#11011010b call delay clr sbit sbit sbit

P2.2 P2.1 P2.0 P2.3

mov P0,#11110010b call delay clr sbit sbit sbit

P2.3 P2.1 P2.2 P2.0

mov P0,#01100110b call delay

djnz 30h,UP1 jmp $ mov 30h,#0FFh UP2: clr sbit sbit sbit

P2.0 P2.1 P2.2 P2.3

mov P0,#10110110b call delay clr sbit sbit sbit

P2.1 P2.0 P2.2 P2.3

mov P0,#10111110b call delay clr sbit sbit sbit

P2.2 P2.1 P2.0 P2.3

mov P0,#11100000b call delay clr sbit sbit sbit

P2.3 P2.1 P2.2 P2.0

mov P0,#11111110b call delay djnz 30h,UP2 jmp $ jmp main delay: mov 40h,#30h L1: mov 41h,#99h djnz 41h,$

ret

djnz 40h,L1

end

OUTPUT

Program to implement 7-Segment Display with 8051 microcontroller By ankur bhardwaj embedded What is 7 Segment Display?

7 Segment Display is an array of 8 LEDs connected or arranged in a special pattern together to form or display the digits from 0-9 and Dot functions also. The 7segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment displays. It is composed of 7 LEDs assigning specific alphabet to each and 1 LED acts as a dot in the display. Every LED is assigned a name from 'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are used to display the numerals while eighth LED 'h' is used to display the dot/decimal. Concept: A 7-segment is generally available in ten pin package. While eight pins correspond to the eight LEDs, the remaining two pins (at middle) are common and internally shorted. These segments come in two configurations, namely, Common cathode (CC) and Common anode (CA). In CC configuration, the negative terminals of all LEDs are connected to the common pins. The common is connected to ground and a particular LED glows when its corresponding pin is given high. In CA arrangement, the common pin is given a high logic and the LED pins are given low to display a number.

Common Cathode and Common Anode Configuration

Configuration:

This below table specify how 7-segment will display the digit when one of the LED is OFF or ON accordingly.

Packaging of 7-Segment Display:

Seven-segment displays can be packaged in a number of ways. Three typical packages are shown above.

1. On the left we see three small digits in a single 12-pin DIP package. The individual digits are very small, so a clear plastic bubble is molded over each digit to act as a magnifying lens.

The sides of the end bubbles are flattened so that additional packages of this type can be placed end-to-end to create a display of as many digits as may be needed.

2. The second package is essentially a 14-pin DIP designed to be installed vertically.

Note that for this particular device, the decimal point is on the left. This is not true of all sevensegment displays in this type of package.

One limitation of the DIP package is that it cannot support larger digits. To get larger displays for easy reading at a distance, it is necessary to change the package size and shape.

3. The package on the right above is larger than the other two, and thus can display a digit that is significantly larger than will fit on a standard DIP footprint. Even larger displays are also available; some digital clocks sport digits that are two to five inches tall.

Interfacing with 8051

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.

    

B ui ld awe b site

We b p age de si gn

P cb Layou ts

Th i sVide o

P ro je cts

Code #include "REG52.h" #define SEG P2 sbit C1=P0^0; // BIT DEFINATION long int i; void main() { C1=C2=C3=1; while(1) { SEG=0x06; C1=0; for(i=0;i
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF