element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Dev Tools
  • Products
  • More
Dev Tools
Forum Which Attiny84 pins are interrupt pins
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Dev Tools to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 6 replies
  • Answers 1 answer
  • Subscribers 77 subscribers
  • Views 2916 views
  • Users 0 members are here
Related

Which Attiny84 pins are interrupt pins

Former Member
Former Member over 11 years ago

Hi,

 

Attiny84 datasheet says that it has pin change interrupt possibility on 12 Pins. I am trying to figure out which pin numbers are to be used when writing a program for Attiny84 in Arduino IDE? Say I want to use physical pins 12 and 11as interrupt pins.

  • Sign in to reply
  • Cancel
  • gihu
    0 gihu over 11 years ago

    Hi,

     

    First of all, I suppose that you have set up the IDE to use it to build code for ATtiny84, if not, check:

    Setting up Arduino IDE for ATtiny's| OpenEnergyMonitor

    In the pins_arduino.c file you will find how pins are numbered, in that case:

     

    // ATMEL ATTINY84 / ARDUINO

    //

    //                                     +-\/-+

    //                           VCC 1|      |14 GND

    //                   (D 0) PB0 2|      |13 AREF (D10)

    //                   (D 1) PB1 3|      |12 PA1 (D9) 

    //                            PB3 4|      |11 PA2 (D 8) 

    // PWM INT0 (D 2) PB2 5|      |10 PA3 (D 7) 

    //          PWM (D 3) PA7 6|      |9 PA4(D 6) 

    //          PWM (D 4) PA6 7|      |8 PA5(D 5) PWM

    //                                      +----+

     

    Pins with PCint capability are whole portA, and portB from pin0 to pin3.

    Check also PinChangeInterrupt-0001.zip library to know how it works.

     

    Hope it helps, regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to gihu

    OK, thanks. Do I understand it correctly that if I want to use physical pins 11 and 12 I should use 1 and 2 as logical pin numbers?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 11 years ago in reply to Former Member

    No, in example, to have a '1' on physical pin 11 digitalWrite(8,HIGH), to have a '0' on physical pin 12 digitalWrite(9, LOW). You fist must configure pin mode.

    But check how work interruptions libraries and classes.

     

    Regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to gihu

    I believe I should use pins 8 and 9 if I want to simply write to them. But my problem is that I want to use those pins as interrupt pins. I thought interrupt pin numbers are different from digital or analog pin numbers? From this pinout below I thought I should be using PCINT1 and PCINT2, i.e. pins 1 and 2 as interrupt pins. But it does not work. I used this video as an example Tutorial 10 for Arduino: Interrupts and Hardware Debouncing - YouTube (see from minute 11). It is about Arduino Uno, but I need to do the same on Attiny84 using two interrupt pins.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 11 years ago in reply to Former Member

    That's how it works for the arduino, you are rigth, but notice that he is using attachedInterrupt funtion.

    You can use the attachedInterrupt funtion included in the WInterrupts.c library, like this.

    Or you can use the libraries in PinChangeInterrupt-0001.zip:

    Downloads - arduino-tiny - ATtiny core for Arduino - Google Project Hosting

    Where the function is attachedPCInterrupt, and the first parameter in this function is the pin number, so it depends on what you are using.

    What are you using? If you were using WInterrupts.c, try PinChangeInterrupt library and its function.

    I am sorry for not being more helpfull, but I don't have an Attiny84 to check it by myself... image

     

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to gihu

    Thanks gihu. I think I realize now that I am confusing External interrupts with Pin Change interrupts.I am trying to use attachinterrupt function as per video tutorial I mentioned and it looks like it only works with External interrrupts (i.e.pin 5 on Attiny84). Working with attachinterrupt function does not require any additional libraries. Will have to figure out now how to program Pin Change interrupts.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube