?? rtc.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 + -