Vous êtes sur la page 1sur 7

- AL Azhar University-Gaza FACULTY OF ENGINEERING AND INFORMATION TECHNOLOGY

DEPARTMENT OF MECHATRONICS ENGINEERING

Embedded System design


Lab Report Experment No.Four

7-Segment Multiplexed display


Prepared by : MOHAMMED RIYAD AL- NAJJAR ALI HAMZA MUKAT
Presented to :

Eng. Mohammed Aqel December 6, 2007


First semester, 2007/2008 1

7-Segment Multiplexed display

Introduction:

In this experiment we want to make a counter which can be count from 0 to 99, as we know to display a digit we need a 7-segment display. And using multiplexing technique and another 7-segment display we can display the two digits.

Objectives:
Understand how 7-segment display works and interface with PIC16F84A . Using the multiplexing technique in the case of multiple 7-segment.

Requirements:
Hardware :
1) PIC16F84A 2) 4MHz Oscillator 3)2 x 30PF capacitor 4) Pull-up Resistor 10K 5) 2 x common anode 7-segment display 6)7 x 200 resistors 7) One 74LS47 BCD decoder IC 8) 2 x PNP transistor

Software:
1)Proteus 2) PIC Basic compiler 3)IC prog

Background :

Firstly, we will give a brief explanation about the 7-segment display. It consists of seven LED's in common cathode or common anode arrangement to display the digits from 1 to 9 and some times displays the hex numbers from A to F as needed. This is the circuit diagram.

As we see, to display the number we need a code, for example in common cathode 7-segment: To display 1, the two segments b and c will glow so we must send the data in the binary form 11000000, and thats a problem and to solve it we used the 74LS47 BCD decoder IC to decode the number.

There are two methods to interface the 7-seg. to the microcontroller : 1) Demultiplexing technique : In this method every seven segment will have it's own BCD decoder and we need 8 of PIC16F84A pins and max. we can interface only three 7-segment since PIC16F84A has 13 output pins.

2)Multiplexing technique : This technique is used when we want to have more than three 7-segment and one common BCD decoder is needed and connected to all seven segment and receives the data from pins RB0,RB1,RB2 and RB3 that means all segments receive the same data, but only one is active at time, this one which we light it up by sending logic (0) to it or (1) as it designed-so every digit will switched in turn .As long as each digit is illuminated within the range of vision but we will not notice the difference it will produce a stable image when a LED cycle at rate more than 25Hz (25 times per one second) . Cycle Time T=1/f The selected cycle time is divided by the number of used 7-seg. The switching is done by a transistors which are biased by other pins.

Well use Port B of the PIC 16F84A to drive each segment individually of a common Anode 7-segment. This means that segments emit light when logical zero is brought to them.This is done by the decoder. The PNP transistor is used to switch the common anode to select the 7-seg. and will switch ON and OFF for 25 times per second .The program will count from 0 to 99.

Lab work :

The Circuit Diagram: The circuit was simulated in proteus software .

The code of program:


PBPro code : TRISA=0 TRISB=0 PORTA=$FF PORTB=0 NUMBER VAR BYTE I VAR BYTE COUNTER VAR WORD I=0 COUNTER=0 5 ;port A and B as output ;intialization

INTCON=%10100000 ON INTERRUPT GOTO ISR INTCON=%10100000 OPTION_REG=%10000001 MAIN: NUMBER= I DIG 0 PORTB=NUMBER PORTA=2 PAUSE 10 NUMBER= I DIG 1 PORTB=NUMBER PORTA=1 PAUSE 10 GOTO MAIN DISABLE ISR:

;Interrupt Enable TMR0

IF COUNTER != 50 THEN COUNTER=COUNTER+1 IF COUNTER = 50 THEN I=I+1 COUNTER=0 ENDIF IF I=100 THEN I=0 INTCON.2=0 RESUME ENABLE END

Comments :

1)7-segment displays are used in most of industrial applications. 2) An advantage of multiplexing is to reduce the hardware
complexity. 3)The interrupt is used in this experiment because of the problem of increasing the number by a loop which causes an incompatible delay. 6

Vous aimerez peut-être aussi