Author Topic: AVR - is it possible to set interrupts on a port instead of a pin?  (Read 3498 times)

0 Members and 1 Guest are viewing this topic.

Offline kolonelkadatTopic starter

  • Regular Contributor
  • *
  • Posts: 202
  • Country: us
  • Obviously, windows are central to Windows.
    • Force Project X
Im using an atmega 328p with a small keypad attached. The keypad is attached to port C (analog 0-5).

What I would like to do is have an interrupt that wakes the microcontroller when any of the keys are pressed. Is there a way to do this?
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1196
  • Country: ca
    • VE7XEN Blog
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #1 on: June 06, 2014, 05:10:20 am »
Pin Change interrupt. Should be available on most pins, and you can enable many at once. Only one ISR is fired regardless of which pin changes, you then need to poll to figure out which one(s) were triggered.

Didn't actually read the link, but this looks like it covers it: https://sites.google.com/site/qeewiki/books/avr-guide/external-interrupts-on-the-atmega328
73 de VE7XEN
He/Him
 

Offline kolonelkadatTopic starter

  • Regular Contributor
  • *
  • Posts: 202
  • Country: us
  • Obviously, windows are central to Windows.
    • Force Project X
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #2 on: June 06, 2014, 05:33:47 am »
perfect! thanks.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #3 on: June 06, 2014, 10:09:34 am »
Quote
Is there a way to do this?

OR those pins into one single interrupt pin - check to make sure that it can wake up the mcu from your sleep mode.
================================
https://dannyelectronics.wordpress.com/
 

Offline SirNick

  • Frequent Contributor
  • **
  • Posts: 589
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #4 on: June 06, 2014, 06:35:12 pm »
Uhh, I don't see any advantage to using external logic when the PCInt method is exactly what the OP is looking for... ?
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4232
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #5 on: June 07, 2014, 11:21:34 am »
The PCINT is probably incapable of creating a wake-up from deep sleep. This is probably exclusively for the INT pins.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10425
  • Country: nz
Re: AVR - is it possible to set interrupts on a port instead of a pin?
« Reply #6 on: June 07, 2014, 11:41:37 am »
The PCINT is probably incapable of creating a wake-up from deep sleep. This is probably exclusively for the INT pins.

nope, PCINT can wake up an AVR from all sleep states.
PCINT is a true interrupt, like INTx.
« Last Edit: June 07, 2014, 11:43:17 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf