I'm trying to generate a 15 minutes alarm using RTC in MSP430F5438A microcontroller from Texas Instruments. What values should I put in the Interrupt registers. I have tried putting 0x95 in RTCAMIN register but it generates an interrupt at 15 min, 1 hour 15 minutes, 2 hours 15 minutes, and so on. I want the interrupt at 15 min and only one time.
1 Answer
\$\begingroup\$
\$\endgroup\$
2
You're getting the interrupt at 15 minutes already using 0x95 (meaning you are using the BCD format instead of hex, I presume). So you just want to disable the additional alarms at 1:15, 2:15, etc.
Set RTCAMIN to 0x00 as the first thing in your Interrupt Service Routine for the alarm to clear the alarm enable (AE) bit and thus set it up as a simple one-shot.
-
\$\begingroup\$ Yes I'm using BCD format. I read somewhere that the interrupts are automatically cleared once serviced. \$\endgroup\$ Commented May 13, 2016 at 2:06
-
\$\begingroup\$ @Jayesh The interrupt is definitely getting cleared, like you said, otherwise you wouldn't be getting multiple interrupts. But that is independent of whether future alarms are enabled. If you desired multiple interrupts, you'd need both conditions. By clearing AE in your ISR, you ensure it only happens once. \$\endgroup\$ Commented May 13, 2016 at 4:45