完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
大神们小弟有个程序还是不懂,这个程序运行后,在lcd需要经过好长时间才走秒,而且一秒的时间太长,大概有实际的五秒间隔,这要怎样修改?
#include "config.h" #include "display.h" #define RTC_NUM 13 #define tiMER0NUM 4 #define uchar unsigned char #define uint unsigned int #define yearposi 0 #define monthposi 4 #define dayposi 6 #define hourposi 0 #define minposi 2 #define secposi 4 uint32 timer1cnt; uint8 secflag,month,day,hour,min,sec,week,year,ctemp; uint8 exint1flag; uint8 premonth,preday,prehour,premin,presec,preyear,prectemp; uint32 timet,datet; uint8 time0flag,time1flag; void RTC_init(void) { CCR=0X12; CIIR=0X01; ILR=0X03; YEAR=2013; MONTH=07; DOM=05; DOW=5; HOUR=11; MIN=11; SEC=06; CCR=0X11; secflag=0; } void __irq RTC_int(void) { timet=CTIME0; datet=CTIME1; sec=timet&0x3f; min=(timet>>8)&0x3f; hour=(timet>>16)&0x1f; week=(timet>>24)&0x07; day=datet&0x1f; month=(datet>>8)&0x0f; year=((datet>>16)&0x0fff)%100; ILR=0X01; VICVectAddr=0x00; secflag=1; } void RTC_int_ini(void) { VICIntSelect&=~(1< VICVectAddr2=(uint32)RTC_int; VICIntEnable=(1< void init_port(void) { //port initialized IO1DIR=0x00FF0000; IO0DIR=0x40600010; } void init_timer0(void) { T0TCR=0X00; T0TC=0X00; T0PR=0; T0MR0=Fpclk/2; T0MCR=0X03; T0TCR=0X01; } void timer0process(void) { if(time0flag==1) { time0flag=0; } } void __irq timer0_int(void) { time0flag=1; T0IR=0X01; VICVectAddr=0x00; } void init_timer0_int(void) { VICIntSelect&=~(1< VICVectAddr0=(uint32)timer0_int; VICIntEnable=1< void freshdatetime() { if(secflag==1) { if(preyear!=year) { Displaydate(year,yearposi); preyear=year; } if(premonth!=month) { Displaydate(month,monthposi); premonth=month; } if(preday!=day) { Displaydate(day,dayposi); displayweek(week); preday=day; } if(prehour!=hour) { Displaytime(hour,hourposi); prehour=hour; } if(premin!=min) { Displaytime(min,minposi); premin=min; } if(presec!=sec) { Displaytime(sec,secposi); presec=sec; } secflag=0; } } void int_enable(void) { init_timer0_int(); } int main (void) {// add user source code timer1cnt=0; init_port(); Lcd_Init(); RTC_init(); RTC_int_ini(); init_timer0(); int_enable(); while(1) { freshdatetime(); timer0process(); } } |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
飞凌嵌入式ElfBoard ELF 1板卡-CAN编程示例之开发板测试
699 浏览 0 评论
该问题是用APP给芯海科技的CST92F25芯片发指令是出现的
2350 浏览 1 评论
809 浏览 0 评论
1573 浏览 1 评论
2357 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 19:27 , Processed in 0.524264 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号