Sign In

Trouble In Measuring Time Of The Pulse From Echopin Of Ultrasonic Sensor

AREEHA areeha6@gmail.com Pakistan

Hardware: Atmega328P Running At 16 Mhz On Arduino Board Software: AVR GCC USING ATMEL STUDIO

I am trying to interface the wind anemometer on avr but i am not getting how to translate the pulseIn command like in arduino into avr.what should i do?

Images

Replies

R Avinash
2016-05-14 11:10:39
Which model anemometer you are using? Give its full name, link to datasheet and on which PIN of ATmega328 you have connected it. Also attach the picture of sensor.
0
R AREEHA
2016-05-16 04:57:19
Thanks for the assistance sir but i aint getting few of the things in your mentioned code like why are we taking the factor of 6000000? and that what is this line doing in the loop?
if(!(US_PIN & (1< i mean what are we checking here?
Secondly,why and how are this 0xffff and 0xfffe used for here?
R Avinash Gupta
2016-05-16 05:40:20
See this tutorial to understand how we check if a bit in a byte is set or clear

http://extremeelectronics.co.in/avr-tutorials/programming-in-c-tips-for-embedded-development/
R AREEHA
2016-05-16 08:44:24
but sir i dont understand why have we used 600000?

Post a reply to AREEHA

Think you can help AREEHA ? Then post your thoughts that might help AREEHA. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.