37.2.1 Standard Instruction Set
ADDFSR | Add Literal to FSRn | |||
---|---|---|---|---|
Syntax: | [ label ] ADDFSR FSRn, k | |||
Operands: | -32 ≤ k ≤
31; n ∈ [ 0, 1] |
|||
Operation: | FSR(n) + k → FSR(n) | |||
Status Affected: | None | |||
Description: |
The signed 6-bit literal ‘k’ is added to the contents of the FSRnH:FSRnL register pair. |
ADDLW | ADD literal to W | |||
---|---|---|---|---|
Syntax: | [ label ] ADDLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | (W) + k → (W) | |||
Status Affected: | C, DC, Z | |||
Description: | The contents of W are added to the 8-bit literal ‘k’ and the result is placed in W. |
ADDWF | ADD W to f | |||
---|---|---|---|---|
Syntax: | [ label ] ADDWF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) + (f) → dest | |||
Status Affected: | C, DC, Z | |||
Description: |
Add the contents of the W register with register ‘f’. If ‘d’ is ‘ |
ADDWFC | ADD W and CARRY bit to f | |||
---|---|---|---|---|
Syntax: | [ label ] ADDWFC f {,d} | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) + (f) + (C) → dest | |||
Status Affected: | C, DC, Z | |||
Description: |
Add W, the Carry flag and data memory location ‘f’. If ‘d’ is ‘ |
ANDLW | AND literal with W | |||
---|---|---|---|---|
Syntax: | [ label ] ANDLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | (W) .AND. k → (W) | |||
Status Affected: | Z | |||
Description: |
The contents of W are ANDed with the 8-bit literal ‘k’. |
ANDWF | AND W with f | |||
---|---|---|---|---|
Syntax: | [ label ] ANDWF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) .AND. (f) → dest | |||
Status Affected: | Z | |||
Description: |
AND the W register with register ‘f’. If ‘d’ is ‘ |
ASRF | Arithmetic Right Shift | |||
---|---|---|---|---|
Syntax: | [ label ] ASRF f, d | |||
Operands: | 0 ≤ f ≤
127 d ∈ [0,1] |
|||
Operation: |
(f[7]) → dest[7] (f[7:1]) → dest[6:0] (f[0]) → C |
|||
Status Affected: | C, Z | |||
Description: |
The contents of register ‘f’ are shifted one bit to the right through the Carry flag. Register f → C |
BCF | Bit Clear f | |||
---|---|---|---|---|
Syntax: | [ label ] BCF f, b | |||
Operands: | 0
≤ f ≤ 127 0 ≤ b ≤ 7 |
|||
Operation: | 0 → f[b] | |||
Status Affected: | None | |||
Description: | Bit ‘b’ in register ‘f’ is cleared. |
BRA | Relative Branch | |||
---|---|---|---|---|
Syntax: | [
label ] BRA label [ label ] BRA $+k |
|||
Operands: | -256 ≤ label - PC + ≤ 255 -256 ≤ k ≤ 255 |
|||
Operation: | (PC) + 1 + k → PC | |||
Status Affected: | None | |||
Description: |
Add the signed 9-bit literal ‘k’ to the PC. |
BRW | Relative Branch with W | |||
---|---|---|---|---|
Syntax: | [ label ] BRW | |||
Operands: | None | |||
Operation: | (PC) + (W) → PC | |||
Status Affected: | None | |||
Description: |
Add the contents of W (unsigned) to the PC. |
BSF | Bit Set f | |||
---|---|---|---|---|
Syntax: | [ label ] BSF f, b | |||
Operands: | 0
≤ f ≤ 127 0 ≤ b ≤ 7 |
|||
Operation: | 1 → (f[b]) | |||
Status Affected: | None | |||
Description: | Bit ‘b’ in register ‘f’ is set. |
BTFSC | Bit Test File, Skip if Clear | |||
---|---|---|---|---|
Syntax: | [ label ] BTFSC f, b | |||
Operands: | 0
≤ f ≤ 127 0 ≤ b ≤ 7 |
|||
Operation: | skip if (f[b]) = 0 | |||
Status Affected: | None | |||
Description: |
If bit ‘b’ in register ‘f’ is ‘ |
BTFSS | Bit Test File, Skip if Set | |||
---|---|---|---|---|
Syntax: | [ label ] BTFSS f, b | |||
Operands: | 0
≤ f ≤ 127 0 ≤ b < 7 |
|||
Operation: | skip if (f[b]) = 1 | |||
Status Affected: | None | |||
Description: |
If bit ‘b’ in register ‘f’ is ‘ |
CALL | Subroutine Call | |||
---|---|---|---|---|
Syntax: | [ label ] CALL k | |||
Operands: | 0 ≤ k ≤ 2047 | |||
Operation: | (PC) + 1 → TOS, k → PC[10:0], (PCLATH[6:3]) → PC[14:11] |
|||
Status Affected: | None | |||
Description: |
Call Subroutine. First, return address (PC + 1) is pushed onto the stack. |
CALLW | Subroutine Call with W | |||
---|---|---|---|---|
Syntax: | [ label ] CALLW | |||
Operands: | None | |||
Operation: | (PC) + 1 →
TOS, (W) → PC[7:0], (PCLATH[6:0]) → PC[14:8] |
|||
Status Affected: | None | |||
Description: |
Subroutine call with W. |
CLRF | Clear f | |||
---|---|---|---|---|
Syntax: | [ label ] CLRF f | |||
Operands: | 0 ≤ f ≤ 127 | |||
Operation: | 000h → f 1 → Z |
|||
Status Affected: | Z | |||
Description: | The contents of register ‘f’ are cleared and the Z bit is set. |
CLRW | Clear W | |||
---|---|---|---|---|
Syntax: | [ label ] CLRW | |||
Operands: | None | |||
Operation: | 00h → (W) 1 → Z |
|||
Status Affected: | Z | |||
Description: | W register is cleared. The Zero (Z) bit is set. |
CLRWDT | Clear Watchdog Timer | |||
---|---|---|---|---|
Syntax: | [ label ] CLRWDT | |||
Operands: | None | |||
Operation: | 00h → WDT, 00h → WDT prescaler, 1 → TO, 1 → PD |
|||
Status Affected: | TO, PD | |||
Description: |
|
COMF | Complement f | |||
---|---|---|---|---|
Syntax: | [ label ] COMF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f) → dest | |||
Status Affected: | Z | |||
Description: |
The contents of register ‘f’ are complemented. |
DECF | Decrement f | |||
---|---|---|---|---|
Syntax: | [ label ] DECF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f) – 1 → dest | |||
Status Affected: | Z | |||
Description: |
Decrement register ‘f’. |
DECFSZ | Decrement f, skip if 0 | |||
---|---|---|---|---|
Syntax: | [ label ] DECFSZ f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f) – 1 → dest,
skip if result = 0 |
|||
Description: |
The contents of register ‘f’ are decremented. |
GOTO | Unconditional Branch | |||
---|---|---|---|---|
Syntax: | [ label ] GOTO k | |||
Operands: | 0 ≤ k ≤ 2047 | |||
Operation: | k
→ PC[10:0] PCLATH[6:3] → PC[14:11] |
|||
Status Affected: | None | |||
Description: |
|
INCF | Increment f | |||
---|---|---|---|---|
Syntax: | [ label ] INCF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f) + 1 → dest | |||
Status Affected: | Z | |||
Description: |
The contents of register ‘f’ are incremented. |
INCFSZ | Increment f, skip if 0 | |||
---|---|---|---|---|
Syntax: | [ label ] INCFSZ f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f) + 1 → dest, skip if result = 0 |
|||
Status Affected: | None | |||
Description: |
The contents of register ‘f’ are incremented. |
IORLW | Inclusive OR literal with W | |||
---|---|---|---|---|
Syntax: | [ label ] IORLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | (W) .OR. k → (W) | |||
Status Affected: | Z | |||
Description: |
The contents of W are ORed with the 8-bit literal ‘k’. |
IORWF | Inclusive OR W with f | |||
---|---|---|---|---|
Syntax: | IORWF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) .OR. (f) → dest | |||
Status Affected: | Z | |||
Description: |
Inclusive OR the W register with register ‘f’. |
LSLF | Logical Left Shift | |||
---|---|---|---|---|
Syntax: | [ label ] LSLF f {,d} | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f[7]) → C (f[6:0]) → dest[7:1] 0 → dest[0] |
|||
Status Affected: | C, Z | |||
Description: |
The contents of register ‘f’ are shifted one bit to the left through the Carry flag. C ← Register f ← 0 |
LSRF | Logical Right Shift | |||
---|---|---|---|---|
Syntax: | [ label ] LSRF f {,d} | |||
Operands: | 0 ≤ f ≤
127 d ∈ [0,1] |
|||
Operation: | 0 →
dest[7] (f[7:1]) → dest[6:0], (f[0]) → C |
|||
Status Affected: | C, Z | |||
Description: |
The contents of register ‘f’ are shifted one bit to the right through the Carry flag. 0 → register f → C |
MOVF | Move f | |||
---|---|---|---|---|
Syntax: | [ label ] MOVF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | f → dest | |||
Status Affected: | Z | |||
Description: |
The contents of register f is moved to a destination dependent upon the status of d. |
|||
Words: | 1 | |||
Cycles: | 1 |
Example: |
|
|||
After
Instruction W = value in FSR register Z = |
MOVIW | Move INDFn to W | |||
---|---|---|---|---|
Syntax: | [
label ] MOVIW ++FSRn [ label ] MOVIW --FSRn [ label ] MOVIW FSRn++ [ label ] MOVIW FSRn-- [ label ] MOVIW k[FSRn] |
|||
Operands: | n ∈ [0,1] mm ∈ [00,01,10,11] -32 ≤ k ≤ 31 |
|||
Operation: |
INDFn → (W) Effective address is determined by
After the Move, the FSR value will be either:
|
|||
Status Affected: | Z | |||
MODE | SYNTAX | mm | ||
Preincrement | ++FSRn | 00 |
||
Predecrement | --FSRn | 01 |
||
Postincrement | FSRn++ | 10 |
||
Postdecrement | FSRn-- | 11 |
||
Description: |
This instruction is used to move data between W and one of the indirect registers (INDFn). |
MOVLB | Move literal to BSR | |||
---|---|---|---|---|
Syntax: | [ label ] MOVLB k | |||
Operands: | 0 ≤ k ≤ 127 | |||
Operation: | k → BSR | |||
Status Affected: | None | |||
Description: | The 6-bit literal ‘k’ is loaded into the Bank Select Register (BSR). |
MOVLP | Move literal to PCLATH | |||
---|---|---|---|---|
Syntax: | [ label ] MOVLP k | |||
Operands: | 0 ≤ k ≤ 127 | |||
Operation: | k → PCLATH | |||
Status Affected: | None | |||
Description: | The 7-bit literal ‘k’ is loaded into the PCLATH register. |
MOVLW | Move literal to W | |||
---|---|---|---|---|
Syntax: | [ label ] MOVLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | k → (W) | |||
Status Affected: | None | |||
Description: |
The 8-bit literal ‘k’ is loaded into W register. |
|||
Words: | 1 | |||
Cycles: | 1 |
Example: |
|
|
After
Instruction W = 5Ah |
MOVWF | Move W to f | |||
---|---|---|---|---|
Syntax: | [ label ] MOVWF f | |||
Operands: | 0 ≤ f ≤ 127 | |||
Operation: | (W) → f | |||
Status Affected: | None | |||
Description: | Move data from W to register ‘f’. | |||
Words: | 1 | |||
Cycles: | 1 |
Example: |
|
|
Before
Instruction LATA = FFh W = 4Fh After Instruction LATA = 4Fh W = 4Fh |
MOVWI | Move W to INDFn | |||
---|---|---|---|---|
Syntax: | [
label ] MOVWI ++FSRn [ label ] MOVWI --FSRn [ label ] MOVWI FSRn++ [ label ] MOVWI FSRn-- [ label ] MOVWI k[FSRn] |
|||
Operands: | n ∈ [0,1] mm ∈ [00,01,10,11] -32 ≤ k ≤ 31 |
|||
Operation: |
(W) → INDFn Effective address is determined by
After the Move, the FSR value will be either:
|
|||
Status Affected: | None | |||
MODE | SYNTAX | mm | ||
Preincrement | ++FSRn | 00 |
||
Predecrement | --FSRn | 01 |
||
Postincrement | FSRn++ | 10 |
||
Postdecrement | FSRn-- | 11 |
||
Description: |
This instruction is used to move data between W and one of the indirect registers (INDFn). |
NOP | No Operation | |||
---|---|---|---|---|
Syntax: | [ label ] NOP | |||
Operands: | None | |||
Operation: | No operation | |||
Status Affected: | None | |||
Description: | No operation. | |||
Words: | 1 | |||
Cycles: | 1 |
Example: | NOP |
None. |
RESET | Software Reset | |||
---|---|---|---|---|
Syntax: | [ label ] RESET | |||
Operands: | None | |||
Operation: |
Execute a device Reset. |
|||
Status Affected: | None | |||
Description: | This instruction provides a way to execute a hardware Reset by software. |
RETFIE | Return from Interrupt | |||
---|---|---|---|---|
Syntax: | [ label ] RETFIE k | |||
Operands: | None | |||
Operation: | (TOS) → PC, 1 → GIE |
|||
Status Affected: | None | |||
Description: |
Return from Interrupt. |
|||
Words: | 1 | |||
Cycles: | 2 |
Example: |
|
|
After
Interrupt PC = TOS GIE
= |
RETLW | Return literal to W | |||
---|---|---|---|---|
Syntax: | [ label ] RETLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | k
→ (W), (TOS) → PC, |
|||
Status Affected: | None | |||
Description: |
The W register is loaded with the 8-bit literal ‘k’. |
|||
Words: | 1 | |||
Cycles: | 2 |
Example:
|
||||
Before
Instruction W = 07h After Instruction W = value of k8 |
RETURN | Return from Subroutine | |||
---|---|---|---|---|
Syntax: | [ label ] RETURN | |||
Operands: | None | |||
Operation: | (TOS) → PC, | |||
Status Affected: | None | |||
Encoding: | 0000 | 0000 | 0001 | 001s |
Description: |
Return from subroutine. |
RLF | Rotate Left f through Carry | |||
---|---|---|---|---|
Syntax: | [ label ] RLF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f[n]) → dest[n + 1], (f[7]) → C, (C) → dest[0] |
|||
Status Affected: | C | |||
Encoding: | 0011 | 01da | ffff | ffff |
Description: |
The contents of register ‘f’ are rotated one bit to the left through the CARRY flag. |
|||
Words: | 1 | |||
Cycles: | 1 |
Example: |
|
|
|
Before
Instruction REG1 = C = After Instruction REG = W = C =
|
RRF | Rotate Right f through Carry | |||
---|---|---|---|---|
Syntax: | [ label ] RRF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f[n]) → dest[n – 1], (f[0]) → C, (C) → dest[7] |
|||
Status Affected: | C | |||
Description: |
The contents of register ‘f’ are rotated one bit to the right through the CARRY flag. |
SLEEP | Enter Sleep mode | |||
---|---|---|---|---|
Syntax: | [ label ] SLEEP | |||
Operands: | None | |||
Operation: | 00h → WDT, 0 → WDT prescaler, 1 → TO, 0 → PD |
|||
Status Affected: | TO, PD | |||
Description: |
The Power-Down (PD) Status bit is cleared. |
SUBLW | Subtract W from literal | |||
---|---|---|---|---|
Syntax: | [ label ] SUBLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | k – (W) → (W) | |||
Status Affected: | C, DC, Z | |||
Description |
The W register is subtracted (two’s complement method) from the 8-bit literal ‘k’. C = C = DC = DC = |
SUBWF | Subtract W from f | |||
---|---|---|---|---|
Syntax: | [ label ] SUBWF f, d | |||
Operands: | 0 ≤ f ≤
127 d ∈ [0,1] |
|||
Operation: | (f) - (W) → (dest) | |||
Status Affected: | C, DC, Z | |||
Description |
Subtract (two’s complement method) W register from register ‘f’. C = C = DC = DC = |
SUBFWB | Subtract W from f with Borrow | |||
---|---|---|---|---|
Syntax: | [ label ] SUBFWB f {,d} | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) – (f) – (B) → dest | |||
Status Affected: | C, DC, Z | |||
Description: |
Subtract W and the BORROW flag (CARRY) from register ‘f’ (two’s complement method). |
SWAPF | Swap Nibbles in f | |||
---|---|---|---|---|
Syntax: | [ label ] SWAPF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (f[3:0]) → dest[7:4], (f[7:4]) → dest[3:0] |
|||
Status Affected: | None | |||
Description: |
The upper and lower nibbles of register ‘f’ are exchanged. |
TRIS | Load TRIS Register with W | |||
---|---|---|---|---|
Syntax: | [ label ] TRIS f | |||
Operands: | 5 ≤ f ≤ 7 | |||
Operation: | (W) → TRIS register ‘f’ | |||
Status Affected: | None | |||
Description: |
Move data from W register to TRIS register. |
XORLW | Exclusive OR literal with W | |||
---|---|---|---|---|
Syntax: | [ label ] XORLW k | |||
Operands: | 0 ≤ k ≤ 255 | |||
Operation: | (W) .XOR. k → (W) | |||
Status Affected: | Z | |||
Description: |
The contents of W are XORed with the 8-bit literal ‘k’. |
XORWF | Exclusive OR W with f | |||
---|---|---|---|---|
Syntax: | [ label ] XORWF f, d | |||
Operands: | 0
≤ f ≤ 127 d ∈ [0,1] |
|||
Operation: | (W) .XOR. (f) → dest | |||
Status Affected: | Z | |||
Description: |
Exclusive OR the contents of the W register with register ‘f’. |