> the first while loop checks as fast as it can, if there is any change > in the array reference and if so, it sends the new array-data to > digital write. > the other whileloop simulates a 2Hz signal by setting array(0) to > true/false and waits 250 ms. > > and now the problem occurs. the while loops are very systemperformance > depending and as soon as i just move the mouse over the screen, the > signals become incorrect. (between 50ms and 300 ms uptime). > > has anyone any idea how to solve this problem? >
As the other response pointed out, you probably want to place a delay in your loops. And this seems odd at first, but if you can't afford to wait a whole ms, wire up a zero to the wait. This will cause the scheduler to rotate the round-robin execution queue and will cause smoother interleaving of tasks. Without this, the loops will often interleave at around 100ms increments, which has less overhead actually runs somewhat faster, but is more jerky. Greg McKaskle