Vous êtes sur la page 1sur 3

Microcontrleur TP5 : Compteur binarie

Manipulation:
Ralisation dun compteur binaire. Il y aura une incrmentation toutes
les secondes.
Schma de l'organigramme:

Brochage du microcontrleur PIC16F84A

Branchement du microcontrleur:

Programmation du microcontrleur:
;******************************************************************
; Projet :
Compteur binaire
; Fichier projet : rombast.mclsprj
; Fichier source : rombast.asm
; Date :
14.03.2012
; Logiciel :
MCLS
; Matriel :
PIC16F84A
;
;******************************************************************
;-----------------------------------------------------------------; Configuration PIC
; ----------------------------------------------------------------LIST p=16f84
; code protection off/ power up timer off/ wdt off /XT oscillator
__config
0x3ff9
; ----------------------------------------------------------------; Variables dans la RAM partir de ladresse 0x10
; ----------------------------------------------------------------cblock 0x10
countb
endc

; ----------------------------------------------------------------; Table des vecteurs dinterruption


; ----------------------------------------------------------------org
0x000
; vecteur RESET
goto
start
org
0x004
; vecteur dinterruption
retfie
; ----------------------------------------------------------------; Programme principal
; ----------------------------------------------------------------start:
bsf
STATUS,RP0
; banque de registre 1
movlw
B'00000000'
; on dfinit le port B comme sortie
movwf
TRISB
; crire le registre de direction
bcf
STATUS,RP0
; banque de registre 0
movlw
movwf

B'00000000'
countb

; W=0000000
; countb=W

countb,f
countb,w
PORTB

; countb = countb + 1
; W=countB
; PORTB=W (pour allumer leds)

call

wait_480ms

; attendre

goto

main

; retour main

main:
incf
movf
movwf

; ----------------------------------------------------------------; Fichiers Include


; ----------------------------------------------------------------include "p16f84.inc"
; contrleur cible
include "time.inc"
; temporisations par logiciel
; ----------------------------------------------------------------end

Vous aimerez peut-être aussi