I added a delay of 1 millisecond in the loop. Here's the code:
Windows 7 64 bit
I'm sorry to have wasted the board's bandwidth on something that couldn't help.
Does not matter, because && has stronger precedence than >=.In case of clarity this would of course be better.
( (!dOn && n1000) >= 500 ) != (!dOn && n1000 >= 500)