Thursday, 13 October 2011

Thermistor Thermometer: LCD version Tutorial

The 1st version having 4-digit 7-segment LED shows the use of simple display device. For applications that needs text display, this LCD version is more suitable and easy to adapt for many kinds of measuring devices.

Figure 1: Thermistor Thermometer LCD version.
Hardware Schematic
The ADC and thermistor circuits are quite the same as the 1st version. The ADC can be LTC1298 or MCP3202. Now with this design, P0 is used to interface LCD bus. SW1 is optional key switch. Since the number of I/O port are not many, we then can replace the 40-pin MCU with 20-pin MCU easily. J2 is available for connecting another sensor. The input range is 0 to +5V.



Figure 3: Hardware schematic.
Software
The main function is the same as 1st version. Now with LCD, the function print_ADC() will use sprintf, to print formatted ASCII string into the buffer. Then the string can be sent to the LCD by function print_LCD. The 0xc0 is the address for 2nd line.


print_ADC()
{
char buffer[20];
if(++timer3<50)
{
timer3=0;
sprintf(buffer,"%0.1fC %0.1fF",read_temp1_filter(),read_temp1_filter()*9/5+32);
print_LCD(0xc0,buffer);
}
}
To print string on the first line, we can use address 0x80. See sample below.
void main()
{
i_LCD();
print_LCD(0x80,"LCD Thermometer");
TMOD |= 0x01;
TR0 = 1;
cputick = 0;
EA = 1;
ET0 = 1;

for(;;)
{
while(!TF0)
continue;
TF0=0;
print_ADC();
}
}
Download


Schematic thermistorlcd.pdf
C source code and Intel Hex file thermoproject.c thermometer.hex
Orcad Schematic File thermometer.dsn

0 comments:

Post a Comment