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.

need help to figure out the problem with the interrupt code for pic 16f873a.

Status
Not open for further replies.

rosh6270

Newbie level 1
Joined
Mar 5, 2013
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Activity points
1,280
The led connected to portc behaves funny when connected to the pic and doesnt seem to acknowledge the interrupt.


unsigned char presence=0;

void ISR(void)
{
if(INTCON.RBIF==1)
{
presence=1;
INTCON.RBIF=0;
}
}

void main(void)
{
TRISB=0x20;// rb5 is pir input
TRISC=0x00;

INTCON.GIE=1;
INTCON.RBIE=1;

while(1)
{
if(presence) // PIR Sensor
{
PORTC=~PORTC; // led output
delay_ms(500);

}

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top