I want to change the precision of the analogRead function with my Intel Edison Arduino Breakout board. With an Arduino Uno, I can include "wiring_private.h" and call cbi(ADCSRA, ADPS2), etc. to clear a bit on the ADC Control and Status Register. This changes the precision of analogRead and its execution time. When I try to include "wiring_private.h" in the Arduino IDE with the board set to "Intel Edison", I get a compiler error because it cannot find the library.
What library should I include so that I can use the sbi() and cbi() functions with the Edison Arduino Breakout Board? Does the Arduino Breakout Board's ADC Control and Status Register use the same macro (ADCSRA) as with the Arduino Uno? Where can I find documentation on this?
Also, I read somewhere that the Arduino Breakout Board's ADC is capable of 12-bit precision. Where can I find documentation on that?
There are Arduino libraries that are based on the specific AVR architecture of the MCUs used in the Arduino boards. When you try to use those libraries with Edison, you will get compilation errors because Edison has another architecture. The sci() and cbi() functions are not supported by Edison because they are based on the AVR architecture.
Unfortunately, there is no documentation about this, but you could use the method analogReadResolution(12) to set 12-bit resolution.
Can I lower the resolution of analogRead below 10-bit to make analogRead execute faster? Shouldn't I be able to do so by setting and clearing certain ADC register bits?
The ADC used by the Arduino expansion board is external. Theoretically, you should be able to access the registers of this IC and configure it through them, however, the way this ADC is accessed and used by the Edison module doesn't allow this, so the only way you can change the resolution is using the method analogReadResolution().
Now, as you can see in the code below, the method limits the parameter to be a value between 1 and 32. I don't know if using, for example, analogReadResolution(4) will set a 4-bit resolution, you could try it of course to see if it has any effect, but I've just used this method to set a 12-bit resolution.
void analogReadResolution(uint32_t res)
if (res >= 1 && res <= 32)<p> _readResolution = res;