Other Parts Discussed in Thread: MSP430G2553
I have a ISR that has a switch in it. I'm using it to different pieces of code run each time it enters the routine. Below I have a piece of the code.
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A0 (void)
{
switch (estado){
case 0:
veces3 = 3;
veces412 = 2;
estado = 1;
TACCR0 += 160;
break;
case 1:
estado = 2;
P2OUT ^= BIT0;
TACCR0 += 320;
break;
case 2: {
estado = 3;
P2OUT ^= BIT0;
TACCR0 += 160;
break;
}
case 3: {
if(veces3 == 1000){
P2OUT ^= BIT2 + BIT4;
}
else if(veces3 == 0){
P2OUT ^= BIT3;
estado = 4;
break;
}
else{
P2OUT ^= BIT2 + BIT3 + BIT4;
}
veces3--;
TACCR0 += 80;
break;
}
...
The code has 14 "estados" but I did not pasted them all here. I'm using TIMER A to enter the ISR every time.
Now, the code works perfectly when I put a lot of breakpoints in it... but when I disable them the code stops working. The variable inside the switch goes back to zero before going through every state.
Any help, ideas why this is not working? Thanks in advance.