PIC18FXX20
BNOV
Branch if Not Overflow
BNZ
Branch if Not Zero
Syntax:
Operands:
Operation:
[ label ] BNOV
-128 ≤ n ≤ 127
if overflow bit is ’0’
(PC) + 2 + 2n → PC
n
Syntax:
Operands:
Operation:
[ label ] BNZ
-128 ≤ n ≤ 127
if zero bit is ’0’
n
(PC) + 2 + 2n → PC
Status Affected:
Encoding:
None
1110
Status Affected:
Encoding:
None
1110
0101
nnnn
nnnn
0001
nnnn
nnnn
Description:
If the Overflow bit is ‘0’, then the
program will branch.
Description:
If the Zero bit is ‘0’, then the
program will branch.
The 2’s complement number ‘2n’ is
added to the PC. Since the PC will
have incremented to fetch the next
instruction, the new address will be
PC+2+2n. This instruction is then
a two-cycle instruction.
The 2’s complement number ‘2n’ is
added to the PC. Since the PC will
have incremented to fetch the next
instruction, the new address will be
PC+2+2n. This instruction is then
a two-cycle instruction.
Words:
Cycles:
1
1(2)
Words:
Cycles:
1
1(2)
Q Cycle Activity:
If Jump:
Q Cycle Activity:
If Jump:
Q1
Decode
Q2
Q3
Q4
Write to PC
Q1
Decode
Q2
Q3
Q4
Write to PC
Read literal
Process
Read literal
Process
'n'
Data
'n'
Data
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
If No Jump:
Q1
If No Jump:
Q1
Q2
Read literal
'n'
Q3
Process
Data
Q4
Q2
Read literal
'n'
Q3
Process
Data
Q4
Decode
No
Decode
No
operation
operation
HERE
BNOV Jump
HERE
BNZ Jump
Example:
Example:
Before Instruction
Before Instruction
PC
=
address (HERE)
PC
=
address (HERE)
After Instruction
After Instruction
If Overflow
PC
=
=
=
=
0;
If Zero
PC
=
=
=
=
0;
address (Jump)
address (Jump)
If Overflow
PC
1;
If Zero
PC
1;
address (HERE+2)
address (HERE+2)
DS39609A-page 270
Advance Information
2003 Microchip Technology Inc.