Wednesday, March 23, 2016

8051 Jump if Bit Not Set

Jump if Bit not set

JNB bit address, relative address
If the indicated bit is a 0, JNB branches to the indicated address; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the third instruction byte to the PC, after incrementing the PC to the first byte of the next instruction. The bit tested is not modified. No flags are affected.

Encoding: 0 0 1 1 0 0 0 1 bit address rel. address

The data present at input port 1 is 11001010B. The Accumulator holds 56H (01010110B). The following instruction sequence,

JNB P1.3,LABEL1
JNB ACC.3,LABEL2

causes program execution to continue at the instruction at label LABEL2.

Example:
ORG 0H
MAIN :
MOV A, #0 ; Clear accumulator
MOV A, #10H
ADD A, P0
JNB P0.1, LABEL1
JNB ACC.2, LABEL2
ADD A, #5H
LABEL1 : SUBB A, #4H
AJMP MAIN
LABEL2 : SUBB A, #2H
AJMP MAIN
END



Related topics:
8051 Unconditional and Conditional Jump   |   8051 Long Jump   |   8051 Absolute Jump   |   8051 Short Jump   |   8051 Indirect Jump   |   8051 Jump if Accumulator Zero   |   8051 Jump if Accumulator Not Zero   |   8051 Compare and Jump if Not Equal   |   8051 Decrement and Jump if Not Zero   |   8051 Jump if Carry is Set   |   8051 Jump if Carry is Not Set   |   8051 Jump if Bit Set   |   8051 Jump if Bit is Set and Clear Bit

List of topics: 8051

No comments:

Post a Comment