giacciu
Newbie level 1
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
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