Using floating point


Results 1 to 9 of 9

Threaded View

  1. #5
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: Using floating point

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    So you have a raw reading which you want to divide by 1.64, is that correct? Or do you want to multiply the raw value by 1.64?

    TempC = TempC ** 39961 ' Multiplu by 0.60976 which is the same as dividing by 1.64

    or

    TempC = TempC */ 420 ' Multiply by ~1.641

    or

    TempC = TempC + (TempC ** 41943) ' Multiply by 0.64 and add result to previous value.

    If neither of these works can you give us a bit more details about how the raw values correlates to actual temperature. Ie what raw value do you get at 0 temp and what raw value do you get at max temp (500 degrees in this case).

    /Henrik.
    Divide by 1.64. I found that the meat thermocouple in boiling water required me to divide by 1.64 to get 100C. The cooker thermocouple was a similar (but slightly different) number. In reality, I have a calibration routine that determines the number then it is stored in COOK_ADJUST or MEAT_ADJUST. This is so I can easily correct if a new thermocouple is installed.

    After reading Jerson's post, I changed C_TEMP and M_TEMP (the cooker and meat raw ADC values, respectively) to LONGS. I came up with the following that I will try when I finish building the new board:

    Code:
     	C_TEMP = C_TEMP * 1000
    	C_TEMP = C_TEMP / COOK_ADJUST 'ADJUST * 1000
    	C_TEMP = C_TEMP + (C_TEMP << 3) ' mul by 1 x + 8*x = 9x
    	C_TEMP = C_TEMP / 5 ' div by 5
            C_TEMP = C_TEMP + 320 ' add 32 with 1 decimal accounted for
    	M_TEMP = M_TEMP * 1000
    	M_TEMP = M_TEMP / MEAT ADJUST
    	M_TEMP = M_TEMP + (M_TEMP << 3) ' mul by 1 x + 8*x = 9x
    	M_TEMP = M_TEMP / 5 ' div by 5
            M_TEMP = M_TEMP + 320 ' add 32 with 1 decimal accounted for	
    		           'CT:nnn.nF  MT:nnn.nF
    	LCDOUT $FE, $80, "CT:", DEC3 (C_TEMP / 10), ".", DEC1 (C_TEMP MOD 10), "F"
    	LCDOUT $FE, $80 + 9, "  ", "MT:", DEC3 (M_TEMP /10), ".", DEC1 (M_TEMP MOD 10), "F"
    I think this will work. Opinions?
    Last edited by andywpg; - 24th February 2015 at 19:59.
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

Similar Threads

  1. Using floating point
    By andywpg in forum PBP3
    Replies: 0
    Last Post: - 24th February 2015, 16:42
  2. Floating point math
    By Glenn in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th January 2009, 03:47
  3. Getting out of floating point
    By jcb344 in forum General
    Replies: 3
    Last Post: - 5th August 2008, 21:18
  4. Floating Point
    By jrudd in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th May 2005, 14:19
  5. help floating Point!
    By Eric in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th December 2003, 21:18

Members who have read this thread : 1

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