Help with the conversion math


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    this is what I mean
    Attached Images Attached Images  

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,626


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    Is this not a repeat of the left and right output justification as on the previous thread in Richard's link.
    Yes, that's exactly what it is. The reason for the results have been covered in that thread but not a way to end up with a correct pressure reading - which is still kind of hit and miss since we need specific details no the actual sensor used.

    /Henrik.

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    Hi All and Thanks!
    Just for grins I took a 10K resistor and fed the A/D input pin with 5 volts. The reading I got was 65472! I had to print and scan the data sheet as the one Servoflo has is similar and does not show the .07 psi device I am using. Not sure why when you print 5 pages to a PDF the text scrambles, its Abobe! I will try the suggest code in a few days. Yes it is a 54A-L07-H-2210 a 5 volt device.

    Best, Ed
    Attached Images Attached Images

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,174


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    And this 65472, isn't the 1023 with left justification?

    Ioannis

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,174


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    At page 157 of the Data sheet, it is shown that the PIC defaults to ADFM at 0 (zero), so it is really Left Justified by default. You have to make it a 1 for Right Justified result.

    The register is the ADCON2 and bit 7.

    Ioannis

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,626


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    Just for grins I took a 10K resistor and fed the A/D input pin with 5 volts. The reading I got was 65472!
    Yes, because you have the freaking thing configured wrong for the way that ADCIN works for crying out loud :-)
    Just set the justification bit correct, as Ioannis shows AND as we've already discussed in the other thread where we went thru all this resolution and justification stuff last time.

    OK, so it's a 0.07psi and not 7psi as I based my code around..... Well, then we need to change the scaling but lets see if it works at all first.

    /Henrik.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Help with the conversion math

    that works out pretty nicely every adc 100 count is almost exactly .01 psi

    0=110 , 0.07 = 820 couldn't be easier


    assuming I read the data sheet properly and that 0.07 psi = 4.0 volts and vref=5 v of course
    Last edited by richard; - 25th November 2014 at 07:49. Reason: still can'y type

Similar Threads

  1. AD conversion
    By CipiCips in forum mel PIC BASIC
    Replies: 8
    Last Post: - 19th May 2011, 02:09
  2. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 02:48
  3. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 11:22
  4. conversion
    By pramodsinha in forum Forum Requests
    Replies: 2
    Last Post: - 19th January 2006, 16:58
  5. ºC -> ºF Conversion
    By CocaColaKid in forum General
    Replies: 6
    Last Post: - 15th March 2005, 10:42

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