4b. 'FIRE' and 'HELP' displaying with flickering effect

vtu mp 4b
Q) Display messages FIRE and HELP alternatively with flickering effects 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 the messages ‘FIRE’ and ‘HELP’ on a 7 segment display with a flickering effect with some delay between each message flickering.
Algorithm:
Step 1: Connect Multiplex seven segment interface to PC.
Step 2: Set the 8255 using control word, initialize the control word i.e., 80H
Step 3: Store the control word in the Control register.
Step 4: Point the SI to FIRE and call display procedure.
Step 5: Display Procedure:
i) Initialize the counter to 4 to display 4 digit seven segment number.
ii) Move the contents of pointer to AL(which points to FIRE and HELP).
iii) Initialize Port A address and load the string byte to display on the seven segment display and the pointer automatically increments to point to the next character (in the FIRE and HELP).
iv) Introduce some delay between each display and enable next digit D2 and so on until all the digits from D1 to D4 is displayed.
Step 6: Point the SI to HELP and call display procedure
Step 7: Repeat from Step5 to Step8.
Step 8: To stop the display use service number 06H with DL content as 0FFH.
Step 9: Stop.

CODE:


Explanation: 
.MODEL SMALL
.DATA
PA EQU 0e800H
PB EQU 0e801H
PC EQU 0e802H
CR EQU 0e803H
CW DB 80H
MSG DB "PRESS ANY KEY TO EXIT$"
M1 DB 086H,88H,0f9H,8EH
M2 DB 8CH,0C7H,86H,89H
One data and one code segment.
Data part contains port addresses, control word and ASCII info of messages ‘FIRE’ and ‘HELP’.
If you do not know how to convert a character to its 7 segment format, visit "MP H/W basics page" to know it.
.CODE
MOV AX,@DATA
MOV DS,AX
MOV AL,CW
MOV DX,CR
OUT DX,AL
LEA DX,MSG
MOV AH,09H
INT 21H
Code segment.
Initialization of data segment (line 2,3)
Activating Controllers by activating control word.
MSG “PRESS ANY KEY TO EXIT” is displayed using LEA and 09H service.

START:
LEA SI,M1
CALL DISP_MSG
CALL DELAY
LEA SI,M2
CALL DISP_MSG
CALL DELAY
MOV AH,01H
INT 16H
JZ START
MOV AH,4CH
INT 21H

START is a label.
Load M1 into SI. That is the message “FIRE”.
CALL DISP_MSG to display FIRE in the 7 segment display.
Call some delay.
Load M2 into SI. That is the message “HELP”.
CALL DISP_MSG to display HELP in the 7 segment display.

MOV AH,01H with INT 16H will determine if you pressed a button during execution and if you pressed, it will set zero flag to 0.
If zero flag is set to 1, it means no button was pressed. So continue to display “FIRE” and “HELP” again by jumping to START label.
Otherwise terminate the program.
DISP_MSG PROC
MOV CX,4
NXT_CHAR:MOV BL,8
MOV AL,[SI]
NXT_BIT:ROL AL,1
    MOV DX,PB
    OUT DX,AL
    PUSH AX
    MOV AL,00H
    MOV DX,PC
    OUT DX,AL
    MOV DX,PC
    MOV AL,11H
    OUT DX,AL
    POP AX
    DEC BL
    JNZ NXT_BIT
    INC SI
    LOOP NXT_CHAR
    RET
DISP_MSG ENDP
Displaying a Message of N length(CX will hold the length, in this case 4 is the CX value.) in a 7 segment display is repeated in many experiments. So i have written about this in a universal article “ Microprocessor H/W basics”. Visit this post to learn more 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 old one.
END ends the code.

Output:
Seen in logic controller.

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!