#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#define uchar unsigned char
#define uint unsigned int
#define lcd12864_date PORTB //数据口
#define lcd12864_rs PTT_PTT5// PTT_PTT5; //寄存器选择输入
#define lcd12864_rw PTT_PTT3 //液晶读/写控制
#define lcd12864_e PTT_PTT2 //液晶使能控制
#define DQ PORTA_PA0 // 定义DQ引脚为P3.3
#define DQ_HIGH() DDRA=0 //设置数据口为输入
#define DQ_LOW() DDRA=1;DQ=0; //设置数据口为输出
//uint temp; //温度值 variable of temperature
uchar A1,A2,A3;
void delay2(uint i);
void Init_Ds18b20(void);
uchar Read_One_Byte();
void Write_One_Byte(uchar dat);
uint Get_Tmp();
void DisplayTemp(uint temp) ;
void delay(unsigned int t)
{
uint i,j;
for(i=t;i>0;i--)
for(j=1000;j>0;j--);
}
void lcd12864_write_cmd(unsigned char command) //写指令
{
lcd12864_rs=0;
lcd12864_rw=0;
lcd12864_e=0;
lcd12864_date=command;
delay(5);
lcd12864_e=1;
lcd12864_e=0;
delay(5);
}
void lcd12864_write_data(unsigned char data) // 写数据 写入一个字符
{
lcd12864_rs=1;
lcd12864_rw=0;
lcd12864_e=0;
lcd12864_date=data;
delay(5);
lcd12864_e=1;
lcd12864_e=0;
delay(5);
}
void lcd12864_pos(unsigned char x,unsigned char y) //确定位置
{
unsigned char pos;
if (x==1)
{x=0x80;}
else if (x==2)
{x=0x90;}