Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Learning Interrupts

$
0
0

I am learning MSP430 programming with the tutorial at http://mspsci.blogspot.com/2010/07/tutorial-01-getting-started.html. I had trouble getting one of the first interrupt-driven programs to work, so I debugged it by adding a write to a RAM location to the interrupt service routine. Then I could see (by printing out that location with mspdebug) whether the ISR was ever entered. Indeed, the reason that program did not seem to run at all was precisely that the ISR was not entered.

 

Now I have progressed to CMeterG2211.c and wanted to use the same trick (if it can be called that). There are three ISR's and, correspondingly, I added three global variables at the start of the C file, like this:

unsigned char mark1 = 0;
unsigned char mark2 = 0;
unsigned char mark3 = 0;

I also added something like this

 mark1++;

at the start of each ISR.

 

Now, the program worked almost out of the box, and there has been no particular need to debug it. However, out of curiosity, I checked the markx variables after a successful run and found them all to be 0 (zero). How can that be? The fact that the program runs OK must indicate that all the ISR's are entered at least once, so how can the variables still be zero?

 


Viewing all articles
Browse latest Browse all 2077

Trending Articles