Você está na página 1de 37

Microcontrolador PIC16F84: Conjunto de Instruções

Conjunto de Instruções
Repertório de 35 instruções
Instruções de 14 bits
Um ou mais operandos

Categoria de Instruções
Instruções orientadas a Registrador
Instruções orientadas a bit
Instruções com literais
Instruções de controle

Prof. Pastro
Microcontrolador PIC16F84: Conjunto de Instruções

Nomenclatura:
f : Registrador (endereço de memória)
W: Registrador de trabalho ( Acumulador)
b : Endereço de um bit do registrador
k : Literal (constante ou label)
x : Condição irrelevante (don´t care)
d : Destino do resultado de uma operação
d = 0: resultado é armazenado em W
d = 1: resultado é armazenado em um
registrador do Register File
label: Nome de um endereço sombólico
TOS: Topo da Pilha

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

ADDWF f,d : Add W and f


d ← (W) + (f)

Exemplos :

ADDWF 0x25,0
W ← (W) + (0x25)

ADDWF 0x25,1
0x25 ← (W) + (0x25)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

ANDWF f,d : And W with f


d ← (W) AND (f)

Exemplos :

ANDWF 0x28,0
W ← (W) AND (0x28)

ANDWF 0x28,1
0x28 ← (W) AND (0x28)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

CLRF f : Clear f
f ←0

Exemplos :

CLRF 0x30
0x30 ← 0

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

CLRW : Clear W
W ←0

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

COMF f,d : Complement f


d ← (f)’

Exemplos :

COMF 0x35,0
W ← (0x35)’

COMF 0x35,1
0x35 ← (0x35)’

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

DECF f,d : Decrement f


d ← (f) - 1

Exemplos :

DECF 0x30,0
W ← (0x30) - 1

DECF 0x30,1
0x30 ← (0x30) - 1

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

DECFSZ f,d : Decrement f, skip if zero


d ← (f) - 1

Exemplos :

DECFSZ 0x30,0
W ← (0x30) – 1
Salta próxima instrução se = 0

DECFSZ 0x30,1
0x30 ← (0x30) – 1
Salta próxima instrução se = 0
Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

INCF f,d : Increment f


d ← (f) + 1

Exemplos :

INCF 0x30,0
W ← (0x30) + 1

INCF 0x30,1
0x30 ← (0x30) + 1

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

INCFSZ f,d : Increment f, skip if zero


d ← (f) + 1

Exemplos :

INCFSZ 0x37,0
W ← (0x37) + 1
Salta próxima instrução se = 0

INCFSZ 0x37,1
0x37 ← (0x37) + 1
Salta próxima instrução se = 0
Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

IORWF f,d : Inclusive OR W with f


d ← (W) OR (f)

Exemplos :

IORWF 0x23,0
W ← (W) OR (0x23)

IORWF 0x23,1
0x23 ← (W) OR (0x23)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

MOVF f,d : Move f


d ← (f)

Exemplos :

MOVF 0x32,0
W ← (0x32)

MOVF 0x32,1
0x32 ← (0x32)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

MOVWF f,d : Move W to f

Exemplos :

MOVWF 0x37
0x37 ← (W)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

NOP : No Operation

Não executa nenhuma operação, porém utiliza


um Ciclo de máquina.

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

RLF f,d : Rotate Left f through Carry


d ← (f) deslocado à esquerda

Exemplos :

RLF 0x23,0
W ← (0x23) deslocado à esquerda

RLF 0x23,1
0x23 ← (0x23) deslocado à esquerda

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

RRF f,d : Rotate Right f through Carry


d ← (f) deslocado à direita

Exemplos :

RRF 0x23,0
W ← (0x23) deslocado à direita

RRF 0x23,1
0x23 ← (0x23) deslocado à direita

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

SUBWF f,d : Subtract W from f


d ← (f) - (W)

Exemplos :

SUBWF 0x25,0
W ← (0x25) - (W)

SUBWF 0x25,1
0x25 ← (0x25) - (W)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

SWAPF f,d : Swap nibbles in f

Exemplos :

SWAPF 0x25,0
W ← (0x25) com nibbles trocados

SWAPF 0x25,1
0x25 ← (0x25) com nibbles trocados

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a Registradores:

XORWF f,d : Exclusive OR W with f


d ← (W) XOR (f)

Exemplos :

XORWF 0x23,0
W ← (W) XOR (0x23)

XORWF 0x23,1
0x23 ← (W) XOR (0x23)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a BIT:

BCF f,b : Bit Clear f


b ← 0

Exemplos :

BCF 0x24,5
Bit 5 do registrador 0x24 é zerado

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a BIT:

BSF f,b : Bit Set f


b ← 1

Exemplos :

BSF 0x28,3
Bit 3 do registrador 0x28 é setado

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a BIT:

BTFSC f,b : Bit Test f, Skip if Clear


Salta próxima instrução se o bit for = 0

Exemplos :

BTFSC 0x34,1
Salta próxima instrução se o bit 1 do
Registrador 0x34 for = 0

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções orientadas a BIT:

BTFSS f,b : Bit Test f, Skip if Set


Salta próxima instrução se o bit for = 1

Exemplos :

BTFSS 0x36,4
Salta próxima instrução se o bit 4 do
Registrador 0x36 for = 1

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

ADDLW k: Add Literal and W


W ← (W) + k

Exemplos :

ADDLW 0x30
W ← (W) + 0x30

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

ANDLW k: And Literal with W


W ← (W) AND k

Exemplos :

ANDLW 0x35
W ← (W) AND 0x35

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

IORLW k: Inclusive OR Literal with W


W ← (W) OR k

Exemplos :

IORLW 0x42
W ← (W) OR 0x42

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

MOVLW k: Move Literal to W


W ← k

Exemplos :

MOVLW 0x77
W ← 0x77

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

SUBLW k: Subtract W from Literal


W ← k – (W)

Exemplos :

SUBLW 0x55
W ← 0x55 – (W)

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções com Literais (constantes):

XORLW k: Exclusive OR Literal with


W
W ← (W) XOR k
Exemplos :

XORLW 0x85
W ← (W) XOR 0x85

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

CALL k: Call Subroutine

Exemplos :

CALL sub
Desvia para sub-rotina cujo endereço
de entrada é sub

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

CLRWDT : Clear Watchdog Timer


WDT ← 0

Exemplos :

CLRWDT

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

GOTO k: Go To Address
Desvia para o endereço k

Exemplos :

GOTO 0x125
Desvia para o endereço 0x125

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

RETFIE : Return From Interrupt


Encerra a interrupção

Exemplos :

RETFIE
Encerra a interrupção que está sendo
atendida

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

RETLW k: Return With Literal in W


Retorna da sub-rotina com o
valor k no registrador W
Exemplos :

RETLW 0x33
Retorna da sub-rotina, colocando o
valor 0x33 no registrador W.

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

RETURN : Return from Subroutine


Retorna da sub-rotina

Prof. Pastro
Microcontrolador PIC16Fxx: Conjunto de Instruções

Instruções de Controle:

SLEEP : Go into Standby Mode

Prof. Pastro

Você também pode gostar