Don't want to steal Steve's thunder, but I made a wireless accelerometer joystick. The transmitter uses an ADXL330 and an ATmega8, among the components. The ADXL330 is analog output also, and the ADC code would be virtually identical for an ATmega16.
Here's link to the details page; there you'll find a source zip.
It's been 5 or 6 years, so my AVR ADC coding skill are a little rusty, but between the source and the datasheet you should be on your way...
yeah, thanks. i got 50% idea. another 50% i'll get after using it... actually I am trying to make an robotic arm using accelerometer and servos... :) cheers...
PDF Downloads As a Pro member, you will gain access to download any Instructable in the PDF format.
You also have the ability to customize your PDF download.
Here's link to the details page; there you'll find a source zip.
It's been 5 or 6 years, so my AVR ADC coding skill are a little rusty, but between the source and the datasheet you should be on your way...
Have you read the data sheet ? These things are very, very easy to use.
Steve
http://www.atmel.com/Images/doc2466.pdf
P204
Here you'll find the control registers for the ADC described, the multiple operating modes, and how to start them.
You are programming "on the metal", so you have to know at the very lowest level how the processor works.
Steve
Lets walk through the steps you need.
1.) Config: Decide on sampling rate and type
2.) Using Interrupts ?
3.) Reading data out: how to avoid atomicity issues.
Gmoon's code's a good place to start.