Re: AVR GCC Simulator 模擬無中斷?
|
||||
---|---|---|---|---|
高級會員
|
反編發現 ISR(TIMER0_COMPA_vect) 被優化不見了
變量已經使用 volatile 況且優化使用 -O0 ,但是仍然無效?
發表於: 2022/4/4 10:20
|
|||
|
AVR GCC Simulator 模擬無中斷?
|
||||
---|---|---|---|---|
高級會員
|
MPLAB X ID 5.20版本
模擬 ATtiny85 AVR_GCC (v5.4.0) TCNT0 跑到 125 後,但是中斷程式跳不進去? #include #include volatile uint8_t timer1; ISR(TIMER0_COMPA_vect) { if (timer1) timer1--; } int main(void) { timer1 = 250; uint8_t timer2 = 1; DDRB | = (1 << DDB3 ); TCCR0A = (1 << WGM01); TCCR0B = (1 << CS01) | (1 << CS00); OCR0A = 125; TIMSK = (1 << OCIE0A); sei(); while (1) { if (!timer1) { timer1 = 250; if (!timer2) { PORTB ^= (1 << PORTB3); timer2 = 1; } else timer2--; } } }
發表於: 2022/4/2 23:56
|
|||
|