Shop OBEX P1 Docs P2 Docs Learn Events
ADC0809 to basic stamp? — Parallax Forums

ADC0809 to basic stamp?

A12A12 Posts: 17
edited 2006-10-20 17:00 in BASIC Stamp
I·could like to convert analog data from a ADXL330 accelerometer to digital and send this digital data to the BS2p. but·I am rather confused by some of the pins in the ADC0809 chip I use.

Take it as X axis analog signal from the accelerometer goes into IN1 (Pin 26), Y axis goes to IN2 (Pin 27) and Z axis goes to IN3 (Pin 28).

So·how do I connect the Address Line A,B,C (pin 25,24,23 respectively). These pins determine which Input Pin I am sending the data to, right?


The control signals EOC (end of conversion), SC (start conversion), ALE (address latch enable) and OE (output enable) are from the BS2p I assume. So how do I send in these signals? Using Pulsout or HIGH?

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-10-18 04:28
    The ADC0809 can handle up to 8 inputs... you are only using 3 of them.

    The A,B, and C lines select which of the 8 inputs are allowed to pass to the internal ADC within the ADC0809.
    On page 5 of the pdf below, it explains the logic states that the A,B, and C lines should be in to do this.
    http://www.learn-c.com/adc0809.pdf
    ·
    As far as the EOC,SC,ALE, and OE ... You also need to supply a Clock Pulse (Pin 10)
    ·
    1) The ALE should go HIGH after the logic states to the A,B, and C select lines have been set, and then the ALE should go LOW. (PULSOUT command)
    2) Following that you should issue a start pulse (SC) by making it go HIGH, and then LOW.(PULSOUT command)
    3) Now you need to issue Clock Pulses (Low-HIGH-Low transitions) until the EOC pin goes LOW.
    4) When the EOC pin goes LOW the OE pin can go HIGH enabling the DAC output to be available.
    5) Read the output as a BYTE connected to the Stamp and you’re ready for the next conversion.
    ·
    For the count, you will need to use all 16 I/O's - 8 for reading the data output ; 3 for the select lines (could be reduced to 2) ; 5 for the EOC,SC,ALE, OE, and CLOCK






















    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • A12A12 Posts: 17
    edited 2006-10-18 11:01
    Ok, so lets say I choose IN0, IN1, IN2, how do I use 2 I/O pins to get LLL, LLH, LHL (in the order of CBA)?

    If I am not wrong, I can ground the C address line since all 3 are Low. So that leaves 1 I/O pin free.

    I am thinking of building a 555 timer circuit (which I have already designed) to give the CLK. So that leaves·2 I/O pins free.

    I need the 2 extra I/O pins to control my servo and motor.·This should pose no problem right?

    from the PDF file, page 7, I was thinking how the BS2p can produce so many pulses at the same time. Is there a way to do so? I think I have read somewhere where the Stamp can·gives the same pulse to 2 I/O pins at the same time. So, how do I give out different signals at the same time. Also, I need the stamp to do calculations on the digital signal to get the acceleration. Can the stamp actually do all this while sending out pulses?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-18 14:17
    A12,
    ·
    ·· As a note, there are serial ADC chips available with multiple channels which would use far less I/O pins.· Unless you have a special reason for this chip it is wasteful of I/O pins.· This kind of chip is designed to interface to a CPU such as a Z80, 6809 or 6502.· Check our website for the MAX1270 (8 channel) or perhaps someone can recommend another such as the ADC0834 (4 channel) or ADC0838 (8 channel) depending on how many channels you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-10-18 14:43
    A12,

    "If I am not wrong, I can ground the C address line since all 3 are Low. So that leaves 1 I/O pin free."
    That's correct

    "I am thinking of building a 555 timer circuit (which I have already designed) to give the CLK. So that leaves 2 I/O pins free."
    I'm not sure about that? The ADC0809 'might' be able to receive a continuous stream of clocks, in which case you would be
    correct, but if not, you would still need to gait the clock pulses. In that case you don't gain or loose any pins, you gain an IC.

    "from the PDF file, page 7, I was thinking how the BS2p can produce so many pulses at the same time."
    That's what the 5 steps were attempting to describe. Those pulses are not at the same time, they represent the sequence of
    pulses necessary in relation to each other in order to communicate to the ADC0809.

    "I think I have read somewhere where the Stamp can gives the same pulse to 2 I/O pins at the same time. So, how do I give
    out different signals at the same time."
    The Stamp is a single step processor, and can only do one thing at a time. You can interleave necessary signals to create the
    required communication pulses in most cases.

    Also, I need the stamp to do calculations on the digital signal to get the acceleration. Can the stamp actually do all this while
    sending out pulses?
    The stamp can do calculations, but not at the same time as sending pulses. Since you mention using a servo this adds more
    complexity, since the servo needs an update pulse every 15 to 25 mS (milli-Seconds). Not that it can't be done, but you need
    to think about how your code tasks are divided up. For Example:

    Main Program Loop:
    Read ADC Input 1
    Update Servos
    Read ADC Input 2
    Update Servos
    Read ADC Input 3
    Update Servos
    Calculate ADC Data
    Update Servos
    Adjust Servo position values from Calculated ADC Data
    Update Servos
    Return to 'Main Program Loop'


    Also, there are other ADC options available that would not take nearly as many I/O pins that might be a better fit for your application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • A12A12 Posts: 17
    edited 2006-10-18 16:08
    Thanks alot, now I am getting somewhere. Should be able to finish the program by tommorrow night I hope. Then I can test it out and calibrate the numbers from there.

    You are both right,·I·will most probably·get a new ADC chip (there goes $10), this chip is a bit too big for my robot anyway.

    My program outline looks something like this:
    1)Get data from accelerometer for a short period of time
    2)Calculate the accelerate every few milliseconds
    3)Once Acceleration is -9.81 (-g), a pause of 0.5 seconds occurs before servo moves
    4)Motor runs
    5)After few minutes of running, motor slows down and stop

    The data from the accelerometer does not affect the motion and position·of the servo, only the timing for the motion. So do I still need to feedback the servo every few seconds?



    Post Edited (A12) : 10/18/2006 4:21:55 PM GMT
  • A12A12 Posts: 17
    edited 2006-10-20 04:38
    I am considering ADC0834 (have some probs buying one), but anyway, where does the pins V+ (1), DI (13), DO(10), SARS (11) and the 2 GND (DGND and AGND) ?

    I know V+ is a shunt voltage regulator, I am using the BOE +5V regulator (Vdd), so do I still need to use this pin?

    I am connecting DI and DO together into a single I/O pin in the Basic Stamp. The manual says to connect to a bi-directional I/O pin which I trust the BS2p can manage, right?

    Not sure what the SARS really does, according to the manual, it sounds as if the SARS is automatically controlled by the ADC. In http://cache.national.com/ds/DC/ADC0831.pdf, page 10, the SARS is HIGH when conversion starts, but at page 12, it says to initiate conversion, CS is held LOW. So if CS is used to start and end conversion, what is the SARS for?

    Lastly, DGND and AGND, do they have common GND or different?
  • A12A12 Posts: 17
    edited 2006-10-20 17:00
    This is my pin interface:

    V+ (1) --> ???
    CS (2) --> P0 (BS2p)
    CH0 (3) <-- ADXL330
    CH1 (4) <-- ADXL330
    CH2 (5) <-- ADXL330
    CH3 (6) --> GND
    DGND (7) --> GND
    AGND (8) --> GND
    Vref (9) --> Vdd
    D0 (10) --> P3 (BS2p)
    SARS (11) --> ???
    CLK (12) <-- P1 (BS2p)
    DI (13) <-- P3, same as D0
    Vcc --> Vdd, same as Vref

    ***all GND are common

    Could anyone kindly help me with the last 2 pins, and correct me for any existing wrong pin interface.


    ·
Sign In or Register to comment.