This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem in Interrupt

I have a strange problem in interrupt, I am incrementing a variable in interrupt and displayng in main program, the code is working fine for some time , latter the system gets hanged , i dont know why??

if there is any solution to this problem plz let me know, I am using Silabs C8051F120

int var=0;
        void PCA_Timer_Interrupt(void) interrupt 9 using 2
         {
                 var++;
          }


       void main()

{
          sprintf(buffer,"%d",(int)var);
          display(buffer,LINE1);

}



Parents
  • "He isn't using the var as an array subscript or a pointer offset,is he?"

    Well, he hasn't shown any code that does that - but then the code that he has shown doesn't make sense, does it?

    Jonny was just proposing an example of one way that could lead to crashing the program

Reply
  • "He isn't using the var as an array subscript or a pointer offset,is he?"

    Well, he hasn't shown any code that does that - but then the code that he has shown doesn't make sense, does it?

    Jonny was just proposing an example of one way that could lead to crashing the program

Children
No data