About interrupt

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't have the scope, is there any mathematical method to determine this also is there any tutorials or about this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Slavko,

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.)

Bye,
Michael

In the beginning was the Word, and the Word was with God, and the Word was God.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

@mckenney
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?

@skotti
I have the filter and I don't have the multiple triggering.

@bob
I measure the frequency of my analog signal, but your information is very useful for my another project :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

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.

Lee

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, thanks