Go Down

Topic: Interupts (Read 4 times) previous topic - next topic

Xbee

@ CosineKitty....

But how can we generate internal interrupts like when a variable reaches a particular value. I actually want to generate interrupt when the distance of my robot from wall reaches a threshold value. obviously this threshold value is calculated in software (Arduino environment).

Are there any internal interrupts in Atmega328?

Thanks!

retrolefty

Quote
I actually want to generate interrupt when the distance of my robot from wall reaches a threshold value. obviously this threshold value is calculated in software (Arduino environment).


If the sensor value is read and threshold calculated in the sketch there is hardly a reason I can think of why you need that to generate an interrupt. Just setting a global flag variable in your sketch when the threshold is met can be used anywhere else in the sketch as required.

If you can explain why you think that generating an interrupt is required or desirable, please share your thinking.

Lefty

Xbee

I thought that since i am continuously checking the reading of the sensor to see whether it has reached the threshold value, its similar to polling for an external input. So i need interrupt. If it is not so then when do we need internal interrupts like why do we have timer interrupts then? Can you give any practical example of internal interrupts in any system.

Thanks!

AWOL

#13
Jun 08, 2010, 08:08 pm Last Edit: Jun 08, 2010, 08:11 pm by AWOL Reason: 1
Quote
Can you give any practical example of internal interrupts in any system


Well, there are address faults, invalid instruction faults, supervisor calls, access violations...

All of these need to operate at much smaller timescales than anything that involve a moving platform (though not, admittedly, on an AVR!).

If you think you absolutely must have an interrupt, then you're going to need some sort of external comparator.

But you don't, really - trust me.


"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Xbee

Ok..i got it. thanks!

Go Up