Readings from MCP3001
I am using an MCP3001 with another project and need some help with the results.
I have used some ADC drivers for this chip from the obex, and for all of them i am having a little trouble.
For all the programs, i am getting a value of "450" when the value at the ADC pin is 1.450V
It seems to be removing the first digit from conversions.
This wouldnt be an issue if my ranger were all in 1V, but I need to measure from 0.3 to 2.5 volts.
Anybody run into this before?
Thanks
I have used some ADC drivers for this chip from the obex, and for all of them i am having a little trouble.
For all the programs, i am getting a value of "450" when the value at the ADC pin is 1.450V
It seems to be removing the first digit from conversions.
This wouldnt be an issue if my ranger were all in 1V, but I need to measure from 0.3 to 2.5 volts.
Anybody run into this before?
Thanks
Comments
I believe the solution is in the assembly section somewhere, but have no assembly experience.
[code]
DAT
shiftin
org 0
''Set the direction and state of the I/O pins and non-recurring events
''
or dira, OS ''Set OS to output
or dira, SCL ''Set SCL to output
or dira, CS ''Set CS to output
xor outa, SCL ''Set SCL pin high (1)
xor outa, CS ''Set CS pin high (1)
''
mov wcnt, #0 ''Zero wcnt
add wcnt, cnt ''Add system counter to wcnt
add wcnt, #13 ''Add 13 clock delay to wcnt
waitcnt wcnt, Tsucs ''Pause COG TSucs clocks
'rdlong ADCtemp,PAR
''==========================================================================================
''Start of conversion
:loop1 ''Loop1
(1.45/3.3) * 1023 = 443. About what you're getting. (assuming you're using 3.3 V on the chip's Vref pin)
If the range is 0-1023, does the chip return a value that is the value 0-1023 that corresponds to the point the sensing voltage is at between 0 and Vref (3.3)?
So that every 1 bit value returned by the adc corresponds to ~0.021v of the sensor?