Shop OBEX P1 Docs P2 Docs Learn Events
16 to 24 Bit A-to-D Converter Recommendation — Parallax Forums

16 to 24 Bit A-to-D Converter Recommendation

dredre Posts: 106
edited 2010-08-05 19:04 in BASIC Stamp
Hi,
I am in need of and A-to-D converter which would take full advantage of a Stamp 'word'
size variable [noparse][[/noparse]i.e. 16 to 24 bits]. Two essentials however: 1] It must be in DIP
configuration as I am not skilled in more precise soldering, and 2] I need the snippet of
BPasic coding to use it with the regular series of Stamps.
It is desirable if it has multichannel input and uses a single power supply.
The only converter I have noticed is the ADS1211P but the datasheet totally alludes me
as to PBasic code generation.
Any suggestions?

cheers, David

Comments

  • Adrian SchneiderAdrian Schneider Posts: 92
    edited 2010-08-03 10:09
    hello david

    what do you mean with "take full advantage of the stamp's word size variable"? Developing and laying out
    circuitry which make reasonable use of 16bit ADC is a challenge even to experts. Even more so for 24bits.
    If not really carefully layed out the lower bits will be mere noise (1LSB/16bit @ 5V = 80uV; 1LSB/24bit @ 5V = 0.3uV).
    If you just need the dynamic range of the 16bit word variable for computations you can always use that with an
    8- to 12bit ADC by shifting the ADC bits into the variable bits where you need them.

    regards
    adrian
  • dredre Posts: 106
    edited 2010-08-03 14:52
    Hello Adrian,
    Thanks for the informative reply.
    Yes, I believe all I need is the "dynamic range of the 16bit word variable". I have never
    come across the procedure of "shifting the ADC bits into the variable bits". Could you
    explain further; perhaps by listing a snippet of PBasic code?
    At present I am using the 12bit TLC2543 ADC and using Dr. Tracy Allen's code:

    Low ADcs ' select chip
    SHIFTOUT sdo,sclk,msbfirst,[noparse][[/noparse]ADch<<8\12] ' mode, left justify ADch
    SHIFTIN sdi,sclk,msbpre,[noparse][[/noparse]result\12] ' get result, 12 bits
    HIGH ADcs ' deselect chip

    Reference: www.emesystems.com/OL2tlc2543.htm

    cheers, David
  • anti-heroanti-hero Posts: 8
    edited 2010-08-03 15:14
    '·· {$STAMP BS2}
    '·· {$PBASIC 2.5}
    'Heres some code I pulled out of a program I'm running. Analog Devices ADC0838 8 channel.
    'The result0 and result1 are the untouched values directly read from the ADC0838. The rest
    ' of the VAR's are used for my particular application. Jumper pin 14 to 17 of the ADC0838 and
    ' it will use the DataIO pin 1 of the Basic Stamp for both inputing and outputing of data.


    Clk················ PIN···· 0·············· ' Clock pin 16 ADC0838
    DataIO··········· PIN···· 1·············· ' Data out and in on ADC (Pin 14&17 ADC0838)
    ChipSelect······ PIN···· 2·············· ' Chip select O2 voltages (Pin 18 ADC0838)

    result0··········· ·VAR···· Byte····················· 'Raw ADC bits read from CH0
    result1··········· ·VAR···· Byte····················· 'Raw ADC bits read from CH1
    VoltsA0·········· ·VAR···· Nib
    VoltsA1·········· ·VAR···· Nib
    VoltsB0·········· ·VAR···· Byte
    VoltsB1·········· ·VAR···· Byte
    Remainder0······ VAR···· Byte
    Remainder1······ VAR···· Byte

    · LOW ChipSelect··············································· ' Enable ADC
    · SHIFTOUT DataIO, Clk, MSBFIRST, [noparse][[/noparse]%11000\5 ]···· ' Select CH0, Single-Ended
    · SHIFTIN DataIO, Clk, MSBPOST, [noparse][[/noparse]result0\8]···········' Read ADC0838 Channel 0
    · HIGH ChipSelect···············································' Disable ADC
    · VoltsA0 = 5 * result0 / 255································' 5volts x ADC value/255 bits, Left of decimal point
    · Remainder0 = 5 * result0 // 255························· ' Remainder calc
    · VoltsB0 = 100 * Remainder0 / 255······················ ' Values for Right of decimal point
    ·
    ·LOW ChipSelect·············································· · ' Enable ADC
    · SHIFTOUT DataIO, Clk, MSBFIRST, [noparse][[/noparse]%11100\5 ]···· ' Select CH1, Single-Ended
    · SHIFTIN DataIO, Clk, MSBPOST, [noparse][[/noparse]result1\8]·········· ' Read ADC0838 Channel 1
    · HIGH ChipSelect··············································· ' Disable ADC
    · VoltsA1 = 5 * result1 / 255······························· ·' 5volts x ADC value/255 bits, Left of decimal point
    · Remainder1 = 5 * result1 // 255···························' Remainder calc
    · VoltsB1 = 100 * Remainder1 / 255······················· ' Values for Right of decimal point
  • be80bebe80be Posts: 56
    edited 2010-08-03 19:02
    This wouldn't be that hard to use http://www.maxim-ic.com/datasheet/index.mvp/id/4950
    it is 24 bit
  • dredre Posts: 106
    edited 2010-08-03 21:41
    Anti-hero
    Thanks for the code. But I am confused.
    I note that the variables "result0 & result1", the raw data downloaded from the ADC, are
    defined as being 'byte' length. As such how can you get any resolution higher than 1 part
    in 255?

    be80be
    Thanks for the recommendation but the MAX11040 can only be purchased in surface mount
    configuration; except for the evaluation board, which costs some $340.

    cheers, David
  • be80bebe80be Posts: 56
    edited 2010-08-03 22:20
    This would be easy to use but it takes some pins $25.00 and it's a pdip http://www.microchipdirect.com/ProductDetails.aspx?Catalog=BuyMicrochip&Category=TC850&mid=11&treeid=2
  • anti-heroanti-hero Posts: 8
    edited 2010-08-04 13:40
    The ADC0838 is a 20 pin good 'ol PDIP package. In my particular app, I'm only reading a voltage from 0 to 1 VDC and two decimal places is more than enough.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-04 16:28
    I cannot overemphasize Adrian's comments. Unless you're super skilled at designing quiet analog PCB layouts, anything beyond 12 bits will be a total waste of money. And don't even think about using a 16-bit ADC on a solderless breadboard.

    -Phil
  • be80bebe80be Posts: 56
    edited 2010-08-04 18:18
    Phil Pilgrim (PhiPi) said...
    I cannot overemphasize Adrian's comments. Unless you're super skilled at designing quiet analog PCB layouts, anything beyond 12 bits will be a total waste of money. And don't even think about using a 16-bit ADC on a solderless breadboard.

    -Phil
    Your both right 8 bit about as good as it get's on the breadboard.
  • Adrian SchneiderAdrian Schneider Posts: 92
    edited 2010-08-05 11:32
    Hi David

    As in your code the result from the ADC is stored in a word variable like below. Thus you can multiply with up to 16
    -- or shift left by up to 4bit -- without dropping bits of your ADC result:

    0000 XXXX XXXX XXXX 12bit result in 16bit variable, right adjusted

    000X XXXX XXXX XXX0 *2, <<1

    00XX XXXX XXXX XX00 *4, <<2

    0XXX XXXX XXXX X000 *8, <<3

    XXXX XXXX XXXX 0000 *16, <<4


    On the other hand, is you would shift your ADC result left by 4 to fill the uppermost bits of the word variable
    you could divide by up to 16 -- or shift right by up to 4bit -- without losing ADC result bits.

    XXXX XXXX XXXX 0000 12bit result in 16bit variable, left adjusted

    0XXX XXXX XXXX X000 /2, >>1

    0XXX XXXX XXXX X000 /4, >>2

    000X XXXX XXXX XXX0 /8, >>3

    0000 XXXX XXXX XXXX /16, >>4

    To make it short, you don't need more bits in your ADC to use the dynamic range of a word size variable. Its just
    binary arithmetic. Of course you could gain even more dynamic range by using 32bit arithmetic and two word
    variables. Tracy Allen's web site (EME Systems) would be a good resource on that subject.

    Regards
    Adrian
  • dredre Posts: 106
    edited 2010-08-05 19:04
    Hi Folks,

    I want to thank all who replied. Although I didn't get results I can use directly, I did get a
    good deal of excellent recommendations to contemplate.
    For the time being I will stick with the 12 bit ADC I am currently using. I will try
    experimenting; maybe 'switching' in the immediate area of concern of the variable prior
    to the conversion.
    .
    [noparse][[/noparse]I once heard a lecture given by Charles F. Kettering [noparse][[/noparse]of GM & Sloan-Kettering fame] in
    which he mentioned that, when he called a meeting of his engineers, he displayed a
    velvet-lined box at the entrance with the note for all engineers to leave their sliderules in
    the box. He didn't want anyone whipping out his sliderule in respond to his technical
    discussion and, using Handbook formulas and sliderule calculations, state that, "it couldn't
    be done".]
    Now thats', 'thinking outside the box'. wink.gif

    Again, my thanks,
    David
Sign In or Register to comment.