Feather M4 CAN SAME51 analog input 1023 not 4095

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mkiehl
 
Posts: 23
Joined: Mon Oct 08, 2012 1:03 pm

Feather M4 CAN SAME51 analog input 1023 not 4095

Post by mkiehl »

The product description for Feather M4 CAN SAME51 claims the analog inputs are 12-bit. A 12-bit input should have a range of values from 0 to 4095. But I discovered that my device only supports a range of values from 0 to 1023 (10-bit). Conversion of ADC to voltage is then as follows:

uint16_t adc = analogRead(A0);
float f = (float)adc * (3.3/1023); // 3.3 volts, 0 to 1023 ADC range

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather M4 CAN SAME51 analog input 1023 not 4095

Post by adafruit_support_bill »

AnalogRead() in the Arduino library defaults to 10 bit resolution for backwards compatibility with older boards. You can change that with the AnalogReadResolution() function.
https://www.arduino.cc/reference/en/lan ... esolution/

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”