Digital Electronics - The 8051 Microcontroller - Discussion

Discussion Forum : The 8051 Microcontroller - General Questions (Q.No. 2)
2.
This program code will be executed continuously:
STAT: MOV A, #01H
 JNZ STAT
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
18 comments Page 1 of 2.

Ramesh Maddara said:   6 years ago
8051:

It doesn't have Z flag. Accumulator value is checked for Zero or non-Zero.

In this case, 0x01 is non-Zero and hence loop continues forever.

The answer is TRUE.

8085: Same instructions in 8085 works differently since it has Z flag which affects for Arithmetic or Logical Operations.

No flags are affected for a data transfer since it doesn't happen inside the ALU, and hence the value of Zero Flag depends on the previous Arithmetic or Logic instruction which is not known here, so let us assume Z flag = 1 on reset.

Right Answer in case of 8085: Unknown (FALSE may be the best answer if we consider the given TRUE/FALSE choices).

Vikram said:   1 decade ago
First instruction copies the immediate data 01h to A (no flag is effected) , second instruction compares the content of carry flag with zero if it is not equal to zero then it becomes infinite loop otherwise it executes next instruction.

Kishor said:   6 years ago
Agree @Anamika.

Zero flags won't be affected & hence JNZ condition will fail & loop should terminate. Since MOV A, #01 is a data transfer instruction & as we know data transfer instructions do not affect flags.

Shruti said:   1 decade ago
#01 signifies value..that means 1 is been stored in accumulator..JNZ means jump if not zero. as accumlator has value 1..this process will continue with execution whenevr it checks the condition.

Ramu said:   1 decade ago
jNZ instruction checks the Contents of Accumulator(A) register.
it's value is greater than zero every time... because it is not decrmenting. So, the loop will infinitely repeats...

Vishnu said:   1 decade ago
JNZ instruction checks the Contents of Accumulator(A) register.
it's value is greater than zero every time... because it is not decrmenting. So, the loop will infinitely repeats...

Mahi.. said:   1 decade ago
# represents immediate addressing to A. #01 is an imediate value to A..JNZ jump if not zero will satisfy the condition and continuopusly jmps to stat flag.. its a loop.

Anamika dadhich said:   1 decade ago
How is this possible?

Jmp instructions does not work after data transfer instruction. Then how will the loop run infinitely?

Nayan said:   7 years ago
JNZ is jump if accumulator is not zero.

Here accumulator contain non-zero value, so it will be a continuous loop execution.

Soumya said:   1 decade ago
Jump to relative address, if A is not zero, since A is not zero so it jumps to STAT. Continues the loop.


Post your comments here:

Your comments will be displayed after verification.