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

Interrupt event handler conflicts


  • Please log in to reply
1 reply to this topic

#1 cce1911

cce1911

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts
  • LocationGeorgia, USA

Posted 21 August 2013 - 01:47 PM

I have a N+2 driving 2 stepper motors with the Sparkfun Easydriver. I have wired up several external buttons

InterruptPort ipT1 = new InterruptPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);ipT1.OnInterrupt += Target_OnInterruptT1;InterruptPort ipT2 = new InterruptPort(Pins.GPIO_PIN_D1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);ipT2.OnInterrupt += Target_OnInterruptT2;

?

 

Here are my event handlers

        static void Target_OnInterruptT1(uint data1, uint data2, DateTime time)            {            if (dtLastHit.AddMilliseconds(intBounceWait) > time) return; // prevent bounce            dtLastHit = time;            Debug.Print("Hit T1 = " + DateTime.Now.ToString("MM/dd/yy H:mm:ss.fff"));            }        static void Target_OnInterruptT2(uint data1, uint data2, DateTime time)            {            if (dtLastHit.AddMilliseconds(intBounceWait) > time) return; // prevent bounce            dtLastHit = time;            Debug.Print("Hit T2 = " + DateTime.Now.ToString("MM/dd/yy H:mm:ss.fff"));            }

My problem is that when I press button T1 it randomly executes Target_OnInterruptT2 or Target_OnInterruptT1. No rhyme or reason. The same thing happens if I press button T2.

 

What is odd is that I've used this same exact board with 5 buttons, in the past, and had no problems. Any idea what is happening? I thought it might be EMI from the Easy driver, but I still get the same behavior even if I disconnect power to the stepper motors.

 

I'm scratching my head...



#2 grey

grey

    Member

  • Members
  • PipPip
  • 12 posts

Posted 01 October 2013 - 08:02 AM

Hi cce1911,

 

maybe you could post a picture of your board.

 

I had the same problem. It was because I had no resistors.

My finger had caused an interruption, even though I had not clicked the button.

 

 






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.