Part Number: MSP430FR2532
Hi,
I am wondering why in CAPT_blockOnFlag(); we have to stall the running program.
//! Use CAPT_blockOnFlag to safely stall the running program in the
//! specified LPM mode until a boolean flag is set to true and the CPU
//! is awakened.
//*****************************************************************************
// CAPT_ISR.c
//
//! CapTIvate&tm; peripheral interrupt service routine.
//
//! The ISR serves to set status flags that may be used by the application.
//! The CapTIvate&tm; ISR always exits in CPU active mode.
//
//! \version 1.83.00.05
//! Released on May 15, 2020
//
//*****************************************************************************
//*****************************************************************************
//! \addtogroup CAPT_ISR
//! @{
//*****************************************************************************
#include <msp430.h>
#include <stdbool.h>
#include "CAPT_HAL.h"
//*****************************************************************************
//
//! \var g_bEndOfConversionFlag is a global flag used to indicate to the
//! CAPT_Touch layer when a conversion has completed. This flag must be set
//! by the application's CapTIvate&tm; ISR to communicate to the touch layer
//! when a conversion has completed.
//
//! \var g_bDetectionFlag
//! This bool is set by the CapTIvate&tm; ISR when a detection interrupt occurs.
//
//! \var g_bConvTimerFlag
//! This bool is set by the CapTIvate&tm; timer when it is time to update (refresh)
//! the user interface.
//
//! \var g_bConvCounterFlag
//! This bool is set by the CapTIvate&tm; ISR when a conversion counter interrupt
//! occurs.
//
//! \var g_bMaxCountErrorFlag
//! This bool is set by the CapTIvate&tm; ISR when a maximum count error interrupt
//! occurs.
//
//*****************************************************************************
volatile bool g_bEndOfConversionFlag;
volatile bool g_bDetectionFlag;
volatile bool g_bConvTimerFlag;
volatile bool g_bConvCounterFlag;
volatile bool g_bMaxCountErrorFlag;
//*****************************************************************************
//
//! CAPT_ISR is the Captivate peripheral interrupt service routine.
//
//*****************************************************************************
#pragma vector=CAPTIVATE_VECTOR
__interrupt void CAPT_ISR(void)
{
switch(__even_in_range(CAPT_getInterruptVector(), CAPT_IV_MAX_COUNT_ERROR))
{
// End of Conversion Interrupt
case CAPT_IV_END_OF_CONVERSION:
g_bEndOfConversionFlag = true;
break;
// Detection Interrupt
case CAPT_IV_DETECTION:
g_bDetectionFlag = true;
break;
// Timer Interrupt
case CAPT_IV_TIMER:
g_bConvTimerFlag = true;
break;
// Conversion Counter Interrupt
case CAPT_IV_CONVERSION_COUNTER:
g_bConvCounterFlag = true;
break;
// Max Count Error Interrupt
case CAPT_IV_MAX_COUNT_ERROR:
g_bMaxCountErrorFlag = true;
break;
}
__bic_SR_register_on_exit(LPM0_bits);
}
Why we have to exit with LPM0bit.
if I delete this line __bic_SR_register_on_exit(LPM0_bits);
The code hangs and don't do anyting.
Thank you