Measuring Resistance


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    34

    Default Measuring Resistance

    Hello All,
    I am trying to measure resistance quite accuratly, i did some research and found that the POT Command can be used to measure resistance but i can't seem to get the resolution i need. Wheni output the data the difference between 10k(output value of 16), 20k(output value of 17) and an open circuit(output value of 20) is to small.

    Does anyone know how to improve my code or have any better ideas?

    <code>
    INCLUDE "modedefs.bas"

    @ DEVICE PIC12f629, XT_OSC
    @ DEVICE PIC12f629, WDT_OFF
    @ DEVICE PIC12f629, PWRT_ON
    @ DEVICE PIC12f629, MCLR_OFF
    @ DEVICE PIC12f629, BOD_ON
    @ DEVICE PIC12f629, CPD_OFF

    Define OSC 4
    CMCON = 7

    RXPIN Var GPIO.1 'Input PIN
    TXPIN VAR GPIO.2 'Output PIN
    SCALE CON 255 'Scale Value
    B0 VAR BYTE 'Pin Value

    rx:
    POT RXpin,scale,B0
    serout txpin,n2400,["Value= ",#b0,10,13]
    Pause 2000
    goto rx

    end
    </code>

    Regards,
    Jeremy

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not think you will be happy with the POT command.

    You may want to look into using an ADC. Use one with a 10 bit resolution. This will give 1024 steps on full scale.
    Take a known voltage, run it through a voltage divider with one of the resistors being fixed.
    With a little calculating the unknown resistance cane be found.

    If you need ideas go here
    http://www.rentron.com/pic.htm
    Examples for using the ADC on a few different chips, and methods.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Thanks Dave, i will take a look.
    Jeremy

  4. #4
    Join Date
    Aug 2008
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Could you use?:
    BO VAR WORD

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Picstar View Post
    Could you use?:
    BO VAR WORD
    You could...
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Measuring DC current
    By mitchf14 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th January 2009, 18:49
  2. Air pressure measuring
    By Eugeniu in forum General
    Replies: 10
    Last Post: - 11th December 2008, 01:20
  3. Calulating BJT base resistance for PIC led switching?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th November 2008, 08:41
  4. interpolating ribbon temperature by resistance
    By rossfree in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th December 2006, 17:53
  5. Voltage to Resistance???
    By Scott in forum General
    Replies: 1
    Last Post: - 15th February 2006, 09:03

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