Shop OBEX P1 Docs P2 Docs Learn Events
ADC 0838 vs ADC 0834 — Parallax Forums

ADC 0838 vs ADC 0834

edited 2009-03-23 17:02 in Propeller 1
Hey everyone,

Last month I put together a circuit on a prop proto board that hooks up an ADC 0834 four-channel Analog to digital converter. I found an object in the object exchange (CD_ADCO834) and got it working with a graphics / TV object. I would spin a potentiometer knob and an "analog gauge style" line would rotate on the screen.

Now I am building an application where I use an ADC 0838. I remember having one of these back in the day and never getting it to work. I wired it up as indicated, and tried the ADC0838_Debug object in the object exchange but it does not seem to work for me. Tried also modifying the ADC0834 code to handle another bit in the data in stream... To no avail.

Trouble is, it's very hard to debug because you download the program and turn your potentiometer and nothing draws, and you have no idea if its because of a software problem or a wiring /hardware issue. I've got Data In and Data Out tied together, and by some magic it seems to work without conflict on the ADC 0834... especially because no where in the code is the DI/DO I/O pin switching from input to output and back again. I resisted the DI/DO line and SARS line with 1k resistors, and the CLK and CS lines are straight from prop IO to the ADC chip.

I can't seem to understand what the purpose of the SARS line is, anyway. It has something to do with whether or not you send the serial stream LSB or MSB, right?

This last part is the lynchpin to my whole program... Tragically the ADC 0838 don't get along !

-Ryan Brandys

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2008-03-22 07:35
    Hello Ryan,

    the end of your post sounds like you have given up.

    if you did not give up please make a new posting with very CONCRETE questions
    and attach your sourcecode

    i think it would be useful to use a simpler displaymethod than the drawing line.
    f.e. sending characters to a terminalsoftware. For debugpurposes you should add
    sending debugstrings to the terminalsoftware inside the SPIN-Sourcecode to analyze if there is an error in the
    received datastream of the ADC

    did you check if these chips use EXACTLY the same protocoll for transmitting the data
    from the ADC-Chip to the propeller?

    regards

    Stefan
  • edited 2008-03-22 16:39
    When all else fails, Google it. I found a link to someone using the ADC0838 with a BS2, and he provides source code as well. Once I get it working on the BS2, I will work towards migrating to the propeller.

    http://web.bii.a-star.edu.sg/~james/a2d_box/
    http://web.bii.a-star.edu.sg/~james/a2d_box/program.bs2

    Will keep you guys posted on the progress and hopefully have an object to share when its all over.

    -Ryan
  • edited 2008-03-22 22:20
    Good news... sort of.

    I tried the BS2 code but it didn't seem to work. I used its wiring diagram as a starting point, and hooked up the propeller using four I/O pins: _cs, clk, dinout, and sars.

    Modifying the CD_0834 code, I came up with an ADC0838 object that almost works. Here's the problem:

    I set up eight potentiometer knobs between 0 and 5 v, and hooked those to the eight analog inputs of the ADC0838.

    I used a very basic graphics / TV object to write to the screen the values it receives from all eight channels of the ADC. these are on eight separate lines of text on the screen, each with a 0-255 number and some text.

    When I rotate each knob, the value on the screen flutters 0 , 255, 0, 254, 0, 255, etc. No values in between show up, just 0 or 255. But the fact that I can get each knob to individually influence its corresponding line on the screen means I have communication between the prop and ADC somewhat working.

    My first thought was the Data In/Out pin was not switching back to an input, but i checked and it flips between input and output as needed. The code in that section has not changed from the ADC0834, which worked fine.

    Is this a hardware issue ? perhaps I need a larger or smaller resistor on my Din/Dout line?


    Is this a software issue? perhaps the way I interpret the SARS value is wrong and i'm grabbing the wrong part of the data stream..


    So close on this one I can taste it...

    -Ryan Brandys
  • edited 2008-03-23 03:43
    Success! The glitch turned out to be a software sync issue that I solved by ditching the SARS as a control method and instead using SE to tell the ADC when to begin the LSB stream. The program works great! I have video display of all 8 analog channels, updating in real-time, and I can use another pot to calibrate all of them using Vref and "com"

    I have posted the object in the new and improved object exchange as RB_ADC0838.spin !

    -Ryan Brandys
  • The MuleThe Mule Posts: 9
    edited 2008-03-24 19:19
    SARS is basically a "Busy" signal out of the ADC indicating that it is currently in the process of returning or calculating the current input voltage at the selected pins.
  • mosquito56mosquito56 Posts: 387
    edited 2009-03-23 17:02
    ·Tried to find rb_adc0838 and it seems to be gone. I gave up on the max1270 and the 0838 in the index is not useful. Where is the rb_adc0838?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·······

    ······· "What do you mean, it doesn't have any tubes?"
    ······· "No such thing as a dumb question" unless it's on the internet
    ········
Sign In or Register to comment.