⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c.c

📁 包括ARM开发环境的使用和一些调试用的源程序
💻 C
📖 第 1 页 / 共 5 页
字号:
		}
		if((FECPHU==4)&&(nc==1))//set 2--14
		{
			combinline(25,41,24,27,0,0,0,0,0,0);
			lengh=4;
		}
		if((FECPHU==4)&&(nc==2))//set 0.01---45
		{
			combinline(23,34,23,23,41,27,28,0,0,0);
			lengh=7;
		}
		if((FECPHU==4)&&((nc==3)||(nc==6)))//set 0.00--2000
		{
			combinline(23,34,23,23,41,25,23,23,23,0);
			lengh=9;
		}
		if((FECPHU=5)&&(nc==3))//set 2---20
		{
			combinline(25,41,25,23,0,0,0,0,0,0);
			lengh=4;
		}
		if((FECPHU==6)&&(nc>=2)&&(nc<=5))//set 1--50
		{
			combinline(24,41,28,23,0,0,0,0,0,0);
			lengh=4;
		}
		if((FECPHU==6)&&(((nc>=6)&&(nc<=9))||(nc==1)||(nc==12)||(nc==13)))//set 0---65535
		{
			combinline(23,41,29,28,28,26,28,0,0,0);
			lengh=7;
		}
		if((FECPHU==6)&&((nc==10)||(nc==11)))//set 0---32767
		{
			combinline(23,41,26,25,30,29,30,0,0,0);
			lengh=7;
		}
		if((FECPHU==6)&&(nc==25))//set 0
		{
			combinline(23,0,0,0,0,0,0,0,0,0);
			lengh=1;
		}
		if((FECPHU==5)&&(nc==25))//set -9.9---0.0
		{
			combinline(33,32,34,32,41,23,34,23,0,0);
			lengh=8;
		}
		if((FECPHU==5)&&((nc==19)||(nc==21)))//set 0.01---10.00
		{
			combinline(23,34,23,24,41,24,23,34,23,23);
			lengh=10;
		}
		if((FECPHU==5)&&(nc==20))//set 0.1--3600.0
		{
			combinline(23,34,24,41,26,29,23,23,34,23);
			lengh=10;
		}
		if(((FECPHU==5)&&(nc==14))||((FECPHU==2)&&(nc==26)))//set 0.0---30.0
		{
			combinline(23,34,23,41,26,23,34,23,0,0);
			lengh=8;
		}
		if((FECPHU==5)&&(nc==13))//set 400---600
		{
			combinline(27,23,23,41,29,23,23,0,0,0);
			lengh=7;
		}
		if((FECPHU==5)&&(nc==11))//set 0.1---10.0
		{
			combinline(23,34,24,41,24,23,34,23,0,0);
			lengh=8;
		}
		if((FECPHU==5)&&(nc==12))//set 0.00---100.0
		{
			combinline(23,34,23,23,41,24,23,23,0,0);
			lengh=8;
		}
		if(lengh>0)
		{	cleardisp();
			DispPage2(fingersbuf,4,10,lengh,2);
		}
	
		
}


/***************************************
运行状态监视
*************************************/
//运行第一屏
void runscreen1(void)
{
	combinline(5,17,191,20,196,0,0,0,0,0);
	DispPage2(fingersbuf,0,0,5,2);
	combinline(7,22,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,90,2,2);
	combinline(8,17,191,20,196,0,0,0,0,0);
	DispPage2(fingersbuf,2,0,5,2);
	combinline(0,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,85,1,2);
	combinline(194,17,191,20,196,0,0,0,0,0);
	DispPage2(fingersbuf,4,0,5,2);
	combinline(194,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,85,1,2);
	combinline(14,11,195,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,0,5,2);
	combinline(38,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,85,1,2);
}
////运行第二屏
void runscreen2(void)
{
	combinline(5,15,192,193,196,0,0,0,0,0);
	DispPage2(fingersbuf,0,0,5,2);
	combinline(7,22,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,90,2,2);
}
//run three screen
void runscreen3(void)
{
	combinline(197,19,198,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,0,4,2);
	combinline(9,12,3,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,0,4,2);
	combinline(9,8,198,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,0,4,2);
	
}
//run four screen 
void runscreen4(void)
{
	combinline(197,194,196,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,0,3,2);
	combinline(13,194,196,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,0,3,2);
	combinline(14,9,3,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,0,4,2);
	combinline(38,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,85,1,2);
	combinline(14,9,1,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,0,4,2);
	combinline(38,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,85,1,2);
}
//run main programm
	
