Question

Given with the code of an 8051, how does a JZ instruction work? Why is it...

Given with the code of an 8051, how does a JZ instruction work? Why is it essential to add CPL A before and after the JZ instruction?

ORG 0000H
MAIN:
CLR A


INPUT:
CALL DELAY
MOV A, P2

CPL A ; complement the content of the register Accumulator
JZ INPUT ; jump to INPUT if no switch is pressed
CPL A; complement the content of the register Accumulator

MOV P1, A


CALL ROTATE


ROTATE:
RL A
MOV P1, A
CALL ROT
DELAY:
MOV R0, #0FH
L1: MOV R1, #01H
L2: MOV R2, #01H
DJNZ R1
DJNZ R0,
RET
END

Homework Answers

Answer #1

JZ what it does is the program control will jump to a specified address pointed by the Label if the Accumulator is zero.

Here CPL A is added before and after the JZ instruction because JZ instruction works with the Accumulator register and here we need to jump if no switch is pressed. That is when P2 is 1 therefore if we complement the Accumuator after moving the content of the P2 to A then that means whenever P2 is 1 then do the jump otherwise dont perform Jump.

To Retain the old value of Accumulator CPLA is again done after the JZ instruction.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Suppose that people's heights (in centimeters) are normally distributed, with a mean of 170 and a...
    asked 2 minutes ago
  • Use the information from the following Income Statement to create and Projected Income Statement and solve...
    asked 15 minutes ago
  • An unequal tangent vertical curve has the following elements: g1=-3.25%, g2=75%, total length = 500.00’, length...
    asked 17 minutes ago
  • Please write clear definitions of the following legal terms. Commerce Clause Supremacy Clause Indictment Tort
    asked 22 minutes ago
  • Do you think Moralistic Therapeutic Deism is an accurate reflection of society today? What are relevant...
    asked 26 minutes ago
  • The mean operating cost of a 737 airplane is $2,071 per day. Suppose you take a...
    asked 35 minutes ago
  • Arguments can be made on both sides of this debate about the ethical implications of using...
    asked 41 minutes ago
  • In the Chapter, they mention the idea of strategizing around your cash flows. Why are cash...
    asked 46 minutes ago
  • Company A signed a fixed-price $6,500,000 contract to construct a building. At the end of Year...
    asked 47 minutes ago
  • An unequal tangent vertical curve has the following elements: g1=-3.25%, g2=1.75%, total length = 500.00’, length...
    asked 54 minutes ago
  • In a previous​ year, 61​% of females aged 15 and older lived alone. A sociologist tests...
    asked 1 hour ago
  • Topic: Construction - Subsurface Investigation (Note: Briefly discuss in your own words, 1 paragraph minimum.) Typically...
    asked 1 hour ago