本设计完整的实现了炉温控制系统,对温度报警上下限的控制,当
炉内温度不满足上下限则报警,同时进行升温或者降温操作。整个
控制过程有显示。
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit ds = P2 ^ 7;
sbit bemp = P3 ^ 7;
sbit lcden = P2 ^ 2;
sbit lcdrs = P2 ^ 0;
sbit lcdrw = P2 ^ 1;
sbit sh_zeng = P1 ^ 7;
sbit sh_jian = P1 ^ 6;
sbit xia_zeng = P1 ^ 5;
sbit xia_jian = P1 ^ 4;
sbit dianji = P3 ^ 0;
sbit heat = P3 ^ 1;
sbit zhengchang = P1 ^ 2;
uchar code table1[] = "temp:";
uchar code table2[] = "up:";
uchar code table3[] = "down:";
uchar code table4[] = "0123456789.-";
uchar bai, shi, ge, flag, num, shi_sh, shi_xia, ge_sh, ge_xia;
int temp;
/* ////////初始化温度上下限 */
int warn_sh = 27;
int warn_xia = 18;
void delayms( uint z )
{
uint x, y;
for ( x = z; z > 0; z-- )
for ( y = 110; y > 0; y-- )
;
}
void dsreset() /* DS18B20初始化 */