Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
rtc.c
Package: arm_exam.rar [view]
Upload User: mhstny
Upload Date: 2022-08-05
Package Size: 793k
Code Size: 3k
Category:
ARM-PowerPC-ColdFire-MIPS
Development Platform:
Unix_Linux
- #include "2410lib.h"
- #include "2410addr.h"
- int year;
- int month,date,weekday,hour,min,sec;
- char *week[8] = { "","SUN","MON", "TUES", "WED", "THURS","FRI", "SAT" } ;
- void __irq RTC_ISR(void);
- /********************************************************************
- Function name: Rtc_Init
- Parameter : void
- Description : 实时时钟初始化程序
- Return : void
- Argument : 设置当前时钟
- Autor & date :
- *********************************************************************/
- void Rtc_Init(void)
- {
- rRTCCON = 0x01; //RTC读写使能,选择BCD时钟、计数器,无复位,1/32768
- rBCDYEAR = 0x06 ; //设定年--06
- rBCDMON = 0x04 ; //设定月--04
- rBCDDATE = 0x04 ; //设定日--04
- rBCDDAY = 0x2 ; //设定星期--TUES
- rBCDHOUR = 0x05 ; //设定小时--05
- rBCDMIN = 0x12 ; //设定分钟--12
- rBCDSEC = 0x12 ; //设定秒--11
- rRTCCON = 0x0; //RTC读写禁止,选择BCD时钟、计数器,无复位,1/32768
- }
- /********************************************************************
- Function name: Display_Rtc
- Parameter : void
- Description : 实时时钟显示程序
- Return : void
- Argument : 读出当前的时间,然后显示
- Autor & date :
- *********************************************************************/
- void Get_Rtc(void)
- {
- rRTCCON = 0x01; //RTC读写使能,选择BCD时钟、计数器,无复位,1/32768
- if (rBCDYEAR == 0x99)
- year = 0x1999;
- else
- year = 0x2000 + rBCDYEAR;
- month=rBCDMON;
- date=rBCDDATE;
- weekday=rBCDDAY;
- hour=rBCDHOUR;
- min=rBCDMIN;
- sec=rBCDSEC;
- rRTCCON = 0x0; //RTC读写禁止,选择BCD时钟、计数器,无复位,1/32768
- }
- /***************************************************************************
- Function name: Main
- Parameter : void
- Description : 初始化系统,串口,并调用RTC实验函数
- Return : void
- Argument :
- Autor & date :
- ****************************************************************************/
- void xmain(void)
- {
- ChangeClockDivider(1,1);
- ChangeMPllValue(0xa1,0x3,0x1);
- Port_Init();
- Uart_Select(0);
- Uart_Init(0,115200);
- Uart_Printf("s3c2410x RTC Testn");
- Rtc_Init(); //实时时钟初始化
- pISR_TICK=(unsigned)RTC_ISR;
- EnableIrq(BIT_TICK);//open RTC TICK INTERRUPT
- rTICNT=0xFF;//Tick time interrupt enable;Tick time count value=127
- while(1);
- }
- /*************************************************************************/
- void __irq RTC_ISR(void)
- {
- Get_Rtc();
- Uart_Printf("RTC TIME : %4x-%02x-%02x - %s - %02x:%02x:%02xn",year,month,date,week[weekday],hour,min,sec);
- ClearPending(BIT_TICK);
- }