New York, NY IMG HI 58° LO 56° Home About Contact
IMG-LOGO
Home Electrical and Electronics Microprocessor & Interfacing Write an assembly language program to interface 7 segment display with 8051 Microcontroller.
Microprocessor & Interfacing Lab Experiments

Write an assembly language program to interface 7 segment display with 8051 Microcontroller.



Aim

Write an assembly language program to interface 7 segment display with 8051 Microcontroller.

Apparatus

  1. 8051 micro controller kit.
  2. PC for connecting the DYNA51 kit
  3. Keil-U-Vision software for compilation of program.
  4. 7 segment HEX PIO CARD for DYNA51.

Procedure:

  1. Connect port-2(J2) of 7-segment display to PORT-1(J2) of Dyna51EB & port-1(J1) of 7-segment display to PORT-2(J3) of Dyna-51EB.
  2. Download the program (seginterface.hex) through flash magic & observe the output on 7segment display.

Program:

Seven Segment 8-Digit Common Anode Display

CPU "8051.TBL" ;Processor declaration HOF

"INT8" ;Intel 8-bit hexcode

ZERO: EQU 3fH ONE:

EQU 06H TWO: EQU

5bH THREE: EQU 4fH

FOUR: EQU 66H FIVE:

EQU 6dH SIX: EQU 7dH

SEVEN: EQU 07H

EIGHT: EQU 7fH NINE:

EQU 0e7H ;DOT: EQU

7FH adata: equ 77h

bdata: equ 7ch

cdata: equ 39h

ddata: equ 5eh

edata: equ 79h

fdata: equ 71h

seg_port: equ 0a0h ; port p2

digit_port: equ 90h ; port p1

again: lcall adconver

ORG 0000H

MOV seg_port,#00H

mov digit_port,#0ffh

mov a,#0feh

LOOP: mov digit_port,a

MOV seg_port,#ZERO

CALL DELAYS

MOV seg_port,#ONE

CALL DELAYS

MOV seg_port,#TWO

CALL DELAYS

MOV seg_port,#THREE

CALL DELAYS

MOV seg_port,#FOUR

CALL DELAYS

MOV seg_port,#FIVE

CALL DELAYS

MOV seg_port,#SIX

CALL DELAYS

MOV seg_port,#SEVEN

CALL DELAYS

MOV seg_port,#EIGHT

CALL DELAYS

MOV seg_port,#NINE

CALL DELAYS

;MOV seg_port,#DOT

;CALL DELAYS

MOV seg_port,#adata

CALL DELAYS

MOV seg_port,#bdata

CALL DELAYS

MOV seg_port,#cdata

CALL DELAYS

MOV seg_port,#ddata

CALL DELAYS

MOV seg_port,#edata

CALL DELAYS

MOV seg_port,#fdata

CALL DELAYS

rl a

AJMP loop

DELAYS:

MOV R5,#2 ;200ms delay

D1:

CALL DELAY

DJNZ R5,D1

RET

DELAY: ;100ms DELAY

MOV R7,#200

D2:

MOV R6,#100

D3:

NOP

NOP

NOP

DJNZ R6,D3

DJNZ R7,D2

RET

end


Result:The desired character will be displayed of 7-segment display