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.
I have tried several methods attempting to set the GIE bit in the SR, none have born fruit. __enable_interrupt(); __bis_SR_register(GIE); I also tried __bis_SR_register(LPM0_bits | GIE); My timer interrupt never happens and when I stop the program I look at the Core Registers -> SR->GIE and it is 0. Any ideas of what I am doing wrong????
Why don't you simply check proven to work timer source code examples and see how things shall be done?
That is a good idea. In fact I thought of that as I laid my head down for sleep. I will be trying that now that I can think again.
Thanks for the suggestion.
Well I tried many of the examples with timer interrupts and yes they all work. I tried to emulate the code in my code and no deal. I never enter the interrupt. It might be the header or something. Here is what I have for the timer and the interrupt:
TA0CTL |= ID_2; /*Timer0A input divider: 2 - /4 */
TA0CCR0 = 5000 - 1; /*PWM Period */
TA0CCTL1 = OUTMOD_7; // CCR1 reset/set
TA0CCR1 = 750; // CCR1 PWM duty cycle
TA0CCTL2 = OUTMOD_7; // CCR2 reset/set
TA0CCR2 = 250; // CCR2 PWM duty cycle
TA0CTL |= TASSEL__SMCLK; /*Timer0A clock source select:SMCLK */
TA0CTL |= TACLR; /*Timer0A counter clear */
TA0CTL |= MC__UP; /*Up mode-Timer counts up to TA0CCR0*/
TA0CTL |= TAIE; /*Timer A counter interrupt enable */
//------------------------------------------------------------------------------
// Timer1 A0 Interrupt Service Routine
//------------------------------------------------------------------------------
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
{
if((P4IN &= BIT5) == 0) {
P4OUT |= BIT6;
if(TA0CCR1 >= 50) TA0CCR1 -= 50;
else TA0CCR1 = 0;
}
else P4OUT &= ~BIT6;
}
Anyone got any suggestions?
SAB said:I tried to emulate the code in my code and no deal.
"No deal" does not give any meaningful information about your results and how you check them. Also it would be good to know what exactly you are trying to achieve.
Don't try everything at once because then you will not notice what you are actually doing wrong. Modify example code by steps, verify after each step.
**Attention** This is a public forum