5b. Display a text on a 7 segment interface in a rolling fashion

vtu mp 5b
Q)  Assume any suitable message of 12 characters length and display it in the rolling fashion on a 7 segment display interface for a suitable period of time. Ensure a flashing rate that makes it easy to read both the messages (Examiner does not specify these delay values nor it is necessary for the student to compute these values). 
This program will display a 12 character length message on a 7 segment display with a rolling fashion with a suitable delay between the roll. (just like the location’s name moving on a Volvo bus)

Algorithm:
Step 1: Connect Multiplex seven segment interface to PC.
Step 2: Set the 8255 using control word, initialize the control word ie., 80H
Step 3: Store the control word in the Control register.
Step 4: Point the SI to 12 character message and call display procedure.
Step 5: Display each character in the 7 segment display.
Step 7: Stop

CODE:

Explanation:
.MODEL SMALL
.DATA
PA EQU 0e800H
PB EQU 0e801H
PC EQU 0e802H
CR EQU 0e803H
CW DB 80H
M1 DB 10,13,"PRESS ANY KEY TO EXIT$"
TAB1 DB 0ffh,0FfH,0ffH,91H,88H,0A1H,0FFH,91H,8ch,8cH,88H,89h,0ffh,0ffh,0ffh
One data one code segment.
Data segment contains port addresses, control word and 7 segment equivalent of the Message “   HAPPY DAY   “.
Learn how to create a 7 segment equivalent code of a character by clicking here.

.CODE
MOV AX,@DATA
MOV DS,AX
MOV AL,CW
MOV DX,CR
OUT DX,AL
LEA DX,M1
MOV AH,09H
INT 21H
Code segment. Data segment is initialized.
7 segment display is activated by sending control word to it. (normal procedure)
Message M1 is printed on the screen using LEA and 09H.

START:LEA SI,TAB1
MOV CX,12
START is a label.
Offset address of TAB1 table is loaded to SI (points to first character in TAB1).
Counter variable CX is assigned with 12. (indicating 12 characters are to be displayed for one rolling display on the 7 segment).

NXT_CHAR:MOV AL,[SI]
CALL DISP_CHAR
CALL DELAY
CALL KBHIT
INC SI
LOOP NXT_CHAR
JMP START
NXT_CHAR is a label.
SI content is moved to AL for display purpose.
CALL DISP_CHAR displays the character.
CALL KBHIT is for checking whether user entered a button. If pressed, you need to terminate. Otherwise continue execution.
Continue in the sense, increase SI to point to next character to be displayed and LOOP back to NXT_CHAR. (this will run 12 times, since CX is 12).

After 12 times iteration, you need the message to be printing again in the rolling fashion. Again jump to START unconditionally and display the same message again and again until user enters a character.

KBHIT PROC
MOV AH,1
INT 16H
JNZ EXIT
RET
EXIT:MOV AH,4CH
INT 21H
KBHIT ENDP
KBHIT procedure will check if user entered a button during execution and if pressed, will terminate the code using AH,4CH. Otherwise continue.
Pressed or not, is determined by checking zero flag after INT 16H with AH equals to 1.

DISP_CHAR PROC
MOV BL,8
NXT_BIT:ROL AL,1
MOV DX,PB
OUT DX,AL
PUSH AX
MOV AL,00H
MOV DX,PC
OUT DX,AL
MOV AL,11H
OUT DX,AL
POP AX
DEC BL
JNZ NXT_BIT
RET
DISP_CHAR ENDP

DISP_CHAR procedure working is same as displaying a character on 7 segment value on 7 segment display. (visit here to learn about the same).

DELAY PROC
PUSH CX
PUSH BX
MOV CX,0FFFFH
N3:MOV BX,0FFfFH
N4:DEC BX
    JNZ N4
    LOOP N3
    POP BX
    POP CX
    RET
DELAY ENDP
END

Delay procedure is the same.
Next is the end of the code.

Output:
Seen in 7 segment display.

He is a simple passionate tech freak who himself is an engineering student at Canara Engineering college. He likes App Development, Web designing, Blogging, Youtubing, Debugging and also is a CodeGeek!

Sharing is sexy!

Related Articles

Share your views about this article!