NadaF
Newbie level 6
- Joined
- May 1, 2013
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,364
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;
}
}
}