View previous topic :: View next topic |
Author |
Message |
SkeeterHawk
Joined: 16 Oct 2010 Posts: 31 Location: Florissant, CO
|
18F87K90 RTC Module Misbehaving |
Posted: Sun May 06, 2012 9:39 pm |
|
|
Hello again all.
As always, I am sure it is my code, but this is an unusual problem. I am trying to simply use the RTCC module on the PIC18F87K90 to act as an interrupt source every 10 seconds. I have a 32.768KHz crystal on SOSC. What is happening is that I am able to enter into the interrupt at 2Hz and at 1Hz, but if I try to set it up for an interrupt every 10 seconds (or higher), it never hits the ISR. I will try to simplify my code below to see if anyone has some hints as to what is happening. I can live with every one second, but I would like to know what is broken. Thanks for your intervention.
Code: |
#include <18F87K90.h>
#FUSES RTCOSC_T1
#FUSES SOSC_LOW
// Setup the Real Time Clock / Calendar so that we can start telling time
setup_rtc (RTC_ENABLE); // We'll see if this proves to be useful soon
setup_timer_1(T1_ENABLE_SOSC);
setup_rtc_alarm (RTC_ALARM_ENABLE, RTC_ALARM_SECOND, 255);
enable_Interrupts (INT_RTC); // Enable the interrupt for the Real Time Clock
enable_interrupts (GLOBAL);
#int_RTC
void RTC_isr (void)
{
output_toggle (HeatLED_Pin); // In the interest of seeing what the heck is going on, we are toggling the Heat pin every time this interrupt gets entered
}
|
As always, I appreciate the insight.
Thanks! _________________ Life is too short to only write code in assembly... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
SkeeterHawk
Joined: 16 Oct 2010 Posts: 31 Location: Florissant, CO
|
|
Posted: Mon May 07, 2012 10:48 pm |
|
|
Thank you for your detailed reply PCM.
I am using version 4.132, which appears to be the most current.
I will look into the alarm settings as they mention and initialize it at least. I disregarded this as I only wanted an interrupt every 10 seconds regardless of what the actual time was.
Otherwise, I will delve deeper into the other possibilities a little without spending too much time on it as I can easily live with an interrupt every second and just count to ten. I was hoping to save some software overhead because I don't really need that much resolution.
Thanks very much again for your insight. It is sincerely appreciated. This forum is definitely something that helps the CCS product rise to the top. _________________ Life is too short to only write code in assembly... |
|
|
|