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.

CCS/MSP432P401R: how to add delay.

Part Number: MSP432P401R


Tool/software: Code Composer Studio

how i can add delay for toggle the led pin.

  • Hi, pls se below the simplest way.

    volatile uint32_t i;
    for (i = 20000; i > 0; i--); // Delay

    or check SDK examples "msp432p401x_cs_01"
  • I suggest __delay_cycles(n). It's a bit wasteful, but is very simple and reliable. The argument "n" is counted in CPU clocks (MCLKs) so you need to know how fast your CPU is running. If you haven't changed it, you're running at about 3MHz. Suggested usage:

    #define HZ 3000000UL // 3MHz MCLK, the way the MCU starts up
    __delay_cycles(HZ/2); // spin for half a second

**Attention** This is a public forum