PIC STATUS register

C operators and PIC instructions

All the following instructions, shown with their C equivalent, set bits of the STATUS file register.

>>LSR for unsigned
ASR for signed

Java’s >> resembles C’s signed >> and its >>> resembles C’s unsigned >>

PIC status register

The PIC STATUS register contains five flags, or bits, that can be set my PIC operations.

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, as if A + -B were being computed.

The bit-wise instructions and two MOV instructions where a file register is the source set the N and Z bits. These two MOV instructions are:
    MOV f
    MOV f, WREG

All shift instructions set the N and Z bits. Sometimes the C is set. This happens in those variations of the ASR, LSR and SL instructions 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.