330_wind.c

来自「C8051F330部分模块程序,已经调试成功」· C语言 代码 · 共 120 行

C
120
字号
extern struct keyboard out ;   
extern struct screen setdata ; 
void enableWDT(void) ;
void disableWDT(void) ;
void refreshWDT(void) ;
void coolauto(void)
{//static unsigned char history ;
if (out.automode == 1){
if((out.temp+1) < setdata.tempnum)               //设置温度+1小于室内温度 
	{out.cool = 1;                               //制冷有效;
	out.heat =  0;                                //制热无效;
	/* 
	if(out.wind == 0){
	    top = 0 ;
		battom = 1 ;
		del1s () ;
		del1s () ;
		top = 1 ;
		del1s () ;
		}
		*/
	if (out.wind == 1){
	    top = 1 ;
		del1s () ;
		del1s () ;
		del1s () ;
		top = 0 ;
		del1s () ;
		}
	if (out.wind == 5){
	    top = 1 ;
	    del1s () ;
		del1s () ;
		del1s () ;
		top = 0 ;
		del1s () ;
		}
	if (out.wind == 9){
	    top = 1 ;
	    del1s () ;
		del1s () ;
		del1s () ;
		top = 0 ;
		del1s () ;
		}
		/*
	if (out.wind == 10){
	    battom = 1 ;
		battom_size = 1 ;
		while (battom_size != 0 ){
		    ;
			}
		battom = 0 ;
		del1s () ;
		}
		*/
	if(out.wind < 10){
	    out.wind++;
		}
		else {
              out.wind = 10;
             } 
	}	
if((out.temp-1)>setdata.tempnum)          //设置温度-1大于室内温度;          
	{out.cool=0;                               //制冷无效;
	out.heat=1;                                //制热有效;
	/*
	if(out.wind == 10){
	    battom = 0 ;
		del1s () ;
		del1s () ;
		battom = 1 ;
		del1s () ;
		}
		*/
	if (out.wind == 9){
		battom = 1 ;
		del1s () ;
		del1s () ;
		del1s () ;
		battom = 0 ;
		del1s () ;
		}
	if (out.wind == 5){
	    battom = 1 ;
		del1s () ;
		del1s () ;
		del1s () ;
		battom = 0 ;
		del1s () ;
		}
	if (out.wind == 1){
	    battom = 1 ;
		battom_size = 1 ;
		del1s () ;
		del1s () ;
		del1s () ;
		battom = 0 ;
		del1s () ;
		}
	if(out.wind > 0){
		out.wind-- ;
		}
	else {
         out.wind = 0 ;
         }
	}    
	}
}               
void enableWDT(void){
    pca0md = 0x00 ;
    pca0cpl2 = 0xff ;
	pca0md |= 0x40 ;
	}
void disableWDT(void){
    pca0md &= ~0x40 ;
	}
void refreshWDT(void){
    pca0cph2 = 0x00 ;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?