This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2633: MSP430FR2633

Part Number: MSP430FR2633
Other Parts Discussed in Thread: CAPTIVATE-BSWP, TIDM-CAPTIVATE-64-BUTTON

Hi support

I am using MSP430FR2633 on IAR(7.11.2) on windows 10.I have performed code size optimized 1 button demo which is in examples  which take response of first button, in case i have to use all the 8 button of BSWP.   what changes should i make in program,how can I define other buttons in the program  

  • Hi Shivam,

    Use the CAPTIVATE-BSWP project included with the MSP-CAPT-FR2633 design files. Or expand the OneButton project's ButtonGroup to include the other 7 buttons (self capacitive, RX00 through RX07 on CAP0.0, 1.0, 2.0, 3.0, 01., 1.1, 2.1, and 3.1, respectively)

    Regards,
    Ryan
  • Hi Ryan
    I am using this program to control 1st button of BSWP to ON/OFF LED2. what changes should I make in this to use say Button 2 of BSWP to control LED1. please help me with this as soon as possible

    #include <msp430.h>
    #include "captivate.h"

    //*****************************************************************************
    // Definitions
    //*****************************************************************************

    //! \brief The bit mask for LED1 on port P1.
    //!
    #define LED1 0x80

    //! \brief The bit mask for LED2 on port P1.
    //!
    #define LED2 0x40

    //! \brief The ratio between the DCOCLK and the FLLREF.
    //!
    #define FLL_RATIO 0x01E7

    //*****************************************************************************
    // Function Prototypes
    //*****************************************************************************

    //! \brief Event handler for the keypad sensor.
    //! This handler updates LED1 and LED2 based on
    //! the status of the keypad sensor.
    //! \param Pointer to the keypad sensor
    static void buttonHandler(tSensor* pSensor);

    //*****************************************************************************
    // Function Implementations
    //*****************************************************************************

    void main(void)
    {
    //
    // Stop the watchdog timer
    //
    WDTCTL = WDTPW | WDTHOLD;

    //
    // Set the port muxing:
    // - P1.1: IRQ (OPEN DRAIN)
    // - P1.2: UCB0 I2C SDA
    // - P1.3: UCB0 I2C SCL
    // - P1.4: UCA0 UART TXD
    // - P1.5: UCA0 UART RXD
    // - P1.6: LED2
    // - P1.7: LED1
    // - P2.0: XOUT
    // - P2.1: XIN
    //
    PAOUT = 0x0000;
    PADIR = 0xFCC1;
    PASEL0 = 0x033C;
    P3OUT = 0x00;
    P3DIR = 0x07;
    P3SEL0 = 0x00;
    PM5CTL0 &= ~LOCKLPM5;

    //
    // Set up FRAM wait state to allow for a 16 MHz MCLK.
    // Note that CapTIvate ROM functions execute without
    // any wait states at 16 MHz.
    //
    FRCTL0 = FRCTLPW | NWAITS_1;

    //
    // Set up the system clocks.
    // MCLK = DCO = 16 MHz
    // ACLK = XT1 = 32 kHz
    // SMCLK = OFF
    //
    do
    {
    CSCTL7 &= ~(XT1OFFG | DCOFFG);
    SFRIFG1 &= ~OFIFG;
    } while (SFRIFG1 & OFIFG);
    CSCTL3 = SELREF__XT1CLK;
    __bis_SR_register(SCG0);
    CSCTL0 = 0;
    CSCTL1 &= ~(DCORSEL_7);
    CSCTL1 |= DCORSEL_5;
    CSCTL2 = FLLD_0 + FLL_RATIO;
    __delay_cycles(3);
    __bic_SR_register(SCG0);
    while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));
    CSCTL4 = SELMS__DCOCLKDIV | SELA__XT1CLK;
    CSCTL5 = SMCLKOFF | VLOAUTOOFF;

    //
    // Set up the CapTIvate peripheral
    // and timer. The timer will periodically
    // set the g_bConvTimerFlag.
    //
    CAPT_initUI(&g_uiApp);
    CAPT_calibrateUI(&g_uiApp);
    MAP_CAPT_registerCallback(&button, &buttonHandler);
    MAP_CAPT_selectTimerSource(CAPT_TIMER_SRC_ACLK);
    MAP_CAPT_writeTimerCompRegister(CAPT_MS_TO_CYCLES(g_uiApp.ui16ActiveModeScanPeriod));
    MAP_CAPT_startTimer();
    MAP_CAPT_enableISR(CAPT_TIMER_INTERRUPT);
    __bis_SR_register(GIE);

    //
    // Start the application
    //
    while(1)
    {
    if (g_bConvTimerFlag == true)
    {
    //
    // If it is time to update the button,
    // update it here with the generic library call.
    //
    g_bConvTimerFlag = false;
    CAPT_updateUI(&g_uiApp);
    }

    //
    // Go to sleep when finished.
    // The CapTIvate timer will wake the application from sleep.
    //
    __bis_SR_register(g_uiApp.ui8AppLPM | GIE);
    }
    } // End main()

    void buttonHandler(tSensor* pSensor)
    {
    //
    // If the button is currently being touched,
    // illuminate LED1.
    //
    if (pSensor->bSensorTouch==true)
    {


    //
    // If a completely new touch was detected,
    // toggle the state of LED2.
    //
    if (pSensor->bSensorPrevTouch==false)
    {
    P1OUT ^= LED2;
    }
    }
    else
    {

    }
    }

    Regards
    SHIVAM
  • Hi Shivam,

    First, I used the CodeSizeOptimized_OneButton-Demo CCS project but copied/pasted the captivate_config folder of the CAPTIVATE-BSWP-Demo project so that all 7 button elements were defined.  Here is a quick demonstration of how to perform the functionality you are asking for:

    #include <msp430.h>
    #include "captivate.h"
    
    //*****************************************************************************
    // Definitions
    //*****************************************************************************
    
    //! \brief The bit mask for LED1 on port P1.
    //!
    #define LED1 0x80
    
    //! \brief The bit mask for LED2 on port P1.
    //!
    #define LED2 0x40
    
    //! \brief The ratio between the DCOCLK and the FLLREF.
    //!
    #define FLL_RATIO 0x01E7
    
    //*****************************************************************************
    // Function Prototypes
    //*****************************************************************************
    
    //! \brief Event handler for the keypad sensor.
    //!        This handler updates LED1 and LED2 based on
    //!        the status of the keypad sensor.
    //! \param Pointer to the keypad sensor
    static void buttonHandler(tSensor* pSensor);
    
    //*****************************************************************************
    // Function Implementations
    //*****************************************************************************
    
    void main(void)
    {
    	//
    	// Stop the watchdog timer
    	//
    	WDTCTL = WDTPW | WDTHOLD;
    
    	//
    	// Set the port muxing:
    	//  - P1.1: IRQ (OPEN DRAIN)
    	//  - P1.2: UCB0 I2C SDA
    	//  - P1.3: UCB0 I2C SCL
    	//  - P1.4: UCA0 UART TXD
    	//  - P1.5: UCA0 UART RXD
    	//  - P1.6: LED2
    	//  - P1.7: LED1
    	//  - P2.0: XOUT
    	//  - P2.1: XIN
    	//
    	PAOUT  = 0x0000;
    	PADIR  = 0xFCC1;
    	PASEL0 = 0x033C;
    	P3OUT  = 0x00;
    	P3DIR  = 0x07;
    	P3SEL0 = 0x00;
    	PM5CTL0 &= ~LOCKLPM5;
    
    	//
    	// Set up FRAM wait state to allow for a 16 MHz MCLK.
    	// Note that CapTIvate ROM functions execute without
    	// any wait states at 16 MHz.
    	//
    	FRCTL0 = FRCTLPW | NWAITS_1;
    
    	//
    	// Set up the system clocks.
    	// MCLK = DCO = 16 MHz
    	// ACLK = XT1 = 32 kHz
    	// SMCLK = OFF
    	//
    	do
    	{
    		CSCTL7 &= ~(XT1OFFG | DCOFFG);
    		SFRIFG1 &= ~OFIFG;
    	} while (SFRIFG1 & OFIFG);
    	CSCTL3 = SELREF__XT1CLK;
        __bis_SR_register(SCG0);
        CSCTL0 = 0;
        CSCTL1 &= ~(DCORSEL_7);
        CSCTL1 |= DCORSEL_5;
        CSCTL2 = FLLD_0 + FLL_RATIO;
        __delay_cycles(3);
        __bic_SR_register(SCG0);
        while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));
    	CSCTL4 = SELMS__DCOCLKDIV | SELA__XT1CLK;
    	CSCTL5 = SMCLKOFF | VLOAUTOOFF;
    
    	//
    	// Set up the CapTIvate peripheral
    	// and timer.  The timer will periodically
    	// set the g_bConvTimerFlag.
    	//
    	CAPT_initUI(&g_uiApp);
    	CAPT_calibrateUI(&g_uiApp);
    	MAP_CAPT_registerCallback(&keypadSensor, &buttonHandler);
    	MAP_CAPT_selectTimerSource(CAPT_TIMER_SRC_ACLK);
    	MAP_CAPT_writeTimerCompRegister(CAPT_MS_TO_CYCLES(g_uiApp.ui16ActiveModeScanPeriod));
    	MAP_CAPT_startTimer();
    	MAP_CAPT_enableISR(CAPT_TIMER_INTERRUPT);
    	__bis_SR_register(GIE);
    
    	//
    	// Start the application
    	//
    	while(1)
    	{
    		if (g_bConvTimerFlag == true)
    		{
    			//
    			// If it is time to update the button,
    			// update it here with the generic library call.
    			//
    			g_bConvTimerFlag = false;
    			CAPT_updateUI(&g_uiApp);
    		}
    
    		//
    		// Go to sleep when finished.
    		// The CapTIvate timer will wake the application from sleep.
    		//
    		__bis_SR_register(g_uiApp.ui8AppLPM | GIE);
    	}
    } // End main()
    
    void buttonHandler(tSensor* pSensor)
    {
    
        extern tElement keypadSensor_E00;
        extern tElement keypadSensor_E01;
    	//
    	// If the button is currently being touched,
    	// illuminate LED1.
    	//
    	if (keypadSensor_E00.bTouch==true)
    	{
    		P1OUT |= LED1;
    	}
    	else
    	{
    		P1OUT &= ~LED1;
    	}
    
        if (keypadSensor_E01.bTouch==true)
        {
            P1OUT |= LED2;
        }
        else
        {
            P1OUT &= ~LED2;
        }
    }

    Please read the Software Library -> How-To section of the CapTIvate Technology Guide to learn about callback functions and element state data access.

    Regards, Ryan

  • hey Ryan

    Thank you man, it was very Helpful.

  • HI,
    I am vivek kumar I am new to MSP430FR2633 and Captivate touch button.
    I got a source code from TI sites TIDM-CAPTIVATE-64-BUTTON Software and i am using the basic demo code.
    I am not using any design center software here.I flashed the TIDM-CAPTIVATE-64-BUTTON_BasicDemo code so after loaded it work like while when I touch on the any one of the key from 64 button the led1's is blink if i multi touch an board both led 1 and led 2 are blink, Now I want that touch sense data in UART. Wright now i get the UART value but it not related on touch sense even withoust touch it sends something in UART it may be a garbage value on it so I need a touch output in UART (with BuadRate) please give me a solution for this issues ASAP.
  • Hi Vivek,

    Please keep conversations regarding this issue on the thread you originated: e2e.ti.com/.../670343

    Thanks,
    Ryan

**Attention** This is a public forum