Teensy LC analogRead -- seems to be limited to 10-bits?

Status
Not open for further replies.

pezman

New member
I have some code to read signals from a scientific instrument. It clips at a tad under 3 volts, so I would expect my highest readings using analogRead to be nearly full-scale (so the better part of 4095-ish for 12 bits, the better part of 65535-ish for 16 bits etc.). Instead, I am getting max readings in the high 860s (so, the better part of 10 bits).

So, I hooked the analog line up to the 3.3 volt ref, and, sure-enough, I got readings of 1023.

The literature for the Teensy says it has a 16 bit A/D that is good to 12 bits of precision. Is there a way to enable this? In my application, I would be grateful for the added precision.

Did some poking around, but did not turn up any posts that addressed this.

Thanks
 
Found the ADC library, which revealed all.

I did find that the ADC library did not compile cleanly for me (error lin line 108 of RingBufferDMA.cpp), and I added the following to the beginning of RingBufferDMA.cpp to hack my way around the compile error

#ifndef DMAMUX_SOURCE_ADC1
#define DMAMUX_SOURCE_ADC1 -1
#endif

The cleaner fix, of course, would be to put conditional compilation #defines around all such bits of code ... but I am in a hurry ;).
 
And if you're using the ADC library, get the latest version. It should compile with no errors or warnings.
 
Status
Not open for further replies.
Back
Top