Question 6.10: Read and test P1 to see whether it has the value 45H. If it ...

Read and test P1 to see whether it has the value 45H. If it does, send 99H to P2; otherwise, it stays cleared.

The blue check mark means that this solution has been answered and checked by an expert. This guarantees that the final answer is accurate.
Learn more on how we answer questions.

MOV    P2,#00        ;clear P2
MOV    P1,#0FFH   ;make P1 an input port
MOV    R3,#45H     ;R3=45H
MOV    A,P1             ;read P1
XRL^{\nearrow ^{\fbox{XRL can be used to see if two registers have the same value } } }     A,R3
JNZ^{\nearrow ^{\fbox{If both registers have the same value, 00 is placed in A. JNZ and JZ test the contents of the accumulator. } } }     EXIT            ;jump if A is not 0
MOV   P2,#99H

EXIT:           . . .

Related Answered Questions

Question: 6.8

Verified Answer:

1.     0011 0100        34H given in binary 2.    ...
Question: 6.15

Verified Answer:

MOV   R1,#0             ;R1 keeps number of 1s MOV...
Question: 6.13

Verified Answer:

MOV    R5,#8 AGAIN:         MOV   C,P2.7         ;...