Why am i getting strange blocking in my loop

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anyone explain to me why this does not work?

I have tried this section of code. In the ISR the xHasInterruptOccured is set. This code blocks for ever!!

do
{
}
while(!xHasInterruptOccured);

Then i tried this. Works fine. I dont understand!!

loop_until_bit_is_set(xHasInterruptOccured,0);
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried:

do {} while(!(xHasInterruptOccured & 0x01));

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah tried that it didn't work.

I made xHasInterruptOccured volatile and it works... I looked at the asm, the compiler was doing bad things...

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahh, the ye olde volatile issue - that catches out quite a lot of people, both newbies and experienced :D. Glad to hear you fixed it.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!