基于单片机热敏电阻温度采集报警设计
1458下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
//头文件的声明 #include <reg51.h> #include <stdio.h> #include <intrins.h> //宏定义温度上限变量 #define TempHigh 300 //定义数码管的位选通道,选择那个数码管显示 sbit w1=P2^0; sbit w2=P2^1; sbit w3=P2^2; sbit w4=P2^3; //定义继电器控制电路的IO口 sbit TempHighControl=P2^4; //定义ADC0831和单片机的连接IO口 sbit CS_n=P1^0; sbit CLK=P1^1; sbit DIO=P1^2; //用于数码管显示的码表 unsigned char code table[]= { 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71 }; //控制数码管显示,选择第几个数码管亮,add可取1-4 void wei(unsigned char add) { switch(add) { case 1: w1=0; w2=1;