please explain in my code
Something like this?
void alarmISR(void)
{
sec_counter++;
if(sec_counter > 5)
{
/* Toggle the alarm led */
PINS_DRV_TogglePins(PTD, (1 << 15));
sec_counter = 0;
}
}
void alarmISR(void)
{
/* Toggle the alarm led */
PINS_DRV_TogglePins(PTD, (1 << 15));
// wait for conditions
}
From the above code , led is toggle and comes out for every 1 sec , so what i want is that there should be any conditions to wait for 5 sec and after that 6th sec it should toggle next like that.can u understand????
I would use a SW counter (global variable) in the ISR and let it count (increment every second) up to 5.
Once it equals 5, I would clear the counter and toggle the LED.
But that's up to you.
BR, Daniel
every 1 sec alarmISR is calling in that i want 5 sec delay . So what logic i have to use inside the alarmISR function. here is my function,
void alarmISR(void)
{
/* Toggle the alarm led */
PINS_DRV_TogglePins(PTD, (1 << 15));
}
Hi Praveena,
If you want the alarm interrupt to be called every 5s, just increase RTC Time Alarm Register by 5 in the Alarm ISR.
void RTC_IRQHandler(void)
{
RTC->TAR += 5; // Writing to the TAR clears the SR[TAF] Time Alarm Flag.
// Next alarm in 5s
}
BR, Daniel
I alrdy used alarm_interrupt its working . i want how to make that alarm delay for 5 sec using second interrupt.
Hello Praveena,
Please have a look at Section 48.4.7 Interrupt, S32K1xx RM rev.9
As you can see, the frequency of the second interrupt is configurable but it can't trigger every 5s.
Regards,
Daniel
Hi,
The RTC module has two interrupts: Second interrupt and alarm interrupt.
The alarm interrupt allow the RTC to generate an interrupt at a predefined time.
Please refer to the rtc_alarm_s32k144 SDK RTM 3.0.0 example that is available in the S32DS.
Regards,
Daniel