资源描述:
《空气净化装置主函数》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、/************************************************************************//*SC5708ADCDemo*//*检测方式:查询方式+中断扫描(中断号:13)*//*AD入口:ADC0P1.0*/#include"MCU_0908.H"#include"PubFunc.H"#include"DataType.h"#includevoidPWM_Init(void);voidT0_initial(void
2、);voidINT1_Init(void);externU16GETADCRESULT(U8i);U16ADCResult;//ADC结果voidADC_Init_temp(U8tongdao);voiddelay();voiddelay_ms();#defineWDT_CLRdo{WDTCLR0=0x00;WDTCLR1=0x00;WDTCLR0=0x53;WDTCLR1=0xac;}while(0);//////////////////////////////////////////////
3、//////bitkey1_b=0,key2_b=0,key3_b=0,zhuanb,aab;bitkey_check_b=0,kjb,laba_flag,hebi_b,kkb;U8lcd1,lcd2,lcd3,qianc;U8laba_ct,fengshanc1,fengshanc2,bba,aac,qiweid,fengshancd;U16fenchengNC;U16aaa1,aaa2,aaa3,aaa4,aaa5;U8LED_ct;//LED半秒计数bitsb30,qiweidb,fenc
4、hengdb,qiweidb1,fenchengdb1;U8lcd_ct,lcd_ct_1,lcd_ct_2,key_chk_ct,timer,zhengb;U8qiwei_ct,qiwei,fencheng,zhengct,fengshanc,LED_ct_1,su1b,sb30b,ccct,fenchengg,qiweigg;U16LED_ct_4,min1,min2;bitqiwei_b,key_chk_flag,huanyao_flag,timerb,shijianb;bitPIN1,P
5、IN2,PIN3,fenchengbz;bitfengshanb1,fanb,ganb,fanb1,ganb1,twominb;U16fenchengcc,twominct;U8adii,fengshancAA,fenchengd,aaci;U16ADCCT,ADCCB,ADCCA,ADCCC,ADCC,ADCCD,ADBJ,ADBB,iadbb,ADCCE,min3,min4,jishikd;voidwr16(unsignedcharaa){unsignedchariI=0,bb=0;for(
6、iI=0;iI<8;iI++){bb=aa&0x80;if(bb==0x80){P05=1;}elseP05=0;P04=0;aa=aa<<1;P04=1;P04=0;}}//////////////////voidmmmin(){min1=0;fengshancAA=0;fencheng=1;qiwei=1;twominb=1;twominct=0;fengshanc1=0;fengshanc2=0;fengshanc=0;fengshancd=0;}/********************
7、***************************//*T0中断服务程序*/voidirq_timer0(void)interrupt1{WDT_CLR;key_chk_ct++;if(sb30==1){if(P02==0){if(fencheng<3)aaa5++;if(fencheng==3){aaa1=0;aaa2=0;aaa3=0;aaa4=0;aaa5=0;}if(aaa5>400)aaa5=0;}}fenchengcc++;qiwei_ct++;lcd_ct_2++;if(lcd
8、_ct_2>50){lcd_ct_2=0;qiwei_b=1;lcd_ct_1++;if(twominb==1){twominct++;}}if(qiwei_ct>100){qiwei_ct=0;if(su1b==1){PWM1DH=0x00;if(PWM1DL>39)PWM1DL--;if(PWM1DL<39)PWM1DL++;}if(su1b==2){PWM1DH=0x00;if(PWM1DL>0)PWM1DL--;}if(su1b==0){PWM1DH=0x00;if(PWM1DL<57)