Dwayne Reid wrote: You are right - I wrote in a confusing manner. I have 2 quantities, where >a goes increases when b decreases, similar to the wiper on a pot. In >effect, I want to find the position of the wiper expressed as a number from >00 to FF. > >One other thing: since a + b is a constant, the sum of the two will also >fit in 9 bits. Why not simply multiply a with a constant that make the result = 0xFF00 when a is max, then use only the high byte of the answer? Multiplying with a constant gives fast short code. Regards /Morgan -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics