You are on page 1of 9

7a -SEGMENT DISPAY INTERFACE

AIM:
To interface 7-segment LED display to 8085 microprocessor and write
1) An assembly language program to display the numbers from 0 to 9.
2) An assembly language program to display the numbers from 00 to 99.
APPARATUS REQUIRED:
1)8085 microprocessor kit.
2) 7-segment LED display.
3) IC-7447
4) IC-8255(PPI)
5) Resistors (330 ohms)-8No.s
THEORY:
7-SEGMENT LED DISPLAY:
The seven segment LED display is a multiple display. It can display all decimal digits
and some letters. It is very popular among multiple displays as it has the smallest number of
separate controlled light emitting diodes (LED). Multiple displays of 7-segment LED, 14-segment
LED and dot matrix types are available .These display gives better representation of
alphanumeric characters but require complex circuitry.

PIN DIAGRAM OF SEVEN SEGMENT LED DISPLAY)

In seven segment display there are seven light emitting diodes (LED) as shown above in
the figure. Each LED can be controlled separately. To display a digit or letter the desired segment
are made ON as shown.

There are 2 types of 7 segment display namely, common -cathode type and common anode type.
In a common cathode type display all the 7cathodes of LED s are tied together to the ground.
When a +5 Vdc is applied to any segment, the corresponding diodes emit light. Thus applying
logic '1' (i.e.) positive logic to the desired segments, the desired letter or decimal number can be
displayed. In a common -anode type display all the 7 anodes are tied together and connected to
the +5V supply as shown in the common -anode 7-segment display figure. A particular segment
will emit light when ' 0' logic is applied to it.

The seven segment displays are not connected to I/O ports directly .They are connected
through buffer or drivers/decoders. 7446A, 74L46, 7447 and 74LS47 are decoders/drivers for
common -anode type seven segment displays.
In this experiment we use 7447 decoders for common -anode type seven segment displays.

PIN DIAGRAM OF IC 7447

CALCULATION:
To display a number 0 using single 7 segment display

PA 7
(DOT)

PA 6

PA4

PA3

PA2

PA1

(g)

PA5
(f)

(e)

(d)

(c)

(b)

PA0
(a)

By using the data CO we can display 0 in the 7-segement display


using a peripheral program interface (IC 8255) from microprocessor.

By this method we can display any number from 0 to 9 as shown in


the below table.
Count PA7
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1

PA6
1
1
0
0
0
0
0
1
0
0

PA5
0
1
0
1
0
0
0
1
0
0

PA4
0
1
0
1
1
1
0
1
0
1

PA3
0
1
0
0
1
0
0
1
0
1

PA2
0
0
1
0
0
0
0
0
0
0

PA1
0
0
0
0
0
1
1
0
0
0

PA0
0
1
0
0
1
0
0
0
0
0

DATA
C0
F9
A4
B0
99
92
82
F8
80
98

PROGRAM TO DISPLAY FROM 0-9:


Memory
Location
4300

Machine
code
3E,80

Label

Mnemonics

Comment

MVI A, 80

Initialize all ports of 8255


in output mode
Move the control word to
control register
Initialize HL register pair
with 4200
Initialize B register with a
count
Move the memory
contents to accumulator
Move the data to Port A
Call delay sub-routine
Increment memory
pointer
Decrement B register
Jump on no zero to loop1
Jump to loop2
Move data 02 to C
register
Load D register pair with
FA00
Decrement DE register
pair
Move contents of e
register to accumulator.
OR the contents of Dregister with accumulator.
Jump on no zero to loop 3
Decrement C-register
content
Jump on no zero to loop4
Return to main program.

4302

D3,0F

4304

21,00,42

4307

06,0A

4309

7E

430A
430C
430F

D3,0C
CD,17,43
23

OUT 0C
CALL Delay
INX H

4310
4311
4314
4317

05
C2,09,43
C3,04,43
0E,02

Delay

DCR B
JNZ Loop1
JMP Loop2
MVI C, 02

4319

11,00,FA

Loop4

LXI D, FA00

431C

1B

Loop3

DCX D

431D

7B

MOV A,E

431E

B2

ORA D

431F
4322

C2,1C,43
0D

JNZ Loop3
DCR C

4323
4326

C2,19,43
C9

JNZ Loop4
RET

OUT 0F
Loop 2

LXI H,4200
MVI B,0A

Loop 1

MOV A,M

CIRCUIT DIAGRAM TO DISPLAY 00-99

PROGRAM TO DISPLAY 00-99:


Memory
Location
4300

Machine code

Label

Mnemonics

Comment

3E,80

MVI A,80

4302

D3,0F

OUT 0F

4304
4306
4308
430B

3E,00
D3,0C
CD,15,43
3C

430C

27

DAA

430D

FE,00

CPI 00

430F

C2,06,43

JNZ Loop1

4312
4315

C3,04,43
06,FF

Move the data to


