Q. Clothes are normally hung outside to dry in the sun. There are possibilities of clothes being wet
when there is a rainfall. The system as shown below is used to put clothes inside the house when
there is a rain. The rain detector sends a high signal to the pin D0 of the input port 30H when
there is rainfall. The microprocessor then rotates the string on which the clothes are hung. The
string is rotated by sending a ‘10’ to pins D0 and D1 of the output port 40H to which a DC motor
is connected. The string is rotated until the limit switch1 sends a high signal to pin D7 of the input
port 30H. Also if the rainfall stops the cloth is send out by rotating the DC motor in the other
direction. ‘01’ is to be send to pins D0 and D1 of output port 40H for this operation. The motor is
rotated until the limit switch2 send a high signal to pin D6 of the input port 30H. Write a program
for the proper operation of the system.
soln
The Program gets input from the input port depending on the rain status and condition
of limit switches, compares with the predefined data for possible input situations, and
sends the corresponding data out as shown in the above table.
START: IN 30H ; get input from sensors
ANI C1H ; mask the other bit than sensor positions
CPI 40H ; check if the cloth is out without rain
JZ END ; if yes motor off
CPI 41H ; else check if the cloth out and there is rain
JNZ LABEL2 ; if no check for other case
LABEL1: MVI A, 02H ; else rotate the clothes inside the house
OUT 40H
IN 30H ; get input from sensors again
ANI 80H ; check if all the clothes are inside the house
JZ LABEL1 ; if no continue to rotate the string
LABEL2: CPI 81H ; else check if clothes are in, and there is rain
JZ END ; if yes motor off
CPI 80H ; else check if clothes are in, and there is no rain
JNZ END ; if no turn off the motor
LABEL3: MVI A, 01H ; else rotate the clothes outside the house
OUT 40H
IN 30H ; get input from sensors again
ANI 40H ; check if all clothes are outside the house
JZ LABEL3 ; if no continue to rotate the string
END: MVI A, 00H ; else turn off the motor
OUT 40H
JMP START ; repeat the task
when there is a rainfall. The system as shown below is used to put clothes inside the house when
there is a rain. The rain detector sends a high signal to the pin D0 of the input port 30H when
there is rainfall. The microprocessor then rotates the string on which the clothes are hung. The
string is rotated by sending a ‘10’ to pins D0 and D1 of the output port 40H to which a DC motor
is connected. The string is rotated until the limit switch1 sends a high signal to pin D7 of the input
port 30H. Also if the rainfall stops the cloth is send out by rotating the DC motor in the other
direction. ‘01’ is to be send to pins D0 and D1 of output port 40H for this operation. The motor is
rotated until the limit switch2 send a high signal to pin D6 of the input port 30H. Write a program
for the proper operation of the system.
soln
The Program gets input from the input port depending on the rain status and condition
of limit switches, compares with the predefined data for possible input situations, and
sends the corresponding data out as shown in the above table.
START: IN 30H ; get input from sensors
ANI C1H ; mask the other bit than sensor positions
CPI 40H ; check if the cloth is out without rain
JZ END ; if yes motor off
CPI 41H ; else check if the cloth out and there is rain
JNZ LABEL2 ; if no check for other case
LABEL1: MVI A, 02H ; else rotate the clothes inside the house
OUT 40H
IN 30H ; get input from sensors again
ANI 80H ; check if all the clothes are inside the house
JZ LABEL1 ; if no continue to rotate the string
LABEL2: CPI 81H ; else check if clothes are in, and there is rain
JZ END ; if yes motor off
CPI 80H ; else check if clothes are in, and there is no rain
JNZ END ; if no turn off the motor
LABEL3: MVI A, 01H ; else rotate the clothes outside the house
OUT 40H
IN 30H ; get input from sensors again
ANI 40H ; check if all clothes are outside the house
JZ LABEL3 ; if no continue to rotate the string
END: MVI A, 00H ; else turn off the motor
OUT 40H
JMP START ; repeat the task
Comments
Post a Comment