For fixed values like this, I generally divide in one of two ways... - Subtract 5 continuously in a loop, until the remainder is less than 5. (Then process the remainder as required). - Convert 1/5 (=0.2) into a value that is /256 (or even /65536, or other depending on precision required). Then multiply by that integer and shift to divide by 256 etc. To find that integer, I generally would keep multiplying 1/5 by 2, and look for as whole a number as possible. For 1/5, multiplying by 256 is close to whole at 51.2. 51/256 = 0.1992, which is 0.4% error from 0.2. If that's acceptable, then the code just needs to multiply by 51, then drop the right-most byte. You can even check the MSB of the right-most byte and increment the next byte if required to round the result. FWIW, there are some divide routines in the PIClist source-code library. BTW, I've done C to F before, and I did the math for 9/5 at once. I used 717/512 = 1.40039 which is 0.03% error. Cheers, -Neil. Quoting alan smith : > Processor is a 18F23K20 > > I've never had the requirement to do much math with a PIC, other > than simple divide by 2 or 4 (shifts), add and subtract > > So looking for a little help in implementing this > > temp_F = (temp_C * 9 / 5) + 32; > > The temp_C * 9 can be done with the MULLW instruction. Just not to > sure about the divide by 5 part? > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist