


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































“PIC Microcontroller and Embedded Systems”, Muhammad
Ali Mazidi, Rolin D. Mckinlay, Danny Causey Prentice Hall,
Embedded
System Design,
Bahria University
Islamabad
It is widely use instruction to for looping
zero, it skips the next instruction.
we can create a loop
the beginning of the loop
It uses the zero flag in the status register
not zero ,it branches (jumps) back to target address
referred to by the label
the counter value
register affected by previous instruction.
It is shown previous example that maximum count
in 255.
What happens if we want to repeat an action more
than 255?
We use loop inside loop called nested loop
We use two registers to hold the count
(255x255), we use three registers to get up to more
than 16 million (2^24) iterations. For 100,000 time
In this instruction zero flag is checked
If high (z=1), jumps to the target address
If PORTB is zero, it jump to the label OVER
We don’t have to perform an arithmetic instruction
such as decrement to use the BZ instruction.
OVER MOVF PORTB, W ; read Port b and put it in WREG
BZ OVER ; jump if WREG is zero
It means that the address of the target must be with in
the 256 bytes if the 256 bytes if the contents of the
program counter (PC)