Hi,
I'm not sure I followed 100% your code, but basically when reading negative temperatures you need to take the 10-bit word, eliminate DB9, and then substract 512 (200h) and divide by 4. Are you actually deleting that bit?
If not, Tempy on the following piece of code will never be negative:
"if(Tempy > 200)//negative temperaure, greater than 200(512)
{
Tempy = (Tempy-200)/4 ;
}"
am I right?
If my understanding is correct you should add Tempy&=0x1FF just when entering the if loop?
I mean, if I got back in binary 1110011100, according to table 5 it correspond to -55C. So, going into hex as you are working it that way. If you get 39Ch, as it is greater that 200h, your code will do (39C-200)/4=67C which is not what we expected. However if you get 39Ch, delete the MSB (sign bit) = 19Ch and then substract 200h and divide by 4, it results in (19C-200)/4 and convert into decimal it becomes -25C.
In fact, deleting the MSB is also the same as substracting 200, so if I get 39Ch and then substract twice 200h and divide by 4:
(39Ch-200h-200h)/4=FFC9h which is -55 in decimal.
so modifying your formula to Tempy=(Tempy-200-200)/4 may work as well.
I hope any of both ways works for you.
Regards,
Lluis.