Shop OBEX P1 Docs P2 Docs Learn Events
Trying to use all four channels with an ADC0838 and having issues with software. — Parallax Forums

Trying to use all four channels with an ADC0838 and having issues with software.

Turnbull2112Turnbull2112 Posts: 65
edited 2011-08-15 11:59 in BASIC Stamp
I have been reading other threads about using the ADC0838 and I am having trouble getting all four differential inputs to work. I would rather use this instead of three or four ADC0831's to conserve I/O and also to keep costs down. Any ideas??

Thanks
-Rob

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-11 09:01
    As with most questions of this sort, we need more information. At the very least, you need to post a schematic or detailed description of how you have your Stamp and ADC0838 connected and a copy of your source code, all provided as attachments to a message. Use the Go Advanced button and you'll see a button for adding attachments to your message. You also need to describe what kind of trouble you're having.
  • Turnbull2112Turnbull2112 Posts: 65
    edited 2011-08-11 09:48
    Sorry Mike,
    Here is my test program so far. What I gather from other threads is that I need to tell the ADC0838 to return information from each differential input (1,2,3,4) with a binary string but I am not getting any results. The datasheet shows instructions to be sent for address, polarity of each input, etc. My experience is limited to the ADC083. What I am trying to do is to read three analog inputs with one ADC0838. I would like to have three subroutines that control this and return the three readings. Is this possible?
  • Turnbull2112Turnbull2112 Posts: 65
    edited 2011-08-11 09:49
    Ooops, *experience is limited to the ADC0831.
  • Turnbull2112Turnbull2112 Posts: 65
    edited 2011-08-11 11:02
    Just thinking some more, I would like to see something like this:

    DO
    GOSUB read_channel1
    GOSUB read_channel2
    GOSUB read_channel3
    LOOP

    read_channel1:
    read ADC0838 differential input 1,2
    RETURN

    read_channel2:
    read ADC0838 differential input 3,4
    RETURN

    read_channel3:
    read ADC0838 differential input 4,5
    RETURN

    Does this help?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-11 11:53
    As you can see from the datasheet, the ADC0838 is very similar to the ADC0831 except that you have to provide the 5 bits of control information as shown on pages 11 and 14 of the datasheet. Your little test program in message #3 should work using inputs CH0/CH1. What's happening? How do you have the ADC0838 connected? What's being returned?
  • Turnbull2112Turnbull2112 Posts: 65
    edited 2011-08-11 15:50
    I think I had some jumpers in the wrong place. I am getting data back now but it's a little strange. I'm reading differential inputs 1,2-2,3-3,4 to give me three voltages. Right now if I supply 5v to input 1 the debug returns "255,128,128" even though input 2 and 3 + is disconnected. If I connect only input 2 + debug returns "0,255,128". Where is this "128" coming from? Is this a timing issue?? All the negative inputs are common.
  • Turnbull2112Turnbull2112 Posts: 65
    edited 2011-08-15 11:59
    I'm probably just going to use three ADC0831's. This thing is a pain in the butt.
Sign In or Register to comment.