This function is used to convert ADC result codes to temperature. Converted temperature range is 0 to 500 Celsius degrees. Type K thermocouple is used. ADC input range is +/-256mV. 16bits. so 1 LSB = 7.8125uV. The coefficient of code to temperature is 1 degree = 40/7.8125 LSBs. Because of nonlinearity of thermocouple. Different coefficients are used in different temperature ranges.
code - code read from ADC
temperature from code