Max 128 A/D converter
Archiver
Posts: 46,084
Just guessing but it sounds like the ADC is in differential mode
in other words it is looking for voltages in the range of negative 2.5 volts
relative to ground to positive 2.5 volts relative to ground.
KF4HAZ - Lonnie
Original Message
From: "Ricky Konvicka" <ricky@
> Can anyone see why this wouldn't work? I can get the last 3 digits to
change as I vary the voltage into channel 0 of the a/d. But the A/D doesn't
start at zero it starts at like 192 and goes to 255. 192 being 0 volts
applied and 255 being about 2 volts. I have placed a link to the data sheet
for the a/d below. The circuit is set up like the one on the first page of
the data sheet.
>
> http://dbserv.maxim-ic.com/quick_view2.cfm?qv_pk=1890
>
> '
[noparse][[/noparse]
Title ]
>
> ' {$STAMP BS2p}
>
> '
[noparse][[/noparse] I/O
Definitions ]
> I2Cpin CON 0 ' SDA on 0; SCL on 1
> '
[noparse][[/noparse]
Constants ]
>
> wrad128 CON %01010000 ' write to A/D
>
> rdad128 CON %01010001 ' Read from A/D
>
> '
[noparse][[/noparse]
Variables ]
>
> result VAR word
>
> hbyte var result.highbyte
>
> lbyte var result.lowbyte
>
>
'
[noparse][[/noparse]Initialize]
>
> result = 0
>
> i2cout i2cpin,wrad128,0,[noparse][[/noparse]%10001000]
>
> pause 100
>
>
>
> main:
>
> i2cin i2cpin,rdad128,0,[noparse][[/noparse]hbyte,lbyte]
>
> pause 100
>
> debug home,dec hbyte," ",dec lbyte,cr
>
> goto main
in other words it is looking for voltages in the range of negative 2.5 volts
relative to ground to positive 2.5 volts relative to ground.
KF4HAZ - Lonnie
Original Message
From: "Ricky Konvicka" <ricky@
> Can anyone see why this wouldn't work? I can get the last 3 digits to
change as I vary the voltage into channel 0 of the a/d. But the A/D doesn't
start at zero it starts at like 192 and goes to 255. 192 being 0 volts
applied and 255 being about 2 volts. I have placed a link to the data sheet
for the a/d below. The circuit is set up like the one on the first page of
the data sheet.
>
> http://dbserv.maxim-ic.com/quick_view2.cfm?qv_pk=1890
>
> '
[noparse][[/noparse]
Title ]
>
> ' {$STAMP BS2p}
>
> '
[noparse][[/noparse] I/O
Definitions ]
> I2Cpin CON 0 ' SDA on 0; SCL on 1
> '
[noparse][[/noparse]
Constants ]
>
> wrad128 CON %01010000 ' write to A/D
>
> rdad128 CON %01010001 ' Read from A/D
>
> '
[noparse][[/noparse]
Variables ]
>
> result VAR word
>
> hbyte var result.highbyte
>
> lbyte var result.lowbyte
>
>
'
[noparse][[/noparse]Initialize]
>
> result = 0
>
> i2cout i2cpin,wrad128,0,[noparse][[/noparse]%10001000]
>
> pause 100
>
>
>
> main:
>
> i2cin i2cpin,rdad128,0,[noparse][[/noparse]hbyte,lbyte]
>
> pause 100
>
> debug home,dec hbyte," ",dec lbyte,cr
>
> goto main
Comments
I vary the voltage into channel 0 of the a/d. But the A/D doesn't start at zero
it starts at like 192 and goes to 255. 192 being 0 volts applied and 255 being
about 2 volts. I have placed a link to the data sheet for the a/d below. The
circuit is set up like the one on the first page of the data sheet.
http://dbserv.maxim-ic.com/quick_view2.cfm?qv_pk=1890
'
[noparse][[/noparse] Title ]
' {$STAMP BS2p}
'
[noparse][[/noparse] I/O Definitions ]
I2Cpin CON 0 ' SDA on 0; SCL on 1
'
[noparse][[/noparse] Constants ]
wrad128 CON %01010000 ' write to A/D
rdad128 CON %01010001 ' Read from A/D
'
[noparse][[/noparse] Variables ]
result VAR word
hbyte var result.highbyte
lbyte var result.lowbyte
'
[noparse][[/noparse]Initialize]
\
--
result = 0
i2cout i2cpin,wrad128,0,[noparse][[/noparse]%10001000]
pause 100
main:
i2cin i2cpin,rdad128,0,[noparse][[/noparse]hbyte,lbyte]
pause 100
debug home,dec hbyte," ",dec lbyte,cr
goto main
[noparse][[/noparse]Non-text portions of this message have been removed]