Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Plus (wrong Pinnumber on Interrupt?)


  • Please log in to reply
2 replies to this topic

#1 y5ee

y5ee

    New Member

  • Members
  • Pip
  • 2 posts

Posted 29 June 2011 - 05:54 AM

Hello,

can somebody tell me, how the Netduino Handle the first Parameter on an default Interrupt?

 InterruptPort button = new InterruptPort(Pins.GPIO_PIN_D6, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
            button.OnInterrupt +=new NativeEventHandler(button_OnInterrupt);

static void button_OnInterrupt(uint port, uint state, DateTime time)
        {
            Debug.Print("Port: " + port.ToString() + " State: " + state.ToString());
            
        }

If i fire this i get:

Port: 52 and State: 0 or 1.

Why GPIO_PIN6 gives me 52?
Pin4 = 12
Pin5 = 51
Pin6 = 52

Somebody knows this Problem?

Kind regards

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 June 2011 - 06:04 AM

Hi y5ee,

Digital pin header D6 maps to the microcontroller's pin PB20. PB (port B) pins start at pin 32, so pin PB20 = 32 + 20 = 52.

Schematic:
http://www.netduino....s/schematic.pdf

In your handler, simply compare the first parameter (which you've named port) to the D6 pin values...

For instance:
if (port == (uint)Pins.GPIO_PIN_D6)
    Debug.Print("pin is D6.");

Does that make sense?

Chris

#3 y5ee

y5ee

    New Member

  • Members
  • Pip
  • 2 posts

Posted 29 June 2011 - 06:11 AM

Thank You Very Much! :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.