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

📄 lcd的多屏多层菜单.htm

📁 多屏多层菜单,液晶多屏多层菜单功能程序实现,可方便调用移值.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                  <BR>showflag=0; <BR>} <BR>break; <BR>&nbsp; &nbsp;case 
                  BUTTON_OK: <BR>&nbsp; &nbsp;menuitem=0x0b+submenuitem; 
                  <BR>&nbsp; &nbsp;submenuitem=0x00; <BR>&nbsp; 
                  &nbsp;showflag=0; <BR>&nbsp; &nbsp;for(i=0;i&lt;9;i++) 
                  <BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;tempvar<I>=0; <BR>&nbsp; 
                  &nbsp;} <BR>j=0; <BR>&nbsp; &nbsp;break; <BR>&nbsp; &nbsp;case 
                  BUTTON_STOP: <BR>&nbsp; &nbsp;menuitem=0x03; <BR>&nbsp; 
                  &nbsp;submenuitem=0x02; <BR>&nbsp; &nbsp;showflag=0; 
                  <BR>&nbsp; &nbsp;break; <BR>&nbsp; &nbsp;} <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;case 0x07://系统参数 <BR>&nbsp; 
                  &nbsp; &nbsp; tm12864_reset(); <BR>&nbsp; 
                  &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR>showflag=1; <BR>} 
                  <BR>tm12864_writehz(4,0,xtcs,0); <BR>switch(submenuitem) <BR>{ 
                  <BR>case 0x00: <BR>tm12864_writehz(0,2,srscds,1);//输入输出点数 
                  <BR>tm12864_writehz(0,4,xtsj,0);//系统时间 
                  <BR>tm12864_writehz(0,6,mm,0); <BR>break; <BR>case 0x01: 
                  <BR>tm12864_writehz(0,2,srscds,0);//输入输出点数 
                  <BR>tm12864_writehz(0,4,xtsj,1);//系统时间 
                  <BR>tm12864_writehz(0,6,mm,0); <BR>break; <BR>case 0x02: 
                  <BR>tm12864_writehz(0,2,srscds,0);//输入输出点数 
                  <BR>tm12864_writehz(0,4,xtsj,0);//系统时间 
                  <BR>tm12864_writehz(0,6,mm,1); <BR>break; <BR>} <BR>&nbsp; 
                  &nbsp;switch(tempkey) <BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;case 
                  BUTTON_SLAVE: <BR>if(submenuitem&lt;2) <BR>{ 
                  <BR>submenuitem++; <BR>} <BR>else <BR>{ <BR>submenuitem=0; 
                  <BR>showflag=0; <BR>} <BR>break; <BR>&nbsp; &nbsp;case 
                  BUTTON_OK: <BR>&nbsp; &nbsp;menuitem=0x08+submenuitem; 
                  <BR>&nbsp; &nbsp;submenuitem=0x00; <BR>&nbsp; 
                  &nbsp;showflag=0; <BR>tempvar[0]=0; <BR>&nbsp; 
                  &nbsp;if(menuitem==0x09) <BR>&nbsp; &nbsp;{ <BR>&nbsp; 
                  &nbsp;gettime_12887(); <BR>&nbsp; &nbsp;} <BR>j=0; <BR>&nbsp; 
                  &nbsp;break; <BR>&nbsp; &nbsp;case BUTTON_STOP: <BR>&nbsp; 
                  &nbsp;menuitem=0x03; <BR>&nbsp; &nbsp;submenuitem=0x03; 
                  <BR>&nbsp; &nbsp;showflag=0; <BR>&nbsp; &nbsp;break; 
                  <BR>&nbsp; &nbsp;} <BR>&nbsp; &nbsp;break; <BR>case 
                  0x08://输入输出点数 <BR>tm12864_reset(); <BR>&nbsp; 
                  &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR>showflag=1; <BR>} 
                  <BR>tm12864_writehz(2,0,srscds,0); <BR>if(submenuitem!=0x02) 
                  <BR>{ <BR>tm12864_writehz(0,4,srds,0);//输入点数 
                  <BR>tm12864_writehz(0,6,scds,0);//输出点数 <BR>} 
                  <BR>tm12864_writehz(14,4,dian,0); 
                  <BR>tm12864_writehz(14,6,dian,0); <BR>switch(submenuitem) 
                  <BR>{ <BR>case 0x00: <BR>if(j==0) <BR>{ 
                  <BR>tempvar[1]=x25045_readbyte(INNUMBER); 
                  <BR>tempvar[2]=x25045_readbyte(OUTNUMBER); 
                  <BR>showstr[0]=(tempvar[2]/10+0x30); 
                  <BR>showstr[1]=(tempvar[2]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(12,6,showstr,0); <BR>} 
                  <BR><BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>if(j==0) <BR>{ <BR>tempvar[1]=0; <BR>} 
                  <BR>tempvar[1]=tempvar[1]*0x0a+tempkey; <BR>j++; <BR>} 
                  <BR>showstr[0]=(tempvar[1]/10+0x30); 
                  <BR>showstr[1]=(tempvar[1]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(12,4,showstr,1); <BR>break; <BR>case 
                  0x01: <BR>showstr[0]=(tempvar[1]/10+0x30); 
                  <BR>showstr[1]=(tempvar[1]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(12,4,showstr,0); 
                  <BR><BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>if(j==0) <BR>{ <BR>tempvar[2]=0; <BR>} 
                  <BR>tempvar[2]=tempvar[2]*0x0a+tempkey; <BR>j++; <BR>} 
                  <BR>showstr[0]=(tempvar[2]/10+0x30); 
                  <BR>showstr[1]=(tempvar[2]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(12,6,showstr,1); <BR>break; <BR>case 
                  0x02://确认存储菜单 <BR>tm12864_writehz(4,5,bmp1,0); 
                  <BR>if(tempkey==BUTTON_OK) <BR>{ <BR>//保存参数 <BR>&nbsp; 
                  &nbsp;x25045_init(); <BR>x25045_writeenable(); 
                  <BR>x25045_writebyte(tempvar[1],INNUMBER); 
                  <BR>x25045_writeenable(); 
                  <BR>x25045_writebyte(tempvar[2],OUTNUMBER); 
                  <BR><BR>menuitem=0x07; <BR>submenuitem=0; <BR>showflag=0; 
                  <BR>tempvar[0]=0; <BR>j=0; <BR>} <BR>break; <BR>} 
                  <BR>switch(tempkey) <BR>{ <BR>case BUTTON_SLAVE: 
                  <BR>if(submenuitem&lt;2) <BR>{ <BR>submenuitem++; <BR>} 
                  <BR>else <BR>{ <BR>submenuitem=0; <BR>showflag=0; 
                  <BR>tempvar[0]=0; <BR>} <BR>if(tempvar[1]&gt;12) <BR>{ 
                  <BR>tempvar[1]=0; <BR>submenuitem=0; <BR>} <BR>else 
                  if((tempvar[2]&gt;32)||(tempvar[2]==0)) <BR>{ 
                  <BR>tempvar[2]=0; <BR>submenuitem=1; <BR>} <BR>j=0; <BR>break; 
                  <BR>case BUTTON_STOP: <BR>menuitem=0x07; <BR>submenuitem=0x00; 
                  <BR>showflag=0; <BR>tempvar[0]=0; <BR>j=0; <BR>break; <BR>} 
                  <BR><BR>break; <BR>case 0x09://系统时间 <BR>tm12864_reset(); 
                  <BR>&nbsp; &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR>showflag=1; 
                  <BR>showstr[0]=(tempvar[0]/1000+0x30); 
                  <BR>showstr[1]=((tempvar[0]%1000)/100+0x30); 
                  <BR>showstr[2]=((tempvar[0]%100)/10+0x30); 
                  <BR>showstr[3]=(tempvar[0]%10+0x30); <BR>showstr[4]='\0'; 
                  <BR>tm12864_writestr(0,4,showstr,0); 
                  <BR>showstr[0]=(tempvar[1]/10+0x30); 
                  <BR>showstr[1]=(tempvar[1]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(6,4,showstr,0); 
                  <BR>showstr[0]=(tempvar[2]/10+0x30); 
                  <BR>showstr[1]=(tempvar[2]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(10,4,showstr,0); 
                  <BR>showstr[0]=(tempvar[3]/10+0x30); 
                  <BR>showstr[1]=(tempvar[3]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(2,6,showstr,0); 
                  <BR>showstr[0]=(tempvar[4]/10+0x30); 
                  <BR>showstr[1]=(tempvar[4]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(6,6,showstr,0); <BR>} 
                  <BR>tm12864_writehz(4,0,xtsj,0); 
                  <BR>tm12864_writehz(12,4,ri,0); <BR><BR>if(submenuitem!=5) 
                  <BR>{ <BR>tm12864_writehz(4,4,nian,0); 
                  <BR>tm12864_writehz(8,4,yue,0); 
                  <BR>tm12864_writehz(4,6,shi,0); 
                  <BR>tm12864_writehz(8,6,fen,0); <BR>} <BR>switch(tempkey) 
                  <BR>{ <BR>case BUTTON_SLAVE: <BR>if(submenuitem&lt;5) <BR>{ 
                  <BR>submenuitem++; <BR>} <BR>else <BR>{ <BR>showflag=0; 
                  <BR>submenuitem=0; <BR>&nbsp; &nbsp;gettime_12887(); <BR>} 
                  <BR>if(tempvar[0]&lt;2000) <BR>{ <BR>tempvar[0]=2001; 
                  <BR>submenuitem=0; <BR>} <BR>else 
                  if((tempvar[1]&gt;12)||(tempvar[1]==0)) <BR>{ 
                  <BR>tempvar[1]=0; <BR>submenuitem=1; <BR>} <BR>else 
                  if((tempvar[2]&gt;31)||(tempvar[2]==0)) <BR>{ 
                  <BR>tempvar[2]=0; <BR>submenuitem=2; <BR>} <BR>else 
                  if(tempvar[3]&gt;24) <BR>{ <BR>tempvar[3]=0; 
                  <BR>submenuitem=3; <BR>} <BR>else if(tempvar[4]&gt;59) <BR>{ 
                  <BR>tempvar[4]=0; <BR>submenuitem=4; <BR>} <BR>j=0; <BR>break; 
                  <BR>case BUTTON_STOP: <BR>submenuitem=0x01; <BR>menuitem=0x07; 
                  <BR>showflag=0; <BR>tempvar[0]=0; <BR>j=0; <BR>break; <BR>} 
                  <BR><BR>switch(submenuitem) <BR>{ <BR>case 0://获取年 
                  <BR><BR>if((j&lt;4)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>if(j==0) <BR>{ <BR>tempvar[0]=0; <BR>} 
                  <BR>tempvar[0]=((tempvar[0]*0x0a)+(int)tempkey); <BR>j++; 
                  <BR>} <BR>showstr[0]=(tempvar[0]/1000+0x30); 
                  <BR>showstr[1]=((tempvar[0]%1000)/100+0x30); 
                  <BR>showstr[2]=((tempvar[0]%100)/10+0x30); 
                  <BR>showstr[3]=(tempvar[0]%10+0x30); <BR>showstr[4]='\0'; 
                  <BR>tm12864_writestr(0,4,showstr,1); <BR><BR>break; <BR>case 
                  1://获取月 <BR>showstr[0]=(tempvar[0]/1000+0x30); 
                  <BR>showstr[1]=((tempvar[0]%1000)/100+0x30); 
                  <BR>showstr[2]=((tempvar[0]%100)/10+0x30); 
                  <BR>showstr[3]=(tempvar[0]%10+0x30); <BR>showstr[4]='\0'; 
                  <BR>tm12864_writestr(0,4,showstr,0); 
                  <BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ <BR>if(j==0) 
                  <BR>{ <BR>tempvar[1]=0; <BR>} 
                  <BR>tempvar[1]=((tempvar[1]*0x0a)+(int)tempkey); <BR>j++; 
                  <BR>} <BR>showstr[0]=(tempvar[1]/10+0x30); 
                  <BR>showstr[1]=(tempvar[1]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(6,4,showstr,1); <BR>break; <BR>case 
                  2://获取日 <BR>showstr[0]=(tempvar[1]/10+0x30); 
                  <BR>showstr[1]=(tempvar[1]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(6,4,showstr,0); 
                  <BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ <BR>if(j==0) 
                  <BR>{ <BR>tempvar[2]=0; <BR>} 
                  <BR>tempvar[2]=((tempvar[2]*0x0a)+(int)tempkey); <BR>j++; 
                  <BR>} <BR>showstr[0]=(tempvar[2]/10+0x30); 
                  <BR>showstr[1]=(tempvar[2]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(10,4,showstr,1); <BR>break; <BR>case 
                  3://获取时 <BR>showstr[0]=(tempvar[2]/10+0x30); 
                  <BR>showstr[1]=(tempvar[2]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(10,4,showstr,0); 
                  <BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ <BR>if(j==0) 
                  <BR>{ <BR>tempvar[3]=0; <BR>} 
                  <BR>tempvar[3]=((tempvar[3]*0x0a)+(int)tempkey); <BR>j++; 
                  <BR>} <BR>showstr[0]=(tempvar[3]/10+0x30); 
                  <BR>showstr[1]=(tempvar[3]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(2,6,showstr,1); <BR>break; <BR>case 
                  4://获取分 <BR>showstr[0]=(tempvar[3]/10+0x30); 
                  <BR>showstr[1]=(tempvar[3]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(2,6,showstr,0); 
                  <BR>if((j&lt;2)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ <BR>if(j==0) 
                  <BR>{ <BR>tempvar[4]=0; <BR>} 
                  <BR>tempvar[4]=((tempvar[4]*0x0a)+(int)tempkey); <BR>j++; 
                  <BR>} <BR>showstr[0]=(tempvar[4]/10+0x30); 
                  <BR>showstr[1]=(tempvar[4]%10+0x30); <BR>showstr[2]='\0'; 
                  <BR>tm12864_writestr(6,6,showstr,1); <BR>break; <BR>case 
                  5://确认存储菜单 <BR>tm12864_writehz(4,5,bmp1,0); 
                  <BR>if(tempkey==BUTTON_OK) <BR>{ <BR>settime_12887(); 
                  <BR>menuitem=0x07; <BR>submenuitem=1; <BR>showflag=0; <BR>j=0; 
                  <BR>} <BR>break; <BR><BR>} <BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp;tempkey=0x50; <BR>&nbsp; &nbsp;break; <BR><BR>break; 
                  <BR>case 0x0a://密码 <BR><BR>tm12864_reset(); <BR>&nbsp; 
                  &nbsp;if(showflag==0) <BR>&nbsp; &nbsp;{ 
                  <BR>tm12864_fillscreen(0x00); <BR>} 
                  <BR>tm12864_writehz(2,0,ymm,0); <BR>tm12864_writestr(8,0,": 
                  ",0); <BR>if(submenuitem!=2) <BR>{ 
                  <BR>tm12864_writehz(2,4,xmm,0); <BR>tm12864_writestr(8,4,": 
                  ",0); <BR>} <BR>switch(submenuitem) <BR>{ <BR>case 0://获取旧密码 
                  <BR>if(showflag==0) <BR>{ <BR>tm12864_writestr(0,2," &nbsp; 
                  &nbsp; &nbsp;",1); <BR>showflag=1; <BR>} 
                  <BR><BR>if((j&lt;6)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>tm12864_writestr(j,2,"*",1); <BR>tempvar[j]=tempkey; 
                  <BR>j++; <BR>} <BR>break; <BR>case 1://获取新密码 
                  <BR>tm12864_writestr(0,2,"******",0); <BR>if(showflag==0) 
                  <BR>{ <BR>tm12864_writestr(0,6," &nbsp; &nbsp; &nbsp;",1); 
                  <BR>showflag=1; <BR>} 
                  <BR>if((j&lt;6)&amp;&amp;(tempkey&lt;0x0a)) <BR>{ 
                  <BR>tm12864_writestr(j,6,"*",1); <BR>tempvar[j]=tempkey; 
   

⌨️ 快捷键说明

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