AnsweredAssumed Answered

Incrementing a variable in assembly

Question asked by Matt Meier on Jan 20, 2012
Latest reply on Jan 24, 2012 by Matt Meier

As a short background, I've only been using CodeWarrior 10.1 for a few days, and I'm still getting used to the quirks.


My problem is that I can't seem to increment a global variable.  I have a 1Hz timer interrupt set up.  I know it works, because I can add code to toggle an I/O pin and watch it on a scope, and I can set breakpoints in the code that do trigger during a debugging session.  However, the variable never increments.  I can load the variable into the accumulator, increment that, and then store it back, and that works fine.  To add further frustration, this EXCACT code sometimes builds fine, and sometimes gives me a warning at the INC instruction, A13003, that the value is being truncated.  That's odd to me, since it's only an 8-bit variable.


Any help is greatly appreciated.  I know this is a pretty remedial issue, and to be honest, I'm a bit embarassed that I haven't figured it out.  I attached the entire code.  The segment in question is the interrupt ISR for Timer 1 (TPM1_OVF_ISR).  The processor is the MC9S08DZ60.  I started the project using the BareBoard Project wizard.  Sorry I didn't just include it in the body; I couldn't get it to paste and be legible.


Thanks in advance,