⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtc.c

📁 TI5509A-DSP-192*64液晶显示驱动
💻 C
字号:

/*****************************************************************************
  Filename:	    native.c
  Version:	    0.01
  Description:  DSP RealTime Clock
  Returns:     BCD result
  Revision History:	 
  EQH-01,  屈宵军  04/02/05, - Original release
*****************************************************************************/
#include <csl_rtc.h>
#include <csl_time.h>
#include <tms320.h>
#include "cpu_reg.h"
char  string[40];
time_t rtcTime; 
RTC_Time getTime;     
time_t *timer = NULL;     
size_t maxsz = 40;
//	char *outTime = string;
struct tm* realTime; 
time_t* lcl;
//unsigned  Globle_var=0;
RTC_Date myDate = {
     0x05,     /* Year */
     0x04,     /* Month */
     0x06,     /* Daym */
     0x03,     /* Dayw */
};

RTC_Time myTime = {
     0x15,     /* Hour */      
     0x45,     /* Minutes */
     0x00,     /* Seconds */
};

RTC_Alarm myAlarm = {
     0x01,     /* alHour */  
     0x59,     /* alMinutes - every minute */
     0x03,     /* alSeconds */
     0x05,     /* alDayw */
};

void realtimeclock(void)
{
  	
  	CSL_init();
    RTC_reset();    // Reset the registers
   // Delay(3000);
    RTC_setTime(&myTime);
   // Delay(3000); 
    RTC_setDate(&myDate);
   // Delay(3000);
    RTC_start();    // start the RTC running
   // Delay(3000);

}
void RTC_DISPLY(void) 
    {
     int temp=0;
//	CSL_init();
    temp=ST1_55;
    ST1_55=0x4900;
 	rtcTime = RTC_time(timer);  
        
    RTC_getTime(&getTime);
	 
	/* Convert calendar time to local time */
	lcl = &rtcTime;   
	realTime = RTC_localtime(lcl); 
	
	/* Format the time into a character string */
	RTC_strftime(string, maxsz, "%c\n", realTime);        
    ST1_55=temp;
   // Globle_var=strlen(string);     
	} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -