I don't see anything wrong with the code, but the documentation is off. Just a couple notes: you can enable, set the clock and start the first conversion in one write. There is no need to delay 15us, etc. Just let er rip and discard the first conversion - unless that delay you have is to allow the Aref cap to charge... In any case the first, dummy conversion is something like 24 cycles long and at 2mhz clock (your doco says 125khz, but your code selects 2mhz) that should be sufficient. As to the problem? Well, is ADCH declared correctly in the header? I use the left adjusted, high speed clock ADC on an mega16 and it works like a champ. Since you said the normal ADC routines work, I am assuming the Aref pin is good and not tied to +5v or something like that.
Message
RE: [AVR-Chat] M128 ADC problem
2003-12-30 by Larry Barello
Attachments
- No local attachments were found for this message.