Basil
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 :)
CON
_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
VAR
long Stack[150]
long Cog
word Temp
OBJ
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.Out(13)
ADC.start(ADC_DIN, ADC_CS, ADC_CLK, %1)
TV.Str(string("ADC Cog started ")) 'then display it and
TV.Out(13)
repeat
waitcnt(64_000_000 + cnt)
TV.out($00)
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))
TV.Out(13)
Thanks for any help!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
(http://our.rocketryplanet.com/profile/basil4j)
Post Edited (Basil) : 9/14/2007 11:13:24 PM GMT
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 :)
CON
_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
VAR
long Stack[150]
long Cog
word Temp
OBJ
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.Out(13)
ADC.start(ADC_DIN, ADC_CS, ADC_CLK, %1)
TV.Str(string("ADC Cog started ")) 'then display it and
TV.Out(13)
repeat
waitcnt(64_000_000 + cnt)
TV.out($00)
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))
TV.Out(13)
Thanks for any help!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
(http://our.rocketryplanet.com/profile/basil4j)
Post Edited (Basil) : 9/14/2007 11:13:24 PM GMT