This is the code I use to convert the output of a DS1821 from C to F. T_C is the temp in C and a negative would be in twos compliment. ToF movlw '+' movwf Sign movlw 0x000 movwf added movwf added_carry movwf Temp movlw 0x012 ;set it too add 18 times (0x012) movwf LOOP1 Negative? btfsc T_C, 7 call Sign? movf T_C, w Adding ;x 18 addwf added btfsc STATUS, C incf added_carry bcf STATUS, C decfsz LOOP1 goto Adding Divide ; / 10 bsf STATUS, C movlw 0x00A incf Temp subwf added btfss STATUS, C goto Dec goto Divide Dec ;carry file / 10 movf added_carry, f btfsc STATUS, Z goto stop decf added_carry goto Divide Sign? comf T_C incf T_C movlw '-' movwf Sign return Pos movlw 0x020 ;+ 32 addwf Temp return Twoscomp comf Temp incf Temp movlw '+' movwf Sign return Neg movlw 0x020 ;+ 32 subwf Temp btfsc Temp, 7 call Twoscomp return -----Original Message----- From: Randie Ohtsji [4555] To: PICLIST@MITVMA.MIT.EDU Date: Monday, March 09, 1998 3:28 PM Subject: degrees C to degrees F conversion >Hello, > >Does anyone have a simple way of converting from degrees Celsius >to degrees Fahrenheit (and vice-versa) using PIC math? > >C -> F >====== >C*9/5 + 32 > > >F -> C >====== >(F-32)(5/9) > > >Thanks in advance! > >-Randie >rohtsji@glenayre.com >