天嵌 ARM开发社区

 找回密码
 注册
查看: 1430|回复: 0

RTC的中断问题

[复制链接]
liujialin125 发表于 2010-11-2 17:57:43 | 显示全部楼层 |阅读模式
大家好:
       想实现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 ) ;
        }
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-6-11 02:52 , Processed in 1.031250 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表