Shop OBEX P1 Docs P2 Docs Learn Events
ADC_MAX186 to BSII — Parallax Forums

ADC_MAX186 to BSII

ArchiverArchiver Posts: 46,084
edited 2004-04-29 22:31 in General Discussion
I am interfacing the BSII to the MAX186 ADC. Everything looks good,
but in the datasheet of MAX186, it specifies that this ADC shift
bits out and in simultaneously.
My code is like that:
shiftout Dout, CLK, MSBFIRST [noparse][[/noparse]Control\8]
shiftin Din, CLK, MSBPOST [noparse][[/noparse]RB1\8]

The thing is I'm shifting out bits but not simultaneously shifting
in to the BSII.

What can I do to solve that ?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-29 17:44
    Dear **********,

    Don't use the shiftin function, simply make sure that you still have the
    chip selected, and read the pin that the Din is connected to. The
    shiftout will output the 'clock information and data', and will
    simultaneously cause the output to be 'presented' to the Din line. You
    then simply look at the line.

    BTW, is ********** your first name or your last name? Are you the
    programmer formerly known as ##########?

    David Erbas-White

    ********** wrote:

    >I am interfacing the BSII to the MAX186 ADC. Everything looks good,
    >but in the datasheet of MAX186, it specifies that this ADC shift
    >bits out and in simultaneously.
    >My code is like that:
    > shiftout Dout, CLK, MSBFIRST [noparse][[/noparse]Control\8]
    > shiftin Din, CLK, MSBPOST [noparse][[/noparse]RB1\8]
    >
    >The thing is I'm shifting out bits but not simultaneously shifting
    >in to the BSII.
    >
    >What can I do to solve that ?
    >
    >
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and Body of the message will be ignored.
    >
    >Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-29 19:23
    Hi **********,

    The way you are doing it is fine, except you will need to shift in 12
    bits to get the full resolution. The '186 does have a turbo mode
    that allows a uP to send out the new control byte while it is till
    shifting in the previous result, but you can't do that on the Stamp.
    You will simply shift out the control byte, and then shift in the
    result.

    -- Be sure to use the internally clocked conversion mode in the
    control byte, because the Stamp is too slow to do an accurate
    conversion with the external clock mode.

    ' from figure 9 in MAX186 data sheet
    ' internal clock mode timing
    LOW chipselect
    shiftout Dout, CLK, MSBFIRST [noparse][[/noparse]Control\8]
    HIGH chipselect ' conversion in progress, 10 microseconds max
    LOW Dout ' to be sure no spurious control byte
    LOW chipselect
    shiftin Din, CLK, MSBPOST [noparse][[/noparse]RB1\12]
    HIGH chipselect ' finished

    -- Tracy


    >I am interfacing the BSII to the MAX186 ADC. Everything looks good,
    >but in the datasheet of MAX186, it specifies that this ADC shift
    >bits out and in simultaneously.
    >My code is like that:
    > shiftout Dout, CLK, MSBFIRST [noparse][[/noparse]Control\8]
    > shiftin Din, CLK, MSBPOST [noparse][[/noparse]RB1\8]
    >
    >The thing is I'm shifting out bits but not simultaneously shifting
    >in to the BSII.
    >
    >What can I do to solve that ?
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-29 22:31
    Thank you for the help,

    I still have some problems,

    I declared Din as :

    Din CON 2

    So how would I just read this line and then display it.






    Don't use the shiftin function, simply make sure that you still have the
    chip selected, and read the pin that the Din is connected to. The
    shiftout will output the 'clock information and data', and will
    simultaneously cause the output to be 'presented' to the Din line. You
    then simply look at the line.

    BTW, is ********** your first name or your last name? Are you the
    programmer formerly known as ##########?

    David Erbas-White

    ********** wrote:

    >I am interfacing the BSII to the MAX186 ADC. Everything looks good,
    >but in the datasheet of MAX186, it specifies that this ADC shift
    >bits out and in simultaneously.
    >My code is like that:
    > shiftout Dout, CLK, MSBFIRST [noparse][[/noparse]Control\8]
    > shiftin Din, CLK, MSBPOST [noparse][[/noparse]RB1\8]
    >
    >The thing is I'm shifting out bits but not simultaneously shifting
    >in to the BSII.
    >
    >What can I do to solve that ?
    >




    Do you Yahoo!?
    Win a $20,000 Career Makeover at Yahoo! HotJobs

    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.