Picomite issues with MCP3002, dual channel ADC SPI


Author Message
apalert
Newbie

Joined: 06/07/2023
Location: Australia
Posts: 30
Posted: 06:45am 01 Feb 2025      

Many thanks for all suggestions, new version of code below. Hours have been spent tweaking. New ADC chip tried, wiring triple checked. Unfortunately output is still garbage :(

Below the code is a table of data returned. I put the code in a For x= 1 to 40 loop and ran it multiple times with 1/2VDD, VDD and VSS test voltage inputs. There is a curious pattern to the garbage!



SETPIN 27, DOUT                 ' pin 27 ADC chip enable active low
PIN(27) = 1                     ' ADC chip disabled
SETPIN 11, 20, 19, SPI2         ' assign SPI I/O pins, RX, TX, CLK
pause 20
SPI2 OPEN 100000, 0, 10         ' speed 1MHz, SPI mode 0, 10 bits data
PIN(27) = 0                     ' ADC chip enabled
data1 = spi2(104)               ' get data from ADC
pin(27)=1                       ' ADC chip disabled
SPI2 CLOSE                      ' close the channel






2025-02-01.png.pdf
Edited 2025-02-01 17:11 by apalert