TIMER A (engl)

Gast #40238
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
Gast #40239
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
Gast #40240
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

Antwort schreiben

Eine eigene Frage? Dieser Thread ist über 23 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.