Forum: Compiler & IDEs TIMER A (engl)


von robert (Gast)


Lesenswert?

interrupt(TIMERA0_VECTOR) TMR0int(void){
P1OUT = 0x01;
}
void main(void){
TACTL = TAIE | TACLR | ID_3 | TASSEL_SMCLK;
TACCR0 = 0xFF0;
TACCTL0 = CCIE;
TACTL |= MC_CONT;
for(;;){
P1OUT = 0x0;
}
}
In above code the LED (P1.pin1) should flash off almost all the time.
Why in my case it is ON.
I ahve no idea
robert
rseku@poczta.onet.pl

von Claus Krause (Gast)


Lesenswert?

Hi Robert,

how is the LED connected to MSP430? Lightning on L-signal at P1.1?
What MCLK/SMCLK is used for operation?
Do you have debuged the application? Is TMR0int called from time to 
time?
If you only want to flash the LED, try PWM-Output of timer A. No 
interrupt service routine will be needed for this.


Greetings,
Claus

von robert (Gast)


Lesenswert?

Thanks!
The code is an simplified example of large piece. I already figured out 
one thing which is wrong:
TAIE is overflow interrupt, which is unnessasary in this case.
(We need only compare).
Also MC_CONT should be changed to MC_UP mode.
It is not said in documentation, but looks, that OVERFLOW interrupt bit 
should be cleared by software, as well as CCIFG1 and 2

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.