基于单片机PID炉温自动控制系统设计
#include <reg51.h> /* 导入库文件 */
#define uchar unsigned char /* 宏定义 */
#define uint unsigned int /* 宏定义 */
sbit ds = P2 ^ 7;
/* 温度采集 */
sbit bemp = P3 ^ 7;
/* 报警蜂鸣器 */
sbit lcden = P2 ^ 2;
/* lcd使能 */
sbit lcdrs = P2 ^ 0;
/* lcd复位 */
sbit lcdrw = P2 ^ 1;
/* lcd数据写入 */
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;
/* 正常温度led */
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-- )
;
}