Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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.
 

did u wrote the routine in the same vector address?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top