tahir4awan
Full Member level 4
- Joined
- Nov 29, 2010
- Messages
- 213
- Helped
- 16
- Reputation
- 32
- Reaction score
- 17
- Trophy points
- 1,308
- Location
- Germany
- Activity points
- 3,116
I wrote this code just to check how interrupt works but the problem is MikroC is not compiling the code
----------------------------------------------------------------------------
int count = 0;
void main()
{
ANSEL = 0;
ANSELH = 0;
TRISB = 0x00;
GIE_bit = 1;
PEIE_bit = 1;
T0IE_bit = 1;
T0IF_bit = 0;
T0CS_bit = 1;
T0SE_bit = 0;
PSA_bit = 0;
PS0_bit = 1;
PS1_bit = 1;
PS2_bit = 1;
TMR0 = 0;
void interrupt() {
count++;
TMR0 = 0;
T0IF_bit = 0;
}
while(1){
if(count==5)
{
PORTB = 0x01;
}
else if(count==10)
{
PORTB = 0x02;
}
else if(count==15)
{
PORTB = 0x03;
}
else if(count==20)
{
PORTB = 0x04;
}
}
}
---------------------------------------------------------------------------
can someone tell me what is the problem?
----------------------------------------------------------------------------
int count = 0;
void main()
{
ANSEL = 0;
ANSELH = 0;
TRISB = 0x00;
GIE_bit = 1;
PEIE_bit = 1;
T0IE_bit = 1;
T0IF_bit = 0;
T0CS_bit = 1;
T0SE_bit = 0;
PSA_bit = 0;
PS0_bit = 1;
PS1_bit = 1;
PS2_bit = 1;
TMR0 = 0;
void interrupt() {
count++;
TMR0 = 0;
T0IF_bit = 0;
}
while(1){
if(count==5)
{
PORTB = 0x01;
}
else if(count==10)
{
PORTB = 0x02;
}
else if(count==15)
{
PORTB = 0x03;
}
else if(count==20)
{
PORTB = 0x04;
}
}
}
---------------------------------------------------------------------------
can someone tell me what is the problem?