On Mon, 9 Mar 1998 10:56:06 -0800 "Randie Ohtsji [4555]" writes: >Hello, > >Does anyone have a simple way of converting from degrees Celsius >to degrees Fahrenheit (and vice-versa) using PIC math? First it's a good idea to store the temperatures internally so they are positive all the time (i.e. they would be relative to the lowest temperature the unit could handle.). Also it would be useful to multiply the temperatures by 10 or 100 so that one or 2 decimal places could be displayed. The display routines would convert the temperature back by subtracting the offset and displaying the possibly negative number, placing a decimal point in the right place. For example, if the minimum temperature is -60 C and 2 decimal places are required, 15.02 C would be stored as 7502. All conversion math can now be done with positive integers only. The ratio of 5/9 would stay the same, but the constant of 32 would need to be multiplied by 10 or 100. A routine to divide a 16 or more bit number by an 8-bit number has been recently posted. The multiplies by 9 or 5 could be done with just hard-coded shifts and adds. Using the -60, *100 convention, the multiply by 9 to convert to F would overflow 16 bits at abour 12 C. So temporary results of 24 bits would be needed. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]