Vous êtes sur la page 1sur 5

PIC PROGRAMMATION ASSEMBLEUR

TP

page 1 / 5
III) Listing programme avec code machine:

TP CLIGNOTEMENT LED 1HZ


I)

Prsentation :

L'objectif est de faire clignoter une LED la frquence de 1Hz. Pour cela, il faudra qu'elle soit
allume pendant 0,5s, puis teinte pendant aussi pendant 0,5s. La LED utilise est connecte sur le
bit 0 du port B.

II)

Algorigramme :
Dbut

Temporisation 0,5s

Initialiser accs Bank 1

Initialiser le nombre de
temporisation lmentaire

Initialiser RB0 RB5 en sortie


Et RB6 et RB7 en entre

Initialiser la valeur de la
temporisation lmentaire

Initialiser accs Bank 0


Utilisation de 5 NOP
Mettre 1 sur RB0
Dcrmenter la
temporisation lmentaire
Temporisation 0,5s
NON

Mettre 0 sur RB0

Fini ?
OUI

Dcrmenter le nombre de
temporisation lmentaire

Temporisation 0,5s
NON

Fini ?
OUI

RETURN

_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
________________________________________________________________________________

PIC PROGRAMMATION ASSEMBLEUR

TP

page 2 / 5
III)

TP CHENILLARD 0,333HZ
I)

Prsentation:

L'objectif est de raliser un chenillard dont la frquence de rotation est de 0,333Hz. La premire LED
s'allumer tant la LED1 (port B, bit 0). On allume les LEDs de LED1 LED6 (RB0 RB5).
Pour cela, il est demand d'crire le programme suivant les ordinogrammes dcrits ci-aprs (les
respecter).

II)

Algorigramme:
Dbut

Temporisation 0,5s

Initialiser accs Bank 1

Initialiser le nombre de
temporisation lmentaire

Initialiser RB0 RB5 en sortie


Et RB6 et RB7 en entre

Initialiser la valeur de la
temporisation lmentaire

Initialiser accs Bank 0


Utilisation de 5 NOP
Initialiser un masque
stock en mmoire

Mettre le masque
sur le port B

Dcrmenter la
temporisation lmentaire
NON

Fini ?
OUI

Temporisation 0,5s

Rotation gauche du masque

NON

Dcrmenter le nombre de
temporisation lmentaire
NON

Fini ?
OUI

Bit 6 du masque 1 ?
OUI

RETURN

Listing programme avec code machine:

_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
________________________________________________________________________________

PIC PROGRAMMATION ASSEMBLEUR

TP

page 3 / 5
III)

TP CHENILLARD 0,167HZ
I)

Prsentation:

L'objectif est de raliser un chenillard dont la frquence de rotation est de 0,167Hz. On doit raliser
un chenillard qui dfile un coup gauche, puis un coup droite de la LED1 LED6 (RB0 RB5).
Pour cela, il est demand d'crire le programme suivant les ordinogrammes dcrits ci-aprs (les
respecter).

II)

Algorigramme:
Dbut

Temporisation 0,5s

Initialiser accs Bank 1

Initialiser le nombre de
temporisation lmentaire

Initialiser RB0 RB5 en sortie


Et RB6 et RB7 en entre

Initialiser la valeur de la
temporisation lmentaire

Initialiser accs Bank 0


Utilisation de 5 NOP
Initialiser un masque
stock en mmoire

Mettre le masque
sur le port B

Dcrmenter la
temporisation lmentaire
NON

Fini ?
OUI

Temporisation 0,5s

Rotation gauche du masque

NON

NON

Fini ?
OUI

Bit 6 du masque 1 ?
OUI

Rotation droite du masque

Rotation droite du masque


Mettre le masque
sur le port B
Temporisation 0,5s
NON

Dcrmenter le nombre de
temporisation lmentaire

Bit 0 du masque 1 ?
OUI

RETURN

Listing programme avec code machine:

___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________

PIC PROGRAMMATION ASSEMBLEUR

TP

page 4 / 5
III)

TP LECTURE & AFFICHAGE ETATS MICROSWITCHS


I)

Prsentation :

L'objectif est de lire l'tat des microswitchs connects sur le port A (RA0 RA3). L'tat de chaque
microswitch sera visualis par une LED. Les LEDs sont connectes sur le port B. Nous utiliserons les
LEDs 0 3.
Pour cela, il est demand d'crire le programme suivant les ordinogrammes dcrits ci-aprs (les
respecter).

II)

Algorigramme :
Dbut

Inhiber le comparateur

Initialiser accs Bank 1


Initialiser RB0 RB5 en sortie
Et RB6 et RB7 en entre
Initialiser RA0 RA7
en entre
Initialiser accs Bank 0

Lecture du port A
Ne garder que les 4 bits
de poids faibles de la lecture
Ecriture du rsultat
dans le port B

Listing programme avec code machine:

_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________

PIC PROGRAMMATION ASSEMBLEUR

TP

page 5 / 5
III)

TP LECTURE ET CLIGNOTEMENT
I)

Prsentation :

L'objectif est de lire l'tat des microswitchs 1 4, c'est dire ceux connects sur les bits 0 3 du port
A. La LED5 connecte sur le bit 4 du port B devra clignoter 1Hz alors que les autres LEDs devront
indiquer l'tat de chacun des microswitchs (LED1 LED4 sur RB0 RB3).
Pour cela, il est demand d'crire le programme suivant les ordinogrammes dcrits ci-aprs (les
respecter).

II)

Algorigramme :
Dbut

Temporisation 0,5s

Inhiber le comparateur

Initialiser le nombre de
temporisation lmentaire

Initialiser accs Bank 1


Initialiser la valeur de la
temporisation lmentaire

Initialiser RB0 RB5 en sortie


Et RB6 et RB7 en entre
Initialiser RA0 RA7
en entre

Mmoriser tat LED5


Eteindre LED0 LED4

Initialiser accs Bank 0

Lire les switchs


Concatner la lecture
avec le port B

Temporisation 0,5s
Dcrmenter la
temporisation lmentaire
Changer tat LED5
NON

Fini ?
OUI

Dcrmenter le nombre de
temporisation lmentaire
NON

Fini ?
OUI

RETURN

Listing programme avec code machine:

_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________