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

📄 menu.c

📁 站长把时间都花费在为您修正说明上。压缩包解压时不能有密码。系统会自动删除debug和release目录
💻 C
字号:
/**********************************多级菜单LCD显示********************************************/
/*********作者:王胜文。QQ:95201972  email:nunk@163.com 希望与大家交流2007。08。03**********/



#include<drive_functions.h>
#include<get_keys.h>
#include<characters.h>
#include<menu_functions.h>
void (*current_operation_index)();//



typedef struct
   {
	uchar current;
	uchar up;
	uchar down;
	uchar enter;
	void (*current_operation)();
	} key_table;

 key_table code table[56]=
 {
 	{0,24,8,1,(*fun0)}, //0//第一层,显示[语言],图片,说明,返回
	{1,7,3,2,(*fun1)},//1-0按回车,进第二层,显示[英语],法语,中文,返回
	{2,2,2,1,(*fun2)},//2-1 >enter>guiyang is the capital of guizhou,[return]
						
	{3,1,5,4,(*fun4)},//4-1向下,显示英语,[法语],中文,返回
	{4,4,4,3,(*fun5)},//5-4 >enter>liupanshui is a base of coal mine of southern of china
						
	{5,3,7,6,(*fun7)},//7-4向下,显示英语,法语,[中文],返回
	{6,6,6,5,(*fun8)}, //8-7 >enter>huangping is my hometown,[return]
						
	{7,5,1,0,(*fun10)},//10-7 >down>显示英语,法语,中文,[返回]
						
	{8,0,16,9,(*fun12)},//12-0 >down>显示语言,[图片],说明,返回
	{9,15,11,10,(*fun13)},//13-12 >enter>[图片1],图片2,图片2,返回
	{10,10,10,9,(*fun14)},//14-13 >entern>chengdu is the capital of sichuan province,[return]
	                       
	{11,9,13,12,(*fun16)},//16-13 >down>图片1,[图片2],图片2,返回
	{12,12,12,11,(*fun17)},//17-16 >enter>miangyang is a technology city of western china,[return]
	                       
	{13,11,15,14,(*fun19)},//19-16 >down>图片1,图片2,[图片3],返回
	{14,14,14,13,(*fun20)},//20-19 >enter>leshan have leshan dafu,[return]
	                       
	{15,13,9,8,(*fun22)},//22-19 >down>图片1,图片2,图片2,[返回]
	                        
	{16,8,24,17,(*fun24)},//24-12 >down>语言,图片,[说明],返回
	{17,23,19,18,(*fun25)},//25-24 >enter>[二键],5键,8键,返回
	{18,18,18,17,(*fun26)},//26-25 >enter>i'm now in shenzhen,[return]
	                        
	{19,17,21,20,(*fun28)},//28-25 >down>二键,[5键],8键,返回
	{20,20,20,19,(*fun29)}, //29-28 >enter>guangzhou is the capital of guangdong,return
	                         
	{21,19,23,22,(*fun31)},//31-28 >down>二键,5键,[8键],返回
	{22,22,22,21,(*fun32)},//32-31 >enter>i'm in huizhou in 1997,[return]
	                        
	{23,21,17,16,(*fun34)},//34-31 >down>二键,5键,8键,[返回]
	                         
	{24,16,0,25,(*fun36)},//36-24 >down>语言,图片,说明,[返回]
	{25,26,26,27,(*fun37)},//37-36 >enter>[关机],菜单
	{26,25,25,0,(*fun38)}, //38-37 >up>关闭,[菜单]
	{27,27,27,0,(*fun39)},//shutdown
    /*..........................................英文菜单...............................................*/
 	{0,52,36,29,(*fun60)}, //0//第一层,显示[语言],图片,说明,返回
	{1,35,31,30,(*fun62)},//1-0按回车,进第二层,显示[英语],法语,中文,返回
	{2,40,40,29,(*fun63)},//2-1 >enter>guiyang is the capital of guizhou,[return]
						
	{3,29,33,32,(*fun64)},//4-1向下,显示英语,[法语],中文,返回
	{4,32,32,31,(*fun65)},//5-4 >enter>liupanshui is a base of coal mine of southern of china
						
	{5,31,35,34,(*fun66)},//7-4向下,显示英语,法语,[中文],返回
	{6,34,34,33,(*fun67)}, //8-7 >enter>huangping is my hometown,[return]
						
	{7,33,29,28,(*fun68)},//10-7 >down>显示英语,法语,中文,[返回]
						
	{8,28,44,37,(*fun69)},//12-0 >down>显示语言,[图片],说明,返回
	{9,43,39,38,(*fun70)},//13-12 >enter>[图片1],图片2,图片2,返回
	{10,38,38,37,(*fun71)},//14-13 >entern>chengdu is the capital of sichuan province,[return]
	                       
	{11,37,41,40,(*fun72)},//16-13 >down>图片1,[图片2],图片2,返回
	{12,40,40,39,(*fun73)},//17-16 >enter>miangyang is a technology city of western china,[return]
	                       
	{13,39,43,42,(*fun74)},//19-16 >down>图片1,图片2,[图片3],返回
	{14,42,42,41,(*fun75)},//20-19 >enter>leshan have leshan dafu,[return]
	                       
	{15,41,37,36,(*fun76)},//22-19 >down>图片1,图片2,图片2,[返回]
	                        
	{16,36,52,45,(*fun77)},//24-12 >down>语言,图片,[说明],返回
	{17,51,47,46,(*fun78)},//25-24 >enter>[二键],5键,8键,返回
	{18,46,46,45,(*fun79)},//26-25 >enter>i'm now in shenzhen,[return]
	                        
	{19,45,49,48,(*fun80)},//28-25 >down>二键,[5键],8键,返回
	{20,48,48,47,(*fun81)}, //29-28 >enter>guangzhou is the capital of guangdong,return
	                         
	{21,47,51,50,(*fun82)},//31-28 >down>二键,5键,[8键],返回
	{22,50,50,49,(*fun83)},//32-31 >enter>i'm in huizhou in 1997,[return]
	                        
	{23,49,45,44,(*fun84)},//34-31 >down>二键,5键,8键,[返回]
	                         
	{24,44,28,53,(*fun85)},//36-24 >down>语言,图片,说明,[返回]
	{25,54,54,55,(*fun86)},//37-36 >enter>[关机],菜单
	{26,53,53,28,(*fun87)}, //38-37 >up>关闭,[菜单]
	{27,55,55,28,(*fun88)},//shutdown
};


void main(void)
{
void fun40();				  
while(1)
{
if(CheckState())                      //检查是否有键按下
		{
			delay();                    //延时去抖动
			
			if(CheckState())
			{
				key=GetKeys();          //读取键盘值
			
               	
/*******************find index****************************/
switch(key)
{
	case 0x14:  	 
				func_index=table[func_index].up;    //向上翻
				break;
	case 0x24: 	if(func_index<28)
                 {
	               dengdai();
				  }
				 else dengdai_y();
                   ClearLCD2(); 
				func_index=table[func_index].enter;//回车
				break;
	case 0x44:  
				func_index=table[func_index].down;//向下翻
				break;
	default:    
				break;

      				}
   				}
            }
		
      current_operation_index=table[func_index].current_operation;
	   
	  (*current_operation_index)();//执行当前操作函数

}
}

⌨️ 快捷键说明

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