TP n° 1 Prise en main de MPLAB 6 - LIAS
TP n° 1 Prise en main de MPLAB 6 - LIAS
TP n° 1 Prise en main de MPLAB 6 - LIAS
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
clrf TMR0<br />
CLRF PORTB<br />
;car le Port A est définie <strong>en</strong> banque 0<br />
; PASSAGE EN BANK 1<br />
BSF STATUS,RP0 ; BSF : Met le bit RPO <strong>de</strong> status à 1<br />
; On passe <strong>en</strong> bank 1 pour modifier le<br />
TRISA<br />
movlw 0xA0<br />
; Interruption : Validation Interruption Générale et<br />
Interruption TmrO 10100000<br />
movwf INTCON<br />
; INTCON = GIE|PEIE|TOIE|INTE|RBIE|TOIF|<br />
INTF|RBIF|<br />
; INTCON se trouve dans les 4 banques<br />
ports <strong>en</strong> <strong>en</strong>trée ou <strong>en</strong> sortie<br />
clrf TRISB<br />
<strong>en</strong>trée<br />
movlw 0x07<br />
movwf OPTION_REG ;<br />
; PASSAGE EN BANK 0<br />
BCF STATUS,RP0<br />
; Nous allons <strong>main</strong>t<strong>en</strong>ant configurer les<br />
; TRISB est <strong>en</strong> bank1; tout le port est configuré <strong>en</strong><br />
; 07 = 00000111 : Prédiviseur par 256 sur Tmr0<br />
; Par précaution, on revi<strong>en</strong>t <strong>en</strong> bank0<br />
Init<br />
movlw Val_compteur<br />
movwf cmpt<br />
; J'affecte mon nombre <strong>de</strong> boucle<br />
Boucle<br />
nop<br />
goto Boucle<br />
; Boucle infini car je n'ai pas <strong>de</strong> tache <strong>de</strong> fond<br />
inttmr0<br />
<strong>de</strong>cfsz cmpt,f<br />
return<br />
<strong>de</strong> la tempo on ne fait ri<strong>en</strong><br />
comf PORTB,f<br />
movlw 7<br />
movwf cmpt<br />
return<br />
; Décrém<strong>en</strong>te le compteur <strong>de</strong> passage<br />
; si le cmpt est non nul, nous ne sommes pas arrivé à la fin<br />
; xor(Led=0,1)=1, xor(Led=1,1)=0<br />
; on réassigne le compteur<br />
<strong>en</strong>d<br />
Programmes d’interruptions Page 18 Formation Thales EN3