Go Down

Topic: Testing MCP3208 with Uno (Read 576 times) previous topic - next topic

twonius

I'm having an issue with the Michrochip 3208 ADC.

I'm using the example code from the playground  and it seems pretty straight forward
http://arduino.cc/playground/Code/MCP3208

Right now all I gout out from the serial monitor is


0
0


I'd expect 4095

I've tried connecting +5V to the Channel 1 and 2 inputs but there's no effect. Has anyone had similar issues? Is there a better way to test whether the chip is working as intended?

Eventually I'd like to use pseudo-differential input but for now i'm sticking to the single ended setup used in the example until I figure out what's wrong.


MarkT

That code appears to do the right thing - you are using it verbatim and have double checked the wiring? You have decoupling on the 3208?
[ I won't respond to messages, use the forum please ]

twonius

Got it working. I was using an Arduino compatible board with a bluetooth module that connects over SPI. It seems there's some compatibility issue here because it works fine on my actual Arduino Uno.

MarkT

If you use more than one SPI device there are several issues you must address:

a) separate chip select pin is needed for each device and they must all be set HIGH initially in setup().
b) if any of the SPI setup parameters differ between devices you have to check and reprogram the SPI hardware on every use
    in case the other device used it last.
c) if using SPI from an interrupt service routine you have to disable interrupts around all calls to SPI code in the main code.
[ I won't respond to messages, use the forum please ]

Go Up