interrupt doesn't work help plz

Status
Not open for further replies.

giacciu

Newbie level 1
Joined
Sep 3, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,290
this is a simple code that turn on the led on rb4 when ccp1 feel the first rising edge maded by another pic

void interrupt()
{

if(PIR1.CCP1IF==1)
{
PORTB=0b00010000;

PIR1.CCP1IF =0;


}

}




void main()
{
TRISC=1;

TRISB=0;




T1CON=0b00110001;

CCP1CON=0b00000101;



T1CON.TMR1ON=1;

INTCON.PEIE = 1;

PIE1.CCP1IE = 1;

PIR1.CCP1IF=0;

INTCON.GIE = 1;

while(1) //endless loop
{
delay_ms(500);

PORTB=0b00100000;

delay_ms(500);

PORTB=0;

}
}

the led on rb5 blink forever , so it don't feel the interrupt
help me please
 

does it blink forever? stays ON forever? or off forever?
Where is the function interrupt() being called in the main?
 

just check the void intrupt() function is correct because in some controllers the intrupt subroutine function might be different form just check the application.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…