> set up with Vref to 5 volts. The user defined limits are defined as : 0v < > LowLimit < High Limit < 5v. The new range is found by : HighLimit - LowLimit > = Range. The problem is: How do I divide ... I guess your problem is you are trying to divide two similar sized integers and want something more than an integer answer. Fixed point is fine in your case because the values are all nicely bounded. The trick is to multiply the numerator by a constant first, then do the divide. For example in decimal, 941 div 1024 = 0 in integer math. However, (941 * 1000) div 1024 = 918. The 918 value is actually fixed point representing 0.918. It is usually more convenient to have fractional binary digits (bits) in the computer than fractional decimal digits. Therefore, instead of multiplying by 1000 as in the example, multiply by some power of 2, which only requires shifting bits around. If the power of 2 is also a power of 256 then the "multiply" is as easy as picking off the right bytes. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu