📄 main.c
字号:
#include<reg51.h>
#include "clock.h"
#include "lcd.h"
#include "key.h"
#include "convert.h"
#include "pid.h"
#define CYCLE 34200
void main()
{
unsigned char h,m,s;
unsigned char c,i=0;
float temp;
TMOD=TMOD&0xf0;
TMOD=TMOD|0x01;
TL0=CYCLE%256;
TH0=CYCLE/256;
EA=1;
ET0=1;
TR0=1;
clock_init(0,0,0);
disp_on(); // 显示器开/关函数
clr_screen(); //清屏
main_loop: //主循环
h=current_time('h');
m=current_time('m');
s=current_time('s');
locate(5,20);
// style_57(16);
// style_57(16);
convert_da(100);
temp=get_temp();
locate(5,20);
put_float(temp,3,1);
c=inkey();
if(c!=255){
if(c<16){
if(i>123) i=0;
locate(5,i);
style_57(c);
i=i+6;
}
}
goto main_loop;
}
void timer_int() interrupt 1 //定时中断服务程序
{
unsigned int x,n;
unsigned char da_out;
float t;
x=CYCLE+TL0;
TL0=x%256;
TH0=x/256;
clock_run();
key_scan(); //实时扫描函数
t=get_temp();
/*if(n==10)
{da_out=PID_regulate(30,t);
n=0;
} */
// convert_da(da_out);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -