It is basically based on technical note (TN004201-0905) by ZiLOG: Technique for Measuring System Temperature Using the On-chip Temperature Sensor of the Z8 Encore! XP®. I just copied the routine for measuring the temperature. The main difference is, in stead of sending the result through the UART of Z8F042A (i.e. using Hyperterminal), I used Nokia 5110 LCD to display the temperature reading. N5110 LCD has the same LCD controller with that of N3310 LCD (so, N3310 LCD can also be used with this project).
The equation used for temperature reading is:
integrated on-chip temperature sensor (ITS) temperature:
T = (25/128)*ADC – 77
T is the temperature in C
ADC represents the 10-bit compensated ADC register value
I was also able to implement a different approach in computing the temperature of the on-chip sensor using the sample code from this application note AN019102-0708 also by ZiLOG: Reading Temperature Using the F082A Series MCUs. Unfortunately, I don't know why the result is different from the previous approach. And I don't have the time (and an accurate thermometer) to test which one is correct (although both of them are not accurate enough compared to of using external temperature sensor). Also, in the datasheet of F082A series, there's a parameter called TSCAL (Temperature Sensor Calibration Data) which I never noticed in the sample codes of the two. I also tried doing my own code starting from 'scratch' (using the datasheet as the only reference), but I always failed. The hardest part is on the compensating of the ADC results.
source code (w/ HEX) and schematic: Z8042A temperature sensor.rar
edited (Jan 16, 2009):
uses this equation from the datasheet in stead of the previous one:
V = 0.01 * T + 0.65 (where T is the temperature in C; V is the sensor output in Volts)
forum link: digital thermometer using 8-pin Z8F042A