Q. A microprocessor based temperature control system is shown below. The light detectors
receive the light when reflected by the mercury level in the thermometer and sends ‘1’ to
the input port (30H). Depending on the input signal the microprocessor is to operate the
fan, heater or the indicators. The fan is to operate for temperature above 20 degree, with
different speed, depending upon the temperature level. The microprocessor is to operate
the resistances accordingly. The heater is to be operated below 16 degree with the heating
coils being on depending on temperature. If the temperature is in the range of 16 to 20
degrees both the fan and heater is to be put off and the Green LED is turned ON. If the
temperature is below 4 degree or above 28 degree the Red LED is to be turned ON with
fan or heater. Write a program for the proper operation of the system and explain the
execution flow.
soln
The Program gets input from the input port depending on the temperature, compares with the
predefined data for different temperature and sends the corresponding data out as shown in
the above table.
START: IN 30H
MOV B, A
SUI 01H
JNZ LABEL1
MVI A, 0FH
OUT 31H
JMP START
LABEL1: MOV A, B
SUI 02H
JNZ LABEL2
MVI A, 03H
OUT 31H
JMP START
LABEL2: MOV A, B
SUI 04H
JNZ LABEL3
MVI A, 01H
OUT 31H
JMP START
LABEL3: MOV A, B
SUI 08H
JNZ LABEL4
MVI A, 10H
OUT 31H
JMP START
LABEL4: MOV A, B
SUI 10H
JNZ LABEL5
MVI A, 10H
OUT 31H
JMP START
LABEL5: MOV A, B
SUI 20H
JNZ LABEL6
MVI A, 20H
OUT 31H
JMP START
LABEL6: MOV A, B
SUI 40H
JNZ LABEL7
MVI A, 60H
OUT 31H
JMP START
LABEL7: MOV A, B
SUI 80H
JNZ LABEL8
MVI A, E4H
OUT 31H
LABEL8: JMP START
receive the light when reflected by the mercury level in the thermometer and sends ‘1’ to
the input port (30H). Depending on the input signal the microprocessor is to operate the
fan, heater or the indicators. The fan is to operate for temperature above 20 degree, with
different speed, depending upon the temperature level. The microprocessor is to operate
the resistances accordingly. The heater is to be operated below 16 degree with the heating
coils being on depending on temperature. If the temperature is in the range of 16 to 20
degrees both the fan and heater is to be put off and the Green LED is turned ON. If the
temperature is below 4 degree or above 28 degree the Red LED is to be turned ON with
fan or heater. Write a program for the proper operation of the system and explain the
execution flow.
soln
The Program gets input from the input port depending on the temperature, compares with the
predefined data for different temperature and sends the corresponding data out as shown in
the above table.
START: IN 30H
MOV B, A
SUI 01H
JNZ LABEL1
MVI A, 0FH
OUT 31H
JMP START
LABEL1: MOV A, B
SUI 02H
JNZ LABEL2
MVI A, 03H
OUT 31H
JMP START
LABEL2: MOV A, B
SUI 04H
JNZ LABEL3
MVI A, 01H
OUT 31H
JMP START
LABEL3: MOV A, B
SUI 08H
JNZ LABEL4
MVI A, 10H
OUT 31H
JMP START
LABEL4: MOV A, B
SUI 10H
JNZ LABEL5
MVI A, 10H
OUT 31H
JMP START
LABEL5: MOV A, B
SUI 20H
JNZ LABEL6
MVI A, 20H
OUT 31H
JMP START
LABEL6: MOV A, B
SUI 40H
JNZ LABEL7
MVI A, 60H
OUT 31H
JMP START
LABEL7: MOV A, B
SUI 80H
JNZ LABEL8
MVI A, E4H
OUT 31H
LABEL8: JMP START
Comments
Post a Comment