全套资料包含:Proteus仿真源文件+keil C语言源程序+AD原理图+流程图+元器件清单+说明书等
资料下载:↓↓↓
通过网盘分享的文件:资料分享
链接: 百度网盘 请输入提取码 提取码: tgnu
目录
项目功能:
模拟量过限报警
(比如酒驾、烟雾、粉尘、电压等)
1、测量传感器输出的模拟量大小
2、如果测量值大于阀值,报警
3、通过按键设置报警值
项目文件:
一、Proteus仿真源文件

二、AD原理图文件

二、报告说明书
三、系统流程图
四、器件清单
| 元件 | 型号 | 数量 |
| 单片机 | AT89C51 | 1 |
| 电容 | 10uf | 1 |
| 电容 | 30pf | 2 |
| 晶振 | 12MHZ | 1 |
| 电阻 | 10k | 1 |
| 按钮 | 3 | |
| 模数芯片 | ADC0832 | 1 |
| 电位器 | 1k | 2 |
| 电阻 | 1k | 1 |
| 三极管 | PNP | 1 |
| 蜂鸣器 | 有源 | 1 |
| 数码管 | 4位共阴 | 2 |
| 排阻 | 10k | 1 |
五、Keil c语言程序源代码(部分)
#include "reg51.h"
#include "intrins.h"
sbit CLK= P1^1;//时钟,初始状态为0
sbit DI= P1^2;//数据输入
sbit DO= P1^3; // 数据输出
sbit CS= P1^0;
sbit k1=P3^6;//按键
sbit k2=P3^7;
sbit beep=P3^0;//蜂鸣器
unsigned char code smgduan[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char num=0;//酒精
unsigned char limit=50;//阀值
/*********************************************
读取ADC
**********************************************/
unsigned char ADC()//通道ch0
{
unsigned char temp0,temp1,i;
CS=0;
temp0=0;
temp1=0;
_nop_();
_nop_();
DI=1;//开始位
_nop_();
_nop_();
CLK=1;
_nop_();
_nop_();
CLK=0;
_nop_();
_nop_();
DI=0;
_nop_();
_nop_();
//选择通道0
DI=1;
_nop_();
CLK=1;//上升沿DI=1
_nop_();
CLK=0;//1个下降沿DI=1
_nop_();
DI=0;
_nop_();
CLK=1;
_nop_();
CLK=0;//第3个上升沿DI=0
_nop_();
DI=1;
//********通道选择结束开始读取转换后的二进制数****
//下降沿读数,一下进行判断和处理,共8次
for(i=0;i<8;i++)
{
temp0=temp0<<1;
CLK=1;
if(DO)
temp0++;
_nop_();
CLK=0;
}
for(i=0;i<8;i++)
{
temp1=temp1>>1;
CLK=1;
if(DO)
temp1=temp1 +0x80;
_nop_();
CLK=0;
}
CS=1;
return temp0;
}
void delay(unsigned int i)//延时
{
while(i--);
}
void main()
{
TMOD|=0X01;
TH0=0X3C;
TL0=0XB0;
ET0=1;//打开定时器0中断允许
EA=1;//打开总中断
TR0=1;//打开定时器
while(1)
{
P0=smgduan[num/1000];//显示酒精度
P2=0xfe;
delay(100);
P2=0xff;
P0=smgduan[num%1000/100];//显示酒精度
P2=0xfd;
delay(100);
P2=0xff;
P0=smgduan[num%100/10];//显示酒精度
P2=0xfb;
delay(100);
P2=0xff;
P0=smgduan[num%10];//显示酒精度
P0=smgduan[limit/1000];//显示酒精度阀值
P0=smgduan[limit%1000/100];//显示酒精度阀值
P2=0xdf;
delay(100);
P2=0xff;
P0=smgduan[limit%100/10];//显示酒精度阀值
P2=0xbf;
delay(100);
P2=0xff;
P0=smgduan[limit%10];//显示酒精度阀值
P2=0x7f;
delay(100);
P2=0xff;
if(!k1)//阀值加
{
limit++;
while(!k1);
}
if(num>limit)//报警
beep=0;
else
beep=1;
}
}
void Timer0() interrupt 1//定时器中断
{
TH0=0X3C;
TL0=0XB0;
num=ADC();
}
六、全套资料包含
七:项目资源获取
需要完整的资料可以点击下面的名片关注,回复“资料”!
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
4081

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



