Timer troubles (avr)

bloody-orc

New Member
Hi there. i'm trying to control a sonar with my AVR tiny2313. for this i need to mesure a time taken from one given point (after sending out bursts of sound) to echo what is high signal on an input of AVR.
i'm programming in C and i just cant find any tutorials on how to do this. only asm tutorials...

thank you in advance
Rain
 
if u know the algorithm , then what is the problem.?
(assuming a one unit Txs and Rxs)
enable the US Tx , for a short duration. skip a little time for it's echo to die out ,start a timer , wait for echo , stop the timer .
 
thats the point. i cant start the timer and stop it. i just dont know the commands :$
 
Look on bastoc.com, there are tutorials there and I think there is a avr timer
sample in RVKBASIC, you can download rvkbasic, type the couple lines of code (timer related), compile it and look at the .ASM for the commands.
 
i dont want neither basic nor asm file cause i cant read them.

i have the manual, but it does not give any examples in C (well actually all the C examples are exactly the same and wrong). i'l go and have a look in the data again to see, wich bits to set 1 and 0 then.
thanks for your help.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…