interrupt on pic16f684

Status
Not open for further replies.

neelam29

New Member
hi m trying to make a led status reverse on interrupt using pic16f684.below is the code...cant find the mistake...please help..the code isnt running

#include<pic16f684.h>

#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))


static bit Led1 @ PORTBIT(PORTC, 5);
static bit Led1_tris @ PORTBIT(TRISC, 5);



static void interrupt isr ()
{
if(INTF)
{
Led1=1;


INTF=0;
INTE=1;
PEIE=1;
}



}

/////////////////////////////////////////////////////////////////////////////////////////////


void main(void){

TRISC=0x00;
PORTC=0x00;
TRISA=0x00;
PORTA=0x00;

CMCON0=0;
ANSEL=0;

GIE=1;
PEIE=1;
INTE=1;
INTF=0;
WPUA2=1;
RAIE=1;
IOCA=0x0F;

INTEDG=1;

Led1=0;

for( ; ; )


{










}
}
 
Last edited:
I don't think an interrupt can occur when you have the int pin set as output.

Also, when posting code put
Code:
 before it and [/c[COLOR="Black"]od[/COLOR]e] after it so that it keeps it's formatting.

Mike.
 
thanks a lot ... i was making so silly mistake...it worked out now.and in future i will take care that code is put in format
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…