You are on page 1of 26

Introduction aux microcontrôleurs

Classification des PICs

1. Base-Line
2. Mide-Line Identification d’un PIC:
3. High-End
Type

Fréquence max (MH)


16 F 84 - 10
Mide-Line

Mémoire pro
F: Flash
C: EPROM ou EEPROM
CR: PROM
Brochage du circuit

RA1
RA2 1 18
RA0
RA3 2 17
OSC1/CLKIN
RA4/ T0CKI 3 16
OSC2/CLKOUT

PIC 16 F 84
MCLR 4 15
VDD
VSS 5 14

RB0/ INT RB7


6 13
RB6
RB1 7 12
RB5
RB2 8 11
RB4
RB3 9 10
Architecture et Constitution interne
Schéma simplifié

Registre 3
1
2 Compteur Mémoire
Mémoire programme RAM
Programme

5
4
6 Registre
Pointeur de pile 8 7
Registre d’instructions 9
Système d’horloge
Organisation de la mémoires programme
Organisation de la mémoire de données et le registres SFR
Jeu d’instructions
1. L’instruction « MOVLW » syntaxe MOVLW k ≈ w←k=0x25
25

W 0 0 1 0 0 1 0 1
2. L’instruction « MOVF » syntaxe MOVF f, d ≈ (f)→d
Si f =25 avec l’adresse 0x10

Reg f add 0x10 0 0 1 0 0 1 0 1

Reg d add 0x12


3. L’instruction « MOVWF » syntaxe MOVWF f ≈ (w)→f
Si w= 0x25

reg W 0 0 1 0 0 1 0 1 Add 0x12

Emplacement f

4. L’instruction « GOTO » syntaxe goto étiquette

Début
movlw 0x12; commentaire
movwf registre;……….
goto début
5. L’instruction « INCF » syntaxe INC f , d ≈ (f) +1→d
Si f= 0x10

00 00 00 11 00 00 00 10
+1

6. L’instruction « DECF » syntaxe DECF f , d ≈ (f) -1→d

0 0 0 1
0 0
1 0
1 0
1 0
1
-1
7. L’instruction « ADDLW » syntaxe ADDLW val ≈ (w)+val→w

Si w=0x10 et si val 0x3

Reg W 0 0 0 1 0 0 0 0
ADDLW
val 0 0 0 0 0 0 1 1

0 0 0 1 0 0 1 1
8. L’instruction « ADDWF» syntaxe ADDWF f , d ≈ (w)+(f)→d

Si w=0x10 et si f = 0x3

Reg W 0 0 0 1 0 0 0 0
ADDWF
F adr 0x15 0 0 0 0 0 0 1 1

d 0 0 0 1 0 0 1 1
9. L’instruction « SUBLW» syntaxe SUBLW val ≈ val-(w)→w

Si w=0x3 et si val 0x10

val 0 0 0 1 0 0 0 0
SUBLW
Reg W 0 0 0 0 0 0 1 1

Reg W 0 0 0 0 1 1 0 1
10.L’instruction « SUBWF» syntaxe SUBWF f , d ≈ (f )– (w)→d

Si w=0x3 et si val 0x10

Emplacement f 0 0 0 1 0 0 0 0
SUBWF
Reg W 0 0 0 0 0 0 1 1

d 0 0 0 0 1 1 0 1
11.L’instruction « ANDLW» syntaxe ANDLW val ≈ (w) & val→w

Si w=0x3 et si val = 0x10

Re W 0 0 0 1 0 0 0 0
ANDLW

val 0 0 0 0 0 0 1 1

W 0 0 0 1 0 0 1 1
12.L’instruction « ANDWF» syntaxe ANDWF f , d ≈ (w) and (f)→d

Si w=0x3 et si f = 0x10

Re W 0 0 0 1 0 0 0 0
ANDWF

Emplacement f 0 0 0 0 0 0 1 1

d 0 0 0 1 0 0 1 1
13.L’instruction « IORLW» syntaxe IORLW val ≈ (w) OR val→W

Si w=0x7 et si val 0x14

val 0 0 0 1 0 1 0 0
IORLW

Reg W 0 0 0 0 0 1 1 1

w 0 0 0 1 0 1 1 1
14.L’instruction « IORWF» syntaxe IORWF f , d ≈ (w) OR (f)→d

Si w=0x7 et si f= 0x14

Emplacement f 0 0 0 1 0 1 0 0
IORWF

Reg W 0 0 0 0 0 1 1 1

d 0 0 0 1 0 1 1 1
15.L’instruction « XORLW» syntaxe XORLW val ≈ (w) XOR val→w

Si w=0x47 et si val 0x14

val 0 0 0 1 0 1 0 0
XORLW

Reg W 0 1 0 0 0 1 1 1

w 0 1 0 1 0 0 0 0
16.L’instruction « XORWF» syntaxe XORWF f , d ≈ (w) XOR (f)→d

Si w=0x47 et si f= 0x14

Emplacement f 0 0 0 1 0 1 0 0
XORWF

Reg W 0 1 0 0 0 1 1 1

d 0 1 0 1 0 0 1 0
17.L’instruction « BSF» syntaxe BSF f , bm ≈ bn …. bm ….b0
Reg f

(1)

18.L’instruction « BCF» syntaxe BCF f , bm ≈ bn …. bm …..b0


Reg f
(0)
19.L’instruction « BTFSC» syntaxe BTFSC f , bm ≈ (1)

20.L’instruction « BTFSS» syntaxe BTFSS f , bm ≈


En vue de la commande d’un MCC
1. En utilisant un PC
vcc

D0

0101100
ULN2003
En vue de la commande d’un M P à P

D0

0101100
ULN2003

You might also like