Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(C) Change the program for the 50% duty cycle by inserting a minimum number of N

ID: 1766147 • Letter: #

Question

(C) Change the program for the 50% duty cycle by inserting a minimum number of NOP instructions. For this case, the period will change. Show the complete program. (5 pts.) (5) Describe what the following program accomplishes. (6) Write a sequence of instructions to Then, show the direct addressing version of the program. implement the following: (10pts) (Your program must be functionally equivalent to the original.) (12pts.) IF (content of 55H) = positive THEN Execute "SETB P1.0" ELSE Execute "CPL C" MOV R1, #55H MOV A, @RI INC R1 INC R1 ADD A, @RI INC R1 INC R1 INC R1 MOV @Ri, A

Explanation / Answer

Q 5. Register R1 is initialized with hex 55.

Contents of memory location 55H is moved into accumulator A. (R1 is acting like memory pointer)

Register R1 contents incremented twice. R1 = #57H

Contents of hex 57 memory location is added to accumulator. Hence Memory locations 55H & 57H contents

are added into accumulator.

Register R1 is icremented thrice to 60H.

Sum of memory locations 55H & 57H contents available in accumulator is moved into memory location 60H.

Q 6.

MOV A, 55H

ANL A, #7FH ; check sign bit by masking

JZ NEXT    ; if positive then jump to label NEXT (Memory location indicated by label NEXT)

CPL C    ; if negative

SJMP END

NEXT SETB P1.0

END SJMP END