Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <p18F4550.inc>
- CONFIG WDT = OFF ; disablewatchdogtimer
- CONFIG MCLRE = ON ; MCLEAR Pin on
- CONFIG DEBUG = OFF ; DisableDebugMode
- CONFIG FOSC = HS
- org 0x0000
- goto prog_init
- org 0x0008 ; si interruption va à cette adresse
- goto irq_handle
- irq_handle
- btfsc INTCON , TMR0IF ; si le flag d'interruption est levé (=1) goto TMR0_interrupt sinon (=0) retourne a l'adresse où il s'est arreté
- goto TMR0_interrupt
- retfie
- TMR0_interrupt
- bcf INTCON , TMR0IF ; clear le flag (=0) pour bien reset et ne pas boucler à l'infini
- incf PORTC ; incrémente de 1 PORT C
- retfie ; retourne à l'adresse enregistrée lors de l'interruption
- prog_init
- clrf TRISC
- bsf T0CON , TMR0ON ; Active le timer 0
- bsf T0CON , T08BIT ; met le timer sur 8 bits
- bcf T0CON , T0CS ; utilise la clock interne
- bcf T0CON , PSA ; active le préscalaire (diviseur de clock)
- bsf INTCON , GIE ; autorise les interruptions
- bsf INTCON , TMR0IE ; autorise les interuptions sur le timer
- clrf TMR0 ; reset le timer, car il s'est deja incrémenter (depuis bsf T0CON , TMR0ON)
- GOTO MAIN_LOOP
- MAIN_LOOP
- goto MAIN_LOOP
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement