code for tmr0 in mikroc pro
Posted: 01 Dec 2011 08:10
using tmr0 at pic 16f877a to make 10 min delay or what ever the delay using 4 MHz oscillatory i tried to write the code but there is error and this is the code
unsigned i;
void interrupt(){
intcon = 0b00100000;
i++;
if (i==305)
portd=1;
tmr0if_bit=0;
tmr0=0;
}
void main() {
intcon = 0b10100000;
option_reg = 0b00000111;
trisd=0;
trisb=0;
PORTB=0;
portd=0;
tmr0=0;
i = 0;
while(1)
{
if(tmr0if_bit=1){
interrubt;
}
}
}
and thanks in advance
unsigned i;
void interrupt(){
intcon = 0b00100000;
i++;
if (i==305)
portd=1;
tmr0if_bit=0;
tmr0=0;
}
void main() {
intcon = 0b10100000;
option_reg = 0b00000111;
trisd=0;
trisb=0;
PORTB=0;
portd=0;
tmr0=0;
i = 0;
while(1)
{
if(tmr0if_bit=1){
interrubt;
}
}
}
and thanks in advance