 Why do my variables reset?? Tom Stathes First off, let me say while im not new to c, i havent programmed in it for years, now im very quickly having to re-learn everything for work. Here is my problem. I have 2 files, lets say file Main.c an support.c Main contains some initilizations and an infinite loop that just waits for the uart to trigger an interrupt. support.c contains the uart ISR and some functions. There are a few global counter variables as well. when the isr tripps a function is called, and a counter is incrimented. the next time the isr tripps the counter resets before the function that incriments it is even called. Since global variables are by default static (and im defining them as static), any one of these functions should be able to modify the counter freely and the value should not reset when a function is called correct?. i verified this by starting another project with a simple prgmm like this int i; void inci(){i++;} main(){ int a; for(a=0;a>100;a++){inci();} } The value of i does not reset just incriments like it should on the watch window. One odd thing i also noticed, if i set a breakpoint on my counter init function and hit RUN it will break there everytime i hit run (it should break then continue and enter a while(1){;} loop the next time i hit run), when i step through using F11 it exectues once and ends up in the infinite loop waiting like it should. If anyone could help, i would really appreciate it. |