40.2 Standard Instruction Set
Mnemonic, Operands |
Description | Cycles | 14-Bit Opcode | Status Affected |
Notes | ||||
---|---|---|---|---|---|---|---|---|---|
MSb | LSb | ||||||||
BYTE-ORIENTED OPERATIONS | |||||||||
ADDWF | f, d | Add WREG and f | 1 |
|
|
|
|
C, DC, Z | 2 |
ADDWFC | f, d | Add WREG and Carry bit to f | 1 |
|
|
|
|
C, DC, Z | 2 |
ANDWF | f, d | AND WREG with f | 1 |
|
|
|
|
Z | 2 |
ASRF | f, d | Arithmetic Right Shift | 1 |
|
|
|
|
C, Z | 2 |
LSLF | f, d | Logical Left Shift | 1 |
|
|
|
|
C, Z | 2 |
LSRF | f, d | Logical Right Shift | 1 |
|
|
|
|
C, Z | 2 |
CLRF | f | Clear f | 1 |
|
|
|
|
Z | 2 |
CLRW | – | Clear WREG | 1 |
|
|
|
|
Z | |
COMF | f, d | Complement f | 1 |
|
|
|
|
Z | 2 |
DECF | f, d | Decrement f | 1 |
|
|
|
|
Z | 2 |
INCF | f, d | Increment f | 1 |
|
|
|
|
Z | 2 |
IORWF | f, d | Inclusive OR WREG with f | 1 |
|
|
|
|
Z | 2 |
MOVF | f, d | Move f | 1 |
|
|
|
|
Z | 2 |
MOVWF | f | Move WREG to f | 1 |
|
|
|
|
None | 2 |
RLF | f, d | Rotate Left f through Carry | 1 |
|
|
|
|
C | 2 |
RRF | f, d | Rotate Right f through Carry | 1 |
|
|
|
|
C | 2 |
SUBWF | f, d | Subtract WREG from f | 1 |
|
|
|
|
C, DC, Z | 2 |
SUBWFB | f, d | Subtract WREG from f with Borrow | 1 |
|
|
|
|
C, DC, Z | 2 |
SWAPF | f, d | Swap nibbles in f | 1 |
|
|
|
|
None | 2 |
XORWF | f, d | Exclusive OR WREG with f | 1 |
|
|
|
|
Z | 2 |
BYTE-ORIENTED SKIP OPERATIONS | |||||||||
DECFSZ | f, d | Decrement f, Skip if 0 | 1(2) |
|
|
|
|
None | 1, 2 |
INCFSZ | f, d | Increment f, Skip if 0 | 1(2) |
|
|
|
|
None | 1, 2 |
BIT-ORIENTED FILE REGISTER OPERATIONS | |||||||||
BCF | f, b | Bit Clear f | 1 |
|
|
|
|
None | 2 |
BSF | f, b | Bit Set f | 1 |
|
|
|
|
None | 2 |
BIT-ORIENTED SKIP OPERATIONS | |||||||||
BTFSC | f, b | Bit Test f, Skip if Clear | 1(2) |
|
|
|
|
None | 1, 2 |
BTFSS | f, b | Bit Test f, Skip if Set | 1(2) |
|
|
|
|
None | 1, 2 |
LITERAL OPERATIONS | |||||||||
ADDLW | k | Add literal and WREG | 1 |
|
|
|
|
C, DC, Z | |
ANDLW | k | AND literal with WREG | 1 |
|
|
|
|
Z | |
IORLW | k | Inclusive OR literal with WREG | 1 |
|
|
|
|
Z | |
MOVLB | k | Move literal to BSR | 1 |
|
|
|
|
None | |
MOVLP | k | Move literal to PCLATH | 1 |
|
|
|
|
None | |
MOVLW | k | Move literal to W | 1 |
|
|
|
|
None | |
SUBLW | k | Subtract W from literal | 1 |
|
|
|
|
C, DC, Z | |
XORLW | k | Exclusive OR literal with W | 1 |
|
|
|
|
Z | |
CONTROL OPERATIONS | |||||||||
BRA | k | Relative Branch | 2 |
|
|
|
|
None | |
BRW | — | Relative Branch with WREG | 2 |
|
|
|
|
None | |
CALL | k | Call Subroutine | 2 |
|
|
|
|
None | |
CALLW | — | Call Subroutine with WREG | 2 |
|
|
|
|
None | |
GOTO | k | Go to address | 2 |
|
|
|
|
None | |
RETFIE | k | Return from interrupt | 2 |
|
|
|
|
None | |
RETLW | k | Return with literal in WREG | 2 |
|
|
|
|
None | |
RETURN | — | Return from Subroutine | 2 |
|
|
|
|
None | |
INHERENT OPERATIONS | |||||||||
CLRWDT | — | Clear Watchdog Timer | 1 |
|
|
|
|
TO, PD | |
NOP | — | No Operation | 1 |
|
|
|
|
None | |
RESET | — | Software device Reset | 1 |
|
|
|
|
None | |
SLEEP | — | Go into Standby mode | 1 |
|
|
|
|
TO, PD |
|
TRIS | f | Load TRIS register with WREG | 1 |
|
|
|
|
None | |
C-COMPILER OPTIMIZED | |||||||||
ADDFSR | n, k | Add Literal k to FSRn | 1 |
|
|
|
|
None | |
MOVIW | n, mm | Move Indirect FSRn to WREG with pre/post inc/dec modifier, mm | 1 |
|
|
|
|
Z | 2, 3 |
k[n] | Move INDFn to WREG, Indexed Indirect. | 1 |
|
|
|
|
Z | 2 | |
MOVWI | n, mm | Move WREG to Indirect FSRn with pre/post inc/dec modifier, mm | 1 |
|
|
|
|
None | 2, 3 |
k[n] | Move WREG to INDFn, Indexed Indirect. | 1 |
|
|
|
|
None | 2 |
Note:
- If the Program Counter (PC) is
modified or a conditional test is true, the instruction requires two cycles. The
second cycle is executed as a
NOP
. - If this instruction addresses an INDF register and the MSb of the corresponding FSR is set, this instruction will require one additional instruction cycle.
- Details on
MOVIW
andMOVWI
instruction descriptions are available in the next section.