royalmadhu
Newbie level 3
hi
i'm building a pulse counter...
i'm using the external interrupt on RB0 in 16F877A for counting the pulse...
i have also used the TMR0 interrupt in the same interrupt function....
but my variable which is count9 for counting the pulses does not get incremented at all....i'm kind of a newbie when it comes to PICs so can anyone of u friends help me for solving this problem?
I'm simulating the program in proteus...and i'm using a push button to simulate the pulses in that
this is my code...
unsigned int count,count1,count2,count3,count4,count5,count6,count7,count8,count9;
void interrupt()
{
if(INTCON.INTF==1)
{
count9=count9+1;
if(count9==999)
{
count9=0;
}
INTCON.INTF=0;
}
if (INTCON.T0IF==1)
{
...
...//I have plenty of other lines here,,so i'm not puting those here..if u think the rest of the code is needed i'll post that
...
...
..
}
void main()
{
int a,b,c,d,k,m,n;
TRISB=0b01111111;
INTCON= 0b10110000;
OPTION_REG= 0b11000010;
TRISA=0b11111111 ;
ADCON1 = 7;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b111;
count1=count=0;
count7=count6=0;
count8=0;
COUNT9=0;
portc.f2=0;
portc.f0=0;
while(1)
{
...
...
..
}
i'm building a pulse counter...
i'm using the external interrupt on RB0 in 16F877A for counting the pulse...
i have also used the TMR0 interrupt in the same interrupt function....
but my variable which is count9 for counting the pulses does not get incremented at all....i'm kind of a newbie when it comes to PICs so can anyone of u friends help me for solving this problem?
I'm simulating the program in proteus...and i'm using a push button to simulate the pulses in that
this is my code...
unsigned int count,count1,count2,count3,count4,count5,count6,count7,count8,count9;
void interrupt()
{
if(INTCON.INTF==1)
{
count9=count9+1;
if(count9==999)
{
count9=0;
}
INTCON.INTF=0;
}
if (INTCON.T0IF==1)
{
...
...//I have plenty of other lines here,,so i'm not puting those here..if u think the rest of the code is needed i'll post that
...
...
..
}
void main()
{
int a,b,c,d,k,m,n;
TRISB=0b01111111;
INTCON= 0b10110000;
OPTION_REG= 0b11000010;
TRISA=0b11111111 ;
ADCON1 = 7;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b111;
count1=count=0;
count7=count6=0;
count8=0;
COUNT9=0;
portc.f2=0;
portc.f0=0;
while(1)
{
...
...
..
}