Mcp3208 adc help


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Mcp3208 adc help

    The way I read the sheet, its not a delay thing. Seems like the A/D uses the SCL to clock the result out, starting some number of clocks after the start bit. So no matter what you do, on the 12th(maybe wrong number, working from memory here)clock, data is comming out. better be ready to catch it. When you "shiftout" the command, thst starts the clock counting. that gives you start bit, then 4 more clocks (i think) then data is comming on the something more clock.

    I will need to re-read section 6 to try and wrap my head around it. Let me know if you need more info, I will read some more.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Mcp3208 adc help

    That seems odd but I'm rusty, so I've ordered a couple of those ADCs. Should have them tomorrow.

    Another thing you could try (though I may need another strong coffee)... keep your original code, but read the data on clock falling edge instead of rising edge.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Thumbs down Re: Mcp3208 adc help

    Duh?!?
    3.6 Serial Data Output (DOUT)
    The SPI serial data output pin is used to shift out the
    results of the A/D conversion. Data will always change
    on the falling edge
    of each clock as the conversion
    takes place.
    Change your clock idle from low to high, and see what happen.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Mcp3208 adc help

    That was easy
    Code:
            high cs
            Pause 100 ' Pause to see display on LCD.
    Main:
            LOW CS ' Enable ADC
            SHIFTOUT DataOut, Clock, 2, [%11000] ' Select CH0, Single-Ended
            high Clock
            SHIFTIN DataIn, Clock, 6, [result0\13] ' Read ADC
            HIGH CS ' Disable ADC
            Low Clock
            LCDOUT $FE,1,"ADC: ",dec result0
            PAUSE 100 'Pause long enough to read LCD.
            Goto Main
    now read the datasheet to know why it works
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts