📄 lcd多级菜单.txt
字号:
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(10,4,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[3]=0;
}
tempvar[3]=((tempvar[3]*0x0a)+(int)tempkey);
j++;
}
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(2,6,showstr,1);
break;
case 4://获取分
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(2,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[4]=0;
}
tempvar[4]=((tempvar[4]*0x0a)+(int)tempkey);
j++;
}
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(6,6,showstr,1);
break;
case 5://确认存储菜单
tm12864_writehz(4,5,bmp1,0);
if(tempkey==BUTTON_OK)
{
settime_12887();
menuitem=0x07;
submenuitem=1;
showflag=0;
j=0;
}
break;
}
tempkey=0x50;
break;
break;
case 0x0a://密码
tm12864_reset();
if(showflag==0)
{
tm12864_fillscreen(0x00);
}
tm12864_writehz(2,0,ymm,0);
tm12864_writestr(8,0,": ",0);
if(submenuitem!=2)
{
tm12864_writehz(2,4,xmm,0);
tm12864_writestr(8,4,": ",0);
}
switch(submenuitem)
{
case 0://获取旧密码
if(showflag==0)
{
tm12864_writestr(0,2," ",1);
showflag=1;
}
if((j<6)&&(tempkey<0x0a))
{
tm12864_writestr(j,2,"*",1);
tempvar[j]=tempkey;
j++;
}
break;
case 1://获取新密码
tm12864_writestr(0,2,"******",0);
if(showflag==0)
{
tm12864_writestr(0,6," ",1);
showflag=1;
}
if((j<6)&&(tempkey<0x0a))
{
tm12864_writestr(j,6,"*",1);
tempvar[j]=tempkey;
j++;
}
break;
case 2://确认存储菜单
tm12864_writestr(12,6," ",0);
tm12864_writehz(4,5,bmp1,0);
showflag=1;
if(tempkey==BUTTON_OK)
{
x25045_init();
for(i=0;i<6;i++)
{
x25045_writeenable();
x25045_writebyte(tempvar,(PASSWORD_ADDR+i));
tempvar=0;
}
menuitem=0x07;
submenuitem=2;
showflag=0;
j=0;
}
break;
}
switch(tempkey)
{
case BUTTON_SLAVE:
if(submenuitem<2)
{
if(submenuitem==0x00)
{
for(i=0;i<6;i++)
{
if(tempvar!=x25045_readbyte(PASSWORD_ADDR+i))
{
goto jp;
break;
}
}
}
submenuitem++;
}
else
{
submenuitem=0;
}
jp:showflag=0;
j=0;
break;
case BUTTON_STOP:
submenuitem=2;
menuitem=0x07;
showflag=0;
break;
}
break;
case 0x0b://联动回路设定
tm12864_reset();
if(showflag==0)
{
tm12864_fillscreen(0x00);
showflag=1;
}
tm12864_writehz(0,0,xzldz,0);
tm12864_writestr(10,0," ",0);
tm12864_writehz(14,0,zu,0);
tm12864_writehz(0,2,xlhlld,0);
tm12864_writehz(2,4,hao,0);
tm12864_writehz(6,4,hao,0);
tm12864_writehz(10,4,hao,0);
tm12864_writehz(14,4,hao,0);
tm12864_writehz(2,6,hao,0);
tm12864_writehz(6,6,hao,0);
tm12864_writehz(10,6,hao,0);
tm12864_writehz(14,6,hao,0);
if(submenuitem!=7)
{
}
switch(tempkey)
{
case BUTTON_SLAVE:
if(submenuitem<9)
{
submenuitem++;
}
else
{
showflag=0;
submenuitem=0;
tempvar[0]=0;
}
if(tempvar[0]>4)
{
tempvar[0]=0;
submenuitem=0;
}
else
{
for(i=1;i<9;i++)
{
if(tempvar>32)
{
tempvar=0;
submenuitem=i;
break;
}
}
}
j=0;
break;
case BUTTON_STOP:
submenuitem=0x00;
menuitem=0x06;
showflag=0;
tempvar[0]=0;
j=0;
break;
}
switch(submenuitem)
{
case 0://获取回路号
if((j<2)&&(tempkey<0x0a))
{
tempvar[0]=tempvar[0]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[0]/0x0a+0x30);
showstr[1]=(tempvar[0]%0x0a+0x30);
showstr[2]='\0';
tm12864_writestr(12,0,showstr,1);
break;
case 1://获取回路号1
showstr[0]=(tempvar[0]/0x0a+0x30);
showstr[1]=(tempvar[0]%0x0a+0x30);
showstr[2]='\0';
tm12864_writestr(12,0,showstr,0);
if(j==0)
{
if(tempvar[0]!=0)
{
for(i=1;i<9;i++)
{
tempvar=x25045_readbyte((0x01bc+(tempvar[0]-1)*9+i-1));
}
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,4,showstr,0);
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,4,showstr,0);
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,4,showstr,0);
showstr[0]=(tempvar[5]/10+0x30);
showstr[1]=(tempvar[5]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,0);
showstr[0]=(tempvar[6]/10+0x30);
showstr[1]=(tempvar[6]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,0);
showstr[0]=(tempvar[7]/10+0x30);
showstr[1]=(tempvar[7]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,0);
showstr[0]=(tempvar[8]/10+0x30);
showstr[1]=(tempvar[8]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,6,showstr,0);
}
else
{
tempvar[1]=0x00;
tempvar[2]=0x00;
tempvar[3]=0x00;
tempvar[4]=0x00;
tempvar[5]=0x00;
tempvar[6]=0x00;
}
}
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[1]=0;
}
tempvar[1]=((tempvar[1]*0x0a)+(int)tempkey);
j++;
}
showstr[0]=(tempvar[1]/10+0x30);
showstr[1]=(tempvar[1]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,4,showstr,1);
break;
case 2://获取回路号2
showstr[0]=(tempvar[1]/10+0x30);
showstr[1]=(tempvar[1]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,4,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[2]=0;
}
tempvar[2]=tempvar[2]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,4,showstr,1);
break;
case 3://获取回路号3
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,4,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[3]=0;
}
tempvar[3]=tempvar[3]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,4,showstr,1);
break;
case 4://获取回路号4
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,4,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[4]=0;
}
tempvar[4]=tempvar[4]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,4,showstr,1);
break;
case 5://获取回路号5
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,4,showstr,0);
if((j<4)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[5]=0;
}
tempvar[5]=tempvar[5]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[5]/10+0x30);
showstr[1]=(tempvar[5]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,1);
break;
原程序5 [huxiangming] [57次] 01-11-16 下午 10:42:22
case 6://获取回路号6
showstr[0]=(tempvar[5]/10+0x30);
showstr[1]=(tempvar[5]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[6]=0;
}
tempvar[6]=tempvar[6]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[6]/10+0x30);
showstr[1]=(tempvar[6]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,1);
break;
case 7://获取回路号7
showstr[0]=(tempvar[6]/10+0x30);
showstr[1]=(tempvar[6]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[7]=0;
}
tempvar[7]=tempvar[7]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[7]/10+0x30);
showstr[1]=(tempvar[7]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,1);
break;
case 8://获取回路号8
showstr[0]=(tempvar[7]/10+0x30);
showstr[1]=(tempvar[7]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[8]=0;
}
tempvar[8]=tempvar[8]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[8]/10+0x30);
showstr[1]=(tempvar[8]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,6,showstr,1);
break;
case 9://确认存储菜单
tm12864_writehz(4,5,bmp1,0);
if(tempkey==BUTTON_OK)
{
if(tempvar[0]!=0)
{
x25045_init();
//保存联动回路
for(i=0;i<8;i++)
{
x25045_writeenable();
x25045_writebyte(tempvar[i+1],(0x01bc+(tempvar[0]-1)*9+i));
}
}
submenuitem=0;
showflag=0;
tempvar[0]=0x00;
j=0;
}
break;
}
tempkey=0x50;
break;
case 0x0c://互锁回路设定
tm12864_reset();
if(showflag==0)
{
tm12864_fillscreen(0x00);
showflag=1;
}
tm12864_writehz(0,0,xzhsz,0);
tm12864_writestr(10,0," ",0);
tm12864_writehz(14,0,zu,0);
tm12864_writehz(0,2,dang,0);
tm12864_writehz(4,2,hhlqd,0);
tm12864_writehz(0,4,tzxlhl,0);
tm12864_writehz(2,6,hao,0);
tm12864_writehz(6,6,hao,0);
tm12864_writehz(10,6,hao,0);
tm12864_writehz(14,6,hao,0);
if(submenuitem!=7)
{
}
switch(tempkey)
{
case BUTTON_SLAVE:
if(submenuitem<6)
{
submenuitem++;
}
else
{
showflag=0;
submenuitem=0;
tempvar[0]=0;
}
if(tempvar[0]>6)
{
tempvar[0]=0;
submenuitem=0;
}
else
{
for(i=1;i<6;i++)
{
if(tempvar>32)
{
tempvar=0;
submenuitem=i;
break;
}
}
}
j=0;
break;
case BUTTON_STOP:
submenuitem=0x01;
menuitem=0x06;
showflag=0;
tempvar[0]=0;
j=0;
break;
}
switch(submenuitem)
{
case 0://获取互锁组
if((j<2)&&(tempkey<0x0a))
{
tempvar[0]=tempvar[0]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[0]/0x0a+0x30);
showstr[1]=(tempvar[0]%0x0a+0x30);
showstr[2]='\0';
tm12864_writestr(12,0,showstr,1);
break;
case 1://获取回路号1
showstr[0]=(tempvar[0]/0x0a+0x30);
showstr[1]=(tempvar[0]%0x0a+0x30);
showstr[2]='\0';
tm12864_writestr(12,0,showstr,0);
if(j==0)
{
if(tempvar[0]!=0)
{
for(i=1;i<6;i++)
{
tempvar=x25045_readbyte((0x01e0+(tempvar[0]-1)*9+i-1));
}
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,0);
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,0);
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,0);
showstr[0]=(tempvar[5]/10+0x30);
showstr[1]=(tempvar[5]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,6,showstr,0);
}
else
{
tempvar[1]=0x00;
tempvar[2]=0x00;
tempvar[3]=0x00;
tempvar[4]=0x00;
tempvar[5]=0x00;
tempvar[6]=0x00;
}
}
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[1]=0;
}
tempvar[1]=((tempvar[1]*0x0a)+(int)tempkey);
j++;
}
showstr[0]=(tempvar[1]/10+0x30);
showstr[1]=(tempvar[1]%10+0x30);
showstr[2]='\0';
tm12864_writestr(2,2,showstr,1);
break;
case 2://获取回路号2
showstr[0]=(tempvar[1]/10+0x30);
showstr[1]=(tempvar[1]%10+0x30);
showstr[2]='\0';
tm12864_writestr(2,2,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[2]=0;
}
tempvar[2]=tempvar[2]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,1);
break;
case 3://获取回路号3
showstr[0]=(tempvar[2]/10+0x30);
showstr[1]=(tempvar[2]%10+0x30);
showstr[2]='\0';
tm12864_writestr(0,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[3]=0;
}
tempvar[3]=tempvar[3]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,1);
break;
case 4://获取回路号4
showstr[0]=(tempvar[3]/10+0x30);
showstr[1]=(tempvar[3]%10+0x30);
showstr[2]='\0';
tm12864_writestr(4,6,showstr,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[4]=0;
}
tempvar[4]=tempvar[4]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,1);
break;
case 5://获取回路号5
showstr[0]=(tempvar[4]/10+0x30);
showstr[1]=(tempvar[4]%10+0x30);
showstr[2]='\0';
tm12864_writestr(8,6,showstr,0);
if((j<4)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[5]=0;
}
tempvar[5]=tempvar[5]*0x0a+tempkey;
j++;
}
showstr[0]=(tempvar[5]/10+0x30);
showstr[1]=(tempvar[5]%10+0x30);
showstr[2]='\0';
tm12864_writestr(12,6,showstr,1);
break;
case 6://确认存储菜单
tm12864_writehz(4,5,bmp1,0);
if(tempkey==BUTTON_OK)
{
if(tempvar[0]!=0)
{
x25045_init();
//保存互锁回路
for(i=0;i<8;i++)
{
x25045_writeenable();
x25045_writebyte(tempvar[i+1],(0x01e0+(tempvar[0]-1)*9+i));
}
}
submenuitem=0;
showflag=0;
tempvar[0]=0x00;
j=0;
}
break;
}
tempkey=0x50;
break;;
case 0x1a://手动处理
tm12864_reset();
if(showflag==0)
{
tm12864_fillscreen(0x00);
showflag=1;
}
tm12864_writehz(4,0,sdyx,0);
tm12864_writehz(0,2,xzschl,0);
tm12864_writehz(14,2,hao,0);
if((j<2)&&(tempkey<0x0a))
{
if(j==0)
{
tempvar[0]=0;
}
tempvar[0]=tempvar[0]*0x0a+tempkey;
j++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -