Hello!
I have one problem with MSP432. Not a crucial one, but just curious...
I needed a quick & dirty millisecond delay function, so I have implemented it like this:
void delay(uint16 ms) {
uint16 count = 0;
while(count++ < ms) {
__delay_cycles(CLOCK_KHZ);
}
}
As you probably have guessed, CLOCK_KHZ = CLOCK/1000. This should give me a delay of
approximately 1 ms. Therefore calling it n times should give me a dealy of n ms. (I didn't
take into account the clocks needed by the loop itself. After all, it's quick & dirty.
The problem: the delay I get is double of what I expected. Just in case, I verified the
clock on my scope (which is reliable by the way), and it's close enough to 48 MHz.
Any idea of what may happen? Of course, the workaround __delay_cycles(CLOCK_KHZ/2);
works fine, but I would like to understand what happens.
Thanks for any hint.
Pascal