I have been racking my brain for the past two weeks with the following!

I have a PIC12F675 reading an AD595 thermocouple IC. The AD595 provides 10mV/C. In order to read the temp below 0 I have added a voltage divider to the ground pin of the AD595. I have also power the AD595 via a -5V to +5V power supply. I read the output of the AD595 on GPIO.0 and the Virtual Ground voltage via GPIO.1.

To read the temperature above 0C I basically subtract GPIO.1 from GPIO.0. I cannot get the math correct for any thing below 0C or 32F.

Here is some of the code:
'celsius
'farenheit
'adval = GPIO.0
'adval1 = GPIO.1

if adval > adval1 then 'this is correct down to 32F or 0C
celsius = adval - adval1
farenheit = (celsius * 18) / 10
farenheit = farenheit + 32
else
celsius = adval1 - adval 'Here is were my problems start
celsius = celsius - adval
farenheit = (celsius * 18) / 10
farenheit = farenheit + 32
endif

I will handle the sign output later!

Can anyone point me in the right direction with the math?

Thanks in advance,

Scott