accumulator
Move the data to control
register
Move 00 to accumulator
Move data to Port A
Call delay program
Increment accumulator
content
Decimal adjust
accumulator
Compare immediate with
00
Jump on no zero to
loop1
Jump to loop2
Move data FF to B
register

Loop 2 MVI A ,00


Loop1 OUT 0C
CALL Delay
INR A

Delay

JMP Loop2
MVI B,FF

4317

0E,FF

Loop3

MVI C,FF

4319
431A

OD
C2,19,43

Loop4

DCR C
JNZ Loop4

431D
431E

05
C2,17,43

DCR B
JNZ Loop3

4321

C9

RET

Move data FF to C
register
Decrement C register
Jump on no zero to
loop4
Decrement B register
Jump on no zero to loop
3
Return to main program.

Result:
Thus 7-segment LED display is interfaced with 8085 microprocessor kit using 8085 and
assembly language programs are written
i) To display the numbers from 0 to 9.
ii) To display the numbers from 00 to 99.

7b) GENERATION OF A SQUAREWAVE AND RECTANGULAR WAVE


Aim: To generate a square wave of 1 KHz frequency and a rectangular wave form of
1Khz frequency with 60% duty cycle.
APPARATUS REQUIRED:
1)8085 microprocessor kit.
2) CRO, CRO probes
Theory: The square wave form of any frequency can be generated by sending bits 0 and 1
alternately with equal time delay on data bus. The port A of 8255 (PPI) can be used in output
mode and one of the port A pins can be made high and low consecutively with a delay of 0.5msec
to generate a square wave of frequency 1KHz. For that the data 00H and 01H have to be sent to
PA0 with the required delay. Suppose if we want to generate square wave on all pins of port A
then the data 00H and FFH have to sent with the calculated delay.
The delay calculation: To generate a square wave of frequency 1KHz, the delay time required
is equal to 0.5msec.
The delay program is as shown below.
MVI B, Count
LOOP
DCR B
JNZ LOOP
RET
The approximate delay = 14N0.3310-6 =0.510-3
N=108=(6C)16

PROGRAM
Memory Machine code
Location
4300
3E,80
4302

D3,0F

4304
4306
4308
430B
430D
430F
4312
4315
4317
4318
431B

3E,FF
D3,0C
CD,15,43
3E,00
D3, 0C
CD,15,43
C3,04,43
06,6C
05
C3,17,43
C9

Label

Mnemonics
MVI A,80

Comment

Move the data to


accumulator
OUT 0F
Move the data to control
register
LOOP MVI A ,FF
Move FF to accumulator
OUT 0C
Move data to Port A
CALL Delay Call delay program
MVI A ,00
Move 00 to accumulator
OUT 0C
Move data to Port A
CALL Delay Call delay program
JMP LOOP Jump to loop
Delay
MVI B,6C
Load count
LOOP1 DCR B
Decrement B
JNZ LOOP1 If not zero jump to loop1
RET
return

Rectangular waveform
Theory: The rectangular waveform of frequency 1 KHz with 60% duty cycle can be generated by
sending logic 1 and logic 0 for a delay of 0.6msec and 0.4msec respectively on the selected port
pin. The port A of 8255 (PPI) can be used in output mode and one of the port A pins can be made
high and low consecutively with a delay of 0.6msec and 0.4msec to generate a rectangular
waveform of frequency 1KHz. For that the data 00H and 01H have to be sent to PA0 with the
required delay..
The delay calculation: To generate a delay of 0.6msec.
The delay program is as shown below.
MVI B, Count
LOOP
DCR B
JNZ LOOP
RET
The approximate delay = 14N10.3310-6 =0.610-3
N1=130=(82)16

Foe a delay of 0.4msec


14N20.3310-6 =0.410-3
N2=87=(57)16

PROGRAM
Memory Machine
Location code
4300
3E,80
4302

D3,0F

4304
4306
4308
430B
430D
430F
4312
4315
4317
4318
431B
431C
431E
431F
4322

3E,FF
D3,0C
CD,15,43
3E,00
D3, 0C
CD,15,43
C3,04,43
06,82
05
C3,17,43
C9
06,57
05
C3,1E,43
C9

Label

Mnemonics

Comment

MVI A,80

Move the data to


accumulator
Move the data to control
register
Move FF to accumulator
Move data to Port A
Call delay program
Move 00 to accumulator
Move data to Port A
Call delay program
Jump to loop
Load count
Decrement B
If not zero jump to loop1
return
Load count
Decrement B
If not zero jump to loop2
return

OUT 0F
LOOP

DELAY1
LOOP1
DELAY2
LOOP2

MVI A ,FF
OUT 0C
CALL Delay1
MVI A ,00
OUT 0C
CALL Delay2
JMP LOOP
MVI B,82
DCR B
JNZ LOOP1
RET
MVI B,57
DCR B
JNZ LOOP2
RET

Result: Thus assembly language programs were written to generate square and rectangular
waveforms and tested.

You might also like