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

📄 lcd的多屏多层菜单.htm

📁 多屏多层菜单,液晶多屏多层菜单功能程序实现,可方便调用移值.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                  <BR>starttime<I>=x25045_readword(i*7); 
                  <BR>stoptime<I>=x25045_readword(i*7+2); 
                  <BR>betweentime<I>=x25045_readword(i*7+4); <BR>} 
                  <BR><BR>x25045_init(); <BR>init(); <BR>TH0=0xd8; <BR>TL0=0x00; 
                  <BR><BR><BR>//初始化变量 <BR><BR>while(1) <BR>{ <BR>init_12887(); 
                  <BR>//*********************** <BR>#if DEBUG 
                  <BR>x25045_disable(); <BR>#else <BR>x25045_init(); <BR>#endif 
                  <BR>//*********************** <BR><BR>TMOD=0x01; <BR>ET0=1; 
                  <BR>TR0=1; <BR>#if ENABLE_INTERRUPT <BR>EX1=1; <BR>PX1=1; 
                  <BR>PT0=0; <BR>#endif <BR>EA=1; 
                  <BR><BR>//********************************** <BR>//加入限时运行功能 
                  <BR>if((x25045_readbyte(0x01bb)==1)&amp;&amp;(menuitem!=0x20)&amp;&amp;(menuitem!=0x1b)) 
                  <BR>{ <BR>tempkey=0; <BR>gettime_12887(); 
                  <BR>for(i=0;i&lt;3;i++) <BR>{ 
                  <BR>if(tempvar<I>&lt;=x25045_readbyte(0x01b5-3+i)) <BR>{ 
                  <BR>tempkey++; <BR>} <BR>else <BR>{ <BR>break; <BR>} <BR>} 
                  <BR>if(tempkey&lt;3) <BR>{ <BR>if(menuitem!=0x20) <BR>{ 
                  <BR>showflag=0; <BR>} <BR>menuitem=0x20; <BR><BR>} <BR>else 
                  <BR>{ <BR>menuitem=0; <BR>} <BR>tempkey=0x50; <BR>i=0; <BR>} 
                  <BR><BR>//********************************** <BR><BR>//主循环开始 
                  <BR>tm12864_reset(); <BR>x25045_resetwatchdog(); <BR>//键盘处理程序 
                  <BR><BR>&nbsp; &nbsp;if((keycode!=0)&amp;&amp;(keypush==0)) 
                  <BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;i=0; <BR>&nbsp; 
                  &nbsp;while(i&lt;10) <BR>&nbsp; &nbsp;{ <BR>&nbsp; 
                  &nbsp;if(keycode==keyscancode<I>) <BR>&nbsp; &nbsp;{ 
                  <BR>&nbsp; &nbsp;tempkey=i; <BR>&nbsp; &nbsp;break; <BR>&nbsp; 
                  &nbsp;} <BR>&nbsp; &nbsp;else <BR>&nbsp; &nbsp;{ <BR>&nbsp; 
                  &nbsp;tempkey=keycode; <BR>&nbsp; &nbsp;} <BR>&nbsp; 
                  &nbsp;i++; <BR>&nbsp; &nbsp;} <BR>&nbsp; &nbsp;} <BR>&nbsp; 
                  &nbsp;else <BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;tempkey=0x50; 
                  <BR>&nbsp; &nbsp;} <BR>&nbsp; &nbsp;keycode=0; <BR><BR>&nbsp; 
                  &nbsp;//屏幕显示处理 <BR>&nbsp; &nbsp;switch(menuitem) <BR>&nbsp; 
                  &nbsp;{ <BR>&nbsp; &nbsp;case 0x00://自动运行状态 <BR>&nbsp; 
                  &nbsp;tm12864_reset(); <BR>&nbsp; &nbsp;if(showflag==0) 
                  <BR>&nbsp; &nbsp;{ <BR>tm12864_fillscreen(0x00); 
                  <BR>showflag=1; <BR><BR>} <BR>showinitscreen(); 
                  <BR>tm12864_writestr(0,0," &nbsp; &nbsp;",0); 
                  <BR>tm12864_writestr(12,0," &nbsp; &nbsp;",0); 
                  <BR>tm12864_writestr(0,4," &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp;",0); <BR>tm12864_writestr(0,6," &nbsp; 
                  &nbsp;",0); <BR>tm12864_writehz(4,6,zzyx,0); 
                  <BR>tm12864_writestr(12,6," &nbsp; &nbsp;",0); 
                  <BR><BR>if(tempkey==BUTTON_STOP)//进入“设置确认”菜单 <BR>{ <BR>j=0; 
                  <BR>menuitem=0x01; <BR>showflag=0; <BR>} <BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp;tempkey=0x50; <BR>&nbsp; &nbsp;break; <BR>&nbsp; 
                  &nbsp;case 0x01://设置确认菜单 <BR>&nbsp; &nbsp;tm12864_reset(); 
                  <BR>&nbsp; &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR>tm12864_writestr(4,6," 
                  &nbsp; &nbsp; &nbsp;",1); <BR>tm12864_writehz(0,6,mm,0); 
                  <BR>showflag=1; <BR>} <BR>showinitscreen(); 
                  <BR><BR><BR>if((j&lt;6)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>tm12864_writehz(0,6,mm,0); 
                  <BR>tm12864_writestr((j+4),6,"*",1); <BR>tempvar[j]=tempkey; 
                  <BR>j++; <BR>} <BR>if(j==6) <BR>{ <BR>for(j=0;j&lt;6;j++) 
                  <BR>{ <BR>if(tempvar[j]!=x25045_readbyte(PASSWORD_ADDR+j)) 
                  <BR>{ <BR>j=0; <BR>showflag=0; <BR>menuitem=0x00; <BR>break; 
                  <BR>} <BR>} <BR>tm12864_writestr(0,6," &nbsp;",0); 
                  <BR>tm12864_writestr(6,6," &nbsp; &nbsp;",0); 
                  <BR>tm12864_writehz(2,6,set,1); 
                  <BR>tm12864_writehz(10,6,yunxing,0); 
                  <BR>if(tempkey==BUTTON_OK) <BR>{ <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;menuitem=0x03; <BR>&nbsp; &nbsp; &nbsp; &nbsp;j=0; 
                  <BR>&nbsp; &nbsp; &nbsp; &nbsp;submenuitem=0; <BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp;showflag=0; <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;tempvar[0]=1; <BR>&nbsp; &nbsp; &nbsp; &nbsp;} 
                  <BR>&nbsp; &nbsp; &nbsp; &nbsp;} <BR>submenuitem=0; 
                  <BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;if(tempkey==BUTTON_START) 
                  <BR>&nbsp; &nbsp; &nbsp; &nbsp;{ <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;menuitem=0x00; <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;showflag=0; <BR>&nbsp; &nbsp; &nbsp; &nbsp;} 
                  <BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;tempkey=0x50; <BR>break; 
                  <BR>&nbsp; &nbsp;case 0x02://运行确认菜单 <BR>&nbsp; 
                  &nbsp;tm12864_reset(); <BR>&nbsp; &nbsp;if(showflag==0) 
                  <BR>&nbsp; &nbsp;{ <BR>tm12864_fillscreen(0x00); 
                  <BR>showflag=1; <BR>} <BR>showinitscreen(); <BR>&nbsp; 
                  &nbsp;switch(submenuitem) <BR>&nbsp; &nbsp;{ <BR>&nbsp; 
                  &nbsp;case 0x00: <BR>tm12864_writehz(2,6,set,0); 
                  <BR>tm12864_writehz(10,6,yunxing,1); <BR>switch(tempkey) <BR>{ 
                  <BR>case BUTTON_OK: <BR>&nbsp; &nbsp;menuitem=0x00; <BR>&nbsp; 
                  &nbsp;showflag=0; <BR>&nbsp; &nbsp;while(1){}; <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;case BUTTON_STOP: <BR>&nbsp; 
                  &nbsp;case BUTTON_SLAVE: <BR>&nbsp; &nbsp;submenuitem=0x01; 
                  <BR>&nbsp; &nbsp;showflag=0; <BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;} <BR>break; <BR>case 0x01: 
                  <BR>tm12864_writehz(2,6,set,1); 
                  <BR>tm12864_writehz(10,6,yunxing,0); <BR>switch(tempkey) <BR>{ 
                  <BR>case BUTTON_OK: <BR>&nbsp; &nbsp;menuitem=0x03; <BR>&nbsp; 
                  &nbsp;showflag=0; <BR>&nbsp; &nbsp;submenuitem=0x00; 
                  <BR>&nbsp; &nbsp;break; <BR>&nbsp; &nbsp;case BUTTON_START: 
                  <BR>&nbsp; &nbsp;case BUTTON_SLAVE: <BR>&nbsp; 
                  &nbsp;submenuitem=0; <BR>&nbsp; &nbsp;showflag=0; <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;} <BR>break; <BR>} <BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp;tempkey=0x50; <BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;case 0x03://设置菜单 <BR>&nbsp; 
                  &nbsp;tm12864_reset(); <BR>&nbsp; &nbsp;if(showflag==0) 
                  <BR>&nbsp; &nbsp;{ <BR>tm12864_fillscreen(0x00); 
                  <BR>showflag=1; <BR>j=0; <BR>} <BR>&nbsp; 
                  &nbsp;x25045_writestatu(0x00); <BR><BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;// 
                  ******************************************************* 
                  <BR>&nbsp; &nbsp; &nbsp; &nbsp;//加入隐蔽菜单功能 
                  <BR><BR>if((j&lt;6)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>tempvar[j]=tempkey; <BR>j++; <BR>showstr[0]=j+0x30; 
                  <BR>showstr[1]='\0'; <BR>tm12864_writestr(15,7,showstr,0); 
                  <BR>tempkey=0x50; <BR>} <BR><BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;if(j==6) <BR>{ <BR>for(j=0;j&lt;6;j++) <BR>{ <BR>#if 
                  DEBUG <BR>tempvar[j]=x25045_readbyte(0x01a9+j); <BR>#else 
                  <BR>if(tempvar[j]!=x25045_readbyte(0x01a9+j)) <BR>{ <BR>j=0; 
                  <BR>break; <BR>} <BR>#endif <BR>} <BR>if(tempkey==BUTTON_SET) 
                  <BR>{ <BR>&nbsp; &nbsp; &nbsp; &nbsp;menuitem=0x1b; <BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp;j=0; <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;submenuitem=0; <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;showflag=0; <BR>&nbsp; &nbsp; &nbsp; &nbsp;tempvar[0]=1; 
                  <BR>&nbsp; &nbsp; &nbsp; &nbsp;} <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;} <BR>&nbsp; &nbsp; &nbsp; &nbsp;// 
                  ******************************************************* 
                  <BR>&nbsp; &nbsp;switch(submenuitem) <BR>&nbsp; &nbsp;{ 
                  <BR>&nbsp; &nbsp;case 0x00: <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,0,"1 ",1); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,0,scsd,1); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,2,"2 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,2,srsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,4,"3 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,4,lssd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,6,"4 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,6,xtcs,0); <BR><BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;case 0x01: <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,0,"1 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,0,scsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,2,"2 ",1); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,2,srsd,1); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,4,"3 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,4,lssd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,6,"4 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,6,xtcs,0); <BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;case 0x02: <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,0,"1 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,0,scsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,2,"2 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,2,srsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,4,"3 ",1); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,4,lssd,1); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,6,"4 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,6,xtcs,0); <BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;case 0x03: <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,0,"1 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,0,scsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,2,"2 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,2,srsd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,4,"3 ",0); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,4,lssd,0); <BR>&nbsp; 
                  &nbsp;tm12864_writestr(0,6,"4 ",1); <BR>&nbsp; 
                  &nbsp;tm12864_writehz(2,6,xtcs,1); <BR>&nbsp; &nbsp;break; 
                  <BR><BR>&nbsp; &nbsp;} <BR>&nbsp; &nbsp;switch(tempkey) 
                  <BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;case BUTTON_START: 
                  <BR>&nbsp; &nbsp;menuitem=0x02; <BR>&nbsp; 
                  &nbsp;submenuitem=0; <BR>&nbsp; &nbsp;showflag=0; <BR>&nbsp; 
                  &nbsp;break; <BR><BR>&nbsp; &nbsp;case BUTTON_SLAVE: 
                  <BR>&nbsp; &nbsp;if(submenuitem&lt;0x03) <BR>&nbsp; &nbsp;{ 
                  <BR>&nbsp; &nbsp;submenuitem++; <BR>&nbsp; &nbsp;} <BR>&nbsp; 
                  &nbsp;else <BR>&nbsp; &nbsp;{ <BR>&nbsp; 
                  &nbsp;submenuitem=0x00; <BR>&nbsp; &nbsp;} <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;case BUTTON_OK: <BR>&nbsp; 
                  &nbsp;menuitem=0x04+submenuitem; <BR>&nbsp; 
                  &nbsp;//如果密码与隐蔽选单密码相符则进入隐蔽选单 <BR>&nbsp; &nbsp;/* <BR>&nbsp; 
                  &nbsp;if(check_password(HIDEMENU)) <BR>&nbsp; &nbsp;{ 
                  <BR>&nbsp; &nbsp;menuitem=0x20; <BR>&nbsp; &nbsp;}*/ 
                  <BR>&nbsp; &nbsp;submenuitem=0x00; <BR>&nbsp; 
                  &nbsp;tempvar[0]=0x00; <BR>&nbsp; &nbsp;showflag=0; <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;} <BR>&nbsp; &nbsp;tempkey=0x50; 
                  <BR>&nbsp; &nbsp;break; <BR><BR>&nbsp; &nbsp;case 
                  0x04://输出设定菜单 <BR>&nbsp; &nbsp;tm12864_reset(); <BR>&nbsp; 
                  &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR><BR>showflag=1; <BR>} 
                  <BR>tm12864_writehz(0,0,xzhlh,0); <BR>tm12864_writestr(10,0," 
                  &nbsp;",0); <BR>tm12864_writehz(14,0,hao,0); 
                  <BR>tm12864_writehz(0,2,gz,0); 
                  <BR>tm12864_writehz(10,2,fen,0); 
                  <BR>tm12864_writehz(14,2,miao,0); 
                  <BR>tm12864_writehz(0,4,tz,0); 
                  <BR>tm12864_writehz(14,4,miao,0); 
                  <BR>tm12864_writehz(0,6,jg,0);//汉字“间隔”尚未建立 
                  <BR>tm12864_writehz(14,6,miao,0); <BR><BR>if(submenuitem!=7) 
                  <BR>{ <BR>tm12864_writehz(10,4,fen,0); 
                  <BR>tm12864_writehz(10,6,fen,0); <BR><BR>} 
                  <BR><BR>switch(tempkey) <BR>{ <BR>case BUTTON_SLAVE: 
                  <BR>if(submenuitem&lt;7) <BR>{ <BR>submenuitem++; <BR>} 
                  <BR>else <BR>{ <BR>showflag=0; <BR>submenuitem=0; 
                  <BR>tempvar[0]=0; <BR>} 
                  <BR>if((tempvar[0]&gt;32)||(tempvar[0]==0)) <BR>{ 
                  <BR>submenuitem=0; <BR>tempvar[0]=0; <BR>} <BR>else 
                  if(tempvar[2]&gt;59) <BR>{ <BR>submenuitem=2; 
                  <BR>tempvar[2]=0; <BR>} <BR>else if(tempvar[4]&gt;59) <BR>{ 

⌨️ 快捷键说明

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