Floating point math


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80

    Default Floating point math

    Now I have rushed into something that I dont know how it works again.

    I trying to build something that reads the voltage from a sensor, I connected the sensor as in the datasheet with correct capacitors and connected Vs to the same +5v as the PIC, then I connected the output from the sensor to an ADC input of a 16F877A and reads it with ADCIN.

    This works fine, and I get a value that varys between 11 and 90. (When just outputting it to an LCD)

    BUT, now I want to know what the real value is, not this representation of the actual voltage.

    In the datasheet of the sensor it says:

    Vout = Vs*(0.00363*P + 0.04)

    ..Wich would be (with a little help from my friends, I suck at math)

    P = ((Vout/Vs)-0.04)/0.00396

    But then I first need the actual voltage, how do I get that ? what kid of value do I get from ADCIN ?

    ..And How do I use the formula in PBP ? its floating point.. how can I use it to get the value of P on my LCD ?


    ..I tried to read the PBP manual but cannot find anything, but maybe this is more of a math problem than a PBP problem ?
    Last edited by Glenn; - 4th January 2009 at 17:43.

Similar Threads

  1. Strugling without floating point
    By pjsmith in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th March 2011, 06:29
  2. Replies: 5
    Last Post: - 28th May 2008, 10:20
  3. Floating Point Display Problem (serial string out)
    By Cash Olsen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th December 2007, 02:03
  4. Floating Point
    By jrudd in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th May 2005, 14:19
  5. DIV32 instead of floating point routines?
    By Tomasm in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd April 2004, 07:50

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