0
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Yes I'm using BCD format. I read somewhere that the interrupts are automatically cleared once serviced. \$\endgroup\$ – Jayesh Parmar May 13 '16 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\$ – Joel Wigton May 13 '16 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.