Other Parts Discussed in Thread: MSP430F5438
I am having a problem creating a software delay to toggle a pin. The problem is the time of the software delay. I am using a MSP430F5438. MCLK should be ~1MHz. I count for 200 clock cycles which should be ~0.2ms. When I probe the pin the time delay is ~2ms. This would mean that MCLK would be 100kHz which doesn't make sense. The code is below. Does anyone know why this time delay would be off?
#define DELAYLOOPS 200
volatile unsigned int count;
P1OUT |= BIT0; // turn P1.0 high
for (count = 0; count < DELAYLOOPS; ++count) {
}
P1OUT &= ~BIT0; // turn P1.0 low