3 ms·
That kind of empty loops are actually used for delays, waiting on interrupts to kick in etc. in embedded systems, where you typically fight against the compiler
by tagrun 8y ago
That kind of empty loops are actually used for delays, waiting on interrupts to kick in etc. in embedded systems, where you typically fight against the compiler using volatile keyword.
Example from https://www.coranac.com/tonc/text/video.htm https://www.coranac.com/tonc/text/video.htm:
#define REG_VCOUNT *(volatile u16*)0x04000006
while(REG_VCOUNT < 160);