|
|
View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
PIC24F16KA102 RTC alarm ignores week day [Solved] |
Posted: Wed Sep 04, 2019 1:06 am |
|
|
Hello friends!
I am using the PIC24F16KA102 RTC module and I want to have week day based alarms which does not seem to work.
Everything works OK, I set the date, week day and time, read it back, I set the alarm and read it back and the alarm works as far as it concerns date and time but it ignores the week day.
For example if I set the RTC week day to 0 (Sunday) and the alarm week day to Monday the alarm will occur ignoring the week day.
CCS:5.049
Code: |
rtc_time_t write_clock, read_clock;
void SetupRTC(){
setup_rtc(RTC_ENABLE , 0);
}
void WriteTime(){
write_clock.tm_year=19;
write_clock.tm_mon=9;
write_clock.tm_mday=6;
write_clock.tm_wday=4;
write_clock.tm_hour=14;
write_clock.tm_min=30;
write_clock.tm_sec=0;
rtc_write(&write_clock);
}
void WriteAlarm(){
write_clock.tm_year=19;
write_clock.tm_mon=9;
write_clock.tm_mday=6;
write_clock.tm_wday=5;
write_clock.tm_hour=14;
write_clock.tm_min=30;
write_clock.tm_sec=6;
setup_rtc_alarm(RTC_ALARM_ENABLE | RTC_CHIME_DISABLE, RTC_ALARM_YEAR, 0x00);
rtc_alarm_write(&write_clock);
}
#INT_RTC
void RTCISR(){
Led=1;
}
|
Code: |
#include "24F16KA102.h"
#device ADC=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES FRC_PLL //Internal osc + PLL
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOPR //Pimary oscillator disabled
#FUSES OSCIO //OSC2 is general purpose output
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOBROWNOUT //Reset when brownout detected
#FUSES PUT //Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES RTCCK_SOSC //Use secondary oscillator for RTCC
#use delay(int=32M)
|
Any help appreciated. _________________ George. |
|
|
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
|
Posted: Wed Sep 04, 2019 1:21 am |
|
|
In reply to myself, you have to set the alarm interval to WEEK
Code: |
setup_rtc_alarm(RTC_ALARM_ENABLE | RTC_CHIME_DISABLE, RTC_ALARM_WEEK, 0x00);
|
_________________ George. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|