0% found this document useful (0 votes)
59 views

7-Segment Display Interface - Display Messages Fire and Help

This program interfaces with a 7-segment display to display the messages "FIRE" and "HELP". It initializes the ports for the display, then calls a procedure to display each character string by sending the correct bits to light up the appropriate segments. It repeats this display in a loop, waiting after each string, so the messages are shown alternately until any key is pressed to exit.

Uploaded by

anand_gudnavar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

7-Segment Display Interface - Display Messages Fire and Help

This program interfaces with a 7-segment display to display the messages "FIRE" and "HELP". It initializes the ports for the display, then calls a procedure to display each character string by sending the correct bits to light up the appropriate segments. It repeats this display in a loop, waiting after each string, so the messages are shown alternately until any key is pressed to exit.

Uploaded by

anand_gudnavar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

7-SEGMENT DISPLAY INTERFACE - DISPLAY MESSAGES FIRE AND HELP.

.MODEL SMALL
.DATA
PA EQU 0CD00H ; Port address for ESA Module.
PB EQU 0CD01H
PC EQU 0CD02H
CR EQU 0CD03H
CW DB 80H ; Port-B Out, Port-C Out, Mode 0 I/O.
MSG1 DB 13,10,"7-SEGMENT DISPLAY INTERFACE - DISPLAY MESSAGES
FIRE AND HELP...",'$'
MSG2 DB 13,10,"Press any key to Exit.$"
STR1 DB 8EH, 0F9H, 0AFH, 86H ; F I r E
STR2 DB 89H, 86H, 0C7H, 8CH ; H E L P

.CODE
START: MOV AX, @DATA
MOV DS, AX

LEA DX, MSG1 ; To display MSG1.


MOV AH, 09H
INT 21H
LEA DX, MSG2 ; To display MSG2.
INT 21H

MOV AL, CW
MOV DX, CR
OUT DX, AL

AGAIN: LEA SI,


STR1 ; Get base address of STR1(FlrE},
CALL DISP_STR ; to display string on SSD.
CALL DELAY ; Wait.
LEA SI, STR2 ; Get base address of STR2(HELP),
CALL DISP_STR ; to display message on SSD.
CALL DELAY ; Wait

MOV AH, 1 ; Press any key to exit.


INT 16H
JZ AGAIN
MOV AH, 4CH ; Terminate.
INT 21H

DISP_STR PROC ; Procedure to display strings.


DISP_STR PROC ; Procedure to display strings.
MOV CX, 4 ; Total number of characters per string.
NCHAR: MOV BL, 8 ; Total number of bits in SSC.
MOV AL, [SI] ; Get the first SSC.
NXTBIT: ROL AL, 1 ; Bring B7 to B0, i.e., B6B5B4B3B2B1B0B7.
MOV DX, PB
OUT DX, AL ; Send bit (0/1) through PB0.
PUSH AX
MOV AL, 00H ; For Clock.
MOV DX, PC
OUT DX, AL ; Send bit 0 through PC0.
MOV AL, 01H ; Send bit 1 through PC0.
MOV DX, PC
OUT DX, AL
POP AX
DEC BL ; Reduce bits counter.
JNZ NXTBIT ; Is counter =0? If no, repeat.
INC SI ; Update pointer.
LOOP NCHAR ; Repeat till CX=0.
RET
DISP_STR ENDP

DELAY PROC ; Procedure for delay.


MOV BX, 011FFH ; Outer counter.
B2: MOV CX, 0FFFFH ; Inner counter.
B1: LOOP B1 ; Repeat till inner counter = 0.
DEC BX
JNZ B2 ; Repeat till outer counter = 0.
RET
DELAY ENDP
END START

.model small

.stack 20

.data

base_address equ 20c0h

control equ base_address+03h ;control port

porta equ base_address+00h ;porta address


portb equ base_address+01h ;portb address

portc equ base_address+02h ;portc address

blanks db 0,0,0,0,0,0

fire db 0,0,79h,50h,06h,71h

help db 73h,38h,79h,76h,0,0

.code

start:

mov ax,@data

mov ds,ax

mov al,80h

mov dx,control

out dx,al

;----------display fire ---------------------------------------

up: mov di,150

fir: mov si,offset fire

call display

dec di

jnz fir

;----------display blank -------------------------------------

mov di,300

blnk: mov si,offset blanks


call display

dec di

jnz blnk

;----------display help ---------------------------------------

mov di,150

hlp: mov si,offset help

call display

dec di

jnz hlp

;----------display blank -------------------------------------

mov di,300

blnk1: mov si,offset blanks

call display

dec di

jnz blnk1

;----------keep looping till any key is pressed-----------

mov ah,0bh

int 21h

or al,al

jz up

;----------terminate-------------------------------------------
mov ah,4ch

int 21h

display proc

mov dx,portc

mov al,07h

out dx,al

mov cx,06h

mov bl,00h

select:

mov al,bl

mov dx,portc

out dx,al

mov dx,porta

lodsb

out dx,al

call delay

inc bl

cmp bl,05

jle down

mov bl,00

down:
loop select

ret

display endp

delay proc

push bx

push cx

mov cx,0ffh

up1: mov bx,0fffh

up2: dec bx

jnz up2

loop up1

pop cx

pop bx

ret

delay endp

You might also like