Octavio, I had a similar problem with my thermometer (in the calibration routines). The easiest way I found to resolve it was to convert the number to a 16 bit by adding 8 trailing zeros to the number. That way, a 1/4 is now simply adding 64 to your count and division can be done by multiplying the fraction COUNT_PER_C. Once you are finished with the operations on the 16 bit numbers, just take the most significant 8 bits and you will have what you need. Give me a ding if this doesn't make sense, Myke >Return-Path: >Date: Sun, 1 Sep 1996 18:23:07 -0200 >Reply-To: pic microcontroller discussion list >Sender: pic microcontroller discussion list >From: nogueira >Subject: DS1820 >Comments: cc: Parallax >To: Multiple recipients of list PICLIST >X-UIDL: 4110483c6dc7833f9297f97fc4799cfd > >Hi all, > >I'm using the DS1820 one-wire temperature sensor from Dallas and I'm very >happy with it. It works very well and I have routines avaible to PICs. > >In order to get a resolution grater than 0.5 degree I need to do the >following math, 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. If anyone can help me, >I will put the wole routine to use ths DS1820 on the list. > >Regards, > >Octavio >-- >======================================================== >Octavio Nogueira >e-mail: nogueira@mandic.com.br >homepage: http://ourworld.compuserve.com/homepages/tato >voice/fax: +55 11 240-6474 >======================================================== >"ProPic" The first Production PIC Programmer running in >Windows and under US$ 20.00. >Avaible at http://ourworld.compuserve.com/homepages/tato > > Do you ever feel like an XT Clone caught in the Pentium Pro Zone?