28.02.2015 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

w_temp:1<br />

status_temp:1<br />

ENDC<br />

; Registre <strong>de</strong> sauvegar<strong>de</strong> <strong>de</strong>stiné à mémoriser le registre<br />

<strong>de</strong> travail<br />

; Registre <strong>de</strong> sauvegar<strong>de</strong> <strong>de</strong>stiné à mémoriser le satus<br />

;**********************************************************************<br />

; DEMARRAGE SUR RESET *<br />

;**********************************************************************<br />

org 0x000<br />

; Adresse <strong>de</strong> départ après reset<br />

goto Init_reg<br />

;**********************************************************************<br />

; ROUTINE D'INTERRUPTION *<br />

;**********************************************************************<br />

org 0x004<br />

; sauvegar<strong>de</strong> <strong>de</strong>s registres principaux<br />

movwf w_temp;<br />

swapf STATUS,w<br />

movwf status_temp<br />

; Adresse d'interruption<br />

; Sauvegar<strong>de</strong> registre W<br />

; Swap Status et sauvegar<strong>de</strong> dans W<br />

; Sauvegar<strong>de</strong> Status dans la ram<br />

; Test si l'interruption est issue du RBO<br />

; Ce test est "inutile" car nous n'avons autorisé qu'une seule interruption<br />

; btfss INTCON, INTF ; Test si le Flag est à 1 (= Débor<strong>de</strong>m<strong>en</strong>t)<br />

; goto restoreg ; Si le test est faux, je ne traite pas l'interruption et je restaure les<br />

registres<br />

; traitem<strong>en</strong>t <strong>de</strong> l'interruption<br />

call intRBO<br />

; On doit impérativem<strong>en</strong>t faire un call et non un goto<br />

; car on doit rev<strong>en</strong>ir ici <strong>en</strong> fin <strong>de</strong> la routine d'interruption<br />

; restauration du flag<br />

bcf INTCON,INTF ; Je repositionne le Flag informant le dépassem<strong>en</strong>t à 0<br />

; restauration <strong>de</strong>s registres<br />

restoreg<br />

swapf status_temp, w<br />

movwf STATUS<br />

swapf w_temp,f<br />

swapf w_temp,w<br />

retfie<br />

; On restaure le registre STATUS<br />

; Inversion <strong>de</strong>s bits poids forts/poids faible du registre <strong>de</strong><br />

sauvegar<strong>de</strong> w_temp sans modifier le status<br />

; Re-inversion W

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!