Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Using Pin Change Interrupt (PCINT) for wakeup

Using Pin Change Interrupt (PCINT) for wakeup

Scheduled Pinned Locked Moved Development
interruptarduino
6 Posts 4 Posters 7.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dirk_H
    Contest Winner
    wrote on last edited by
    #1

    Hello,

    Can I use the Pinchange Interrupts (PCINT), which are available for every Pin, to wakeup the Arduino/MySensors module?

    I think I read in a Sketch which uses Sleep Mode that only the "real" 2 Interrupt pins can be used.
    Is this true? I also think that I saw a sketch somewhere where someone used the pinchange Interrupts to wake up (but it was not in conjunction with MySensors I think).

    Anyway has anybody tried to use PinChange Interrupts or can give some more Information on that topic?

    Tanks in advance
    Dirk_H

    axillentA 1 Reply Last reply
    0
    • D Dirk_H

      Hello,

      Can I use the Pinchange Interrupts (PCINT), which are available for every Pin, to wakeup the Arduino/MySensors module?

      I think I read in a Sketch which uses Sleep Mode that only the "real" 2 Interrupt pins can be used.
      Is this true? I also think that I saw a sketch somewhere where someone used the pinchange Interrupts to wake up (but it was not in conjunction with MySensors I think).

      Anyway has anybody tried to use PinChange Interrupts or can give some more Information on that topic?

      Tanks in advance
      Dirk_H

      axillentA Offline
      axillentA Offline
      axillent
      Mod
      wrote on last edited by
      #2

      @Dirk_H sure, you can use this interrupt on any pin.

      It is not a standard arduino future but I'm sure you can find someone else library for this.
      I personally did all needed programming just by reading atmel's datasheet, It is very simple to do it without any library,
      If you will need help this way just let me to know
      See register description page 56 http://www.atmel.com/images/atmel-7810-automotive-microcontrollers-atmega328p_datasheet.pdf#56

      sense and drive

      1 Reply Last reply
      0
      • scalzS Offline
        scalzS Offline
        scalz
        Hardware Contributor
        wrote on last edited by scalz
        #3

        Hi.
        I am trying to use pin change interrupt. It does not compile with the master branch but it compiles well with the dev branch (maybe cleanings have been done in the dev branch).
        The compile error is about the PCINT2_vect. What can I change in the master branch to fix my problem. I think it is related to pinchangeint.h
        I have another question related to change interrupt.
        If i have an interrupt configured on d5 or d6 in the mask for example. And a sensor connected on pin of the same mask but with no interruption on its pin (a temp sensor for example).
        Does the sensor will trigger? Or it will use the mask rightly?

        I hope I am clear in my explanation.

        Here is the simple piece of code I added in my node:

        // Problem  here
        ISR(PCINT2_vect) {
          Serial.print("Interruption : ON");
        }
        In setup() I add this :
        PCMSK2 = PCMSK2 | B00010000;
        PCIFR = PCIFR | B00000100;
        PCICR = PCICR | B00000100;
        
        MySensors\MyGateway.cpp.o: In function `__vector_5':
        C:\Users\Pascal\Documents\Arduino\libraries\MySensors\utility/PinChangeInt.h:583: multiple definition of `__vector_5'
        TempHumidOnMotion.cpp.o:/Arduino/TempHumidOnMotion.ino:73: first defined here
        collect2: error: ld returned 1 exit status
        Erreur lors de la compilation.
        1 Reply Last reply
        0
        • D Offline
          D Offline
          Dirk_H
          Contest Winner
          wrote on last edited by
          #4

          @scalz
          Hi, regarding you first qeustion I'll copy somehting from my Project Documentation from the Wall Remote below.
          I dont really understand your second question. If you enable the interrupts on pin5 and pin6, the interrupt will always be triggered if the pin changes its voltage level... It can obviously not discover what caused the voltage level only that it did.. But I fear I do not understand exactly what you mean..

          To wake up the controller from sleep mode, which is used to save power, the PinChange Interrupts
          have been used, but Arduino compiles also the MyGateway.cpp where PinChange interrupts also
          have been used. Because every Interrupt Vector is only allowed to be once in the compiled code this
          is a problem.
          However the workaround for this is to rename the “MyGateway.cpp” from the “{Arduino
          Sketchbooks}\libraries\MySensors” into something the compiler does not try to compile e.g.
          “MyGateway.cpp.nolib”. Remind to undo this renaming if you want to compile a MySensors
          Gateway!
          You find the {Arduino Sketchbooks} location by “File-Prefernces” in the Arduino IDE.
          When the files have been renamed it is possible to compile the WallRemote sketch. When
          everything is connected like shown above you can also download the sketch to the hardware. For
          the download the correct Board and COM port must be selected. Make sure the
          “Tools->Board->Arduino Pro or ProMini (3.3V, 3.6864 MHz) w/ ATmega328” is selected. This
          board has been added earlier to the Arduino environment in section 2.7.

          1 Reply Last reply
          0
          • scalzS Offline
            scalzS Offline
            scalz
            Hardware Contributor
            wrote on last edited by
            #5

            Hi.
            @Dirk_H I should try before. I renamed Mygateway.cpp and it works well now.
            Thx for your help.

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              Or use development branch where this dependency has been removed from the library.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              15

              Online

              11.7k

              Users

              11.2k

              Topics

              113.0k

              Posts


              Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular