Picomite issues with MCP3002, dual channel ADC SPI


Author Message
apalert
Newbie

Joined: 06/07/2023
Location: Australia
Posts: 30
Posted: 09:31am 03 Feb 2025      

  TassyJim said  I forgot to mask off the higher bits in the 16bit code
data0 = data0 AND &h3FF
etc

doing that will get rid of the obviously wrong readings.

In the 8 bit version I should have masked of bits for each SPI read before adding them together.


Jim, did as you suggested and you have nailed it! Results are amazing.

Initially results were +/- 3. However I stabilised VDD on the VDC at 3 volts with an LM4040 and forced Pico into PWM mode while reading, now we get +/- 1 as per spec sheet.

Was able to remove all pauses and bring clock back up to 1000000. Time to take 20 readings around 7.5m/s when not printing result of each loop.

Hard to say which is better, 8 bit SPI or 16. Accuracy seems the same. 16 bit is a tiny bit faster.

Thanks so much for your input.