焚烧炉控制器Word文档格式.docx
- 文档编号:22853495
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:37
- 大小:20.81KB
焚烧炉控制器Word文档格式.docx
《焚烧炉控制器Word文档格式.docx》由会员分享,可在线阅读,更多相关《焚烧炉控制器Word文档格式.docx(37页珍藏版)》请在冰豆网上搜索。
voiddelay1ms(intt);
voidkeyscan(void);
voidkey(void);
//*************************************
sbitset=P0^0;
sbitright=P0^2;
sbitleft=P0^1;
sbitup=P0^3;
sbitdown=P0^4;
sbitziran=P2^7;
sbitzuran=P0^6;
sbitstop=P0^7;
sbitpower=P0^5;
//***************************************
sbitziranout=P2^0;
sbitzuranout=P2^1;
sbitbeijinlcd=P2^5;
//*****************
sbitziranled=P2^2;
sbitzuranled=P2^4;
sbitstopled=P2^3;
//***************************************
unsignedcharhour1=2,sec1=0,min1=0,Busy;
//赋初值
unsignedcharhour2=2,sec2=0,min2=0;
unsignedcharcodeLcddata[]={"
0123456789:
"
};
unsignedcharcodeqq1[]={"
Fan"
unsignedcharcodeqq2[]={"
Fir"
unsignedintxx;
unsignedintii;
unsignedintadd;
unsignedintflag0;
unsignedintflag1;
unsignedintflag2;
unsignedintdata1;
unsignedcharkeyvol;
unsignedcharrightvol;
unsignedcharsetvol;
unsignedcharupvol;
//*****2408**********
sbitSDA=P3^1;
sbitSCL=P3^0;
//******************
voiddelay(unsignedintus);
voidx24c02_init();
voidstart();
voidstop1();
voidclock();
voidwritex(unsignedcharj);
voidx24c02_write(unsignedcharaddress,unsignedcharinfo);
unsignedcharreadx();
unsignedcharx24c02_read(unsignedcharaddress);
//写数据
voidWriteDataLCM(unsignedcharWDLCM)
{
ReadStatusLCM();
//检测忙
LCM_Data=WDLCM;
LCM_RS=1;
LCM_RW=0;
LCM_E=0;
//若晶振速度太高可以在这后加小的延时
//延时
LCM_E=1;
}
//写指令
voidWriteCommandLCM(unsignedcharWCLCM,BuysC)//BuysC为0时忽略忙检测
if(BuysC)ReadStatusLCM();
//根据需要检测忙
LCM_Data=WCLCM;
LCM_RS=0;
LCM_RW=0;
LCM_E=0;
LCM_E=0;
LCM_E=1;
//读数?
unsignedcharReadDataLCM(void)
LCM_RS=1;
LCM_RW=1;
return(LCM_Data);
//读状态
unsignedcharReadStatusLCM(void)
LCM_Data=0xFF;
LCM_RS=0;
//LCM_E=0;
delay1ms
(2);
while(LCM_Data&
Busy)//检测忙信?
{;
voidLCMInit(void)//LCM初始化
LCM_Data=0;
WriteCommandLCM(0x38,0);
//三次显示模式设置,不检测忙信号
Delay5Ms();
WriteCommandLCM(0x38,1);
//显示模式设置,开始要求每次检测忙信号
WriteCommandLCM(0x08,1);
//关闭显示
WriteCommandLCM(0x01,1);
//显示清屏
//WriteCommandLCM(0x07,1);
//显示光标移动设置
WriteCommandLCM(0x0c,1);
//显示开及光标设置
//按指定位置显示一个字符
voidDisplayOneChar(unsignedcharX,unsignedcharY,unsignedcharDData)
Y&
=0x1;
X&
=0xF;
//限制X不能大于15,Y不能大于1
if(Y)X|=0x40;
//当要显示第二行时地址码+0x40;
X|=0x80;
//算出指令码
WriteCommandLCM(X,0);
//这里不检测忙信号,发送地址码
WriteDataLCM(DData);
//按指定位置显示一串字符
voidDisplayListChar(unsignedcharX,unsignedcharY,unsignedcharcode*DData)
unsignedcharListLength;
ListLength=0;
while(DData[ListLength]>
0x20)//若到达字串尾则退出
{
if(X<
=0xF)//X坐标应小于0xF
DisplayOneChar(X,Y,DData[ListLength]);
//显示单个字符
ListLength++;
X++;
}
//5ms延时
voidDelay5Ms(void)
unsignedintTempCyc=5552;
while(TempCyc--);
//400ms延时
voidDelay400Ms(void)
unsignedcharTempCycA=5;
unsignedintTempCycB;
while(TempCycA--)
TempCycB=7269;
while(TempCycB--);
/******************************************************************************/
voidTimer0Init(void)//定时器0-init
TMOD=0x01;
TH0=_TH0_TL0_/256;
TL0=_TH0_TL0_%256;
ET0=1;
EA=1;
TR0=1;
voidIsrTimer0(void)interrupt1using1//T05mS中断程序
staticunsignedcharcount0=0;
staticunsignedcharcount1=0;
staticunsignedcharcount2=0;
staticunsignedintxx=0;
TR0=0;
TL0+=(_TH0_TL0_+9)%256;
TH0+=(_TH0_TL0_+9)/256+(char)CY;
TR0=1;
if(flag0==1)
count0++;
if(count0==CNT_OF_1S)
count0=0;
xx++;
if(xx==60)
beijinlcd=1;
xx=0;
flag0=0;
if(flag1==1)
count1++;
if(count1==CNT_OF_1S)//定时1s时间到
count1=0;
if(sec1>
0)
{--sec1;
else//1分钟时间到
sec1=59;
if(min1>
min1--;
//sec1=59;
else//1小时时间到
if(hour1>
{--hour1;
min1=59;
else//24小时时间到
flag1=0;
hour1=0;
min1=0;
sec1=0;
ziranout=1;
ziranled=1;
//*******************
if(flag2==1)
{
count2++;
if(count2==CNT_OF_1S)//定时1s时间到
count2=0;
if(sec2>
sec2--;
else
sec2=59;
if(min2>
min2--;
//sec2=59;
if(hour2>
hour2--;
min2=59;
else//时间到
flag2=0;
hour2=0;
min2=0;
sec2=0;
zuranout=1;
zuranled=1;
/************//******************************************************************************/
voidShow_Time(void)
DisplayOneChar(4,0,Lcddata[hour1/10]);
//显示小时
DisplayOneChar(5,0,Lcddata[hour1%10]);
DisplayOneChar(6,0,Lcddata[10]);
//显示:
DisplayOneChar(7,0,Lcddata[min1/10]);
//显示分钟
DisplayOneChar(8,0,Lcddata[min1%10]);
DisplayOneChar(9,0,Lcddata[10]);
DisplayOneChar(10,0,Lcddata[sec1/10]);
//显示秒
DisplayOneChar(11,0,Lcddata[sec1%10]);
DisplayOneChar(4,1,Lcddata[hour2/10]);
DisplayOneChar(5,1,Lcddata[hour2%10]);
DisplayOneChar(6,1,Lcddata[10]);
DisplayOneChar(7,1,Lcddata[min2/10]);
DisplayOneChar(8,1,Lcddata[min2%10]);
DisplayOneChar(9,1,Lcddata[10]);
DisplayOneChar(10,1,Lcddata[sec2/10]);
DisplayOneChar(11,1,Lcddata[sec2%10]);
/******************************************************************************/
voidkeyscan(void)
unsignedchary1,y2,y3,y4,x1,x2;
Show_Time();
WriteCommandLCM(0x80,0);
//*********************************
if(ziran==0)//自燃打开
delay1ms(10);
beijinlcd=0;
ziranout=!
ziranout;
ziranled=!
ziranled;
flag1=!
flag1;
flag0=1;
while(!
ziran)
;
if(zuran==0)//助燃打开
zuranout=!
zuranout;
zuranled=!
zuranled;
flag2=!
flag2;
zuran)
if(stop==0)//停止燃烧
ET0=0;
TR0=0;
stopled=0;
x1=flag1;
x2=flag2;
flag1=0;
flag2=0;
y1=ziranout;
y2=ziranled;
y3=zuranout;
y4=zuranled;
ziranout=1;
ziranled=1;
zuranout=1;
zuranled=1;
stop)
{;
while(stop)
;
ziranout=y1;
ziranled=y2;
zuranout=y3;
zuranled=y4;
stopled=1;
flag1=x1;
flag2=x2;
ET0=1;
TR0=1;
//***********************xxxxxxx*************************
if(set==0)//时间设定,按下它才能左右移动
set)
ET0=0;
TR0=0;
//stopled=!
stopled;
flag0=1;
while(set)
WriteCommandLCM(0x84,0);
WriteCommandLCM(0x0F,0);
WriteCommandLCM(data1,0);
key();
//********
if(right==0)//向右移动
delay1ms(10);
beijinlcd=0;
while(!
right)
++add;
//add&
=0xF;
if(add<
16)//确定光标范围
if(add<
8)
add=add;
data1=add+0x84;
if(add>
=8)
data1=add+0x84+0x38;
else
add=0;
data1=add+0x84;
}
{;
while(right&
&
left&
WriteCommandLCM(data1,0);
WriteCommandLCM(0x0F,0);
key();
}
//****************************
if(left==0)//向左移动
add--;
add&
//add|=0x1;
if(16>
add>
=0)//确定光标范围
if(add>
add=16;
data1=add+0x84+0x38;
while(!
left)
;
while(left&
right&
x24c02_init();
/*初始化24Cxx*/
x24c02_write(0x10,hour1);
/*x24c02_write(ucharaddress,ucharinfo);
*/
delay(200);
/*提供足够的写入数据时间,以保证能正确写入数据*/
x24c02_write(0x11,min1);
x24c02_write(0x12,sec1);
x24c02_write(0x13,hour2);
x24c02_write(0x14,min2);
x24c02_write(0x15,sec2);
//******************************************************************
voidkey(void)//修改时间参数
if(up==0)
//******1111111***********
if(add==0)
hour1=hour1+10;
if(hour1<
=99)
{hour1=hour1;
{hour1=20+hour1%10;
//*******
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 焚烧 控制器