完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
这段代码的这几个按键具体用了会怎么样
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); //±ØÐëÔٴδò¿ª»ù±¾Ö¸ÁÒòΪ»æͼ¿ªÁËÀ©³äÖ¸Áî Display_LCD_String(0 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(1 , " ģʽһ ",time12864); Display_LCD_String(2, " ģʽ¶þ ",time12864); Display_LCD_String(3, " ģʽÈý ",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 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(1, "ģʽһ ",time12864); Display_LCD_String(2, " ģʽ¶þ ",time12864); Display_LCD_String(3, " ģʽÈý ",time12864); break; case 2: Display_LCD_String(0 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(1 ," ģʽһ ",time12864); Display_LCD_String(2, "ģʽ¶þ ",time12864); Display_LCD_String(3, " ģʽÈý ",time12864); break; case 3: Display_LCD_String(0 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(0 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(1 ," ģʽһ ",time12864); Display_LCD_String(2, " ģʽ¶þ ",time12864); Display_LCD_String(3, "ģʽÈý ",time12864); break; case 4: Display_LCD_String(0 , " »ù±¾²¿·Ö ",time12864); Display_LCD_String(1 , " ģʽ¶þ ",time12864); Display_LCD_String(2, " ģʽÈý ",time12864); Display_LCD_String(3, "ģʽËÄ ",time12864); break; case 5: Display_LCD_String(0 , " ·¢»Ó²¿·Ö ",time12864); Display_LCD_String(1 , "ģʽһ ",time12864); Display_LCD_String(2, " ģʽ¶þ ",time12864); Display_LCD_String(3, " ģʽÈý ",time12864); break; case 6: Display_LCD_String(0 , " ·¢»Ó²¿·Ö ",time12864); Display_LCD_String(1 , " ģʽһ ",time12864); Display_LCD_String(2, "ģʽ¶þ ",time12864); Display_LCD_String(3, " ģʽÈý ",time12864); break; case 7: Display_LCD_String(0 , " ·¢»Ó²¿·Ö ",time12864); Display_LCD_String(1 , " ģʽһ ",time12864); Display_LCD_String(2, " ģʽ¶þ ",time12864); Display_LCD_String(3, "ģʽÈý ",time12864); break; } } while(Key_Scan(GPIOA,GPIO_Pin_4) != 0) { switch(num) { case 0:break; case 1: Display_LCD_String(0 , " ģʽһ²ÎÊý ",time12864); Display_LCD_String(1, "ÎÞ²ÎÊýÉèÖà ",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 , " ģʽ¶þ²ÎÊý ",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 , " ģʽÈý²ÎÊý ",time12864); Display_LCD_String(2,Table3,time12864); Display_LCD_String(3, " ",time12864); Display_LCD_String(1, " ",time12864); break; case 4: Display_LCD_String(0 , " ģʽËIJÎÊý ",time12864); Display_LCD_String(1, "ÎÞ²ÎÊýÉèÖà ",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 , " ģʽÎå²ÎÊý ",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 , " ģʽÁù²ÎÊý ",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 , " ģʽÈý²ÎÊý ",time12864); Display_LCD_String(1, " ºº×ÖÊéд ",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; } } } } |
|
相关推荐
1个回答
|
|
看看include里面的引用,有没有详细的keyscan代码。
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1187 浏览 0 评论
AD7686芯片不传输数据给STM32,但是手按住就会有数据。
1122 浏览 2 评论
2223 浏览 0 评论
如何解决MPU-9250与STM32通讯时,出现HAL_ERROR = 0x01U
1311 浏览 1 评论
hal库中i2c卡死在HAL_I2C_Master_Transmit
1735 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 19:50 , Processed in 0.809179 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号