This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 static variable handling



Hello everyone,

I have written a sample program to print the values of the static variables but the output are not printed properly? As per my code the value for the variable ActiveState = 0 and state = 8, but in terminal window the value printed is same? I have seen the memory also none of the values are there to the relevant memory address of the variable ActiveState. I have attached the screen of the project. Could anyone explain me?

  • Hello Prakash,

    So, looking at this, everything this appears to be correct and operating as expected except for what you are seeing in the terminal window.  Do you agree?  

    Are you including <stdio.h>?  I believe this is required for printf to work, but I imagine it would give an error if it's not included.  

    If you are, I'm not sure why the terminal window is incorrect but it would seem the printf() isn't working as expected.  Can you test it by just passing in an integer directly instead of a variable to test?  

    Thanks,

    JD

**Attention** This is a public forum