void runwatch(void)
{
	if((page==3)&&(itemcode==3))
	{
		if((runcount==0)||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(runcount==2)))
		{
			key_code2=0;
			cleardisp();
			runscreen1();
			//send 
			runcount=1;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(runcount==1))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(runcount==3)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			runscreen2();
			//send
			runcount=2;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(runcount==2))||((key_code2==UP)&&(key_code1==0)&&(key_code3==0)&&(runcount==4)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			runscreen3();
			//send
			runcount=3;
		}	
		if((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(runcount==3))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			runscreen4();
			//send
			runcount=4;
		}
		
			
	}
}

/******************************************8
I/O检查
********************************************/
//I/O screen one 
void  IOscreen1(void)
{
	combinline(11,4,10,6,199,18,25,199,18,29);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(199,5,201,3,199,18,26,199,18,30);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(199,11,4,194,199,18,27,199,18,31);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(199,18,24,6,199,18,28,199,18,32);
	DispPage2(fingersbuf,6,16,10,2);
}
//I/O screen two 
void IOscreen2(void)
{
	combinline(2,12,10,10,199,18,25,199,18,29);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(199,5,201,3,199,18,26,199,18,30);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(199,11,4,194,199,18,27,199,18,31);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(199,18,24,6,199,18,28,199,18,32);
	DispPage2(fingersbuf,6,16,10,2);
}
//I/O screen forth
void IOscreen5(void)
{
	combinline(2,24,196,6,6,6,6,6,202,0);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(2,25,196,6,6,6,6,6,202,0);
	DispPage2(fingersbuf,2,16,10,2);
}
//I/O screen three
void IOscreen3(void)
{
	combinline(199,19,24,6, 199,19,28,0,0,0);
	DispPage2(fingersbuf,0,16,7,2);
	combinline(199,19,25,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,16,3,2);
	combinline(199,19,26,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,16,3,2);
	combinline(199,19,27,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,16,3,2);
}
//I/O screen four 
void IOscreen4(void)
{
	combinline(24,25,196,6,203,6,6,6,6,194);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(25,25,196,6,6,6,6,6,6,194);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(26,25,196,6,203,6,6,6,6,194);
	DispPage2(fingersbuf,4,16,10,2);
}
//I/O screen seven
void IOscreen7(void)
{
	combinline(0,12,196,6,203,6,6,6,6,194);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(2,197,196,6,6,6,6,6,202,0);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(3,8,196,6,6,6,6,6,6,7);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(3,12,196,6,6,6,6,6,6,7);
	DispPage2(fingersbuf,6,16,10,2);
}
//I/O screen six
void IOscreen6(void)
{
	combinline(5,10,0,196,6,6,6,6,194,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(5,10,13,196,6,6,6,6,194,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,10,13,196,6,6,6,6,0,0);
	DispPage2(fingersbuf,4,16,4,2);
}
//I/O screen eight
void IOscreen8(void)
{
	combinline(13,24,196,203,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,16,4,2);
	combinline(22,24,196,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,16,3,2);
	combinline(13,25,196,203,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,16,4,2);
	combinline(22,25,196,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,6,16,3,2);
}
		
//IO main programm
void IOwatch(void)
{
	if((page==3)&&(itemcode==4))
	{
		if((IOcount==0)||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(IOcount==2)))
		{
			key_code2=0;
			cleardisp();
			IOscreen1();
			//send
			IOcount=1;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==1))||((key_code2==UP)&&(key_code1==0)&&(key_code3==0)&&(IOcount==3)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			IOscreen2();		
			//send
			IOcount=2;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==2))||((key_code2==UP)&&(key_code1==0)&&(key_code3==0)&&(IOcount==4)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			IOscreen3();
			//send
			IOcount=3;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==3))||((key_code2==UP)&&(key_code1==0)&&(key_code3==0)&&(IOcount==5)))
		{
			key_code2=0;
			key_code3=0;
			cleardisp();
			IOscreen4();
			//send
			IOcount=4;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==4))||((key_code2==UP)&&(key_code1==0)&&(key_code3==0)&&(IOcount==6)))
		{
			key_code2=0;
			key_code3=0;
			cleardisp();
			IOscreen5();
			//send
			IOcount=5;
		}
		if(((key_code3==DOWN)&&(key_code1==0)&&(key_code2==0)&&(IOcount==5))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(IOcount==7)))
		{
			key_code2=0;
			key_code3=0;
			cleardisp();
			IOscreen6();
			//send
			IOcount=6;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==6))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(IOcount==8)))
		{
			key_code2=0;
			key_code3=0;
			cleardisp();
			IOscreen7();
			//send
			IOcount=7;
		}
		if((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(IOcount==7))
		{
			key_code3=0;
			cleardisp();
			IOscreen8();
			//send
			IOcount=8;
		}
	}
}
/***************************************
维护信息
**************************************/
//vindicator screen one 
void vindicatescreen1(void)
{
	combinline(14,8,10,4,196,0,0,0,0,0);
	DispPage2(fingersbuf,0,16,5,2);
	combinline(4,3,2,196,6,6,6,6,194,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(14,10,13,8,196,6,6,6,6,204);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(14,10,13,5,196,6,6,6,6,204);
	DispPage2(fingersbuf,6,16,10,2);
}
//vindicator screen two 
void vindicatescreen2(void)
{
	combinline(8,202,205,206,196,6,6,6,6,0);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(2,0,13,196,6,6,6,6,6,38);
	DispPage2(fingersbuf,2,16,10,2);
}
//vindicator screen three
void vindicatescreen3(void)
{
	combinline(14,2,0,13,196,0,0,0,0,0);
	DispPage2(fingersbuf,0,16,5,2);
	combinline(14,5,0,207,196,0,0,0,0,0);
	DispPage2(fingersbuf,4,16,5,2);
}
//vindicator screen four 
void vindicatescreen4(void)
{
	combinline(207,11,208,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,16,4,2);
	combinline(207,11,11,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,2,16,4,2);
	combinline(207,11,12,196,0,0,0,0,0,0);
	DispPage2(fingersbuf,4,16,4,2);
}
//vindicator screen fire
void vindicatescreen5(void)
{
	combinline(8,207,194,196,7,0,0,0,0,0);
	DispPage2(fingersbuf,0,16,5,2);
	combinline(208,4,19,13,0,3,196,208,0,0);
	DispPage2(fingersbuf,2,16,8,2);
	combinline(12,13,14,8,12,207,196,13,0,0);
	DispPage2(fingersbuf,4,16,8,2);
}
//vindicate main programm

void vindicatewatch(void)
{
	if((page==3)&&(itemcode==5))
	{
		if((vindicatecount==0)||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(vindicatecount==2)))
		{
			key_code2=0;
			cleardisp();
			vindicatescreen1();
			//send
			vindicatecount=1;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(vindicatecount==1))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(vindicatecount==3)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			vindicatescreen2();
			//send
			vindicatecount=2;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(vindicatecount==2))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(vindicatecount==4)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			vindicatescreen3();
			//send
			vindicatecount=3;
		}
		if(((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(vindicatecount==3))||((key_code2==UP)&&(key_code3==0)&&(key_code1==0)&&(vindicatecount==5)))
		{
			key_code3=0;
			key_code2=0;
			cleardisp();
			vindicatescreen4();
			//send
			vindicatecount=4;
		}
		if((key_code3==DOWN)&&(key_code2==0)&&(key_code1==0)&&(vindicatecount==4))
		{
				key_code3=0;
				cleardisp();
				vindicatescreen5();
				//send
				vindicatecount=5;
		}
	}
}
/****************************************
起动
***************************************/
bit direction;
void startstop(void)
{
	if((key_code1==STOP)&&(key_code2==0)&&(key_code3==0))
	{
		state=0;
		page=0;
		key_code1=0;
	}
	if((key_code3==FWD)&&(key_code2==0)&&(key_code1==0))
	{
		state=1;
		page=1;
		direction=1;
		key_code3=0;
	}
	if((key_code2==REV)&&(key_code3==0)&&(key_code1==0))
	{
		state=1;
		page=1;
		direction=0;
		key_code2=0;
	}
}
/****************************************
负载率
*******************************************/

void main(void)
{
	uchar i,j;
	EA=1;
	TMOD=0x01;
	ET0=1;
	TH0=0x3c;		//2.5ms/3.6864
	TL0=0xb0;
	for(j=0;j<8;j++)
	{
	    LCM12864(i,j,0,128,1);
	}
	
	while(1)
	{
		
		
		readkey();
		startstop();
		itemcode=managemenu();
		i=item1();
		if(i!=0)
		{
			designe(i);
			FECPHU=0;
		}
		runwatch();
		IOwatch();
		vindicatewatch();
	}
}




⌨️ 快捷键说明

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