nogueira wrote: > > I'd like to get help solving this: > > TEMPERATURE=TEMP_READ-0.25+(COUNT_PER_C-COUNT_REMAIN)/COUNT_PER_C > > where: > TEMP_READ = 8 bits > COUNT_PER_C = 8 bits > COUNT_REMAIN = 8 bits > TEMPERATURE = 8 bits > > I just want a small routine to do this math. It's about time somebody asked another PIC related math question! Suppose you make this little simplification: TEMPERATURE=TEMP_READ-0.25+(COUNT_PER_C-COUNT_REMAIN)/COUNT_PER_C =TEMP_READ-0.25+ 1 - COUNT_REMAIN/COUNT_PER_C =TEMP_READ+0.75 - COUNT_REMAIN/COUNT_PER_C Now, for an assumption/question. I assume that "TEMP_READ" is an 8-bit integer that is very close to the correct temperature. The rest of the equation is the fractional portion of "TEMPERATURE". Or maybe it is at most one or two counts. Are these assumptions true? If so, there are two tricks I can think of that can efficiently "solve" this equation. But rather than posting a solution without first knowing the problem, I'll wait to you verify the assumptions. Scott