Pin Change Interrupts in Arduino Nano

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • Pins D4, D13 and A5 on the Nano are reprogrammed to accept hardware interrupts.
    Link to code:
    akuzechie.blogspot.com/2020/1...
    Contents:
    0:00 Introduction
    0:28 Arduino Nano PCI Pins
    2:00 Programming PCI Registers
    3:41 Circuit Description
    4:16 Demonstration
    5:09 C++ Sketch
    5:51 Conclusion

ความคิดเห็น • 37

  • @G-Code_official
    @G-Code_official ปีที่แล้ว +1

    I just don't like the fact that you have only few subscribers. With your style of explanation, even professionals could learn from you....thank you very much. I hope to see more people learn from you.

    • @AnasKuzechie
      @AnasKuzechie  ปีที่แล้ว

      Thanks for your kind words

  • @isnainiahmadi1411
    @isnainiahmadi1411 2 ปีที่แล้ว +1

    This is the best explanation about Pin Change Interrupts in Arduino!
    I've searched many articles about Pin Change Interrupts but only this video that makes me understand.
    Thank you very much Anas. You deserve more likes!

    • @AnasKuzechie
      @AnasKuzechie  2 ปีที่แล้ว

      Thanks for your feedback

  • @BaronRosenhein
    @BaronRosenhein 3 ปีที่แล้ว

    Anas your videos are awesome. I finally understood that pin change interrupts are the same as assignable hardware interrupts. Thank you for taking the time to show registers, reference datasheets and explain what all these abbreviations mean. And last but not least simple code examples that are very easy to follow.

    • @AnasKuzechie
      @AnasKuzechie  3 ปีที่แล้ว

      Thanks, I appreciate your feedback.

  • @FreddyBNL
    @FreddyBNL 3 ปีที่แล้ว

    Very good explanation and well illustrated with your setup.

  • @lyrixs4u
    @lyrixs4u 3 ปีที่แล้ว

    Wow! This is very informative. Thank you!

    • @AnasKuzechie
      @AnasKuzechie  3 ปีที่แล้ว +1

      Thanks for your feedback

  • @user-tn8ps8ww1i
    @user-tn8ps8ww1i 2 ปีที่แล้ว

    Very good explanation
    💙💙

  • @fpgamachine
    @fpgamachine 3 ปีที่แล้ว

    Excellent info, very clear. Thanks!

    • @AnasKuzechie
      @AnasKuzechie  3 ปีที่แล้ว

      Thanks for your feedback.

  • @jorgepamies-teixeira5998
    @jorgepamies-teixeira5998 ปีที่แล้ว

    This is the best explanation I ever found! Thank you.
    From this explanation I understood that only 3 interrupts can be set each one related to each PCMSK#. Is that so?

  • @metronom_81
    @metronom_81 2 ปีที่แล้ว

    great sir

  • @salahyoucefa8821
    @salahyoucefa8821 ปีที่แล้ว +1

    I have a problem
    when I use interrupt with a program that quantifies the delay function, the interrupt does not work
    but when I eliminate the delay function, the interrupt works correctly

  • @salahyoucefa8821
    @salahyoucefa8821 ปีที่แล้ว +1

    j'ai un probleme
    quand j'utlise interruption ;avec un programme qui quantient la fonction delay ,l'interuption ne fonctionne pas
    mais quand j'limine la fonction delay ,l'interruption fonctionne correctement
    quelle la solution et Merci

  • @Schroeder9999
    @Schroeder9999 ปีที่แล้ว

    Do we not need to set the I-bit in the SREG register to high before any interrupt is enabled? Similarly I didn't see the I-bit in SREG set back to high after each execution of the interrupt subroutines. It was mentioned in the ATMEGA328 manual that the I-bit will be reset back to low by hardware after an interrupt has ocurred

  • @coolcolumbus
    @coolcolumbus 2 ปีที่แล้ว

    Love your videos, please put us a tutorial on atmega mcu programming with c or c++.... will really be grateful!!!

    • @AnasKuzechie
      @AnasKuzechie  2 ปีที่แล้ว

      Thanks for your feedback

  • @sankalpakr5368
    @sankalpakr5368 2 ปีที่แล้ว

    Hi sir,
    The video is so clear to configure pin change interrupts belonging to different ports.
    Could you please let me know how to configure pin change interrupts belonging to same port?

  • @pruthvirajg.k1965
    @pruthvirajg.k1965 8 หลายเดือนก่อน

    How do we configure Pin change interrupt assigned to a Pin which is set as output ? The datasheet claims the uC supports this but havent been able to do the same.

  • @a330turbinex7
    @a330turbinex7 ปีที่แล้ว

    Is it possible to use 3 interrupts for PWM inputs?

  • @waterfallphd8040
    @waterfallphd8040 8 หลายเดือนก่อน

    What happen if 2 interupt triger the same time

  • @NikhilSehgal21
    @NikhilSehgal21 2 ปีที่แล้ว

    Video is very informative. The only thing I didn't understand that inside ISR function the parameter is given ISR(PCINT0_vect), ISR(PCINT1_vect), ISR(PCINT2_vect), From where PCINT0,1 and 2 comes.
    As per datasheet we should be using PCINT20, PCINT5 and PCINT13 for pin D4,D13 and A5 respectively.
    Please help me to understand how PCINT0,1 and 2 comes instead PCINT20,5 and13. Thanks in advance.

    • @NikhilSehgal21
      @NikhilSehgal21 2 ปีที่แล้ว

      Please reply I need to use interrupt urgently.

    • @AnasKuzechie
      @AnasKuzechie  2 ปีที่แล้ว +1

      Hi. ATmega328 has 3 registers related to PCI, namely, PCMSK0, PCMSK1 & PCMSK2. Within theses registers PCINT0 to PCINT23 are allocated. Also, associated with each mask register is one ISR. So for example any pin change interrupt is enabled within PCMSK0 will invoke ISR(PCINT0_vect). I hope this clarifies, and I apologize for my late reply.

  • @G-Code_official
    @G-Code_official ปีที่แล้ว

    Hi, In the code I have seen that you didn't define A5 as input. Is it not required?

    • @AnasKuzechie
      @AnasKuzechie  ปีที่แล้ว

      Hi. No need since A5 is by default analog input.

  • @gokulkrish7256
    @gokulkrish7256 2 ปีที่แล้ว

    Hi Anas, this is Gokul.I would need you to guide me. Im building my own flight controller but the thing is I need to know which programming language would be better serving me to unlock the full capabilities of the microcontroller if I learn it. As of now I'm using C++.

    • @AnasKuzechie
      @AnasKuzechie  2 ปีที่แล้ว +1

      A combination of C++ and assembly. You can check out my series on programming Atmel controllers via assembly. Good luck with your project.

    • @gokulkrish7256
      @gokulkrish7256 2 ปีที่แล้ว

      @@AnasKuzechie Thank you so much. Sure I'll do that... Sir.

  • @AkashManish
    @AkashManish 3 ปีที่แล้ว

    can we use nano every instead
    ?

    • @AnasKuzechie
      @AnasKuzechie  3 ปีที่แล้ว +1

      Nano Every uses ATMega 4809, and it does support PCI. You need to check datasheet.

  • @dreamlessfull
    @dreamlessfull 2 ปีที่แล้ว

    Is there a way to make the ISR respond to falling/raising edges of the triggering signal?. Or should that be managed via software? Thank you for your video.