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

📄 main.c

📁 包括ARM开发环境的使用和一些调试用的源程序
💻 C
📖 第 1 页 / 共 5 页
字号:
	//}
//	CTCOM1=1;
//	CTCOM2=1;
//	CTCOM3=1;
//	CTCOM4=1;
	//if(ledchange==0)
	//{
	//	P0=led[dispnum[ledchange]];
/*		CTK=1;
		CTK=0;
		CTK=1;
		CTCOM1=0;
	}
	else if(ledchange==1)
	{
		if(dotflag)
			P0=led[dispnum[ledchange]];
		else P0=led[dispnum[ledchange]]|led[10];		//加小数点

		CTK=1;
		CTK=0;
		CTK=1;
		CTCOM2=0;
	}
	else if(ledchange==2)
	{
		if(!dotflag)
			P0=led[dispnum[ledchange]];
		else P0=led[dispnum[ledchange]]|led[10];		//加小数点
		P0=led[dispnum[ledchange]];
		CTK=1;
		CTK=0;
		CTK=1;
		CTCOM3=0;
	}
	else if(ledchange==3)
	{
		P0=led[dispnum[ledchange]];
		CTK=1;
		CTK=0;
		CTK=1;
		CTCOM4=0;
	}
	ledchange++;*/
}

/**********************************8
指示移位
************************************/
void fingermove(uchar a,bit b,bit d)
{
	uchar temb;
	if(d)
	{
                if(b)//指针down
                {       temb=a-2;
			LCM12864(0,temb,0,16,0);
                        _nop_();
                        LCM12864(0,temb+1,0,16,0);
                        _nop_();
			fingersbuf[0]=40;
                        _nop_();
			DispPage2(fingersbuf,a,0,1,2);
                        _nop_();
	          }
	          else //up
		{
			temb=a+2;
			LCM12864(0,temb,0,16,0);
			LCM12864(0,temb+1,0,16,0);
			fingersbuf[0]=40;
			DispPage2(fingersbuf,a,0,1,2);
		}
	}
	else
	{
		fingersbuf[0]=40;
		temb=a;
		DispPage2(fingersbuf,temb,0,1,2);
	}
}
/****************************************
 系统处理
**************************************/
uchar  page;
uchar  state;
bit   port;//port=0 为鍵面操作,port=1为端口操作.
uchar idata Fcount;//F 项位置定位。
uchar idata Ecount;//E项位置 定位。
uchar idata Ccount;//C项位置 定位。
uchar idata Hcount;//H项位置 定位。
uchar idata Ucount;//P项位置定位。
uchar idata Pcount;
uchar idata Mcount;//菜单位置 定位。
bit   runfirst;
uchar idata movepin;
uchar idata IOcount;
uchar idata runcount;
bit stopfirst;
bit runfirst;
uchar itemcode;
void managemenu(void)
{
		uchar subb;
		if((state==0)&&(page==0)&&(stopfirst==0))
		{	cleardisp();
			interfaceStop();
			stopfirst=1;

		}
		if((state==1)&&(page==1)&&(runfirst==0))
		{	cleardisp();
			interfaceRun();
			runfirst=1;

		}
		if(((state==0)&&(stopfirst))||((state==1)&&(runfirst)))
		{
			if((key_tag==1)&&(key_code==PRG)&&((page==0)||(page==1)))
			{

				key_tag=0;
				Mcount=1;
				page=2;
				back=0;
				time=0;
				changepage(1,2,1);


			}
			if((key_tag)&&(key_code==DOWN)&&(Mcount>0)&&(Mcount<=9)&&(page==2))
			{
					back=0;
					time=0;

					key_tag=0;
					if((Mcount%4)==0)
					{
						subb=Mcount/4;
						subb+=1;
						changepage(subb,2,1);
						Mcount+=1;
					}
					else if(((Mcount%4)!=0)&&(Mcount!=9))
					{
						Mcount+=1;
						movepin+=2;
						fingermove(movepin,1,1);
					}

			}
			if((key_tag)&&(key_code==UP)&&(Mcount>0)&&(Mcount<10)&&(page==2))
			{
					back=0;
					time=0;

					key_tag=0;
					subb=Mcount-1;
					if((subb!=0)&&((subb%4)==0))
					{
						subb=subb/4;
						changepage(subb,2,0);
						Mcount-=1;
					}
					else if((((Mcount-1)%4)!=0)&&(Mcount!=1))
					{
						Mcount-=1;
						movepin-=2;
						fingermove(movepin,0,1);
					}
			}
			if((key_tag)&&(key_code==FUNC)&&(Mcount>0)&&(Mcount<10)&&(page==2))
			{
						key_tag=0;
						back=0;
						time=0;
						page=3;
						Fcount=0;
						Hcount=0;
						Ecount=0;
						Pcount=0;
						Ucount=0;
						Ccount=0;
						vindicatecount=0;
						IOcount=0;
						runcount=0;
						itemcode=Mcount;
			}
			if((((key_code==PRG))||((key_code==RESET)))&&(page==2)&&(key_tag))
			{
				key_tag=0;

				if(state==0)
				{
					page=0;
					stopfirst=0;
					Mcount=0;
				}
				if(state==1)
				{
					page=1;
					runfirst=0;
					Mcount=0;
				}
			}
		}

}
/************************************
基本功能1屏
************************************/
void screen1(void)
{
	combinline(5,23,23,6,42,43,44,45,0,0);
	DispPage2(fingersbuf,0,16,8,2);
	combinline(5,23,24,6,46,47,77,78,24,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,23,25,6,116,117,173,170,0,0);
	DispPage2(fingersbuf,4,16,8,2);
	combinline(5,23,26,6,48,49,46,47,24,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/************************************
基本功能2屏
************************************/
void screen2(void)
{
	combinline(5,23,27,6,50,51,46,47,24,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(5,23,28,6,54,123,52,53,24,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,23,29,6,48,49,52,53,24,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(5,23,30,6,55,56,57,58,24,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/*****************************
screen 3
******************************/
void screen3(void)
{
	combinline(5,23,31,6,147,56,57,58,24,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(5,23,32,6,62,63,64,65,24,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,24,23,6,59,60,52,61,24,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(5,24,24,6,12,9,77,78,80,24);
	DispPage2(fingersbuf,6,16,10,2);
}
/*********************************
screen 4
********************************/
void screen4(void)
{
	combinline(5,24,25,6,59,78,42,20,24,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(5,24,26,6,3,1,52,85,12,9);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(5,24,27,6,81,66,67,0,0,0);
	DispPage2(fingersbuf,4,16,7,2);
	combinline(5,24,28,6,83,82,46,47,0,0);
	DispPage2(fingersbuf,6,16,8,2);
}

/*******************************
screen 5
********************************/
void screen5(void)
{
	combinline(5,24,29,6,84,82,46,47,0,0);
	DispPage2(fingersbuf,0,16,8,2);
	combinline(5,24,30,6,77,78,86,87,0,0);
	DispPage2(fingersbuf,2,16,8,2);
	combinline(5,24,31,6,46,47,88,89,0,0);
	DispPage2(fingersbuf,4,16,8,2);
	combinline(5,25,23,6,3,2,91,67,7,22);
	DispPage2(fingersbuf,6,16,10,2);
}
/************************************
screen 6
**********************************/
void screen6(void)
{
	combinline(5,25,24,6,3,2,91,67,80,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(5,25,25,6,3,2,91,67,20,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,25,26,6,66,67,46,47,0,0);
	DispPage2(fingersbuf,4,16,8,2);
	combinline(5,25,27,6,44,92,57,58,0,0);
	DispPage2(fingersbuf,6,16,8,2);
}
/********************************8
screen 7
*********************************/
void screen7(void)
{
	combinline(5,25,28,6,68,69,46,47,0,0);
	DispPage2(fingersbuf,0,16,8,2);
	combinline(5,25,29,6,73,74,46,47,0,0);
	DispPage2(fingersbuf,2,16,8,2);
	combinline(5,25,30,6,52,70,71,72,0,0);
	DispPage2(fingersbuf,4,16,8,2);
	combinline(5,26,23,6,5,10,0,52,53,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/*****************************88
screen 8
*******************************/
void screen8(void)
{
	combinline(5,26,24,6,5,10,0,0,9,2);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(4,0,0,0,0,0,0,0,0,0);
	DispPage2(fingersbuf,0,96,1,2);
	combinline(5,26,26,6,5,10,0,97,98,47);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(5,26,27,6,5,10,13,52,53,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(5,26,28,6,5,10,13,75,76,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/***********************************
screen 9
************************************/
void screen9(void)
{
	combinline(5,26,29,6,26,23,11,19,99,100);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(5,27,23,6,101,67,62,63,24,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(5,27,24,6,92,67,62,63,24,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(5,27,25,6,62,63,102,103,24,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/*****************************8
screen 10
******************************/
void screen10(void)
{
	combinline(4,23,24,6,18,24,33,75,76,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,23,25,6,18,25,33,75,76,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,23,26,6,18,26,33,75,76,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(4,23,27,6,18,27,33,75,76,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/******************************
screen 11
******************************/
void screen11(void)
{
	combinline(4,23,28,6,18,28,33,75,76,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,23,29,6,18,29,33,75,76,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,23,30,6,18,30,33,75,76,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(4,23,31,6,18,31,33,75,76,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/*************************************8
screen 12
**********************************/
void screen12(void)
{
	combinline(4,23,32,6,18,32,33,75,76,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,24,23,6,55,56,57,58,25,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,24,24,6,147,56,57,58,25,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(4,24,25,6,55,56,57,58,26,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/**************************************
screen 13
*************************************/
void screen13(void)
{
	combinline(4,24,26,6,147,56,57,58,26,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,24,27,6,55,56,57,58,27,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,24,28,6,147,56,57,58,27,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(4,24,29,6,101,67,62,63,25,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/***************************************
screen 14
**************************************/
void screen14(void)
{
	combinline(4,24,30,6,91,67,62,63,25,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,25,23,6,19,24,33,75,76,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,25,24,6,19,25,33,75,76,0);
	DispPage2(fingersbuf,4,16,9,2);
	combinline(4,25,25,6,19,26,33,75,76,0);
	DispPage2(fingersbuf,6,16,9,2);
}
/***********************************
screen 15
**********************************/
void screen15(void)
{
	combinline(4,25,26,6,19,27,33,75,76,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,25,27,6,19,28,33,75,76,0);
	DispPage2(fingersbuf,2,16,9,2);
	combinline(4,25,28,6,19,28,96,33,75,76);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(4,26,23,6,5,0,11,33,104,80);
	DispPage2(fingersbuf,6,16,10,2);
}
/*************************************
screen 16
***********************************/
void screen16(void)
{
	combinline(4,26,24,6,5,3,14,24,33,46);
	DispPage2(fingersbuf,0,16,10,2);
	fingersbuf[0]=47;
	DispPage2(fingersbuf,0,104,1,2);
	combinline(4,26,25,6,5,3,14,33,127,165);
	DispPage2(fingersbuf,2,16,10,2);
	fingersbuf[0]=80;
	DispPage2(fingersbuf,2,112,1,2);
	combinline(4,26,26,6,12,9,33,94,93,95);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(4,26,27,6,12,9,24,33,94,95);
	DispPage2(fingersbuf,6,16,10,2);
	fingersbuf[0]=80;
	fingersbuf[1]=24;
	DispPage2(fingersbuf,6,112,2,2);
}
/**************************************
screen 17
*************************************/
void screen17(void)
{
	combinline(4,26,28,6,12,9,33,94,93,95);
	DispPage2(fingersbuf,0,16,10,2);
	fingersbuf[0]=20;
	DispPage2(fingersbuf,0,120,1,2);
	combinline(4,26,29,6,5,3,14,25,33,46);
	DispPage2(fingersbuf,2,16,10,2);
	fingersbuf[0]=47;
	DispPage2(fingersbuf,2,104,1,2);
	combinline(4,26,30,6,12,9,25,33,94,93);
	DispPage2(fingersbuf,4,16,10,2);
	fingersbuf[0]=80;
	fingersbuf[1]=25;
	DispPage2(fingersbuf,4,112,2,2);
	combinline(4,27,23,6,106,107,108,42,0,0);
	DispPage2(fingersbuf,6,16,9,2);

}
/***********************************8
screen 18
************************************/
void screen18(void)
{
	combinline(4,27,24,6,106,107,108,42,1,0);
	DispPage2(fingersbuf,0,16,9,2);
	combinline(4,27,25,6,106,107,159,74,0,0);
	DispPage2(fingersbuf,2,16,8,2);
	combinline(4,27,26,6,9,4,3,33,156,157);
	DispPage2(fingersbuf,4,16,10,2);
	fingersbuf[0]=24;
	DispPage2(fingersbuf,4,112,1,2);
	combinline(4,27,27,6,9,4,3,33,156,157);
	DispPage2(fingersbuf,6,16,10,2);
	fingersbuf[0]=25;
	DispPage2(fingersbuf,4,112,1,2);
}
/*********************************8
screen 19
**********************************/
void screen19(void)
{
	combinline(2,23,24,6,109,110,33,7,22,24);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(2,23,25,6,109,110,33,7,22,25);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(2,23,26,6,109,110,33,7,22,26);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(2,23,27,6,109,110,104,80,0,0);
	DispPage2(fingersbuf,6,16,8,2);
}
/*******************************88
screen 20
*********************************/
void screen20(void)
{
	combinline(2,23,28,6,111,112,33,7,22,24);
	DispPage2(fingersbuf,0,16,10,2);
	combinline(2,23,29,6,111,112,33,7,22,25);
	DispPage2(fingersbuf,2,16,10,2);
	combinline(2,23,30,6,111,112,33,7,22,26);
	DispPage2(fingersbuf,4,16,10,2);
	combinline(2,23,31,6,111,112,33,7,22,27);
	DispPage2(fingersbuf,6,16,10,2);
}
/**********************************

⌨️ 快捷键说明

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