目录
一、主要功能
基于51单片机,通过DS18B20检测温度,滑动变阻器连接数模转换器模拟电流、电压,通过LCD1602显示,程序里设置温度阈值为40,电流阈值为60,电压阈值为100,如果超于阈值,则蜂鸣器报警。
二、硬件资源
基于KEIL5编写C++代码,PROTEUS8.15进行仿真,全部资源在页尾,提供安装包。
编辑
三、程序编程
#include <REGX52.H>#include<intrins.h>#include<stdio.h>#include "Delay.h"#include "LCD1602.h"#define uchar unsigned char#define uint unsigned intsbit beep = P2^5; //蜂鸣器引脚sbit DS=P2^4; //DS18B20温度传感器sbit DS1=P2^3; //DS18B20温度传感器sbit CS=P1^0; //adc0832引脚sbit CLK=P1^1;
sbit DIO=P1^2;
sbit CS1=P1^3; //adc0832引脚sbit CLK1=P1^4;
sbit DIO1=P1^5;
sbit CS2 = P1^6; //ADC0832引脚定义sbit CLK2 = P1^7;
sbit DIO2 = P2^6;unsigned char count;typedef unsigned char u8;typedef unsigned int u16;static uint temp;static float ftemp = 0.0f;//温度转变uint temp;static uint temp1;static float ftemp1= 0.0f;//温度转变uint temp1;static unsigned char num;static int wdyz=40,dymax=100,dlmax=60; //wd38static uchar u,U,R ,u1,U1,R1,u2,U2,R2; //定义变量void tmpchange();uint tmp();void tmpchange1();uint tmp1();void beep\_warning();void Time0\_Init() &nbs

最低0.47元/天 解锁文章
991

被折叠的 条评论
为什么被折叠?



