加入星計(jì)劃,您可以享受以下權(quán)益:

  • 創(chuàng)作內(nèi)容快速變現(xiàn)
  • 行業(yè)影響力擴(kuò)散
  • 作品版權(quán)保護(hù)
  • 300W+ 專業(yè)用戶
  • 1.5W+ 優(yōu)質(zhì)創(chuàng)作者
  • 5000+ 長期合作伙伴
立即加入

基于51單片機(jī)的酒精氣體檢測器設(shè)計(jì)

09/27 09:01
1105
服務(wù)支持:
技術(shù)交流群

完成交易后在“購買成功”頁面掃碼入群,即可與技術(shù)大咖們分享疑惑和經(jīng)驗(yàn)、收獲成長和認(rèn)同、領(lǐng)取優(yōu)惠和紅包等。

虛擬商品不可退

當(dāng)前內(nèi)容為數(shù)字版權(quán)作品,購買后不支持退換且無法轉(zhuǎn)移使用。

加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論
放大
實(shí)物圖
相關(guān)方案
  • 方案介紹
  • 相關(guān)文件
  • 相關(guān)推薦
  • 電子產(chǎn)業(yè)圖譜
申請(qǐng)入駐 產(chǎn)業(yè)圖譜

使用說明:

上電以后,需要預(yù)熱一段時(shí)間,此時(shí)lcd顯示Loading... (預(yù)熱過程為電壓先上升后下降的改成,通過檢測電壓來檢測是否預(yù)熱完成) , 預(yù)熱完成后顯示酒精濃度,按下按下按鍵key1即可進(jìn)入報(bào)警設(shè)置模式,按下key2加,key3減, 再次按下key1退出報(bào)警設(shè)置模式(必須為報(bào)警設(shè)置模式key2和key3才起作用)

原理圖

部分程序:

#include "stc89x_90x.h"
#include "LCD1602.h"
#include "ADC0832.h"
#include "intrins.h"

sbit k1=P1^4;
sbit k2=P1^5;
sbit k3=P1^6;

sbit beep=P3^5;
sbit beep2=P3^2;
sbit beep3=P3^3;
sbit beep4=P3^4;
sbit led=P3^6;

unsigned char temp1[]={"Potency: **%"};?? ? ?//??ê??????¨?è
unsigned char temp2[]={"early:**% ?"};?? ? ?//??ê??¨?è?¤?ˉ?μ
unsigned char temp3[]={"Loading... ? "};

unsigned char key,a;
unsigned char dat=50; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //?????¨?è?¤?ˉ3?ê???
long int m;

void Delay1000ms()?? ??? ?//@11.0592MHz
{
unsigned char i, j, k;

_nop_();
i = 8;
j = 1;
k = 243;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}

/********
void concentration()
?????¨?è????
*********/
void concentration()
{
unsigned char count;?? ??? ??? ??? ??? ??? ? ? //?¨ò?8??μ?cout
long int a;?? ??? ??? ??? ??? ??? ??? ??? ??? ? ? //?¨ò?3¤??Dí±?á?

count=ADC_acquisition();?? ??? ??? ??? ??? ? ? //??ADC0832?á3?μ??μ?3??count
a=count*50;
count=(float)(a/256);

if(count<13)
count=(float)(13);?? ??? ??? ??? ? ? //μ±μ??1?μD?óú1.4Vê±£???μ??1?μ1ì?¨?ú1.4V
else
count=(float)(count-13)*3.5;?? ??? ??? ??? ? ? //?????????¨?è?aò?????μ?Dí±?á?

/*?? ??aò?????óDó?é?ò???count?au8ààDíò??-íê3éá?ààDí×a??
count=(char)count;
*/

if(count>=100)?? ??? ??? ??? ??? ??? ??? ??? ? ? //μ±?¨?è′óóú100%ê±£????¨?è1ì?¨?ú100%
{
count=100;
temp1[8]=count/100+'0';
}
else temp1[8]=' ';
temp1[9]=count%100/10+'0';?? ??? ??? ??? ??? ? ? //???¨?è?μ?3??êy×é
temp1[10]=count%100%10+'0';
m=count;
}

/************
void loading()
3?ê??ó??(?¤èè)oˉêy
*************/
void loading()
{
unsigned char s=10;
while(s--)
{
WriteInstruction(0x80);
a=0;
while(temp3[a]!='?')
{
WriteData(temp3[a]);
a++;
}
}
Delay1000ms();Delay1000ms();
Delay1000ms();Delay1000ms();
while(1)
{
concentration();
if(m==0)
{
temp3[7]=' ';
temp3[8]='O';
temp3[9]='K';
}
WriteInstruction(0x80);
a=0;
while(temp3[a]!='?')
{
WriteData(temp3[a]);
a++;
}
if(m==0)
{
Delay1000ms();
break;
}
}
}

/********
void independent()
?¤?ˉ??????£?k2?a???ó£?k3?a??éù
*********/
void independent()
{
if(k2==0)
{
delay(1000);
if(k2==0)
{
while(k2==0);
dat++;
if(dat==100)dat=99;
}
}
if(k3==0)
{
delay(1000);
if(k3==0)
{
while(k3==0);
dat--;
if(dat==0)dat=1;
}
}
temp2[6]=dat/10+'0';
temp2[7]=dat%10+'0';
}

/**************
void first_line()
??ê?μúò?DD£??′?a?????¨?è
***************/
void first_line()
{
WriteInstruction(0x80);
a=0;
while(temp1[a]!='?')
{
WriteData(temp1[a]);
a++;
}
delay(1000);
}

/*************
void second_line()
??ê?μú?tDD£??′?a?????¨?è?¤?ˉ?μ
**************/
void second_line()
{
independent();
temp2[6]=dat/10+'0';
temp2[7]=dat%10+'0';
WriteInstruction(0x80+0x40);
a=0;
while(temp2[a]!='?')
{
WriteData(temp2[a]);
a++;
}
delay(1000);
}

/*******
void main()
?÷oˉêy
********/
void main()
{
unsigned char n=0;
key=0;
Init();
loading();
Init();
while(1)
{
concentration();?? ??? ??? ? //?????¨?è?ì2a??
first_line();?? ??? ??? ??? ? //??ê?μúò?DD?????¨?è
if(k1==0)
{
delay(1000);
if(k1==0)
{
while(k1==0);
if(key==0)key=1;
else key=0;
}
}
if(key==1)
{
independent();
second_line();
n=1;
}
if(key==0)
{
if(n==1)
{
WriteInstruction(0x01);
}
n=0;
}
if(dat<=m)
{
led=0;

  • 有需要資料的可了解一下.docx

相關(guān)推薦

電子產(chǎn)業(yè)圖譜