vinay bs
Member level 3
Hi,
I am using pic 16f676 and mikroc compiler, i facing problem in external interrupt(INTE), interrupt occurs at first time
and next time onwards its not responding, below is my code, please help me out wats wrong with my program.....
thanks in advance...
I am using pic 16f676 and mikroc compiler, i facing problem in external interrupt(INTE), interrupt occurs at first time
and next time onwards its not responding, below is my code, please help me out wats wrong with my program.....
thanks in advance...
Code:
#define red PORTC.F0
#define green PORTC.F1
#define blue PORTC.F2
#define mode PORTA.F2
void flashrgb();
void strobe();
void smooth();
void fadergb();
void rgboff();
unsigned char i,j,k,l,m,n;
unsigned int count,sec;
unsigned int signal_high;
unsigned int signal_low;
unsigned char readb;
unsigned char mode_count = 0;
void interrupt()
{
if(INTCON.INTF == 1)
{
mode_count = mode_count+1;
switch(mode_count)
{
case 1:
INTCON.INTF = 0;
flashrgb();
break;
case 2:
INTCON.INTF = 0;
strobe();
break;
case 3:
INTCON.INTF = 0;
fadergb();
break;
case 4:
INTCON.INTF = 0;
mode_count = 0;
smooth();
break;
}
INTCON.INTF = 0;
}
}
void main()
{
OPTION_REG = 0b00000000;
WPUA = 0b00000100;
INTCON.GIE = 1;
//INTCON.PEIE = 1;
INTCON.INTE = 1;
INTCON.INTF = 0;
CMCON = 0x07;
ANSEL = 0x00;
TRISA = 0b111111;
TRISC = 0b000000;
PORTC = 0x00;
while(1)
{
INTCON.INTF = 0;
rgboff();
}
}
void rgboff()
{
red=0;
green=0;
blue=0;
}
void fadergb()
{
}
void flashrgb()
{
}
void strobe()
{
}
void smooth()
{
}