完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我按加减的键,key的值会随机的发生改变,时钟调时老是不行,是哪里问题,各位大哥指点啊
void Systick_Handler(void){ num++;if(num==10){num=0;miao++;if(miao>=60){fen++;miao=0;if(fen>=60){ shi++; fen=0; if(shi>=24) { week++; ri++; shi=0; if(week>=8) { week=1; } GUI_Rectangle(96,126,128,174,0xffff,1); dis_32_48(96,126,week,(u16 *)picture); if(ri>=32) { ri=1; month++; if(month>=13) { month=1; year++; if(year>=10000) { year=0; } year1=year/1000; year2=(year%1000)/100; year3=(year%100)/10; year4=(year%10); GUI_Rectangle(96,10,192,58,0xffff,1); dis_32_48(96,10,year1,(u16 *)picture); dis_32_48(128,10,year2,(u16 *)picture); dis_32_48(160,10,year3,(u16 *)picture); dis_32_48(192,10,year4,(u16 *)picture); } month1=month/10; month2=month%10; GUI_Rectangle(64,68,128,116,0xffff,1); dis_32_48(64,68,month1,(u16 *)picture); dis_32_48(96,68,month2,(u16 *)picture); } ri1=ri/10; ri2=ri%10; GUI_Rectangle(200,68,264,116,0xffff,1); dis_32_48(200,68,ri1,(u16 *)picture); dis_32_48(232,68,ri2,(u16 *)picture); } shi1=shi/10; shi2=shi%10; GUI_Rectangle(0,184,64,232,0xffff,1); dis_32_48(0,184,shi1,(u16 *)picture); dis_32_48(32,184,shi2,(u16 *)picture);}fen1=fen/10;fen2=fen%10;GUI_Rectangle(96,184,162,232,0xffff,1);dis_32_48(96,184,fen1,(u16 *)picture);dis_32_48(128,184,fen2,(u16 *)picture);}miao1=miao/10;miao2=miao%10;GUI_Rectangle(192,184,256,232,0xffff,1);dis_32_48(192,184,miao1,(u16 *)picture);dis_32_48(224,184,miao2,(u16 *)picture); }//num1=num/100; // num2=num/10;//num3=num%10;//GUI_Rectangle(144,34,192,58,0x0000,1);//zifu_16_24(144,34,num1,0x07e0); // zifu_16_24(160,34,num2,0x07e0);//zifu_16_24(176,34,num3,0x07e0); } void EXTI0_IRQHandler(void)//WA键,就是右键,keynum3{ Delay(0x2fff); if(EXTI_GetITStatus(EXTI_Line0) != RESET) { switch(key) { case 1:miao++;if(miao>=60)miao=0; miao1=miao/10; miao2=miao%10; GUI_Rectangle(192,184,256,232,0xffff,1); dis_32_48(192,184,miao1,(u16 *)picture); dis_32_48(224,184,miao2,(u16 *)picture);break; case 2:fen++;if(fen>=60)fen=0; fen1=fen/10; fen2=fen%10; GUI_Rectangle(96,184,162,232,0xffff,1); dis_32_48(96,184,fen1,(u16 *)picture); dis_32_48(130,184,fen2,(u16 *)picture); break; case 3:shi++;if(shi>=24)shi=0; shi1=shi/10; shi2=shi%10; GUI_Rectangle(0,184,64,232,0xffff,1); dis_32_48(0,184,shi1,(u16 *)picture); dis_32_48(32,184,shi2,(u16 *)picture); break; case 4:ri++;if(ri>=32)ri=1; ri1=ri/10; ri2=ri%10; GUI_Rectangle(200,68,264,116,0xffff,1); dis_32_48(200,68,ri1,(u16 *)picture); dis_32_48(232,68,ri2,(u16 *)picture); break; case 5:week++;if(week>=8)week=1; GUI_Rectangle(96,126,128,174,0xffff,1); dis_32_48(96,126,week,(u16 *)picture); break; case 6:month++;if(month>=13)month=1; month1=month/10; month2=month%10; GUI_Rectangle(64,68,128,116,0xffff,1); dis_32_48(64,68,month1,(u16 *)picture); dis_32_48(96,68,month2,(u16 *)picture); break; case 7:year++;if(year>=10000)year=0; year1=year/1000; year2=(year%1000)/100; year3=(year%100)/10; year4=(year%10); GUI_Rectangle(96,10,192,58,0xffff,1); dis_32_48(96,10,year1,(u16 *)picture); dis_32_48(128,10,year2,(u16 *)picture); dis_32_48(160,10,year3,(u16 *)picture); dis_32_48(192,10,year4,(u16 *)picture); break; } EXTI_ClearFlag(EXTI_Line0); } }void EXTI9_5_IRQHandler(void)//user1键,下键,keynum4{ Delay(0x2ffff); if(EXTI_GetITStatus(EXTI_Line8) != RESET) { key++; if(key>=8) { key=0; } EXTI_ClearFlag(EXTI_Line8); } }void EXTI15_10_IRQHandler(void) //TAM键,左键,keynum1{ Delay(0x2ffff); if(EXTI_GetITStatus(EXTI_Line13) != RESET) { switch(key) { case 1:miao--;if(miao<0)miao=59; miao1=miao/10; miao2=miao%10; GUI_Rectangle(192,184,256,232,0xffff,1); dis_32_48(192,184,miao1,(u16 *)picture); dis_32_48(224,184,miao2,(u16 *)picture);break; case 2:fen--;if(fen<0)fen=59; fen1=fen/10; fen2=fen%10; GUI_Rectangle(96,184,160,232,0xffff,1); dis_32_48(96,184,fen1,(u16 *)picture); dis_32_48(130,184,fen2,(u16 *)picture); break; case 3:shi--;if(shi<0)shi=23; shi1=shi/10; shi2=shi%10; GUI_Rectangle(0,184,64,232,0xffff,1); dis_32_48(0,184,shi1,(u16 *)picture); dis_32_48(32,184,shi2,(u16 *)picture); break; case 4:ri--;if(ri<1)ri=31; ri1=ri/10; ri2=ri%10; GUI_Rectangle(200,68,264,116,0xffff,1); dis_32_48(200,68,ri1,(u16 *)picture); dis_32_48(232,68,ri2,(u16 *)picture); break; case 5:week--;if(week<1)week=7; GUI_Rectangle(96,126,128,174,0xffff,1); dis_32_48(96,126,week,(u16 *)picture); break; case 6:month--;if(month<1)month=12; month1=month/10; month2=month%10; GUI_Rectangle(64,68,128,116,0xffff,1); dis_32_48(64,68,month1,(u16 *)picture); dis_32_48(96,68,month2,(u16 *)picture); break; case 7:year--;if(year<0)year=9999; year1=year/1000; year2=(year%1000)/100; year3=(year%100)/10; year4=(year%10); GUI_Rectangle(96,10,192,58,0xffff,1); dis_32_48(96,10,year1,(u16 *)picture); dis_32_48(128,10,year2,(u16 *)picture); dis_32_48(160,10,year3,(u16 *)picture); dis_32_48(192,10,year4,(u16 *)picture); break; } EXTI_ClearFlag(EXTI_Line13); } } |
|
相关推荐
2个回答
|
|
仿真跟踪一下看看。
|
|
|
|
几百行代码? 你觉得谁有时间帮你一行行看?
|
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1532 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1484 浏览 1 评论
901 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
649 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1528 浏览 2 评论
1841浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
589浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
491浏览 3评论
490浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
471浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-2 21:16 , Processed in 0.743828 second(s), Total 84, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号