hello i m confuse in volatile type of data types?
basically i read about volatile but after go through led blinking code of MSP430 then i m confuse.
If i put Volatile the code works but if i erased it then it doesn't work.
here is code
basically i read about volatile but after go through led blinking code of MSP430 then i m confuse.
If i put Volatile the code works but if i erased it then it doesn't work.
here is code
Code:
#include <msp430.h>
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01; // Set P1.0 to output directionz
for(;;) {
unsigned int i; // volatile to prevent optimization
P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
i = 10000; // SW Delay
do i--;
while(i != 0);
}
return 0;
}