Jepp es klappt:
Habe soeben das Program ergänzt und es funktioniert genau so wie ich es möchte.
Code:// Timer_Interrupt_TEST_3.c Programm // #include <inttypes.h> #include <avr/io.h> #include <avr/interrupt.h> int A; int Delai; // Routine d'interruption //----------------------- ISR (TIMER1_COMPB_vect) { if(A==0x00){ PORTB=0x05; } if(A==0x01){ PORTB=0x00; } if(A==0x0A){ PORTB=0x0A; } if(A==0x0B){ PORTB=0x00; } A=A++; OCR1B=TCNT1+Delai; if(A==0x0C){ //0x14 A=0; TCCR1B=(0<<CS10); // timer stopp } } // Programme principal: //--------------------- int main () { A=0; DDRB=0xFF; // PORTB mis en sortie DDRC=0xFF; Delai=3686000/20/20/165; OCR1B=TCNT1+Delai; // initialisation du registre de comparaison TIMSK|=(1<<OCIE1B); // autorisation de l'interruption sei (); // autorisation de toutes les interruptions while (1){ if(PINA == 0xFE){ TCCR1B=(3<<CS10); //timer1 start, timer1 source: ck/64 } } }
Natürlich währe es ohne eure Hilfe nix geworden.
Danke normals.
Dass mit dem
CS12, CS11, CS10 (Clock Select Bits)
Diese 3 Bits bestimmen die Quelle für den Timer/Counter:
CS12 CS11 CS10 Resultat
0 0 0 Stopp, Der Timer/Counter wird angehalten.
0 0 1 CPU-Takt
0 1 0 CPU-Takt / 8
0 1 1 CPU-Takt / 64
1 0 0 CPU-Takt / 256
1 0 1 CPU-Takt / 1024
1 1 0 Externer Pin T1, fallende Flanke
1 1 1 Externer Pin T1, steigende Flanke
hatte ich aus einer anderen Website aber bin gestern einfach nicht darauf gekommen, obwohl es gross draufstand... 0<<CS10 = timer Stopp eieiei
Naja jetzt gehts ja lol
Ciao
Euer Nightlord







Zitieren

Lesezeichen