#include <p16F84.inc> ; processor specific variable
definitions
;**********************************************************************
sec equ 0xC0
min equ 0x3C ;60 en décimal
compt_1 equ 0F
compt_2 equ 0E
;***********************************************************************************
ORG 0x00 ; processor reset vector
goto main ; go to beginning of program
;***********************************************************************************
;
*********************************************************************
ORG 0x04 ; routine d'interruption
btfsc INTCON,2 ; test interr de TMR0 ?
goto temps ; si oui -> temps
goto fin
temps: nop
decfsz compt_1,1
goto fintps
movlw 03E
movwf compt_1
decfsz compt_2,1
goto fintps
movlw min
movwf compt_2
RLF PORTB,1
fintps: movlw sec ; mise à jour du compteur TMR0
movwf TMR0
bcf INTCON,2 ; RAZ du drapeau d'interruption TMR0
fin: bcf STATUS,0
retfie ; fin d'interruption
main: bcf STATUS,5 ; banque 0
clrf PORTB ; RAZ PORTB
movlw sec ; mise à jour du compteur TMR0
movwf TMR0
movlw 03E ;03E
movwf compt_1
movlw min
movwf compt_2
movlw B'01000000' ; tout le port B est en sortie
bsf STATUS,5 ; banque 1
movwf TRISB
movlw B'11000111' ;mise à jour du registre OPTION
movwf OPTIO
bcf STATUS,5 ; banque 0
bcf STATUS,0 ; RAZ de carry
bsf INTCON,4 ; autorise l'interruption du port B
bsf INTCON,5 ; autorise le débordement du TMR0
bsf INTCON,7 ; autorise toutes les interruptions
movlw B'00000001' ; envoi un 1 sur B0
movwf PORTB
;***********************************************************************************
boucle: nop ; boucle d'attente d'interruption
goto boucle
END ; directive 'end of program'