Hi, I use external interrupt with falling edge detection. My signal looks like this on the picture. How can I determine the point of time at whom interrupt will be executed?
Id set up a scope with your pictured signal on one channel and an output in on another channel set to trigger. For your first instruction, set the output pin. Use a wave generator and see how voltage level and fall time affect the irq timing.
I don't have the scope, is there any mathematical method to determine this also is there any tutorials or about this?
Slowly lower voltage and see at what point the irq happens buy making it turn on a light. As far as timing, it takes a certain low number of clock cycles to get to the irq but usually its nothing to worry about.
In the "Electrical Characteristics" in the Data Sheet for your device, look for
"Input Low Voltage"; that will tell you (roughly) what Y value in your
picture will trigger the interrupt.
Unless your picture shows an analytic function, you may find it difficult to
compute mathematically what t[s] value the trigger corresponds to; i.e.
you may end up finding out experimentally (as suggested above) anyway.
pay attention to the multiple triggering of the IRQ. If there is a little noise on your signal and the falling of the signal is slow, the interrupt handler can be called a fewtimes (you can set a flag in the software or if your AVR has an build-in noise-canceler, use the timer/counter-pin with overflow value 1 instead of the external IRQ pin, noise-canceler is very helpful for frequency measurement).
How about using an external Schmitt trigger? E.g. 74x14 or an OpAmp where you can tune the trigger level? (It depends on the application if too too complicated.)
In the beginning was the Word, and the Word was with God, and the Word was God.
You have a voltage divider from the vcc, put this before a diode to the big cap. If you have several 10s of ms holdup in the cap before the 5v reg drops out. The vcc drops and triggers a falling edge interrupt, you have just enough time to save a couple bytes in eeprom at 10ms per byte.
Imagecraft compiler user
The signal on my picutre is: U = 45*sin( 2*pi*f ) V, f = 50Hz (analog :D) and it is truncated by internal clampling diodes.
I found in the electrical charactheristics (ATmega48) the input low voltage and it is max 0.3Vcc. Since my Vcc is 5V, the input low voltage is 1.5V. Is this mean that when my signal change from 1.6V to 1.4V an interrupt will be triggered?
I have the filter and I don't have the multiple triggering.
I measure the frequency of my analog signal, but your information is very useful for my another project :D
Is this mean that when my signal change from 1.6V to 1.4V an interrupt will be triggered?
Not necessarily. The figures in the datasheet give the levels at which the signal is guaranteed to be a low or a high. In between is "no man's land".
If it is critical to your application to know the level, consider using the analog comaprator or other means.
You can put lipstick on a pig, but it is still a pig.
I've never met a pig I didn't like, as long as you have some salt and pepper.
© 2019 Microchip Technology Inc.