13.11.2012 Views

PIC 16F628

PIC 16F628

PIC 16F628

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Microchip <strong>PIC</strong> <strong>16F628</strong> M. Deloizy 17<br />

Sauvegarde de W et STATUS en RAM :<br />

MOVWF W_TEMP ;copy W to temp register, could be in either bank<br />

SWAPF STATUS,W ;swap status to be saved into W<br />

BCF STATUS,RP0 ;change to bank 0 regardless of current bank<br />

MOVWF ST_TEMP ;save status to bank 0 register<br />

:<br />

: (ISR)<br />

:<br />

SWAPF ST_TEMP,W ;swap ST_TEMP register into W,<br />

;sets bank to original state<br />

MOVWF STATUS ;move W into STATUS register<br />

SWAPF W_TEMP,F ;swap W_TEMP<br />

SWAPF W_TEMP,W ;swap W_TEMP into W<br />

III.5. Watchdog<br />

→ compteur indépendant.<br />

Durée ≈ 18ms sans prédiviseur d’horloge (jusqu’à 2,3s avec)<br />

Activé par WDTE du mot de configuration<br />

Fonctionne même si horloge arrêtée (sur OSC1, OSC2) par SLEEP.<br />

En mode normal → déclenchement d’un RESET<br />

En mode SLEEP → réveil du µP → retour au fonctionnement normal.<br />

CLRWDT et SLEEP initialisent le watchdog<br />

III.6. Mode Power-down<br />

→ atteint par l’instruction SLEEP<br />

→ arrête le driver de l’oscillateur (arrêt de l’horloge)<br />

Réveil par :<br />

• MCLR → Réinitialisation du système<br />

• Watchdog<br />

• Interruption sur RB0/INT ou RB change ou comparateur<br />

Poursuite du<br />

programme

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

Saved successfully!

Ooh no, something went wrong!