ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Воскресенье
30 июня
332255 Топик полностью
mazur (31.05.2012 16:37 - 16:56, просмотров: 143) ответил zeleny на не вызывается TIMER2_COMP_vect в Atmega16 - что за... ?
Update. В дизассемблере нужно смотреть, что происходит. А если на глазок смотреть, то ну не знаю-не знаю... Только что накидал, все работает. #define F_CPU 16000000L #include <avr\io.h> #include <avr\interrupt.h> //#include <avr\wdt.h> #define LED_PIN PINC #define LED_PORT PORTC #define LED_DDR DDRC #define LED1 0 ISR (TIMER0_COMP_vect){ LED_DDR ^= _BV(LED1); } void main(void){ //wdt_enable(6); //LED_PORT=0; OCR0 = 200; //Fctc = F_CPU / 8 / 200 TIMSK=_BV(OCIE0); TCCR0=_BV(CS00)|_BV(CS02); sei(); while(1){} Или так: #define F_CPU 16000000L #include <avr\io.h> #include <avr\interrupt.h> //#include <avr\wdt.h> #define LED_PIN PINC #define LED_PORT PORTC #define LED_DDR DDRC #define LED1 0 #define led1_blink() LED_DDR ^= _BV(LED1) ISR (TIMER0_COMP_vect){ //LED_DDR ^= _BV(LED1); led1_blink(); } void main(void){ //wdt_enable(6); //LED_PORT=0; OCR0 = 200; //Fctc = F_CPU / 8 / 200 TIMSK=_BV(OCIE0); TCCR0=_BV(CS00)|_BV(CS02); sei(); while(1){} }