Forum Discussion
Altera_Forum
Honored Contributor
14 years agoWhen sharing variables between two tasks there are two important things to do[list][*]define them as volatile so that the compiler doesn't make assumptions about how the variables are used and makes optimizations that prevent you from correctly transferring the value from one task to the other[*]protect access to the shared variables with a mutex, to be sure a task doesn't read the variables while you are right into the middle of editing them. You could end up in strange cases with mix ups of old and new values[/list]
I'm not sure this is the reason why you have this problem, but it won't hurt ;) Except that you should use a bit more printfs to see if your variables are modified as expected.