| ADDWF |
Sum W and f |
To return |
| Syntax: |
[label] ADDWF f, d |
| Operandos: |
d=0 or d=1; 0 <= f <= 31 |
| Operation: |
(w) + (f) --> (dest) |
| Flags affected: |
C, DC, Z |
| Description: |
Sum the content of the registry W and registry “f”. If “d” is 0, the result stores in the registry W. If “d” is the 1 resutado one is stored in registry “f”.
|
| Example: |
ADDWF REG, 0
Before the instruction:
After the instruction:
|
W= 0x17
REF= 0xC2
W= 0xD9
REG= 0xC2
|
|
|
ANDWF
|
W AND f
|
To return |
| Syntax: |
[label] ANDWF f, d |
| Operandos: |
d=0 or d=1; 0 <= f <= 31 |
| Operation: |
(w) AND (f) --> (dest) |
| Flags affected: |
Z |
| Description: |
It conducts logic operation AND between the registry W and registry “f”. If “d” is 0 the result it stores in the registry W. If “d” is 1, the result is stored in registry “f”.
|
| Example: |
ANDWF REG, 1
Before the instruction:
After the instruction:
|
W=0x17
REG= 0xC2
W=0x17
REG= 0x02
|
|
|
| ANDLW |
Literal W AND |
To return |
| Syntax: |
[label] ANDWL k |
| Operandos: |
0 <= k <= 255 |
| Operation: |
(w) AND (k) --> (w) |
| Flags affected: |
Z |
| Description: |
It conducts logic operation AND between the registry W and the constant “k”. The result stores in the registry W.
|
| Example: |
ANDLW 0x5F
Before the instruction:
After the instruction:
|
W= 0xA3
W= 0x03
|
|
|
| BCF |
Flock a bit |
To return |
| Syntax: |
[label] BCF f, b |
| Operandos: |
0 <= f <= 31; 0 <= b <= 7; |
| Operation: |
0 --> (f < b >) |
| Flags affected: |
None
|
| Description: |
Flock bit “b” of registry “f”. |
| Example: |
BCF REG, 7
Before the instruction:
After the instruction:
|
REG = 0x0A
REG = 0x47
|
|
|
| BSF |
It activates a bit |
To return |
| Syntax: |
[label] BSF f, b |
| Operandos: |
0 <= f <= 31; 0 <= b <= 7; |
| Operation: |
1 --> (f < b >) |
| Flags affected: |
None
|
| Description: |
It activates bit “b” of registry “f”. |
| Example: |
BSF REG, 0x0A
Before the instruction:
After the instruction:
|
REG = 0x0A
REG = 0x8A
|
|
|
| BTFSC |
Test of bit and jump |
To return |
| Syntax: |
[label] BTFSC f, b |
| Operandos: |
0 <= f <= 31; 0 <= b <= 7; |
| Operation: |
Jump if (f < b >) = 0 |
| Flags affected: |
None
|
| Description: |
If bit “b” of registry “f” is 0, an instruction skips and it is continued with the execution.
|
| Example: |
COM BTFSC REG, 1
FALSE GOTO PROCESA_X
TRUE °
Before the instruction:
After the instruction:
|
PC= Direction (COM_)
IF REG <1> = 0
PC= Direction (TRUE)
IF REG <1> = 1
PC= Direction (FALSE)
|
|
|
| BTFSS |
Test of bit and jump |
To return |
| Syntax: |
[label] BTFSS f, b |
| Operandos: |
0 <= f <= 31; 0 <= b <= 7; |
| Operation: |
Jump if (f < b >) = 1 |
| Flags affected: |
None |
| Description: |
If bit “b” of registry “f” is 1, an instruction skips and it is continued with the execution.
|
| Example: |
COM BTFSS REG, 6
FALSE GOTO PROCESA_X
TRUE °
Before the instruction:
After the instruction:
|
PC= Direction (COM_)
IF REG <6> = 0
PC= Direction (FALSE)
IF REG <6> = 1
PC= Direction (TRUE)
|
|
|
| CALL |
Jump to subroutine |
To return |
| Syntax: |
[label] CALL k |
| Operandos: |
0 <= k <= 255 |
| Operation: |
(PC) + 1 --> stack; k --> PC |
| Flags affected: |
None
|
| Description: |
Jump to subroutine. The return direction keeps in stack. The constant “k” of 8 bits forms the direction of jump and load in the bits <7: 0> of the PC.
The bits <10: 9> of the PC loads with the bits <6: 5> of the registry “STATUS”. PC <8> is put to 0.
|
| Example: |
ORG CALL DESTINY
Before the instruction:
After the instruction:
|
PC = ORG
PC = DESTINY
|
|
|
| CLRF |
Flock a registry |
To return |
| Syntax: |
[label] CLRF f |
| Operandos: |
0 <= f <= 32 |
| Operation: |
00f --> (f); 1 --> Z |
| Flags affected: |
Z |
| Description: |
Flock the content of registry “f” and flag Z of state activates.
|
| Example: |
CLRF REG
Before the instruction:
After the instruction:
|
REG = 0x5A
REG = 0x00
Z = 1
|
|
|
| CLRW |
Flock the registry W |
To return |
| Syntax: |
[label] CLRW |
| Operandos: |
None |
| Operation: |
00h --> W; 1 --> Z |
| Flags affected: |
Z |
| Description: |
The work registry “W” load with 00h. Flag of Z activates.
|
| Example: |
CLRW
Before the instruction:
After the instruction:
|
W = 0x5A
W = 0x00
Z = 1
|
|
|
| CLRWDT |
Flock “watchdog” |
To return |
| Syntax: |
[label] CLRWDT |
| Operandos: |
None |
| Operation: |
00h --> WDT; 1 --> TO; 1 --> PS; |
| Flags affected: |
TO, PS |
| Description: |
This instruction flock as much “watchdog” as prescaler. Bits TO and PS of the state registry are put to “1”.
|
| Example: |
CLRWDT
After the instruction:
|
Accountant WDT = 0
Prescaler WDT = 0 Bit of state TO = 1 Bit of state PS = 1
|
|
|
| COMF |
It complements f |
To return |
| Syntax: |
label COMF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(f) --> (dest) |
| Flags affected: |
Z |
| Description: |
The content of registry “f” is complemented. If “d” is 0 result “R” it stores in the registry W. If “d” is 1, result “R” is stored in registry “f”.
|
| Example: |
|
|
|
| DECF |
Decrement of f |
To return |
| Syntax: |
[label] DECF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(f) - 1 --> (dest) |
| Flags affected: |
Z |
| Description: |
Decrementa in a unit the content of registry “f”. If “d” is 0, the result is stored in W. If “d” is 1, the result is stored in “f”.
|
| Example: |
DEC CONT, 1
Before the instruction:
After the instruction:
|
CONT = 0x01
Z = 0
CONT = 0x00
Z = 1
|
|
|
| DECFSZ |
Decrement and jump |
To return |
| Syntax: |
[label] DECFSZ f, d |
| Operandos: |
0 <= f <= 32; d = 0 or d = 1 |
| Operation: |
(f) - 1 --> d; Jump if R = 0 |
| Flags affected: |
None |
| Description: |
The content of registry “f” decrementa. If “d” is 0, result “R” is placed in the registry W. If “d” is 1, result “R” is placed in registry “f”. If R = 0, skips the following instruction and it is continued with the execution.
|
| Example: |
COM_ DECFSZ REG, OR
GOTO_NO_ES_0
Before the instruction:
After the instruction:
|
PC = Dirección (COM_)
REG = REG - 1
IF REG = 0
PC = CONTINUOUS Direction
IF REG! = 0 PC = Direction (COM_ + 1)
|
|
|
| GOTO |
Unconditional jump |
To return |
| Syntax: |
[label] GOTO k |
| Operandos: |
0 <= k <= 511 |
| Operation: |
k --> PC --> <8: 0> |
| Flags affected: |
None |
| Description: |
One is an unconditional jump. The 9 bits of the constant “k” that form the instruction, load in the bits <8: 0> of the PC and forms the jump direction. The bits <10: 9> of the PC loads with the bits <6: 5> of the state registry.
|
| Example: |
ORG GOTO DESTINY
Before the instruction:
After the instruction:
|
PC = 0
PC = DESTINY
|
|
|
| INCF |
Increase of f |
To return |
| Syntax: |
[label] INCF f, d |
| Operandos: |
0 <= k <= 31; d = 0 or d = 1 |
| Operation: |
(f) + 1 --> (dest) |
| Flags affected: |
Z |
| Description: |
It increases in a unit the content of registry “f”. If “d” is 0, the result is stored in W. If “d” is 1, the result is stored in “f”.
|
| Example: |
INCF CONT, 1
Before the instruction:
After the instruction:
|
CONT = 0xFF
Z = 0
CONT = 0x00
Z = 1
|
|
|
| INCFSZ |
Increase of f, if he is 0 jumps |
To return |
| Syntax: |
[label] INCFSZ f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(f) + 1 --> (dest); Jump if R = 0 |
| Flags affected: |
None |
| Description: |
It increases in a unit the content of registry “f”. If “d” is 0, the result is stored in W. If “d” is 1, the result is stored in “f”. If R=0, skips the following instruction and it is continued with the execution.
|
| Example: |
COM_ INCFSZ REG, 1
GOTO_NO_ES_0
CONTINUOUS
Before the instruction:
After the instruction:
|
PC = Dirección (COM_)
CONT + 1
IF CNT = 0
PC = CONTINUOUS Direction
IF REG! = 0
PC = Direction (COM_ + 1)
|
|
|
|
| IORLW |
Literal W OR |
To return |
| Syntax: |
[label] IORLW k |
| Operandos: |
0 <= f <= 255 |
| Operation: |
(W).OR.(k) --> (w) |
| Flags affected: |
Z |
| Description: |
Logical function OR between the registry W and the contante “k” is realized. The result stores in the registry W.
|
| Example: |
IORLW Ox35
Before the instruction:
After the instruction:
|
W = 0x9A
W = 0xBF
|
|
|
| IORWF |
OR between W and f |
To return |
| Syntax: |
[label] IORWF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(W).OR.(f) --> (dest) |
| Flags affected: |
Z |
| Description: |
It conducts logic operation OR between the registry W and registry “f”. If “d” is 0 the result it stores in the registry W. If “d” is 1, the result warehouse in registry “f”.
|
| Example: |
IORWF REG, 0
Before the instruction:
After the instruction:
|
RESULT = 0x13
W = 0x91
RESULT = 0x13
W = 0x93
Z = 0
|
|
|
| MOVF |
To move to f |
To return |
| Syntax: |
[label] MOVF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(f) --> (dest) |
| Flags affected: |
Z |
| Description: |
The content of registry “f” moves to destiny “d”. If “d” is 0, the destiny is the registry w. If “d” is 1, the destiny is own registry “f”. This possibility allows to verify this registry since flag Z is affected.
|
| Example: |
MOVF REG, 0
After the instruction:
|
W = REG
|
|
|
| MOVLW |
It loads a literal one in W |
To return |
| Syntax: |
label MOVLW k |
| Operandos: |
0 <= f <= 255 |
| Operation: |
(k) --> (w) |
| Flags affected: |
None |
| Description: |
The registry W load with the value of 8 bits expressed by means of the literal “k”.
|
| Example: |
MOVLW 0x5A
After the instruction:
|
W = 0x5A
|
|
|
| MOVWF |
To move W to f |
To return |
| Syntax: |
label MOVWF f |
| Operandos: |
0 <= f <= 31 |
| Operation: |
(w) --> (dest) |
| Flags affected: |
None |
| Description: |
It moves the content of the registry W to registry “f”. |
| Example: |
MOVWF REG
Before the instruction:
After the instruction:
|
REG = 0xFF
W = 0x4F
REG = 0x4F
W = 0x4F
|
|
|
| NOP |
Not to operate |
To return |
| Syntax: |
[label] NOP |
| Operandos: |
None |
| Operation: |
Not to operate |
| Flags affected: |
None |
| Description: |
It does not conduct operation some. It consumes an instruction cycle.
|
| Example: |
NOP |
|
|
| OPTION |
Load reg. OPTION |
To return |
| Syntax: |
[label] OPTION |
| Operandos: |
None |
| Operation: |
(w) --> OPTION |
| Flags affected: |
None |
| Description: |
The content of the registry W load in registry OPTION. This it is a registry of only writing where the operation of prescaler is formed and the TMR0.
|
| Example: |
OPTION
Before the instruction:
After the instruction:
|
W = 0x07
OPTION = 0x07
|
|
|
| RETWL |
Return, load W |
To return |
| Syntax: |
[label] RETWL k |
| Operandos: |
0 <= f <= 255 |
| Operation: |
(k) --> (w); COUGH --> PC |
| Flags affected: |
None |
| Description: |
The registry W load with the 8 bits of the constant k. The PC load with the content of the top stack (COUGH): return direction. This instruction consumes two cycles.
|
|
Example:
TABLE
|
CALL TABLE; it contains offset
; of the table.
|
W = 07
W = Value of K8
|
|
. ; Now W has
|
|
. ; value of the table
ADDWF PC; W offset
RETLW K1; table begins
RETLW K2
.
.
RETLW Kn; Aim of the table
Before the instruction:
After the instruction:
|
|
|
| RLF |
Defeat f to the left |
To return |
| Syntax: |
[label] RLF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
Rotation to the left of f |
| Flags affected: |
C |
| Description: |
The content of registry “f” broken a position to the left. The bit of more weight happens to carry and carry is introduced by the bit of less weight of “f”. If “d” is 0, the result is placed in the registry W. If “d” is 1, the result is in registry “f”.
|
| Example: |
RLF REG1,0
Before the instruction:
After the instruction:
|
REG1 = 11100110
C = 0
REG1 = 11100110
W = 11001100
C = 1
|
|
|
| RRF |
Defeat f to the right |
To return |
| Syntax: |
[label] RRF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
Rotation to the right |
| Flags affected: |
C |
| Description: |
The content of broken registry “f” to the right. The bit of less weight of “f” passes to flag carry. Carry is placed in the bit of more weight of “f”. If “d” is 0, the result stores in the registry W. If “d” is 1, the result is stored in “f”. |
| Example: |
RRF REG1
Before the instruction:
After the instruction:
|
REG1 = 11100110
C = 0
REG1 = 11100110
W = 01110011
C = 0
|
|
|
| SLEEP |
It happens to rest state |
To return |
| Syntax: |
[label] SLEEP |
| Operandos: |
None |
| Operation: |
ooh --> WDT; 0 --> WDT to prescaler; 1 --> TO; 0 --> PS |
| Flags affected: |
TO, PS, GPWUF |
| Description: |
When leaving, it activates the bit of state TO and flock the PS.
The WDT and prescaler erase.
When entering way SLEEP, the oscillator pauses.
|
| Example: |
SLEEP |
|
|
|
| SUBWF |
Subtraction f - W |
To return |
| Syntax: |
[label] SUBWF f, d |
| Operandos: |
0 <= f <= 32; d = 0 or d = 1 |
| Operation: |
(f) - (w) --> (dest) |
| Flags affected: |
C, DC, Z |
| Description: |
Subtraction, by the method of the complement to 2, the content of registry “f” except the content of the registry W. If “d” is 0, the result stores in the registry W. If “d” is 1, the result is stored in registry “f”. If the result is negative, carry is put to 0.
|
| Example: |
SUBWF REG, 1
Before the instruction:
After the instruction:
|
REG = 1
W = 2
REG = 0xFF
W = 0xFF
|
|
|
| SWAPF |
Interchange of f |
To return |
| Syntax: |
[label] SWAPF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(f<3: 0>) --> (dest.<7: 4>)
(f<7: 4>) --> (dest.<3: 0>)
|
| Flags affected: |
None |
| Description: |
The four bits of more weight of registry “f” interchange with the four bits of less weight of the same registry. If “d” is 0, the result is placed in the registry W. If “d” is 1, the result is in registry “f”.
|
| Example: |
SWAPF REG, 0
Before the instruction:
After the instruction:
|
REG = 0x5A
REG = 0x5A
W = 0xA5
|
|
|
| TRIS |
Load registry TRIS |
To return |
| Syntax: |
[label] TRIS f |
| Operandos: |
5 <= f <= 7 |
| Operation: |
(w) --> Registry TRIS “f” |
| Flags affected: |
None |
| Description: |
The content of the registry W load in one of three registries TRIS (TRISA, TRISB, TRISC) according to “f” is worth 5, 6 or 7 respectively. Registries TRIS are used to form each one of the doors To, B or C so that their lines like entrance or exit act.
|
| Example: |
TRIS CARRIES
Before the instruction:
After the instruction:
|
W = 0xA5
TRISA = 0xA5
|
|
|
| XORLW |
Literal W XOR |
To return |
| Syntax: |
[label] XORLW k |
| Operandos: |
0 <= k <= 255 |
| Operation: |
(W).XOR.K --> (w) |
| Flags affected: |
Z |
| Description: |
It realizes exclusive logical function OR (EOR) between the content of the registry W and the constant “k” of 8 bits. The result stores in the registry W.
|
| Example: |
XORLW 0xAF
Before the instruction:
After the instruction:
|
W = 0xB5
W = 0x1A
|
|
|
| XORWF |
W XOR f |
To return |
| Syntax: |
[label] XORWF f, d |
| Operandos: |
0 <= f <= 31; d = 0 or d = 1 |
| Operation: |
(W).XOR.(f) --> (dest.) |
| Flags affected: |
Z |
| Description: |
It realizes exclusive logical function OR (EOR) between the content of the registry W and registry “f”. If “d” is 0, the result stores in the registry W. If “d” is the 1 result is stored in registry “f”.
|
| Example: |
XORWF REG, 1
Before the instruction:
After the instruction:
|
REG = 0xAF
W = 0xB5
REG = 0x1A
W = 0xB5
|