Microchip
直播中

马占云

8年用户 1645经验值
私信 关注
[问答]

PIC24FJ128GA202 RTCC中断不触发

我用MPLABX和MCC设置了PIC,并设置了如图所示的RTCC…RTCC运行,我可以显示在我的LCD下面的代码…可能会在那里,但愚蠢的论坛不会让我添加它见附件。TXT文件显示了在RTCC ISR代码中递增的半个SyxCube变量,除了它从不从零移动。很多人似乎对RTCC中断有问题。我想知道的是,当RTCC在第二个点时,我可以让LCD闪烁一个被设置的数字。有什么想法吗?

以上来自于百度翻译


      以下为原文

    I set up the PIC using MPLABX and MCC and set the RTCC as shown in picture...  The RTCC runs and I can display on my LCD with following code... would have been there BUT STUPID FORUM WON'T LET ME ADD IT SEE ATTACHED .TXT FILE

Note the half_Sec_count variable that's incremented in the RTCC ISR code except that it never moves from zero.
void __attribute__ ( ( interrupt, no_auto_psv ) ) _ISR _RTCCInterrupt( void )
{
    /* TODO : Add interrupt handling code */
    half_Sec_count++;
   
    // TM I think this is only called when an alARM is triggered but
    // I think I've set the alarm to trigger every half second
    IFS3bits.RTCIF = false;
}
A lot of people seem to have issues with the RTCC interrupt.  What I want to do is know when the RTCC is at the half-second point so I can make the LCD blink a number that is being set.

Any ideas?
   Attached Image(s)


Attachment(s)

codesnip.txt (3.02 KB) - downloaded 45 times

回帖(14)

李涛

2018-9-26 16:42:56
RTC中断必须启用,可能是在第二个选项卡寄存器中。

以上来自于百度翻译


      以下为原文

    The rtc interrupt must be enabled, maybe that is in the second tab - registers.
 
举报

张玉

2018-9-26 16:56:26
我确信RTCC中断是启用的,在RTCC C的初始化例程的末尾有一行,表示…//启用RTCC中断IEC3BIT.RTCIE=1;但是是否也有相当于一个全局中断使能,我需要添加到Meal.C?也许这就是我丢失的图片。

以上来自于百度翻译


      以下为原文

    I'm pretty sure the RTCC interrupt is enabled, there's a line at the end of the initialize routine in rtcc.c that says...
 
//Enable RTCC interrupt
IEC3bits.RTCIE = 1;
 
But is there also the equivalent to a global interrupt enable that I need to add to main.c?  Maybe that's what I'm missing.
 
Picture of second tab for RTCC in MCC attached.
   Attached Image(s)

举报

李涛

2018-9-26 17:14:46
你读过寄存器,看看闹钟是否被设定好了吗?NVMKY必须依次设置,然后设置RTCWREN位,然后清除RTCEN位,编写寄存器,设置RTCEN位并清除RTCWRIEN位。

以上来自于百度翻译


      以下为原文

    Did you read back the registers to see if the alarm was actually set?
 
The NVMKEY has to be set in sequence, followed by setting RTCWREN bit followed by clearing RTCEN bit.
 
Write the registers, set RTCEN bit and clearing RTCWREN bit.
举报

李涛

2018-9-26 17:25:44
没有全局中断标志担心,中断优先级可以改变,但默认中断将工作。

以上来自于百度翻译


      以下为原文

    No global interrupt flag to worry about, the interrupt priority can be changed but by default interrupts will work.
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分