Hallo zusammen Ich messe mit dem Capture Eingang eines Timers eine bestimmte Periodendauer eines Sinussignals. Konfiguriere ich den Timer auf 16Bit, tritt kein overflow auf, die Messung funktioniert einwandfrei. Sobald ich aber den Timer auf 10Bit konfiguriere (muss ich, da ich mit demselben Timer einen 10Bit PWM ansteuern muss...) treten overflows auf, die ich natürlich registriere. Das Problem ist jetzt aber, dass wenn (vermutlich!) capture und overflow GLEICHZEITIG auftreten, messe ich eine falsche Periodendauer, was in meinem Programm fatal ist! Kann mir jemand helfen? Es handelt sich um einen MSP430, sollte jedoch kein Diskussionspunkt sein. Dieses Problem kann bei jedem uP auftreten. Hier noch mein Code der interrupt-service routine: / Timer B1 interrupt service routine #pragma vector=TIMERB1_VECTOR __interrupt void Timer_B (void) { tbccr1_act = TBCCR1; // save actual counter value tbiv_loc = TBIV; // save interrupt vector switch(tbiv_loc) { case 0x0E: // timer overflow { overflow_val++; break; } case 0x02: { sig_period = tbccr1_act + (overflow_val-1) * 1024 + (1024 - tbccrl_last); overflow_val = 0; tbccrl_last = tbccr1_act; break; } } } Danke für Eure Hilfe!! Gruss Lukas
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
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.