Gast
#1052732
Hallo! Anbei ein Projekt von mir, mit einem Problem, was mich ca. 2 Tage gekostet hat. Das ganze läuft auf einem ATMega 128 und einem Uhrenquartz für Timer 0. Ich nutze gcc 4.3.0 mit Eclipse. Das Problem war, das ab und zu der Overflow Interrupt für Timer 0 nicht kam. Im Datasheet für den Mega 128 habe ich im Errata für den Timer 2 dann folgendes gefunden: >2. Interrupts may be lost when writing the timer registers in the >asynchronous timer >If one of the timer registers which is synchronized to the asynchronous >timer2 clock is written >in the cycle before a overflow interrupt occurs, the interrupt may be >lost. >Problem Fix/Workaround >Always check that the Timer2 Timer/Counter register, TCNT2, does not have >the value 0xFF >before writing the Timer2 Control Register, TCCR2, or Output Compare >Register, OCR2 Nachgedacht --> Timer 0 läuft ja auch Asynchron! Dann das Projekt welche im Anhang ist zusamengebaut, und siehe da, der Overflow wird NIE ausgeführt wenn der Timer auf 0xFF steht und in OCR0 was rein geschrieben wird(egal was!). --> die LED die bei mir an PORT B 7 ist Blinkt nicht! Bei mir hat sich das nur selten geäußert, das OCR0 immer mit +=9 verwendet wurde.Nur dann halt wenn Timer 0 auf 0xff stand Will das hier schreiben, falls einer das gleiche Problem mal haben sollte. In meine Projekt hab ich mir nen Workaround gebastelt, läuft jetzt zuverlässig! Auch eine Frage: kann mann sich irgendwie an Atmel wenden oder kennt da jemand einen, das die das eventuel ins Errata aufnehmen? Gruß Stefan