Hi Vasile, I suspected there was abit more to this then the subject led on :), in this case to understand why/what caused the problem with signed/unsigned i consulted the maxim site and the app. notes for the DS1620. http://dbserv.maxim-ic.com/quick_view2.cfm?qv_pk=2735 Now I can understand your concerns, however there might be an solution :) After an quick glance through the app-notes, I think the following assumptions are correct: -Data output in 8 bit+sign bit in 0.5 degrees resolution ( rounded ) -Possibility to read the slope/count registers manually to achive higher accuracy. -the examples uses float variables which is 'a tad bit' overkill for temperature calculation on an pic. Instead i propose the following: Read data, store sign bit separately, if negative make 2's complement and then perform remaing calculation for positive numbers only. To avoid the float issue I think an alternative data format might be useful, i.e the data is originally presented as 7Q1 in whole degrees ( 0.5 deg. 8 bits ) and formula is intended to extend the resolution to atleast 0.1 deg. Why not multiply original data with 128 ( i.e leftshift by 7 ), data would then be represented in two bytes as 8Q8. With the lowest byte as fractional part ( i.e. fixed point ). Use this data representation for all data from the device, then scaling should not be an issue ( i.e. counter_remain, count_per_deg etc ). pseuso hack/slash something like: data_input RES 2 ; storage for temp. data ( 9 bits from device ) count_rem RES 2 ; storage for temp. internal counter count_deg RES 2 ; storage for temp. internal slope bit_vars RES 1 ; misc. bit varibales #define _sign_bit bit_vars,0 ; storage for sign //pseudo.. data_input = read_data9bit() // read data from device store in local ram ; store the sign bit for future use BCF _sign_bit ; clear ev. previous sign BTFSC data_input,0 ; test sign bit BSF _sign_bit ; temp. is negative ; if the 9'th bit is set then make 2's complemnt BTFSS data_input,0 ; set if negative GOTO DATA_SWAP ; negative, normalize data COMF data_input+1,F ; 1's complement MOVLW D'1' ADDWF datainput+1,F ; and add 1 :DATA_SWAP ; at entry we have data in as 15q1 ( in full degrees ) ; now we want to store data in 8q8 ( really 7q8 ) format instead ; as input is limited to <255 we can just swap the bytes ; and right shift by one CLRC ; clear carry for byte rotation RRF data_input+1,W ; get data, get lowest bit into carry MOVWF data_input ; overwrite top byte CLRF data_input+1 ; and clear bottom byte RRF data_input+1,F ; and rotate the carry into top bit ; data now represented in fixed point as 8q8 ( where the top bit is always zero ) ; note data is *not* truncated yet ; now read the count_rem and count_deg variables ; and store them in 8q1 format ( similar to data, i.e. left shifted by 7 ) ; then you can use 'normal' 16 bit division routines the result is then 'read out' from the 16 bit variable as whole degrees in top byte, and fractional degrees in low byte ( 256'th of deg. ) If you want 'normal' 10's base representation, Nikolai's code generator works wonders :) /Tony PS don't forget about truncation, 0.25 degrees ! DS -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads