Prob. timer/interruption

julien__68 Messages postés 5 Date d'inscription mardi 24 mai 2005 Statut Membre Dernière intervention 7 juin 2005 - 7 juin 2005 à 15:36
phenojeff Messages postés 87 Date d'inscription jeudi 10 octobre 2002 Statut Membre Dernière intervention 4 avril 2008 - 7 juin 2005 à 16:48
voila , j'ai réaliser une interruption sur rb0 (il fonctionne) mai je
ne compren pas a quoi peut servir cette ligne par rapport a
l'interruption de rb0 .... : bsf PIE1,TMR1IE pasque
normalement c'est pour autoriser l'interruption sur le timer , et en
faite je doit enlevé cette ligne pour continuer mon programme .....
mais quand je l'enleve , mon programme ne fonctionne plus ....

que dois-je faire pour enlevé cette ligne ?

merci pour vos réponses ++



voici mon programme :



list p=18f452, n=48, t=ON, st=OFF

#include "p18f452.inc"



;------------------BIT DEFINITIONS------------------------------------

F
EQU 0x0001

ptr
EQU 0x0c

compt EQU 0x000d

;------------------VECTORS--------------------------------------------



org 0x000000 ; reset vector

bra START



org 0x000008 ; high priority interrupt vector

bra TMR1_ISR



;--------------------PROGRAM-----------------------------------

START



rcall INIT



movlw 0x03

movwf ADCON1



clrf compt

clrf TRISB

CLRF PORTB

MOVLW B'00000001' ;RB0=inputs

MOVWF TRISB ;RB2-RB7=outputs.





movlw B'00000000' ;initialize USART

MOVWF ptr





bsf PIE1,TMR1IE ;enable Timer1 interrupts

;--------------------

;enable rb0 interrupts





MOVLW B'01100001' ;RB0=inputs

MOVWF INTCON2 ;RB2-RB7=outputs



bcf
INTCON2,INT1IE ;clear the rb0
interrupt flag

bcf
INTCON2,INT1IF ;clear the rb0
interrupt flag



bsf
INTCON,RBIE ;

bcf INTCON,RBIF



;---------------------

bsf INTCON,GIEH
;set the
global interrupt enable bits

bsf INTCON,GIEL

; "



MLOOP


goto MLOOP



;-------------------------------SUBROUTINES---------------------------------

TMR1_ISR ; high
priority
isr




btfsc INTCON,INT0IE

goto int_rb0



btfsc INTCON,INT0IF

goto int_rb0



goto fin



int_rb0

bcf INTCON,INT0IE ;clear the rb0 interrupt flag

bcf INTCON,INT0IF ;clear the rb0 interrupt flag



btfss ptr,1

goto affon3



bcf PORTB,1

bsf INTCON2,INTEDG0

bcf ptr,1



goto fin



affon3

bcf INTCON2,INTEDG0

bsf PORTB,1

bsf ptr,1

goto fin





fin



retfie



INIT

clrf PORTB ; setup portb for outputs

clrf DDRB



return



END

1 réponse

phenojeff Messages postés 87 Date d'inscription jeudi 10 octobre 2002 Statut Membre Dernière intervention 4 avril 2008
7 juin 2005 à 16:48
allo tu mélange ca un peu

list p=18f452, n=48, t=ON, st=OFF
#include "p18f452.inc"

;------------------BIT DEFINITIONS------------------------------------
F EQU 0x0001
ptr EQU 0x0c
compt EQU 0x000d
;------------------VECTORS--------------------------------------------


org 0x000000 ; reset vector
bra START

org 0x000008 ; high priority interrupt vector
bra TMR1_ISR


;--------------------PROGRAM-----------------------------------
START



INIT
clrf DDRB
movlw 0x07 ;desactive A/D pin sur PORTA pin toute en digital
movwf ADCON1


clrf compt
CLRF PORTB
MOVLW B'00000001' ;RB0=inputs
MOVWF TRISB ;RB2-RB7=outputs.



movlw B'00000000' ;initialize USART
MOVWF ptr


;--------------------
;enable rb0 interrupts

bsf INTCON,INT0IE ;active interup sur RB0
bcf INTCON,INT0IF ;efface le flag interrupt RB0


;---------------------
bsf INTCON,GIEH ;TOUTE interrupt ACTIVE
bsf INTCON,GIEL ; "


MLOOP
goto MLOOP

;-------------------------------SUBROUTINES---------------------------------
TMR1_ISR ; high priority isr


btfsc INTCON,INT0IF ; si interup sur RB0
goto int_rb0


goto fin


int_rb0
; bcf INTCON,INT0IE ;desactive interup sur RB0
bcf INTCON,INT0IF ;clear the rb0 interrupt flag


btfss ptr,1
goto affon3


bcf PORTB,1
bsf INTCON2,INTEDG0 ; Interrupt on rising edge
bcf ptr,1


goto fin


affon3
bcf INTCON2,INTEDG0 ;Interrupt on falling edge
bsf PORTB,1
bsf ptr,1
goto fin



fin


retfie


END
0
Rejoignez-nous