View Full Version : MCP3208 problems SOLVED THANKS :)

09-14-2007, 09:12 AM
Hi All,

I have a problem :)

I have a MCP3208 connected to the prop with Din and Dout tied together.
The values I am getting back do not seem to be right.

Nothing connected to the following:
Chan 0 returns 0
Chan 1 returns 0
Chan 2 returns 14
Chan 3 returns 0
Chan 6 returns 1
Chan 7 returns 0
These are all floating so the crazy value is not really a biggie.

Accelerometer on channel 4
Chan 4 returns 12, should be returning ~2048

Pressure sensor on channel 5
Chan 5 returns 0, should be returning ~3500

I have check the voltage output from the sensors and they are fine.

Heres my code :)

_clkmode = xtal1 + pll16x
_xinfreq = 4_000_000
ADC_CLK = 12 'Clock to ADC
ADC_DIN = 13 'Data to/from ADC
ADC_CS = 14 'CS to ADC


long Stack[150]
long Cog
word Temp

Num : "Numbers"
TV : "PC_Text"
ADC : "MCP3208"

PUB Main | i, ii, ok
waitcnt(32_000_000*10 + cnt) 'Delay

Num.Init 'Initialize Numbers
TV.Start(30) 'Start TV Terminal
TV.Str(string("TV started ")) 'then display it and

TV.Str(string("ADC Cog started ")) 'then display it and

waitcnt(64_000_000 + cnt)
repeat ii from 0 to 7 step 1
Temp := ADC.in(ii)
TV.Str(Num.ToStr(ii, Num#DDEC))
TV.Str(string(" ADC = "))
TV.Str(Num.ToStr(Temp, Num#DDEC))

Thanks for any help!


My our page
Post Edited (Basil) : 9/14/2007 11:13:24 PM GMT

09-14-2007, 11:37 AM
Just changed mode to '$FF' rather than just '1'.

Now all results are reading '0'...better :) Still not correct, but no crazy values now...just none :)

Should also mention, I have a 1K resistor between Data pins and prop.


My our page

Beau Schwabe (Parallax)
09-14-2007, 01:17 PM

Can you zip the entire project (excluding the IDE)? We can't tell much without looking at what is inside of the MCP3208 object.

Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

09-14-2007, 02:54 PM

I have worked with the MCP3002, quite successfully, which is almost the same thing as a 3208. But, I recall that Din and Dout needed to have a resistor between them should you choose to drive then from one common pin on the Prop. It sounds like you have them tied together without the resistor, is this true? I'll try to dig up a post where (if I recall) Mike Green states that it's okay to drive these from one pin. I think it was a 1k or 4.7k ohm......


PS - I attached my MCP3002 code, in assembly, pretty well documented. It is messy, so I'm sorry if it isn't helpful, but it might give you some ideas...

Chad George
09-14-2007, 08:09 PM

I've used the 3208 in several projects and I know more than one time I didn't have the reference voltage attached correctly and it behaved similar to what you described.


Fred Hawkins
09-14-2007, 09:51 PM
Interesting chip. Here's the datasheet for those following along: http://ww1.microchip.com/downloads/en/DeviceDoc/21294C.pdf

Post Edited (Fred Hawkins) : 9/14/2007 5:45:24 PM GMT

09-14-2007, 10:43 PM
I sent him a separate email.

The main problem is that he has the call parameters for CLK and CS reversed.

I also told him to use $FF.


09-15-2007, 06:10 AM
Hi Jim,

Just got your email :) Its works! Silly parameters :P

Thanks guys for all the suggestions :)


My our page