📄 main.c
字号:
//********************************************************************************************************/
//#include "config.h"
//#include "MyHFile.h"
/*******************************************************************************************************
** 函数名称:
** 功能描述:
** 入口参数:无
** 出口参数:无
*******************************************************************************************************/
#include <REG52.H>
#include <stdio.h>
#include "lcd.h"
/*******************************************************************************************************
** 函数名称:main()
** 功能描述:
** 调试说明:
*******************************************************************************************************/
void delay2s(int n)
{
unsigned char i,j;
for(;n>0;n--)
for(i=0;i<250;i++)
for(j=0;j<250;j++);
}
void delay20ms(int n)
{
unsigned char i,j;
for(;n>0;n--)
for(i=0;i<50;i++)
for(j=0;j<250;j++);
}
xdata long int Alm_t=3700L;
int prockey(void)
{
char c=(~P0)&0xf;
xdata char ss[10];
if(c==0) return(0);
delay20ms(1);
if(c!=(~P0&0xf)) return(0);
switch(c)
{
case 0x1:
LCD_WStr(0x80,"显示温度曲线");
delay2s(5);
return(1);
break;
case 0x2:
Alm_t+=10;
break;
case 0x4:
Alm_t-=10;
break;
case 0x8:
LCD_WStr(0x80,"显示温度曲线");
delay2s(5);
return(1);
break;
default:
return(0);
}
LCD_WStr(0x80,"报警温度:");
sprintf(ss,"%d.%d",(int)(Alm_t/100L),(int)((Alm_t/10)%10));
LCD_WStr(0x84,ss);
LCD_WStr(0x87,"度");
delay2s(10);
LCD_CLS();
return(0);
}
int main(void)
{
Init_timer0();
LCD_Init();
LCD_CLS();
timer0_count1_CNST=6000;//60s
timer0_tick1=0;
timer0_tick1=1;
timer0_count2=timer0_count2_CNST=100;//1.5s
timer0_tick2=0;
timer0_count3=timer0_count3_CNST=100;
timer0_tick3=0;
while(1)
{
if(prockey()) display2();
else display1();
GetAdc(); //get adc temp
//Get_t_Str(); //get temperate string
if( timer0_tick1)
{
timer0_count1=timer0_count1_CNST=6000;//60s
timer0_tick1=0; //restart 60s counter
startplay();
}
radio_play();
//delay2s(1);
}
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -