NadaF
Newbie level 6
i need equation to convert value in TMR1L into microseconds on pic 16f877a using mikroc language plzzz anyone help me !!!!
- - - Updated - - -
my code using mikroc language:
i'm using pic 16f877a , timer1, internal clock
int Dis;
int Dur;
int T;
void main()
{
TRISB.B7=1; // i/p for pic
TRISB.B6=0; // o/p for pic
while (1)
{
if (PORTB.B6=1)
{
T1CON=0001001; // timer on
if (PORTB.B7=1)
{
T1CON=00000000; // timer off
}
T= TMR1L;
Dur=T/4/1; // lsa freq of osc. /4 / prescaler rate 1:1 -----> is that convert value into microseconds ?!
Dis=(Dur/29.1)/2;
}
}
}
- - - Updated - - -
my code using mikroc language:
i'm using pic 16f877a , timer1, internal clock
int Dis;
int Dur;
int T;
void main()
{
TRISB.B7=1; // i/p for pic
TRISB.B6=0; // o/p for pic
while (1)
{
if (PORTB.B6=1)
{
T1CON=0001001; // timer on
if (PORTB.B7=1)
{
T1CON=00000000; // timer off
}
T= TMR1L;
Dur=T/4/1; // lsa freq of osc. /4 / prescaler rate 1:1 -----> is that convert value into microseconds ?!
Dis=(Dur/29.1)/2;
}
}
}