Hallo an alle,
ich weiß nicht warum, aber ich kriege es nicht hin, den freien Timer 1 der M32 Erweiterungsplatine zu konfigurieren. Das Interrupt wird anscheinend nicht ausgelöst! Ich habe schon alles mögliche ausprobiert. Hier das Initialisierungsvoid, die Initialisierung vom Timer 1 fett geschrieben:
Und hier die Interruptroutine:Code:void initRP6Control(void) { portInit(); // Setup port directions and initial values. // This is the most important step! cli(); // Disable global interrupts. // UART: UBRRH = UBRR_BAUD_LOW >> 8; // Setup UART: Baud is Low Speed UBRRL = (uint8_t) UBRR_BAUD_LOW; UCSRA = 0x00; UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); UCSRB = (1 << TXEN) | (1 << RXEN) | (1 << RXCIE); // Initialize ADC: ADMUX = 0; //external reference ADCSRA = (0<<ADIE) | (0<<ADEN) | (1<<ADPS2) | (1<<ADPS1) | (1<<ADIF); SFIOR = 0; // Initialize External interrupts - all disabled: MCUCR = (1 << ISC11) | (1 << ISC10) | (1 << ISC01) | (1 << ISC00); GICR = (0 << INT2) | (0 << INT1) | (0 << INT0); MCUCSR = (0 << ISC2); // 10kHz Timer 0: TCCR0 = (0 << WGM00) | (1 << WGM01) | (0 << COM00) | (0 << COM01) | (0 << CS02) | (1 << CS01) | (0 << CS00); OCR0 = 199; /* Timer 1 is free for your applications! */ TCCR1A = (1 << WGM12); TCCR1B = (1 << CS12); TIMSK = (1<< OCIE1A); // SPI Master (SPI Mode 0, SCK Frequency is F_CPU/2, which means it is 8MHz // on the RP6 CONTROL M32...): SPCR = (0<<SPIE) | (1<<SPE) | (1<<MSTR) | (0<<SPR0) | (0<<SPR1) | (0<<CPOL) | (0<<CPHA); SPSR = (1<<SPI2X); sei(); // Enable Global Interrupts }
Da das ja normales AVR C ist, kann das Problem bestimmt jeder, der sich mit AVRs befasst und diese in C programmiert, lösen.Code:ISR (TIMER1_OVF_vect) { [...] }
Vielen Dank schon mal im Voraus und
Viele Grüße
teamohnename







Zitieren
Lesezeichen