PIC STATUS registers

C operators and PIC instructions

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

CPIC
binary=MOV
+ADD
-SUB and SUBR
&AND
|IOR
^XOR
<<SL
>>LSR for unsigned
ASR for signed
unary-NEG
~COM
++INC
--DEC

C’s signed >> uses ASR. Java’s >> resembles ASR and its >>> resembles LSR.

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.

The bit-wise instructions and the MOV where a file register is the source set the N and Z bits.

All shift instructions set the N and Z bits. Some shift instructions also set the C bits.

Take a look a the MSU ECE 3724 chapter 4 notes to see how the bits of the status register are used for shift operators and common control structures.