Go Down

Topic: Intterrupts (Read 1 time) previous topic - next topic

baum

What is the difference between a pin-change interrupt and an external interrupt?

Thanks!
baum

johnwasser

The external interrupts are associated with specific interrupt pins.  They can be set to signal on a LOW level, RISING edge, FALLING edge, or CHANGE (both rising and falling edge).

There is one "Pin Change" interrupt per port (8-bit group of I/O pins).  The pins within the group can be individually masked.  The pins are sampled periodically and the interrupt is signaled if any of the un-masked pins has changed.  If you have more than one pin in a port enabled you have to read the interrupt flag register to find out which pin(s) changed.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

baum

But on the attiny, every pin has a pcint (pin change interrupt)!!!!


http://www.atmel.com/dyn/resources/prod_documents/2535S.pdf (2ndPage)

Coding Badly

Pin-change...
• Applies to all pins
• Overloaded; all pins on a port are vectored through a single interrupt handler
• Fires only on CHANGE
• Processor clock does not need to be running

External...
• Applies to only specific pins
• One-to-one; each pin has a dedicated interrupt handler
• Can be configured to fire on RISING, FALLING, LOW, CHANGE
• Requires the processor clock to be running (except LOW)

Coding Badly

Quote
But on the attiny, every pin has a pcint (pin change interrupt)!!!!


Each pin on that processor is capable of generating a pin-change interrupt.  If any pin is configured to generate a pin-change interrupt, when the interrupt occurs, execution is vectored through a single interrupt service routine.

baum

How do I call the ISR and get the pin state?

Is it something like

PCINT << 4?

Coding Badly

Quote
How do I call the ISR


Are you asking how to enable pin-change interrupts?

Quote
and get the pin state?


digitalRead


baum

So I can use digital read w/ your cores; how do i do pchange interrupts?

Coding Badly


You're going to have a tough time using any core with an ATtiny13.  It really does not have much memory (64 bytes of SRAM; 4 bytes are used just getting into loop).  The processor was really meant to be programmed using assembly or possibly "raw" C.

There is an enormous amount of information available regarding pin-change interrupts.

http://www.google.com/search?q=arduino+pin+change
http://www.arduino.cc/playground/Main/PcInt
http://www.arduino.cc/playground/Main/PinChangeInt
http://arduino-tiny.googlecode.com/files/PinChangeInterrupt-0001.zip
http://arduino.cc/forum/index.php/topic,51838.msg369796.html#msg369796

baum

I was talking about the '85... sorry!

So in summary, external interrupts execute certain code when triggered, pin change interrupts are a register that stores the inputs on that port?

Coding Badly

Quote
I was talking about the '85... sorry!


In that case, just snag the Pin Change library from the Tiny Core website and play a bit.

So in summary, external interrupts execute certain code when triggered


Yes.

Quote
pin change interrupts are a register that stores the inputs on that port?


No.  "Pin change interrupts" also execute certain code when triggered.  The difference is that up to eight pins are tied to a single interrupt service routine and only CHANGE is supported.

Go Up