timer/counter problem - please help
hi
i'm using atmega328 build engine controller final year project , i've run problem can solve.
i used 16bit timer1 counter encoder, , periodically fetched value tcnt1.
however, using timer1 counter prevents servo function working, need actuate engine trottle.
i've tried using timer0, seemed disable serial com, , can't figure out how use timer2 counter.
if can setting timer2 counter, or knows of method of using high speed encoder (up 5000 inputs per second) , servo motor together, i'd extremely grateful.
this timer 2 setup thats not working:
i'm using atmega328 build engine controller final year project , i've run problem can solve.
i used 16bit timer1 counter encoder, , periodically fetched value tcnt1.
however, using timer1 counter prevents servo function working, need actuate engine trottle.
i've tried using timer0, seemed disable serial com, , can't figure out how use timer2 counter.
if can setting timer2 counter, or knows of method of using high speed encoder (up 5000 inputs per second) , servo motor together, i'd extremely grateful.
this timer 2 setup thats not working:
code: [select]
timsk2 = 0; // disable timer2 interrupts
assr = 0b01000000; // enable external clock source
// assr | 0b00100000; // set asnychronous mode ???
// apparently timer must asnychronous use external source
tccr2a = 0; // disable waveform generation mode
tccr2b = 0; // use clock no prescaler
tcnt2 = 0; // clear counter
tifr2=0; // clear interrupt flag register
timsk2 = 1; // enable overflow interrupts
i forgot mention serial communication computer vital project, why timer0 can't used.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > timer/counter problem - please help
arduino
Comments
Post a Comment