Shop OBEX P1 Docs P2 Docs Learn Events
Stamp as Resistance Meter — Parallax Forums

Stamp as Resistance Meter

ArchiverArchiver Posts: 46,084
edited 2003-10-21 03:54 in General Discussion
Hello,

Im fairly new to the Stamp but I have had a real cool
time learning how to use it.

I am building a resistance meter .... On the front end
of my circuit I have a Fixed resistor R1 (10M) setup
in a voltage divider configuration with R2 being the
un known resistance. The out put of my voltage divider
is going straight to a MAX1202 12 bit A/D converter. I
ve placed a 10M resistor as R2 and have had very
stable results after I poll the A/D i receive the
value 2500 + or - 2 LSB (Im using 5 volts for power).
Im using the Voltage divider formula and my meter to
verify accuracy :

Vout = R2/R2+R1 x Vin

5V
|
|
\
/ R1 10M
\
/
|
|
> AD > 2500 +- 2 LSB > Debug Screen
|
\
/ R2 10M
\
/
|
|
|
GND

Now I want to display the actual Resistance on my
debug screen. This is where Im having troubles, the
Stamp does not deal directlw with Floats only
Integers.

How do you rewrite Vout = R2/R2+R1 x Vin to solve for
R2? I guess I still will have an issue because 2500
needs to be calculated as 2.500 in the formula. Any
advice would be greatly appreciated.

BTW the thread about the proper setup of the AD helped
me out ... the 1K resistor in line with the input of
the AD stabalized my readings .an also a .01 uf cap to
ground on the input, I seen this on the MAX1202 Eval
Kit. everyone probally knows this but Maxim gives out
free samples of parts ... Not the eval Kits though.

