|
大家好:
想实现RTC的中断,即TICK TIME INTERRUPT,数据手册里的内容:The RTC tick time is used for interrupt request;The TICNT register has an interrupt enable bit and the count value for the interrupt. The count value reaches '0' when the tick time interrupt occurs. Then the period of interrupt is as follows:
— Period = ( n+1 ) / 128 second
— n: Tick time count value (1~127)
This RTC time tick may be used for real time operating system (RTOS) kernel time tick.
我就想在正常操作模式下产生中断的时候在LCD上显示一张图片,但我写这样的程序不能实现,根本就没有进入中断服务程序。恳求帮助,谢谢!具体见附件!
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
//#define BIT_RTC (0x1<<30)
extern unsigned char TQ_LOGO_320240[];//自定义的图片
//==================================================================================
void RTC_Time_Set( void )
{
rRTCCON = 1 ; //RTC read and write enable
rBCDYEAR = 0x08 ; //年
rBCDMON = 0x11 ; //月
rBCDDATE = 0x07 ; //日
rBCDDAY = 0x05 ; //星期
rBCDHOUR = 0x12 ; //小时
rBCDMIN = 0x00 ; //分
rBCDSEC = 0x00 ; //秒
//rRTCCON &= ~1 ; //RTC read and write disable
}
static void __irq RTC_ISR(void)
{
Paint_Bmp(0, 0, 320, 240, TQ_LOGO_320240);
//rTICNT=1<<7|0x1f;
ClearPending(BIT_RTC);
rINTMSK&=~BIT_RTC;
Uart_Printf( "\nRTC TIME RTC_ISR !\n" ) ;
}
void RTC_Time_Init(void)
{
pISR_RTC = (U32)RTC_ISR;
rTICNT=(1<<7)|0x7f;
ClearPending(BIT_RTC);
rINTMSK&=~BIT_RTC;
rRTCALM=0xff;
rRTCCON &= ~1 ; //RTC read and write disable
}
//==================================================================================
void RTC_Display(void)
{
U16 year ;
U8 month, day ; // week
U8 hour, minute, second ;
RTC_Time_Set() ;
RTC_Time_Init();
Uart_Printf( "\nRTC TIME Display, press ESC key to exit !\n" ) ;
while( Uart_GetKey() != ESC_KEY )
{
rRTCCON = 1 ; //RTC read and write enable
year = 0x2000+rBCDYEAR ; //年
month = rBCDMON ; //月
day = rBCDDATE ; //日
// week = rBCDDAY ; //星期
hour = rBCDHOUR ; //小时
minute = rBCDMIN ; //分
second = rBCDSEC ; //秒
rRTCCON &= ~1 ; //RTC read and write disable
Uart_Printf( "RTC time : %04x-%02x-%02x %02x:%02x:%02x\n", year, month, day, hour, minute, second );
Delay( 300 ) ;
}
} |
|