Gast
#6069816
Hallo, ich habe folgendes Problem was habe ich vergessen das der Interrupt Vektor auf 0x2A kommt? AVR ATmega2560 beim AtmelStudio7 kommt der Interrupt Vektor so gut wie nie obwohl das compa bit aufleuchtet und der Counter mit CTC resetet wird aber der Interrupt kommt nicht er springt nie dort hin obwohl der Vektor dort steht? Warum ist das so. Wollte das zuerst mit sleep machen und aufwachen aber da löscht sich alles im timer0 - sleep geht auch nicht!? Habe alles definiert temp = r16 usw. Mein code: (hier copiere ich nicht alles rein weil nicht nötig. .equ tim0_stop = 0b00000000 .equ tim0_start = 0b00000001 .equ tim0_start64 = 0b00000011 .equ tim0_count = 0x00 .equ tim0_tccr0a_init= 0b00000000 .equ tim0_tccr0a_ctc = 0b00000010 ;CTC,OCR0A=Top .equ tim0_toie0_ena = 0x01 ;TIMSK0 page 131 .equ tim0_ocie0a_ena = 0x02 ;OCIE0A Ocompare Interrupt Enable .equ tim0_ocr0a_max = 0xFA .org 0x00 ;reset rjmp reset_vector .org 0x2a ;tim0 compa rjmp tim0_compa_handler .org 0x100 tim0_compa_handler: cbr status,from_compa ;mark bit_compa reti reset_vector: ldi temp,high(ramend) out SPH,temp ldi temp,low(ramend) out SPL,temp ;Global Interrrupt Enable sei init_timers: ldi temp,tim0_count out TCNT0,temp ;TCNT0 ldi temp,tim0_tccr0a_ctc ;TCCR0A value 0x02 out TCCR0A,temp ;TCCR0A page 126 ldi temp,tim0_ocr0a_max ;OCR0A max count overflow out ocr0a,temp ldi temp,tim0_ocie0a_ena ;overflow interrupt enable sts TIMSK0,temp ldi temp,tim0_start ;start clk 16MHz ;no prescaler! out tccr0b,temp ;tim0 clk 16MHz start control: cbi porta,bit_oszi ;oszi_bit = 0; falling edge nop sbi porta,bit_oszi ;oszi_bit = 1; rising edge zzz: rjmp zzz Das I-bit is set, das SE-bit sleep is set '(sleep geht aber nicht im Atmelstudio7 da bleibt der Zähler stehen und das war es). CTC kommt und der tim0 wird auf 0x00 gesetzt. Das TIFR0 OCF0A=1 kommt. TIMSK0 bit-OCIE0A=ena Welches bit habe ich eventuell vergessen und warum kommt der Einsprung nicht in den Interrupt-Vektor?