if(tl < 0)
{
LcdWriteCom(0x90); LcdWriteData('-'); rr=-tl;
} else {
LcdWriteCom(0x90); LcdWriteData('+'); }
datas2[0] = rr / 100; datas2[1] = rr% 100 / 10; datas2[2] = rr % 10; LcdWriteCom(0x8e); LcdWriteData('L'); LcdWriteCom(0x8f); LcdWriteData(':'); LcdWriteCom(0x91);
rr=tl;
LcdWriteData('0'+datas2[0]); LcdWriteCom(0x92);
LcdWriteData('0'+datas2[1]); LcdWriteCom(0x93);
LcdWriteData('0'+datas2[2]); if(mm>=(th*10)||mm<=(tl*10)||th<=tl)
beep=0;
else
beep=1;
LcdWriteCom(0x80);
LcdWriteData('T'); LcdWriteCom(0x81); LcdWriteData('A'); LcdWriteCom(0x82); LcdWriteData('I'); LcdWriteData(' '); LcdWriteCom(0x84); LcdWriteData('A'); LcdWriteCom(0x85); LcdWriteData('N'); LcdWriteCom(0xc1);
LcdWriteData('0'+datas[0]); LcdWriteCom(0xc2);
LcdWriteData('0'+datas[1]);
}
LcdWriteCom(0xc3);
LcdWriteData('0'+datas[2]); LcdWriteCom(0xc4); LcdWriteData('.');
LcdWriteCom(0xc5);
LcdWriteData('0'+datas[3]); LcdWriteCom(0xc6); LcdWriteData('\
2.lcd.h
#ifndef __LCD_H_ #define __LCD_H_
/********************************** 当使用的是4位数据传输的时候定义, 使用8位取消这个定义
**********************************/ #define LCD1602_4PINS
/********************************** 包含头文件
**********************************/ #include
//---重定义关键词---// #ifndef uchar
#define uchar unsigned char #endif
#ifndef uint
#define uint unsigned int #endif
/********************************** PIN口定义
**********************************/ #define LCD1602_DATAPINS P0 sbit LCD1602_E=P2^7; sbit LCD1602_RW=P2^5; sbit LCD1602_RS=P2^6;
/********************************** 函数声明
**********************************/ /*在51单片机12MHZ时钟下的延时函数*/ void Lcd1602_Delay1ms(uint c); //误差 0us /*LCD1602写入8位命令子函数*/ void LcdWriteCom(uchar com); /*LCD1602写入8位数据子函数*/ void LcdWriteData(uchar dat) ; /*LCD1602初始化子程序*/ void LcdInit(); #endif 3.temp.h
#ifndef __TEMP_H_ #define __TEMP_H_
#include
sbit DSPORT=P3^7;
void Delay1ms(unsigned int );