DSP5509的RTC实验-第3篇

1. RTC实时时钟,不在过多介绍,本例程直接调用芯片支持库CSL的库函数,用起来比较简单

 1 main()
 2 {
 3     CSL_init();
 4     printf ("\nTESTING...\n");
 5   
 6     RTC_reset();    // Reset the registers
 7     RTC_config(&myConfig);   // Initialization  
 8     RTC_getConfig(&Config);        
 9     printf ("RTCSEC value is: %x\n",Config.rtcsec);  
10     printf ("RTCMIN value is: %x\n",Config.rtcmin); 
11     printf ("RTCHOUR value is: %x\n",Config.rtchour); 
12     printf ("RTCDAYW value is: %x\n",Config.rtcdayw); 
13     printf ("RTCDAYM value is: %x\n",Config.rtcdaym);        
14     printf ("RTCYEAR value is: %x\n",Config.rtcyear);        
15 
16     RTC_setTime(&myTime);       
17     RTC_getTime(&getTime);
18     printf("Current RTC time is: %x:%x:%x\n",getTime.hour,getTime.minute,getTime.second);
19   
20     RTC_getDate(&getDate);        
21     printf("Current RTC date is: %x/%x/%x\tDay of week: %x\n",getDate.month,getDate.daym,getDate.year,getDate.dayw); 
22       
23     /* Set an alarm at the time specified by myAlarm */         
24     /* Alarm needs to be enabled to occur */
25     RTC_setAlarm(&myAlarm);           
26     printf("Alarm time: %x : %x : %x\tDay of week: %x\n",
27     RTC_FGET(RTCHOURA,HAR),RTC_FGET(RTCMINA,MAR),
28     RTC_FGET(RTCSECA,SAR),RTC_FGET(RTCDAYW,DAR));
29    
30     RTC_start();    // start the RTC running
31 }

2. 感觉和STM32的RTC差不多,比较简单,在本例程中有2个疑问,TMS320C5509和TMS320C5509A有和区别?printf函数打印是什么机制?实际运行的时候,发现程序卡在如下函数,怀疑是标准C库的底层没支持这个函数。

1 printf ("RTCSEC value is: %x\n",Config.rtcsec);

3. 实际测试发现printf可以打印在CCS的console窗口,调试很方便。

posted @ 2017-12-27 19:28  429512065  阅读(455)  评论(0编辑  收藏  举报