|
PIC18F6520-I Datasheet, PDF (276/380 Pages) Micrel Semiconductor – 64/80-Pin High-Performance, 256 Kbit to 1 Mbit Enhanced Flash Microcontrollers with A/D | |||
|
◁ |
PIC18F6520/8520/6620/8620/6720/8720
BZ
Branch if Zero
Syntax:
[ label ] BZ n
Operands:
-128 ⤠n ⤠127
Operation:
if Zero bit is â1â
(PC) + 2 + 2n â PC
Status Affected: None
Encoding:
1110 0000 nnnn nnnn
Description:
If the Zero bit is â1â, 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.
Words:
1
Cycles:
1(2)
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Decode
No
operation
If No Jump:
Read literal
ânâ
No
operation
Process
Data
No
operation
Write to PC
No
operation
Q1
Q2
Q3
Q4
Decode
Read literal
ânâ
Process
Data
No
operation
Example:
HERE
Before Instruction
PC
=
After Instruction
If Zero
=
PC
=
If Zero
=
PC
=
BZ Jump
address (HERE)
1;
address (Jump)
0;
address (HERE+2)
CALL
Subroutine Call
Syntax:
Operands:
Operation:
Status Affected:
[ label ] CALL k [,s]
0 ⤠k ⤠1048575
s â [0,1]
(PC) + 4 â TOS,
k â PC<20:1>,
if s = 1
(W) â WS,
(STATUS) â STATUSS,
(BSR) â BSRS
None
Encoding:
1st word (k<7:0>) 1110
2nd word(k<19:8>) 1111
110s k7kkk
k19kkk kkkk
kkkk0
kkkk8
Description:
Subroutine call of entire 2-Mbyte
memory range. First, return
address (PC+ 4) is pushed onto the
return stack. If âsâ = 1, the W,
Status and BSR registers are also
pushed into their respective
shadow registers, WS, STATUSS
and BSRS. If âsâ = 0, no update
occurs (default). Then, the 20-bit
value âkâ is loaded into PC<20:1>.
CALL is a two-cycle instruction.
Words:
2
Cycles:
2
Q Cycle Activity:
Q1
Q2
Decode
Read literal
âkâ<7:0>
No
operation
No
operation
Q3
Push PC to
stack
No
operation
Q4
Read literal
âkâ<19:8>,
Write to PC
No
operation
Example:
HERE
CALL THERE,1
Before Instruction
PC
= address (HERE)
After Instruction
PC
=
TOS
=
WS
=
BSRS =
STATUSS =
address (THERE)
address (HERE + 4)
W
BSR
STATUS
DS39609B-page 274
 2004 Microchip Technology Inc.
|
▷ |