I have this piece of code which is triggered when a bit is set high (the bit is set high when an interrupt occurs). It works when I have a delay in place, but not without. Can anyone explain why?
Code:
while (1) {
// _delay_us(1);
if (myFlags & (1 << serialAvailable)) {
sendChar('Q');
myFlags &= ~(1 << serialAvailable);
}
}
If it matter, this is for an AVR microcontroller.
So if I remove those comment symbols, it works. I cannot understand why?
The only way I can get this to work is if I change...
Code:
if (myFlags & (1 << serialAvailable)) {
to...
Could this just be a artefact of the Atmel micro, or is this something with the code itself?
john.c -> I cant reply, but yes I do. That is fixed but still the issue persists
Thanks.