想请问下这段代码中按键具体功能
时间:10-02
整理:3721RD
点击:
这段代码的这几个按键具体用了会怎么样
while(1)
{
flag=0;
flag5=1;
flag2_1=0;
num=0;
setlong=0;
setang=0;
setR=0;
resetmot();
Write_LCD_Command(0x01); //???á
delay_ms(2);
Write_LCD_Command(0x30); //±?D??ù′?′ò?a?ù±???á?£?òò?a??í??aá?à?3???á?
Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864);
while(Key_Scan(GPIOB,GPIO_Pin_1) !=0)
{
if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
if(num<7)
num++;
else
num=7;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(num>0)
num--;
else
num=1;
}
switch(num)
{
case 0:break;
case 1: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1, "?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 2: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 ," ?£ê?ò? ",time12864);
Display_LCD_String(2, "?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 3: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 ," ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, "?£ê?èy ",time12864); break;
case 4: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 , " ?£ê??t ",time12864);
Display_LCD_String(2, " ?£ê?èy ",time12864);
Display_LCD_String(3, "?£ê??? ",time12864); break;
case 5: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , "?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 6: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, "?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 7: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, "?£ê?èy ",time12864); break;
}
}
while(Key_Scan(GPIOA,GPIO_Pin_4) != 0)
{
switch(num)
{
case 0:break;
case 1:
Display_LCD_String(0 , " ?£ê?ò?2?êy ",time12864);
Display_LCD_String(1, "?T2?êyéè?? ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
case 2:
if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setlong+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setlong>0)
setlong-=5;
else
setlong=0;
}
Table2[12]=shuzi[setlong/10];
Table2[13]=shuzi[setlong%10];
Display_LCD_String(0 , " ?£ê??t2?êy ",time12864);
Display_LCD_String(2,Table2,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 3: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setang+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setang>0)
setang-=5;
else
setang=0;
}
Table3[10]=shuzi[(unsigned int)setang/100];
Table3[12]=shuzi[(unsigned int)setang%100/10];
Table3[13]=shuzi[(unsigned int)setang%10];
Display_LCD_String(0 , " ?£ê?èy2?êy ",time12864);
Display_LCD_String(2,Table3,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 4: Display_LCD_String(0 , " ?£ê???2?êy ",time12864);
Display_LCD_String(1, "?T2?êyéè?? ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
case 5: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setR+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setR>0)
setR-=5;
else
setR=0;
}
Table5[12]=shuzi[setR/10];
Table5[13]=shuzi[setR%10];
Display_LCD_String(0 , " ?£ê???2?êy ",time12864);
Display_LCD_String(2,Table5,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 6: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setR+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setR>0)
setR-=5;
else
setR=0;
}
Table5[12]=shuzi[setR/10];
Table5[13]=shuzi[setR%10];
Display_LCD_String(0 , " ?£ê?áù2?êy ",time12864);
Display_LCD_String(2,Table5,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 7:
flag7=1;
Display_LCD_String(0 , " ?£ê?èy2?êy ",time12864);
Display_LCD_String(1, " oo×?êéD′ ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
}
}
while(Key_Scan(GPIOB,GPIO_Pin_0) != 0)
{
switch(num)
{
case 0: break;
case 1: mode1();break;
case 2: mode2();break;
case 3: mode3();break;
case 4:flag=4;break;
case 5: mode5();break;
case 6: mode5();break;
case 7:mode7();break;
}
}
}
}
while(1)
{
flag=0;
flag5=1;
flag2_1=0;
num=0;
setlong=0;
setang=0;
setR=0;
resetmot();
Write_LCD_Command(0x01); //???á
delay_ms(2);
Write_LCD_Command(0x30); //±?D??ù′?′ò?a?ù±???á?£?òò?a??í??aá?à?3???á?
Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864);
while(Key_Scan(GPIOB,GPIO_Pin_1) !=0)
{
if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
if(num<7)
num++;
else
num=7;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(num>0)
num--;
else
num=1;
}
switch(num)
{
case 0:break;
case 1: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1, "?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 2: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 ," ?£ê?ò? ",time12864);
Display_LCD_String(2, "?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 3: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 ," ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, "?£ê?èy ",time12864); break;
case 4: Display_LCD_String(0 , " ?ù±?2?·? ",time12864);
Display_LCD_String(1 , " ?£ê??t ",time12864);
Display_LCD_String(2, " ?£ê?èy ",time12864);
Display_LCD_String(3, "?£ê??? ",time12864); break;
case 5: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , "?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 6: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, "?£ê??t ",time12864);
Display_LCD_String(3, " ?£ê?èy ",time12864); break;
case 7: Display_LCD_String(0 , " ·¢?ó2?·? ",time12864);
Display_LCD_String(1 , " ?£ê?ò? ",time12864);
Display_LCD_String(2, " ?£ê??t ",time12864);
Display_LCD_String(3, "?£ê?èy ",time12864); break;
}
}
while(Key_Scan(GPIOA,GPIO_Pin_4) != 0)
{
switch(num)
{
case 0:break;
case 1:
Display_LCD_String(0 , " ?£ê?ò?2?êy ",time12864);
Display_LCD_String(1, "?T2?êyéè?? ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
case 2:
if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setlong+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setlong>0)
setlong-=5;
else
setlong=0;
}
Table2[12]=shuzi[setlong/10];
Table2[13]=shuzi[setlong%10];
Display_LCD_String(0 , " ?£ê??t2?êy ",time12864);
Display_LCD_String(2,Table2,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 3: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setang+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setang>0)
setang-=5;
else
setang=0;
}
Table3[10]=shuzi[(unsigned int)setang/100];
Table3[12]=shuzi[(unsigned int)setang%100/10];
Table3[13]=shuzi[(unsigned int)setang%10];
Display_LCD_String(0 , " ?£ê?èy2?êy ",time12864);
Display_LCD_String(2,Table3,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 4: Display_LCD_String(0 , " ?£ê???2?êy ",time12864);
Display_LCD_String(1, "?T2?êyéè?? ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
case 5: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setR+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setR>0)
setR-=5;
else
setR=0;
}
Table5[12]=shuzi[setR/10];
Table5[13]=shuzi[setR%10];
Display_LCD_String(0 , " ?£ê???2?êy ",time12864);
Display_LCD_String(2,Table5,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 6: if(Key_Scan(GPIOB,GPIO_Pin_12) == 0)
{
setR+=5;
}
if(Key_Scan(GPIOB,GPIO_Pin_13) == 0)
{
if(setR>0)
setR-=5;
else
setR=0;
}
Table5[12]=shuzi[setR/10];
Table5[13]=shuzi[setR%10];
Display_LCD_String(0 , " ?£ê?áù2?êy ",time12864);
Display_LCD_String(2,Table5,time12864);
Display_LCD_String(3, " ",time12864);
Display_LCD_String(1, " ",time12864); break;
case 7:
flag7=1;
Display_LCD_String(0 , " ?£ê?èy2?êy ",time12864);
Display_LCD_String(1, " oo×?êéD′ ",time12864);
Display_LCD_String(2, " ",time12864);
Display_LCD_String(3, " ",time12864); break;
}
}
while(Key_Scan(GPIOB,GPIO_Pin_0) != 0)
{
switch(num)
{
case 0: break;
case 1: mode1();break;
case 2: mode2();break;
case 3: mode3();break;
case 4:flag=4;break;
case 5: mode5();break;
case 6: mode5();break;
case 7:mode7();break;
}
}
}
}
看看include里面的引用,有没有详细的keyscan代码。