Shop OBEX P1 Docs P2 Docs Learn Events
mcp3204 code — Parallax Forums

mcp3204 code

ArchiverArchiver Posts: 46,084
edited 2001-06-11 13:59 in General Discussion
help, help.

ive spent hours trying to make this work, no luck.

ive used the stamp code for the ltc1298 a 2 d converter, i just modified it
for the demands of the mcp3204.

all i can ever get is all zeroes.

ill attach the code as a file at the end.

any help is greatly appreciated.

normdoty@h...


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-06-10 14:37
    Hello norman,

    Try putting 12 instead of 16 in the shiftin command


    Best regards,
    Kalun mailto:klnlau@v...



    Sunday, June 10, 2001, 7:29:27 AM, you wrote:

    nd> help, help.

    nd> ive spent hours trying to make this work, no luck.

    nd> ive used the stamp code for the ltc1298 a 2 d converter, i just modified it
    nd> for the demands of the mcp3204.

    nd> all i can ever get is all zeroes.

    nd> ill attach the code as a file at the end.

    nd> any help is greatly appreciated.

    nd> normdoty@h...
  • ArchiverArchiver Posts: 46,084
    edited 2001-06-10 15:51
    the mcp3204 docs says you need 3 extra clock cycles, 1 to latch the data in
    1 to run the conversion, and 1 which clocks out an unknown bit, ive tried
    all combinations from 12 to 27, it will clock out the data backwards after
    its forwards reading if you keep sending clock pulses, and after that if
    clocks are still supplied its supposed to clock out zeroes indefinately.

    any other ideas would be appreciated.

    norm



    >From: Kalun Lau <klnlau@t...>
    >Reply-To: basicstamps@yahoogroups.com
    >To: norman doty <basicstamps@yahoogroups.com>
    >Subject: Re: [noparse][[/noparse]basicstamps] mcp3204 code
    >Date: Sun, 10 Jun 2001 08:37:08 -0500
    >
    >Hello norman,
    >
    >Try putting 12 instead of 16 in the shiftin command
    >
    >
    >Best regards,
    > Kalun mailto:klnlau@v...
    >
    >
    >
    >Sunday, June 10, 2001, 7:29:27 AM, you wrote:
    >
    >nd> help, help.
    >
    >nd> ive spent hours trying to make this work, no luck.
    >
    >nd> ive used the stamp code for the ltc1298 a 2 d converter, i just
    >modified it
    >nd> for the demands of the mcp3204.
    >
    >nd> all i can ever get is all zeroes.
    >
    >nd> ill attach the code as a file at the end.
    >
    >nd> any help is greatly appreciated.
    >
    >nd> normdoty@h...
    >
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed with. Text in the Subject
    >and Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >

    _________________________________________________________________
    Get your FREE download of MSN Explorer at http://explorer.msn.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-06-10 16:05
    don't know if this will help I think I have one more this is a 3202 not
    sure what the difference is


    The Shiftin / Shiftout routines work extremely well with several ADC/s that
    we use in production. I've pasted a snipet of code we use in one of our
    instruments which contains an LTC1298. This code has also been reliably
    tested with the newer Microchip MCP3202. The averaging gives us somewhat
    better than the 12 bits these A/D's are rated at.

    For x = 0 to 4
    AdConfig=AdConfig|%1011 ' set all bits xcept
    OddSign
    CS = 0 ' Low CS-enable ad
    shiftout data_io,clk,0,[noparse][[/noparse]AdConfig\4] ' send config bits
    shiftin data_io,clk,2,[noparse][[/noparse]Analog\12] ' get result data bits
    CS = 1 ' High CS-disable
    Temperature=Temperature+Analog ' Sum A/D bits
    Next
    Temperature=(Temperature */ 125 + 1)/2 ' A/D reference voltage to
    '5.000VDC; average of 5 counts



    norman doty wrote:
    >
    > the mcp3204 docs says you need 3 extra clock cycles, 1 to latch the data in
    > 1 to run the conversion, and 1 which clocks out an unknown bit, ive tried
    > all combinations from 12 to 27, it will clock out the data backwards after
    > its forwards reading if you keep sending clock pulses, and after that if
    > clocks are still supplied its supposed to clock out zeroes indefinately.
    >
    > any other ideas would be appreciated.
    >
    > norm
    >
    > >From: Kalun Lau <klnlau@t...>
    > >Reply-To: basicstamps@yahoogroups.com
    > >To: norman doty <basicstamps@yahoogroups.com>
    > >Subject: Re: [noparse][[/noparse]basicstamps] mcp3204 code
    > >Date: Sun, 10 Jun 2001 08:37:08 -0500
    > >
    > >Hello norman,
    > >
    > >Try putting 12 instead of 16 in the shiftin command
    > >
    > >
    > >Best regards,
    > > Kalun mailto:klnlau@v...
    > >
    > >
    > >
    > >Sunday, June 10, 2001, 7:29:27 AM, you wrote:
    > >
    > >nd> help, help.
    > >
    > >nd> ive spent hours trying to make this work, no luck.
    > >
    > >nd> ive used the stamp code for the ltc1298 a 2 d converter, i just
    > >modified it
    > >nd> for the demands of the mcp3204.
    > >
    > >nd> all i can ever get is all zeroes.
    > >
    > >nd> ill attach the code as a file at the end.
    > >
    > >nd> any help is greatly appreciated.
    > >
    > >nd> normdoty@h...
    > >
    > >
    > >
    > >To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > >from the same email address that you subscribed with. Text in the Subject
    > >and Body of the message will be ignored.
    > >
    > >
    > >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    > _________________________________________________________________
    > Get your FREE download of MSN Explorer at http://explorer.msn.com
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed with. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-06-10 16:16
    Here is one other little tidbit

    sclock - pulled up to 5vdc using a 47k resistor and connected to stamp
    cs = pulled up to 5vdc using a 47k resistor and connected to stamp

    norman doty wrote:
    >
    > help, help.
    >
    > ive spent hours trying to make this work, no luck.
    >
    > ive used the stamp code for the ltc1298 a 2 d converter, i just modified it
    > for the demands of the mcp3204.
    >
    > all i can ever get is all zeroes.
    >
    > ill attach the code as a file at the end.
    >
    > any help is greatly appreciated.
    >
    > normdoty@h...
    >
    > _________________________________________________________________
    > Get your FREE download of MSN Explorer at http://explorer.msn.com
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed with. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    > Name: mcp3204.bs2
    > mcp3204.bs2 Type: Plain Text (text/plain)
    > Encoding: 8bit
  • ArchiverArchiver Posts: 46,084
    edited 2001-06-11 13:57
    chip documentation didnt show this, ive tried it at your suggestion (thanks
    a lot) but it didnt help, i replaced the chip with a 3202 and made the code
    changes for it and now it works.

    dont know if i had a nad 3204 or bad pins on the stamp2

    normdoty@h...



    >From: "L .Gaminde" <lgaminde@t...>
    >Reply-To: basicstamps@yahoogroups.com
    >To: basicstamps@yahoogroups.com
    >Subject: Re: [noparse][[/noparse]basicstamps] mcp3204 code
    >Date: Sun, 10 Jun 2001 08:16:23 -0700
    >
    >Here is one other little tidbit
    >
    >sclock - pulled up to 5vdc using a 47k resistor and connected to stamp
    >cs = pulled up to 5vdc using a 47k resistor and connected to stamp
    >
    >norman doty wrote:
    > >
    > > help, help.
    > >
    > > ive spent hours trying to make this work, no luck.
    > >
    > > ive used the stamp code for the ltc1298 a 2 d converter, i just modified
    >it
    > > for the demands of the mcp3204.
    > >
    > > all i can ever get is all zeroes.
    > >
    > > ill attach the code as a file at the end.
    > >
    > > any help is greatly appreciated.
    > >
    > > normdoty@h...
    > >
    > > _________________________________________________________________
    > > Get your FREE download of MSN Explorer at http://explorer.msn.com
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed with. Text in the
    >Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    >http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    > > Name: mcp3204.bs2
    > > mcp3204.bs2 Type: Plain Text (text/plain)
    > > Encoding: 8bit
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed with. Text in the Subject
    >and Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >

    _________________________________________________________________
    Get your FREE download of MSN Explorer at http://explorer.msn.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-06-11 13:59
    i changed the chip to a 3202 and different pins and now im in business.

    dont know if the 3204 was bad or bad pins on the stamp2

    thanks

    normdoty@h...



    >From: "L .Gaminde" <lgaminde@t...>
    >Reply-To: basicstamps@yahoogroups.com
    >To: basicstamps@yahoogroups.com
    >Subject: Re: [noparse][[/noparse]basicstamps] mcp3204 code
    >Date: Sun, 10 Jun 2001 08:05:04 -0700
    >
    >don't know if this will help I think I have one more this is a 3202 not
    >sure what the difference is
    >
    >
    >The Shiftin / Shiftout routines work extremely well with several ADC/s that
    >we use in production. I've pasted a snipet of code we use in one of our
    >instruments which contains an LTC1298. This code has also been reliably
    >tested with the newer Microchip MCP3202. The averaging gives us somewhat
    >better than the 12 bits these A/D's are rated at.
    >
    > For x = 0 to 4
    > AdConfig=AdConfig|%1011 ' set all bits xcept
    >OddSign
    > CS = 0 ' Low CS-enable ad
    > shiftout data_io,clk,0,[noparse][[/noparse]AdConfig\4] ' send config bits
    > shiftin data_io,clk,2,[noparse][[/noparse]Analog\12] ' get result data bits
    > CS = 1 ' High CS-disable
    > Temperature=Temperature+Analog ' Sum A/D bits
    > Next
    > Temperature=(Temperature */ 125 + 1)/2 ' A/D reference voltage
    >to
    >'5.000VDC; average of 5 counts
    >
    >
    >
    >norman doty wrote:
    > >
    > > the mcp3204 docs says you need 3 extra clock cycles, 1 to latch the data
    >in
    > > 1 to run the conversion, and 1 which clocks out an unknown bit, ive
    >tried
    > > all combinations from 12 to 27, it will clock out the data backwards
    >after
    > > its forwards reading if you keep sending clock pulses, and after that if
    > > clocks are still supplied its supposed to clock out zeroes indefinately.
    > >
    > > any other ideas would be appreciated.
    > >
    > > norm
    > >
    > > >From: Kalun Lau <klnlau@t...>
    > > >Reply-To: basicstamps@yahoogroups.com
    > > >To: norman doty <basicstamps@yahoogroups.com>
    > > >Subject: Re: [noparse][[/noparse]basicstamps] mcp3204 code
    > > >Date: Sun, 10 Jun 2001 08:37:08 -0500
    > > >
    > > >Hello norman,
    > > >
    > > >Try putting 12 instead of 16 in the shiftin command
    > > >
    > > >
    > > >Best regards,
    > > > Kalun mailto:klnlau@v...
    > > >
    > > >
    > > >
    > > >Sunday, June 10, 2001, 7:29:27 AM, you wrote:
    > > >
    > > >nd> help, help.
    > > >
    > > >nd> ive spent hours trying to make this work, no luck.
    > > >
    > > >nd> ive used the stamp code for the ltc1298 a 2 d converter, i just
    > > >modified it
    > > >nd> for the demands of the mcp3204.
    > > >
    > > >nd> all i can ever get is all zeroes.
    > > >
    > > >nd> ill attach the code as a file at the end.
    > > >
    > > >nd> any help is greatly appreciated.
    > > >
    > > >nd> normdoty@h...
    > > >
    > > >
    > > >
    > > >To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@yahoogroups.com
    > > >from the same email address that you subscribed with. Text in the
    >Subject
    > > >and Body of the message will be ignored.
    > > >
    > > >
    > > >Your use of Yahoo! Groups is subject to
    >http://docs.yahoo.com/info/terms/
    > > >
    > > >
    > >
    > > _________________________________________________________________
    > > Get your FREE download of MSN Explorer at http://explorer.msn.com
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed with. Text in the
    >Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    >http://docs.yahoo.com/info/terms/
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed with. Text in the Subject
    >and Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >

    _________________________________________________________________
    Get your FREE download of MSN Explorer at http://explorer.msn.com
Sign In or Register to comment.