Moin liebe Gemeinde,
ich habe im Rahmen eines Projektes ein Autonomes Modellfahrzeug zu
programmieren, einen Fehler in meinem Porgramm.
Ich bin noch am Anfang, also nicht wundern.
Das Problem ist bisher nur, dass keine ISR beim Timerüberlauf ausgelöst
wird.
Es handelt sich um einen AtMega128 mit 16bit Timer.
----------------------------------------------------------------
void main(){
//----------------------------------------------------------------------
--------
// Timer Initialisierung
//----------------------------------------------------------------------
--------
// SETUP für 16bit Timer [NEUES BOARD]
TCCR1A = (1<<WGM11) | (1<<WGM10) | (1<<COM1A1) | (1<<COM1A0) |
(0<<COM1B1)| (0<<COM1B0)| (0<<COM1C1)| (0<<COM1C0) ;
TCCR1B |= (0<<ICNC1) | (0<<ICES1) | (1<<WGM13) | (1<<WGM12);
//Prescaler Setup [001=1 | 010=8 | 011=64 | 100=256 | 101=1024]
// 16000000MHZ/256=62500 Hz
// 65536/62500 =1.048576 seconds
TCCR1B |= (1<<CS12) | (0<<CS11) | (0<<CS10);
TCCR1B = (0<<FOC1A) | (0<<FOC1B) | (0<<FOC1C);
//Timer Interrupt Enable
TIMSK |= ( 1 << TOIE0 );
TIMSK1 = 0x01; // enabled global and timer overflow interrupt;
TCCR1A = 0x00; // normal operation page 148 (mode0);
TCCR1B = 0x04; // start timer/ set clock
// 16bit counter start register
// start at 3036 -> overflow every second
// 16000000MHz/256=62500 Hz
// (65536-3036)/62500 =1.00 second
TCNT1 = 3036;
//Global Interrupt Enable
sei();
while(1);
}
-------------------------------------------------------------------
Zurzeit besteht die ISR nur aus reseten des Timers.
Mein Ziel ist es, bei jeder ISR ein PWM-Signal mit dem Oszilloskopen
auszugeben.
Ich bedanke mich jetzt schon einmal für eure Hilfe.