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:
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.
7 segment display is activated by sending control word to it. (normal procedure)
Message M1 is printed on the screen using LEA and 09H.
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).
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.
Pressed or not, is determined by checking zero flag after INT 16H with AH equals to 1.
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.
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 SMALLOne data one code segment.
.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
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.
.CODECode segment. Data segment is initialized.
MOV AX,@DATA
MOV DS,AX
MOV AL,CW
MOV DX,CR
OUT DX,AL
LEA DX,M1
MOV AH,09H
INT 21H
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,TAB1START is a label.
MOV CX,12
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]NXT_CHAR is a label.
CALL DISP_CHAR
CALL DELAY
CALL KBHIT
INC SI
LOOP NXT_CHAR
JMP START
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 PROCKBHIT procedure will check if user entered a button during execution and if pressed, will terminate the code using AH,4CH. Otherwise continue.
MOV AH,1
INT 16H
JNZ EXIT
RET
EXIT:MOV AH,4CH
INT 21H
KBHIT ENDP
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.
Share your views about this article!