C operators and PIC instructions
All the following instructions, shown with their C equivalent,
set bits of the
STATUS file register.
PIC status register
STATUS register contains five flags, or bits,
that can be set my PIC operations.
C: Set when a carry occurs
Z: Set when the result is zero
N: Set when the result is negative, msb of 1
OV: Set when an overflow occurs
DC: Set when a digit carry occurs in the 4 lsb bits
In general, all five bits are set by the addition, subtraction,
increment, and decrement instructions.
For subtraction, the carry bit is set as if the minuend is
added to the twos complement of the subtrahend, that is,
A + -B were being computed.
The bit-wise instructions and two
instructions where a file register
is the source set the
MOV instructions are:
MOV f, WREG
All shift instructions set the
C is set. This happens in those variations
designed to shift only one place. In those cases, the
C bit will be set to the bit being shifted out.
Take a look at pages 100-101 of the textbook or at the
MSU ECE 3724 chapter 4 notes
to see nice pictuers of how the
C bit is used for
shift operators and common control structures.