First i hesitated to watch an one hour video about this topic but afterwards, i have to commit i'm grateful to got such a detailed introdutction in interrupts. Top Job! Keep going!
Thank you for posting these videos. At the PC-interrupt code example, although the main concept is clear, inside the loop() function the interrupts are disabled but serial.print() is used.
Hi Robert, I'm totally new to this stuff that's why I am watching your videos, thanks! Watching another video yesterday I read a few lines of the ATmega48A/PA/88A/PA/168A/PA/328/P manual, which says the following in the first paragraph of chapter 13: "Observe that, if enabled, the interrupts will trigger even if the INT0 and INT1 or PC INT23...0 pins are configured as outputs." I just want to point out that you mention that the pins need to be set up as inputs for them the be able to handle interrupts (after 5:00), which doesn't seem to be correct for the above ATmega chips. I appreciate your work though, ciao!
Dr. Paz, excellent lectures. It would be excellent and helpful to have the lab assignments so I could apply the material from class. It would also be very helpful if we could have the homework assignments (without solutions) to work them out as well as reading assignments from the book. There is a lot of material in the classes and it is difficult to figure out how to make use of it without these complements. I have bought the EduBoard but without the labs It is difficult to make use of it. Thank you.
Thanks for asking. I've been asked before, but there is not a convenient way to do this. For now I think I will simply add more videos with problems that are like the ones I assign for homework or for lab.
Great video, code works wonders however i am having trouble detecting a low or high state of that particular pin is this possible? i am only able to detect that a interrupt was triggered by pin 3 (in my case) but instead i get results for both low and high states.
Nice video. Given that you shouldn't Serial.print inside the interrupt how would you send a stream of information (e.g. the time between interrupts) from the interrupt to the main loop? Some kind of circular buffer?
Hi Dr. Paz.. can you apply interrupts to an ultrasonic sensor even if the output signal of the sensor is not a square wave? Will it go to the interrupt function once the input gets small enough?
can i use obstacle detector as an interrupt...i want two arduinos to turn on or off one after other with obstacle sensor attached to each arduino uno...when one arduino is working the devices connected to it should operate and other arduino should stop working..and vice versa
I'm learning a lot from your videos. I was wondering if you have any resources, projects, IC's I can buy or any practical work that I can do to hammer in these concepts. I understand by doing. There are are resources online on interrupts but they don't give it the same detailed/thorough approach as you do on ANY TOPIC, be it I2C, SPI or whatever. I can write an essay on how interrupts work, but I can't for the life of me program it onto an Arduino, I want that ability. Do you give your students labs based on these topics?
Yes, a Lab accompanies this course as well as homework. While I wouldn't post all of those things here (so that my students don't have the answers), I can see from your post that it might be good to include a hands-on component with each lecture video. Hmm. I'll have to think about that....
Hi, I have tried interrupt to capture the width of a pulse of a PWM input (say set to 1100us @ 400hz), My reading is getting a variance +/- 4us meaning a random value of 1104 ,1100, 1096. I use micros() to get time change between HIGH and LOW of the pulse Question: Is it something to do with resolution of timer that used by micros(() or the resolution of the interrupt timer? Is there a work around to increase the resolution of the micros()? or the interrupt in the UNO/Mega? On DUE i got descent +/- 1us Thanks.
On the Uno, Duemilanove, and Nano (16MHz) arduinos, the micros() command has a resolution of 4us (it always returns a value that is divisible by 4). It sounds like what you are trying to do is on the boundary of that resolution. A better way to do this capture is to use the Timer 1 Input Capture capability. This has uses an analog comparator and a noise canceler before the edge detector. The output of the edge detector can be used to set the ICF1 (input capture flag) which can be set to trigger an interrupt. I've seen a lot of garbage on the net about this. I recommend you go directly to the source: www.atmel.com/Images/doc8161.pdf
hello i work for long time to understand pin change int but it doesn't work i want to have code wich use pin 7 (on arduino uno ) as pin change int to turn on and off led on pin 13
I use timer two and the OC2B and OC2A registers (pin 3 and 11). Both pins generate the same output except one is an inverted output. How do i make a dead time between these outputs to make sure both are never on at the same time?
If I understand you correctly, you want two signals with the same frequency, but different phase. To do this, set up a timer to have twice the frequency as the desired frequency. Toggle the first signal on the rising edge of the timer, and the other signal on the falling edge of the timer. This will create two signals in "quadrature."
First i hesitated to watch an one hour video about this topic but afterwards, i have to commit i'm grateful to got such a detailed introdutction in interrupts.
Top Job! Keep going!
Many Thanks Mr Paz for these lessons. I learned a lot of information.
Great lecture, I love the detail you go into. I'll definitely be returning for more in the future. Too much eye contact though.
Thank you for posting these videos.
At the PC-interrupt code example, although the main concept is clear, inside the loop() function the interrupts are disabled but serial.print() is used.
Thanks for mentioning that. I'll take a closer look.
Hi Robert, I'm totally new to this stuff that's why I am watching your videos, thanks!
Watching another video yesterday I read a few lines of the ATmega48A/PA/88A/PA/168A/PA/328/P manual, which says the following in the first paragraph of chapter 13:
"Observe that, if enabled, the interrupts will trigger even if the INT0 and INT1 or PC INT23...0 pins are configured as outputs."
I just want to point out that you mention that the pins need to be set up as inputs for them the be able to handle interrupts (after 5:00), which doesn't seem to be correct for the above ATmega chips.
I appreciate your work though, ciao!
Dr. Paz, excellent lectures.
It would be excellent and helpful to have the lab assignments so I could apply the material from class. It would also be very helpful if we could have the homework assignments (without solutions) to work them out as well as reading assignments from the book. There is a lot of material in the classes and it is difficult to figure out how to make use of it without these complements. I have bought the EduBoard but without the labs It is difficult to make use of it.
Thank you.
Thanks for asking. I've been asked before, but there is not a convenient way to do this. For now I think I will simply add more videos with problems that are like the ones I assign for homework or for lab.
Great video, code works wonders however i am having trouble detecting a low or high state of that particular pin is this possible? i am only able to detect that a interrupt was triggered by pin 3 (in my case) but instead i get results for both low and high states.
WHAT I DO IS A JUST SAY " WELLLLL EXCUSSSSSSSSE MEEEEEEEEEE" AND THEN INTERRUPT ! GREAT VID ! THANKS.
Nice video.
Given that you shouldn't Serial.print inside the interrupt how would you send a stream of information (e.g. the time between interrupts) from the interrupt to the main loop? Some kind of circular buffer?
Hi Dr. Paz.. can you apply interrupts to an ultrasonic sensor even if the output signal of the sensor is not a square wave? Will it go to the interrupt function once the input gets small enough?
can i use obstacle detector as an interrupt...i want two arduinos to turn on or off one after other with obstacle sensor attached to each arduino uno...when one arduino is working the devices connected to it should operate and other arduino should stop working..and vice versa
in one word, awesome...
I'm learning a lot from your videos. I was wondering if you have any resources, projects, IC's I can buy or any practical work that I can do to hammer in these concepts. I understand by doing. There are are resources online on interrupts but they don't give it the same detailed/thorough approach as you do on ANY TOPIC, be it I2C, SPI or whatever. I can write an essay on how interrupts work, but I can't for the life of me program it onto an Arduino, I want that ability. Do you give your students labs based on these topics?
Yes, a Lab accompanies this course as well as homework. While I wouldn't post all of those things here (so that my students don't have the answers), I can see from your post that it might be good to include a hands-on component with each lecture video. Hmm. I'll have to think about that....
If you look at Lecture 16 H, you'll find an example worked from start to finish!
Hello Mr. Paz I love you lectures but could you do lecture about Arduino Processing?
Hi, I have tried interrupt to capture the width of a pulse of a PWM input (say set to 1100us @ 400hz), My reading is getting a variance +/- 4us meaning a random value of 1104 ,1100, 1096. I use micros() to get time change between HIGH and LOW of the pulse Question: Is it something to do with resolution of timer that used by micros(() or the resolution of the interrupt timer? Is there a work around to increase the resolution of the micros()? or the interrupt in the UNO/Mega? On DUE i got descent +/- 1us Thanks.
On the Uno, Duemilanove, and Nano (16MHz) arduinos, the micros() command has a resolution of 4us (it always returns a value that is divisible by 4). It sounds like what you are trying to do is on the boundary of that resolution. A better way to do this capture is to use the Timer 1 Input Capture capability. This has uses an analog comparator and a noise canceler before the edge detector. The output of the edge detector can be used to set the ICF1 (input capture flag) which can be set to trigger an interrupt. I've seen a lot of garbage on the net about this. I recommend you go directly to the source: www.atmel.com/Images/doc8161.pdf
Thanks,
Was that an error to set Portcpast = Portcstate BEFORE comparing them with an XOR?
hello
i work for long time to understand pin change int but it doesn't work
i want to have code wich use pin 7 (on arduino uno ) as pin change int to turn on and off led on pin 13
I use timer two and the OC2B and OC2A registers (pin 3 and 11). Both pins generate the same output except one is an inverted output. How do i make a dead time between these outputs to make sure both are never on at the same time?
If I understand you correctly, you want two signals with the same frequency, but different phase. To do this, set up a timer to have twice the frequency as the desired frequency. Toggle the first signal on the rising edge of the timer, and the other signal on the falling edge of the timer. This will create two signals in "quadrature."
Very informative!
hello Robert what worke Arduino witch PLC
Thanks, that was a big help.
That would be great!
Thank you.
hi is this usable for arduino uno? to set 1 khz freq
Yes. You can do this using a timer with a Compare Match Interrupt. See how this works in Part II.
The updated code.google (referenced 58:08) may be found on GitHub github.com/GreyGnome/EnableInterrupt
tnx master but how to do this code with matlab
Don´t interrupt while I´m interrupting you :-)