|
#include "intrins.h"
#include "string.h"
#include "STC15Fxxxx.h"
#include "main.h"
#include "W25QXX.h"
#include "COG12864-5V.h"
#include "zima.h"
#include "DS18B20.h"
#include "setTem.h"
#include "key.h"
#include "AT24C0X.h"
void InitG(unsigned int dat,unsigned int dath,unsigned int datl)//12864液晶界面显示内容初始化化
{
// 显示形式: 20.3 C
Print(0,38,songti,"温度");
DisplayDigit(0,70,mao);
DisplayDigit(0,78,dig[dat%10000/1000]);
DisplayDigit(0,86,dig[dat%1000/100]);
DisplayDigit(0,93,dian);
DisplayDigit(0,104,dig[dat%100/10]);
DisplayDigit(0,112,se);
DisplayDigit(0,120,si);
//显示形式为 上限温度:35
Print(4,0,songti,"上限温度");
DisplayDigit(4,64,mao);
DisplayDigit(4,74,dig[dath/10]);
DisplayDigit(4,82,dig[dath%10]);
//显示形式为 下限温度:8
Print(6,0,songti,"下限温度");
DisplayDigit(6,64,mao);
DisplayDigit(6,74,dig[datl/10]);
DisplayDigit(6,82,dig[datl%10]);
}
void main()
{
unsigned char keyvalue = 0xff,i;
PortInit(); //端口初始化
InitTimer(); //定时器0初始化
InitSPI(); //W25QXX初始化
COG_Initialize(); //设置液晶显示格式
LCD_Clr(); //清屏
while(1)
{
keyvalue = key_scan(); //获取按键值
tem = Conversion(ds18b20ReadTemp());//获取温度
temh = read_24c04(0x80);
teml = read_24c04(0x86);
warn(); //警报界限判断
InitG(tem,temh,teml); //12864液晶显示
LCD_Clr(); //清屏
Delay(10);
setwendu(keyvalue); //设置上下限温度值
if(TR0 == 1) //进入定时器0中断后开始对frq累加
{
for(i=0;i<30;i++)
{
frq++;
}
}
}
}
|
评分
-
查看全部评分
|