Wednesday, January 13, 2010

Z8 on-chip Temperature Sensor

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

Nokia LCD Interfacing

Due to their wide availability in the local markets, old Nokia LCDs are the best alternatives for those expensive GLCDs. They can be bought cheaply at many cellphone parts shops (N3310 lcds usually cost only around Php100 each). Interfacing them with microcontrollers can easily be done using serial communication (e.g. SPI protocol).

Nokia 3530/3510i LCD
98x67 pixels , 4096 colors

Nokia 6610/6100 LCD
132x132 pixels, 4096 colors
(good backlights,
but the connector is difficult to use)

Nokia 3310/5110 LCD
84x48 pixels, monochrome
(very common and relatively cheap)

some links for N3310/N5110 LCDs:
Using Nokia 3310 LCD as Display for PIC Projects
Nokia 3310 LCD LPH7779
Nokia 3310 LCD Image Encoder
DIY scope using Z8F0823 and N3310 LCD