Shop OBEX P1 Docs P2 Docs Learn Events
A/D source code — Parallax Forums

A/D source code

ArchiverArchiver Posts: 46,084
edited 2002-02-19 02:21 in General Discussion
Ok since my last post I have figured out that my I2cout command is not working.
So I am not setting up the A/D properly. Does anyone know what happens in this
command when the device you are trying to write to has no addresses to access?
The third part of the I2cout command calls for an address but this A/D has no
address. Is this just a zero?





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



[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

Sign In or Register to comment.