Part Number: MSP430F5529
Assuming the following timer settings....
TA1CCTL0 = CCIE; // CCR0 interrupt enabled
TA1CCR0 = 10000; // Set the count value
TA1CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, upmode, clear TAR
*TAIE is not enabled, so TAIFG never triggers an ISR
*We are using CCIFG to trigger the ISR
I know the CCR0 ISR Vector for Timer1 will run after 10,000 counts given the above setting.
Looking at Figure 17-3 from the Technical Manual, it seems CCIFG Flag would happen just as TAxR is updated to CCR0 = 10,000.
But my question is this.
If the ISR is triggered, and code is run while TAxR = CCR0, then what would happen if we updated CCR0 value in the ISR?
1) Would changing CCR0 from 10,000 to 50,000 in the ISR mean the next CCIFG would trigger after only 40,000 clock edges?
*Would this depend on the Timer Clock Source and MCLK speed differences?
2) If you want to update the Timer Count in the ISR to a different period, would it be better to :
- Halt the Timer
- Set TACLR to clear TAxR count value back to "0"
- Set a new CCR0 value
- Restart the Timer
??
Regards,
Darren