Тёмный
No video :(

Interrupts in AVR 

DrMattMarshall
Подписаться 2,3 тыс.
Просмотров 3,4 тыс.
50% 1

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 5   
@SteaM992
@SteaM992 3 года назад
How can 2 interrupts be handled in the same code? I understand that the cli command is activated when you enter a interrupt but i am doing a interrupt blinking a led at a 1 Hz frequency, and i am trying to trigger a second external interrupt whenever a button is pressed .What approach do you suggest that i should do in order to work? Thanks!
@drmattmarshall6545
@drmattmarshall6545 3 года назад
It's possible to call sei() in an interrupt service routine (ISR) and thereby enable nested interrupts. Otherwise, if the button gets pressed during the LED ISR then the button interrupt will just get handled as soon as the LED ISR finishes.
@SteaM992
@SteaM992 3 года назад
@@drmattmarshall6545 I tried also your sugestion but still, the ISR for blinking a led is executed when the button is pressed (when PD2 is tied to ground). Otherwise, the led is in sort of a bouncing effect, similiar to not having pull up resitors( is either on, or off, or it flickers..its weird). github.com/tandrei96/Interrupts-Atmega328p_personal-projects/blob/main/double_interrupts/double_interrupts.c .I appreciate the help !
@drmattmarshall6545
@drmattmarshall6545 3 года назад
@@SteaM992 Your code looks nice, IMO. There's nothing I see that might cause weird behavior. I should think that nested interrupts would be unnecessary since your ISRs are so short that even if the button-press routine has to wait for the LED-blink routine the performance should be fine. My only suggestion right now is to declare cnt as a volatile variable but I'm pretty sure that's not causing any problems for you.
@SteaM992
@SteaM992 3 года назад
@@drmattmarshall6545 yup, is ok even though is not initialized as volatile... would be cool a future video that tackles 2 or 3 different interrupts, maybe you get the same error as me haha:) Cheers!
Далее
PWM in AVR
15:13
Просмотров 14 тыс.
🛑самое грустное видео
00:10
Просмотров 167 тыс.
#61 ATmega328 - External Interrupt
47:58
Просмотров 3,3 тыс.
MTD00_stateSpaceIntro
23:19
Просмотров 1,6 тыс.
AVR-INTERRUPTS Made Easy Part 2. TIMER0 INTERRUPT
16:43
AVR Interrupts: A Guide for ATmega32 Microcontroller
15:44
Considerations for wheels in mobile robots
13:34
Просмотров 7 тыс.
AVR USART (Serial Communication) Explained
26:41
Просмотров 35 тыс.
AVR Interrupt Basics
16:16
Просмотров 28 тыс.
Interrupts in the PIC 18 MCU Family
1:18:54
Concerning the Stranded Astronauts
13:27
Просмотров 107 тыс.
🛑самое грустное видео
00:10
Просмотров 167 тыс.