mike

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-19 18:55
    Hi Mike,

    To display a decimal point in the debug window I use this line of code:

    DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)

    It displays 1 digit behind the decimal point. Ts is 10 times the actual
    value, of course. In the rest of the program I keep my integers as large as
    needed for this trick.

    I guess you could do this with a hundred (two digits). A thousend will
    probably cause problems as you may come too close te de size of a word
    variable (ca. 65999).

    Regards,

    Klaus




    Oorspronkelijk bericht
    Van: Mike Blankenship [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=7RwmF48NG3NYQdEMGJmML_Een9v6bQkfBpX5VWjcACNCH48MKJvgOLDxsqnZ1dl-_gBhooquIG4SSIC8Ruv82dTmbS0]mike_blankenship@s...[/url
    Verzonden: zondag 19 oktober 2003 9:12
    Aan: basicstamps@yahoogroups.com
    CC: mike_blankenship@s...
    Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter



    Hello,

    Im fairly new to the Stamp but I have had a real cool
    time learning how to use it.

    I am building a resistance meter .... On the front end
    of my circuit I have a Fixed resistor R1 (10M) setup
    in a voltage divider configuration with R2 being the
    un known resistance. The out put of my voltage divider
    is going straight to a MAX1202 12 bit A/D converter. I
    ve placed a 10M resistor as R2 and have had very
    stable results after I poll the A/D i receive the
    value 2500 + or - 2 LSB (Im using 5 volts for power).
    Im using the Voltage divider formula and my meter to
    verify accuracy :

    Vout = R2/R2+R1 x Vin

    5V
    |
    |
    \
    / R1 10M
    \
    /
    |
    |
    > AD > 2500 +- 2 LSB > Debug Screen
    |
    \
    / R2 10M
    \
    /
    |
    |
    |
    GND

    Now I want to display the actual Resistance on my
    debug screen. This is where Im having troubles, the
    Stamp does not deal directlw with Floats only
    Integers.

    How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    R2? I guess I still will have an issue because 2500
    needs to be calculated as 2.500 in the formula. Any
    advice would be greatly appreciated.

    BTW the thread about the proper setup of the AD helped
    me out ... the 1K resistor in line with the input of
    the AD stabalized my readings .an also a .01 uf cap to
    ground on the input, I seen this on the MAX1202 Eval
    Kit. everyone probally knows this but Maxim gives out
    free samples of parts ... Not the eval Kits though.

    mike


    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.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-20 00:55
    Hi Mike,

    You need to solve for R2, given the constants R1 and Vin and the
    measured value Vout:

    R2 = R1 * Vout/(Vin-Vout)

    This, involving a variable ratio times a constant, can be done most
    easily and accurately on the Stamp using looped long division
    calculation:



    Vin con 5000 ' supply volts
    R1 con 10000 ' reference resistor (1 meg = 10000*100ohms)
    Vout var word ' from ADC
    R2 var word ' find resistance
    D var word ' ditto
    J var nib ' ditto

    ' get Vout, based on unknown R2
    Vout=1234 ' for example, millivolts
    D = Vin - Vout ' 3766
    '
    binary division loop
    for J=15 to 0 ' 16 bits
    Vout=Vout//D<<1 ' remainder*2
    R2.bit0(J)=Vout/D ' next bit
    next
    '
    ' exits with R2=21474 intermediate result
    R2=R2**R1 ' final result, note ** operator
    debug dec R2,"00 ohms" ' prints 327600 ohms
    ' "correct" value is 326668 ohms


    Note that the precision of the calculation is about 100 ohms, given
    the 10 megaohm reference resistor. Is that good enough? And, the
    calculation works for R2 values up to 10 megaohms. There is more info
    on the math posted on my web site at
    http://www.emesystems.com/BS2math2.htm#longdivision

    -- Tracy




    >Hello,
    >
    >Im fairly new to the Stamp but I have had a real cool
    >time learning how to use it.
    >
    >I am building a resistance meter .... On the front end
    >of my circuit I have a Fixed resistor R1 (10M) setup
    >in a voltage divider configuration with R2 being the
    >un known resistance. The out put of my voltage divider
    >is going straight to a MAX1202 12 bit A/D converter. I
    >ve placed a 10M resistor as R2 and have had very
    >stable results after I poll the A/D i receive the
    >value 2500 + or - 2 LSB (Im using 5 volts for power).
    >Im using the Voltage divider formula and my meter to
    >verify accuracy :
    >
    >Vout = R2/R2+R1 x Vin
    >
    >5V
    >|
    >|
    >\
    >/ R1 10M
    >\
    >/
    >|
    >|
    > AD > 2500 +- 2 LSB > Debug Screen
    >|
    >\
    >/ R2 10M
    >\
    >/
    >|
    >|
    >|
    >GND
    >
    >Now I want to display the actual Resistance on my
    >debug screen. This is where Im having troubles, the
    >Stamp does not deal directlw with Floats only
    >Integers.
    >
    >How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    >R2? I guess I still will have an issue because 2500
    >needs to be calculated as 2.500 in the formula. Any
    >advice would be greatly appreciated.
    >
    >BTW the thread about the proper setup of the AD helped
    >me out ... the 1K resistor in line with the input of
    >the AD stabalized my readings .an also a .01 uf cap to
    >ground on the input, I seen this on the MAX1202 Eval
    >Kit. everyone probally knows this but Maxim gives out
    >free samples of parts ... Not the eval Kits though.
    >
    >mike
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-20 13:29
    Here's a simplification that won't give you any troubles:

    DEBUG CLS, DEC Ts/10, ".", DEC1 Ts

    When adding a width specifier to DEC (or HEX or BIN) the digits will
    come from the LSD side. If, for example, you want to display a value as
    x.xx you would do this:

    DEBUG DEC x/100, ".", DEC2 x

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oabwaOzGmz_fklGPtqES4-DFVUsooFXkDzk03c1NE9JCpB24hGKrgEjxV3DjYqR_VH1Vi_UxqCjqSfxcKv7p]Klaus.Jong@n...[/url
    Sent: Sunday, October 19, 2003 12:55 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Hi Mike,

    To display a decimal point in the debug window I use this line of code:

    DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)

    It displays 1 digit behind the decimal point. Ts is 10 times the actual
    value, of course. In the rest of the program I keep my integers as large
    as needed for this trick.

    I guess you could do this with a hundred (two digits). A thousend will
    probably cause problems as you may come too close te de size of a word
    variable (ca. 65999).

    Regards,

    Klaus




    Oorspronkelijk bericht
    Van: Mike Blankenship [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JFhNBm19jOkRJVNfNiTVEU1HQtEr9wX3Gdoi2v6w37Tz7Cto_r7SstH5JH38EwYK3TJQ4wyDEpWoryZ3LnVf86gIOL9g]mike_blankenship@s...[/url
    Verzonden: zondag 19 oktober 2003 9:12
    Aan: basicstamps@yahoogroups.com
    CC: mike_blankenship@s...
    Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter



    Hello,

    Im fairly new to the Stamp but I have had a real cool
    time learning how to use it.

    I am building a resistance meter .... On the front end
    of my circuit I have a Fixed resistor R1 (10M) setup
    in a voltage divider configuration with R2 being the
    un known resistance. The out put of my voltage divider
    is going straight to a MAX1202 12 bit A/D converter. I
    ve placed a 10M resistor as R2 and have had very
    stable results after I poll the A/D i receive the
    value 2500 + or - 2 LSB (Im using 5 volts for power).
    Im using the Voltage divider formula and my meter to
    verify accuracy :

    Vout = R2/R2+R1 x Vin

    5V
    |
    |
    \
    / R1 10M
    \
    /
    |
    |
    > AD > 2500 +- 2 LSB > Debug Screen
    |
    \
    / R2 10M
    \
    /
    |
    |
    |
    GND

    Now I want to display the actual Resistance on my
    debug screen. This is where Im having troubles, the
    Stamp does not deal directlw with Floats only
    Integers.

    How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    R2? I guess I still will have an issue because 2500
    needs to be calculated as 2.500 in the formula. Any
    advice would be greatly appreciated.

    BTW the thread about the proper setup of the AD helped
    me out ... the 1K resistor in line with the input of
    the AD stabalized my readings .an also a .01 uf cap to
    ground on the input, I seen this on the MAX1202 Eval
    Kit. everyone probally knows this but Maxim gives out
    free samples of parts ... Not the eval Kits though.

    mike


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-20 18:31
    Thank you Jon,

    It works fine, as expected :-).

    Klaus

    PS it's in the manual :-))))))).

    Oorspronkelijk bericht
    Van: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=CgJ_BzLGMeXTCh3nbthtNP8uSMsPlgg9YaagLx-kKSGf5AiWbrgTdK4pVPutwtMETZYY6lRavW4zowmaKb7uK2Q]jwilliams@p...[/url
    Verzonden: maandag 20 oktober 2003 13:29
    Aan: basicstamps@yahoogroups.com
    Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Here's a simplification that won't give you any troubles:

    DEBUG CLS, DEC Ts/10, ".", DEC1 Ts

    When adding a width specifier to DEC (or HEX or BIN) the digits will
    come from the LSD side. If, for example, you want to display a value as
    x.xx you would do this:

    DEBUG DEC x/100, ".", DEC2 x

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=sQZsDCejHb5tooeDHo1y_XkJYsRZQ7OpepbpyixkVX-Duv2LlF6AmhWRBa1keCulUAA_mobEI9v7n1_s_vY8_Q]Klaus.Jong@n...[/url
    Sent: Sunday, October 19, 2003 12:55 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Hi Mike,

    To display a decimal point in the debug window I use this line of code:

    DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)

    It displays 1 digit behind the decimal point. Ts is 10 times the actual
    value, of course. In the rest of the program I keep my integers as large
    as needed for this trick.

    I guess you could do this with a hundred (two digits). A thousend will
    probably cause problems as you may come too close te de size of a word
    variable (ca. 65999).

    Regards,

    Klaus




    Oorspronkelijk bericht
    Van: Mike Blankenship [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=j-H7buZVB81lZoa6n72cR7VjvaJG2Yw-KIYdz38RXhlVazl_ov-tfQgrnodX6YC-R0mEJrac_69fTo3QMA3Z4q6qpY07Lg]mike_blankenship@s...[/url
    Verzonden: zondag 19 oktober 2003 9:12
    Aan: basicstamps@yahoogroups.com
    CC: mike_blankenship@s...
    Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter



    Hello,

    Im fairly new to the Stamp but I have had a real cool
    time learning how to use it.

    I am building a resistance meter .... On the front end
    of my circuit I have a Fixed resistor R1 (10M) setup
    in a voltage divider configuration with R2 being the
    un known resistance. The out put of my voltage divider
    is going straight to a MAX1202 12 bit A/D converter. I
    ve placed a 10M resistor as R2 and have had very
    stable results after I poll the A/D i receive the
    value 2500 + or - 2 LSB (Im using 5 volts for power).
    Im using the Voltage divider formula and my meter to
    verify accuracy :

    Vout = R2/R2+R1 x Vin

    5V
    |
    |
    \
    / R1 10M
    \
    /
    |
    |
    > AD > 2500 +- 2 LSB > Debug Screen
    |
    \
    / R2 10M
    \
    /
    |
    |
    |
    GND

    Now I want to display the actual Resistance on my
    debug screen. This is where Im having troubles, the
    Stamp does not deal directlw with Floats only
    Integers.

    How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    R2? I guess I still will have an issue because 2500
    needs to be calculated as 2.500 in the formula. Any
    advice would be greatly appreciated.

    BTW the thread about the proper setup of the AD helped
    me out ... the 1K resistor in line with the input of
    the AD stabalized my readings .an also a .01 uf cap to
    ground on the input, I seen this on the MAX1202 Eval
    Kit. everyone probally knows this but Maxim gives out
    free samples of parts ... Not the eval Kits though.

    mike


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....


    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.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-20 18:32
    You're kidding, right? You mean you actually found useful information
    in the manual? That never happens! <wicked grin>

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ZQpj-sqU8U8vHbZ404MYaxg4o76NzVwQuBE7czl2UmXmeGnHWN0Uln2T748sfv-M06SLALhVfFaq3EDBCE5O]Klaus.Jong@n...[/url
    Sent: Monday, October 20, 2003 12:31 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Thank you Jon,

    It works fine, as expected :-).

    Klaus

    PS it's in the manual :-))))))).

    Oorspronkelijk bericht
    Van: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Q95wcl1H_Jy_0bjFdB0E8hxFkFh9vMunZSqlratvY4bGieQla5djTZnPbgJWubjj98srG5C-aQ2J2RLUUE4TsC8]jwilliams@p...[/url
    Verzonden: maandag 20 oktober 2003 13:29
    Aan: basicstamps@yahoogroups.com
    Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Here's a simplification that won't give you any troubles:

    DEBUG CLS, DEC Ts/10, ".", DEC1 Ts

    When adding a width specifier to DEC (or HEX or BIN) the digits will
    come from the LSD side. If, for example, you want to display a value as
    x.xx you would do this:

    DEBUG DEC x/100, ".", DEC2 x

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ZQpj-sqU8U8vHbZ404MYaxg4o76NzVwQuBE7czl2UmXmeGnHWN0Uln2T748sfv-M06SLALhVfFaq3EDBCE5O]Klaus.Jong@n...[/url
    Sent: Sunday, October 19, 2003 12:55 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Hi Mike,

    To display a decimal point in the debug window I use this line of code:

    DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)

    It displays 1 digit behind the decimal point. Ts is 10 times the actual
    value, of course. In the rest of the program I keep my integers as large
    as needed for this trick.

    I guess you could do this with a hundred (two digits). A thousend will
    probably cause problems as you may come too close te de size of a word
    variable (ca. 65999).

    Regards,

    Klaus




    Oorspronkelijk bericht
    Van: Mike Blankenship [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=f7b_AGfx6FzNrqyHlR-oJpff1jp-FWfZTlHyZaO1zbz4W-2k63z8XjfUKsFaJYIrmTDlpFDx_jv_CIXGjaAcTu00Wpx3AlIz]mike_blankenship@s...[/url
    Verzonden: zondag 19 oktober 2003 9:12
    Aan: basicstamps@yahoogroups.com
    CC: mike_blankenship@s...
    Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter



    Hello,

    Im fairly new to the Stamp but I have had a real cool
    time learning how to use it.

    I am building a resistance meter .... On the front end
    of my circuit I have a Fixed resistor R1 (10M) setup
    in a voltage divider configuration with R2 being the
    un known resistance. The out put of my voltage divider
    is going straight to a MAX1202 12 bit A/D converter. I
    ve placed a 10M resistor as R2 and have had very
    stable results after I poll the A/D i receive the
    value 2500 + or - 2 LSB (Im using 5 volts for power).
    Im using the Voltage divider formula and my meter to
    verify accuracy :

    Vout = R2/R2+R1 x Vin

    5V
    |
    |
    \
    / R1 10M
    \
    /
    |
    |
    > AD > 2500 +- 2 LSB > Debug Screen
    |
    \
    / R2 10M
    \
    /
    |
    |
    |
    GND

    Now I want to display the actual Resistance on my
    debug screen. This is where Im having troubles, the
    Stamp does not deal directlw with Floats only
    Integers.

    How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    R2? I guess I still will have an issue because 2500
    needs to be calculated as 2.500 in the formula. Any
    advice would be greatly appreciated.

    BTW the thread about the proper setup of the AD helped
    me out ... the 1K resistor in line with the input of
    the AD stabalized my readings .an also a .01 uf cap to
    ground on the input, I seen this on the MAX1202 Eval
    Kit. everyone probally knows this but Maxim gives out
    free samples of parts ... Not the eval Kits though.

    mike


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-20 18:44
    Well......, to be honest, when I got my first Stamp I read the manual from A
    to Z and had a jumpstart in programming these curious little things.

    Take it as the comliment! The manual is superb and I had a nice time reading
    it. Especially when you are used to the Microsoft C/C++ and MFC stuff it is
    astonishingly clear and I could program right from the manual into the Stamp
    ;-).

    Chapeau!!!

    Klaus

    Oorspronkelijk bericht
    Van: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=IJp_-xBEraZ6jRIto3ayQy5_FLrfGAHWGuB3Q0-X7DOJaR8rVKp-3YdKWixmJuodKiOlzhOhOPLyUKwdA2eEpg]jwilliams@p...[/url
    Verzonden: maandag 20 oktober 2003 18:33
    Aan: basicstamps@yahoogroups.com
    Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    You're kidding, right? You mean you actually found useful information
    in the manual? That never happens! <wicked grin>

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JAvXFuSWgoYXImDvisWvcQiEWkYd7wneH1PBHeA_wBjv_XhCIM-2F-uRo5AnS1dCKNTeYAfSNhiOd8xs8g]Klaus.Jong@n...[/url
    Sent: Monday, October 20, 2003 12:31 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Thank you Jon,

    It works fine, as expected :-).

    Klaus

    PS it's in the manual :-))))))).

    Oorspronkelijk bericht
    Van: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=IJp_-xBEraZ6jRIto3ayQy5_FLrfGAHWGuB3Q0-X7DOJaR8rVKp-3YdKWixmJuodKiOlzhOhOPLyUKwdA2eEpg]jwilliams@p...[/url
    Verzonden: maandag 20 oktober 2003 13:29
    Aan: basicstamps@yahoogroups.com
    Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Here's a simplification that won't give you any troubles:

    DEBUG CLS, DEC Ts/10, ".", DEC1 Ts

    When adding a width specifier to DEC (or HEX or BIN) the digits will
    come from the LSD side. If, for example, you want to display a value as
    x.xx you would do this:

    DEBUG DEC x/100, ".", DEC2 x

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: K de Jong [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JAvXFuSWgoYXImDvisWvcQiEWkYd7wneH1PBHeA_wBjv_XhCIM-2F-uRo5AnS1dCKNTeYAfSNhiOd8xs8g]Klaus.Jong@n...[/url
    Sent: Sunday, October 19, 2003 12:55 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter


    Hi Mike,

    To display a decimal point in the debug window I use this line of code:

    DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)

    It displays 1 digit behind the decimal point. Ts is 10 times the actual
    value, of course. In the rest of the program I keep my integers as large
    as needed for this trick.

    I guess you could do this with a hundred (two digits). A thousend will
    probably cause problems as you may come too close te de size of a word
    variable (ca. 65999).

    Regards,

    Klaus




    Oorspronkelijk bericht
    Van: Mike Blankenship [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=iC4se_2KBPMfOfcoBsJxK9OC01Fma_krhTGJSLihjHqDhV1-2X1Ci4F6DbIslhVvmZAMAFMDHhaIcCgWw2LBgLUYUSg]mike_blankenship@s...[/url
    Verzonden: zondag 19 oktober 2003 9:12
    Aan: basicstamps@yahoogroups.com
    CC: mike_blankenship@s...
    Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter



    Hello,

    Im fairly new to the Stamp but I have had a real cool
    time learning how to use it.

    I am building a resistance meter .... On the front end
    of my circuit I have a Fixed resistor R1 (10M) setup
    in a voltage divider configuration with R2 being the
    un known resistance. The out put of my voltage divider
    is going straight to a MAX1202 12 bit A/D converter. I
    ve placed a 10M resistor as R2 and have had very
    stable results after I poll the A/D i receive the
    value 2500 + or - 2 LSB (Im using 5 volts for power).
    Im using the Voltage divider formula and my meter to
    verify accuracy :

    Vout = R2/R2+R1 x Vin

    5V
    |
    |
    \
    / R1 10M
    \
    /
    |
    |
    > AD > 2500 +- 2 LSB > Debug Screen
    |
    \
    / R2 10M
    \
    /
    |
    |
    |
    GND

    Now I want to display the actual Resistance on my
    debug screen. This is where Im having troubles, the
    Stamp does not deal directlw with Floats only
    Integers.

    How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    R2? I guess I still will have an issue because 2500
    needs to be calculated as 2.500 in the formula. Any
    advice would be greatly appreciated.

    BTW the thread about the proper setup of the AD helped
    me out ... the 1K resistor in line with the input of
    the AD stabalized my readings .an also a .01 uf cap to
    ground on the input, I seen this on the MAX1202 Eval
    Kit. everyone probally knows this but Maxim gives out
    free samples of parts ... Not the eval Kits though.

    mike


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....


    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.


    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. 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....


    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.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-21 03:54
    Thanks guys for the tips ... I also founf the manual very helpful.
    I also love the spiral ring very usefule for begginers who need to
    flip back and forth back and forth [noparse];)[/noparse]

    mike

    --- In basicstamps@yahoogroups.com, "K de Jong" <Klaus.Jong@n...>
    wrote:
    > Well......, to be honest, when I got my first Stamp I read the
    manual from A
    > to Z and had a jumpstart in programming these curious little
    things.
    >
    > Take it as the comliment! The manual is superb and I had a nice
    time reading
    > it. Especially when you are used to the Microsoft C/C++ and MFC
    stuff it is
    > astonishingly clear and I could program right from the manual into
    the Stamp
    > ;-).
    >
    > Chapeau!!!
    >
    > Klaus
    >
    >
    Oorspronkelijk bericht
    > Van: Jon Williams [noparse][[/noparse]mailto:jwilliams@p...]
    > Verzonden: maandag 20 oktober 2003 18:33
    > Aan: basicstamps@yahoogroups.com
    > Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter
    >
    >
    > You're kidding, right? You mean you actually found useful
    information
    > in the manual? That never happens! <wicked grin>
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: K de Jong [noparse][[/noparse]mailto:Klaus.Jong@n...]
    > Sent: Monday, October 20, 2003 12:31 PM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter
    >
    >
    > Thank you Jon,
    >
    > It works fine, as expected :-).
    >
    > Klaus
    >
    > PS it's in the manual :-))))))).
    >
    >
    Oorspronkelijk bericht
    > Van: Jon Williams [noparse][[/noparse]mailto:jwilliams@p...]
    > Verzonden: maandag 20 oktober 2003 13:29
    > Aan: basicstamps@yahoogroups.com
    > Onderwerp: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter
    >
    >
    > Here's a simplification that won't give you any troubles:
    >
    > DEBUG CLS, DEC Ts/10, ".", DEC1 Ts
    >
    > When adding a width specifier to DEC (or HEX or BIN) the digits
    will
    > come from the LSD side. If, for example, you want to display a
    value as
    > x.xx you would do this:
    >
    > DEBUG DEC x/100, ".", DEC2 x
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: K de Jong [noparse][[/noparse]mailto:Klaus.Jong@n...]
    > Sent: Sunday, October 19, 2003 12:55 PM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter
    >
    >
    > Hi Mike,
    >
    > To display a decimal point in the debug window I use this line of
    code:
    >
    > DEBUG CLS, DEC Ts/10,".",DEC Ts-((Ts/10)*10)
    >
    > It displays 1 digit behind the decimal point. Ts is 10 times the
    actual
    > value, of course. In the rest of the program I keep my integers as
    large
    > as needed for this trick.
    >
    > I guess you could do this with a hundred (two digits). A thousend
    will
    > probably cause problems as you may come too close te de size of a
    word
    > variable (ca. 65999).
    >
    > Regards,
    >
    > Klaus
    >
    >
    >
    >
    >
    Oorspronkelijk bericht
    > Van: Mike Blankenship [noparse][[/noparse]mailto:mike_blankenship@s...]
    > Verzonden: zondag 19 oktober 2003 9:12
    > Aan: basicstamps@yahoogroups.com
    > CC: mike_blankenship@s...
    > Onderwerp: [noparse][[/noparse]basicstamps] Stamp as Resistance Meter
    >
    >
    >
    > Hello,
    >
    > Im fairly new to the Stamp but I have had a real cool
    > time learning how to use it.
    >
    > I am building a resistance meter .... On the front end
    > of my circuit I have a Fixed resistor R1 (10M) setup
    > in a voltage divider configuration with R2 being the
    > un known resistance. The out put of my voltage divider
    > is going straight to a MAX1202 12 bit A/D converter. I
    > ve placed a 10M resistor as R2 and have had very
    > stable results after I poll the A/D i receive the
    > value 2500 + or - 2 LSB (Im using 5 volts for power).
    > Im using the Voltage divider formula and my meter to
    > verify accuracy :
    >
    > Vout = R2/R2+R1 x Vin
    >
    > 5V
    > |
    > |
    > \
    > / R1 10M
    > \
    > /
    > |
    > |
    > AD > 2500 +- 2 LSB > Debug Screen
    > |
    > \
    > / R2 10M
    > \
    > /
    > |
    > |
    > |
    > GND
    >
    > Now I want to display the actual Resistance on my
    > debug screen. This is where Im having troubles, the
    > Stamp does not deal directlw with Floats only
    > Integers.
    >
    > How do you rewrite Vout = R2/R2+R1 x Vin to solve for
    > R2? I guess I still will have an issue because 2500
    > needs to be calculated as 2.500 in the formula. Any
    > advice would be greatly appreciated.
    >
    > BTW the thread about the proper setup of the AD helped
    > me out ... the 1K resistor in line with the input of
    > the AD stabalized my readings .an also a .01 uf cap to
    > ground on the input, I seen this on the MAX1202 Eval
    > Kit. everyone probally knows this but Maxim gives out
    > free samples of parts ... Not the eval Kits though.
    >
    > mike
    >
    >
    > 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.
    >
    >
    > 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. 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
    >
    >
    > 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.
    >
    >
    > 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. 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
    >
    >
    > 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.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
Sign In or Register to comment.