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

📄 init.c

📁 blackfin531处理器实时时钟程序,一秒一秒走,适用于初学者学习硬件blackfin系列dsp编程
💻 C
字号:
#include <cdefBF532.h>
#include <sys\exception.h>     //contain interrupt_kind enumeration 


EX_INTERRUPT_HANDLER(RTC_ISR);


void Init_RTC(void)
{
    *pRTC_ICTL = 0x4;
    *pRTC_PREN = 0x1;
    
//   int current_time = *pRTC_STAT;
//   printD("time is %x", current_time);
   
}



void Init_Interrupts(void)
{
    *pSIC_IAR0 = 0x1fffffff;
	*pSIC_IAR1 = 0xffffffff;
	*pSIC_IAR2 = 0xffffffff;					// RTC

	// assign ISRs to interrupt vectors
	register_handler(ik_ivg8, RTC_ISR);		// RTC ISR -> IVG 8

	// enable RTC interrupt
	*pSIC_IMASK = 0x00000080;

}



EX_INTERRUPT_HANDLER(RTC_ISR)
{

	// confirm interrupt handling
	*pRTC_ISTAT = 0x0004;
	
	int sec,min,hor,day,time;

	time = *pRTC_STAT;
	
	sec = time & 0x3f;
	min = (time>>6) & 0x3f;
	hor = (time>>12) & 0x1f;
	day = (time>>17) & 0x7fff;
	
	printD("\nTime is %d:%d:%d:%d\n",day,hor,min,sec);


}

⌨️ 快捷键说明

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