Timer troubles (avr)

Status
Not open for further replies.

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 .
 
i donno abt the avr , but in 8051 core there is something like TR0 and TR1 (timerX run bits) , setting and clearing will do the job. haven't u got the manual for the tiny?
 
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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…