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.

MSP430F541x_MSP430F543x_Code_Examples

Other Parts Discussed in Thread: MSP430F5438

Hello everyone.

I am new in programing and I've just started dealing with MSP430F5438. I am using IAR embedded workbench for MSP430.

I downloaded MSP430F541x_MSP430F543x_Code_Examples. In these examples I find lines of code I don't understand. May be you can shed some light on this:

The code is:

#include <msp430f5438a.h>

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  ADC12CTL0 = ADC12SHT02 + ADC12ON;         // Sampling time, ADC12 on
  ADC12CTL1 = ADC12SHP;                     // Use sampling timer
  ADC12IE = 0x01;                           // Enable interrupt
  ADC12CTL0 |= ADC12ENC;
  P6SEL |= 0x01;                            // P6.0 ADC option select
  P1DIR |= 0x01;                            // P1.0 output

  while (1)
  {
    ADC12CTL0 |= ADC12SC;                   // Start sampling/conversion
    
    __bis_SR_register(LPM0_bits + GIE);     // LPM0, ADC12_ISR will force exit
    __no_operation();                       // For debugger
  }
}

The part I don't understand are these functions:
__bis_SR_register(LPM0_bits + GIE); and __no_operation(); Please guide me where to find more information about how these function work and what are they used for?
I found them residing into the header file but I still don't understand them. Please help. Thank you in advance.

  • Radoslav:

    These are useful "intrinsics" - here are the definitions (from the EW430_CompilerReference):

     

    _ _bis_SR_register

         Syntax

         void _ _bis_SR_register(unsigned short);

         Description

         Sets bits in the status register. The function takes an integer literal as its argument, that is, a bit mask with the bits to be set.

     

    _ _no_operation

         Syntax

      void _ _no_operation(void);

         Description

         Inserts a NOP instruction.

**Attention** This is a public forum