Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21942

Compiler/MSP432P401R: delay implementation

$
0
0

Part Number:MSP432P401R

Tool/software: TI C/C++ Compiler

void Delay(uint16_t msec){
    uint32_t i=0;
    uint32_t time=(msec/1000)*(SYSTEM_CLOCK_SPEED/15);

    for(i=0;i<time;i++);
}

This is the delay used in the grlib example for the Kentec touchscreen. I notice that I is not even marked volatile. Shouldn't this get optimized away? Do I need to be careful if I add optimization? Is the compiler smart enough to see the word "delay" and leave it alone? 8^)


Viewing all articles
Browse latest Browse all 21942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>