How to interface PING sensor to AVR (ATmega168)?
Hi,
How do I use the Parallax PING sensor with an AVR?
Specifically, the ATmega 168 using WinAVR (a gcc C-compiler and library).
The Parallax code uses the Serial commands of the Basic Stamp,
but I don't know how to implement this for the ATmega168.
I'm guessing this has been done before, but I couldn't find
a link that was simple enough for me to understand.
(It seems that many people did "bit-banging" using assembly language.)
Thanks for any help!
How do I use the Parallax PING sensor with an AVR?
Specifically, the ATmega 168 using WinAVR (a gcc C-compiler and library).
The Parallax code uses the Serial commands of the Basic Stamp,
but I don't know how to implement this for the ATmega168.
I'm guessing this has been done before, but I couldn't find
a link that was simple enough for me to understand.
(It seems that many people did "bit-banging" using assembly language.)
Thanks for any help!
Comments
I assume the AVR has library code to generate a fixed size pulse, and another library call to measure a pulse-width on an input pin.
Thanks for the reply, but I made a stupid mistake.····
I meant to ask about the Sharp IR distance sensor:··
http://www.parallax.com/dl/docs/prod/acc/SharpGP2D12Snrs.pdf
The code I'm having trouble with is the SHIFTIN command below:··
How do I convert the SHIFTIN into C?·· ··
Thanks again for any help!· ··
··
The ADC involved uses a protocol called SPI which is very common. Check the ADC manufacturer's website for datasheets and application notes. You may find a ready-to-go driver in C. Also check Atmel's website and support documents and you will probably find drivers in C for the ATmega168. The ADC datasheets usually include a detailed description of the signals necessary for doing an analog to digital conversion including diagrams of the signals involved.
Post Edited (Mike Green) : 7/2/2008 4:35:45 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen