16F87Xa timer0 programming error

Status
Not open for further replies.

bimalkamal

Member level 1
Joined
Nov 27, 2011
Messages
32
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,529
This code is for PIC16F876A with 20Mhz crystal to learn using Timer0 .
I am getting the following error in mikroc Pro:-


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void main() {
 unsigned char count;
 TRISB=0;
 TMR0=0;
 OPTION_REG=0B00001000;
 PORTB=0x00;
 while(1){
    if(TMR0IF)    { //<---------no error here
    count++;
    TRISB=count;
    TMR0IF=0;  //<----------Error : Assigning to non lvalue "TMR0IF" but no error if I write INTCON.TMR0IF=0;
    
    }
 }
}



Why TMR0IF=0; giving error?

Also please suggest some site/blog to learn 16F87Xa timer0 programming

Thanks in advance.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…