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 port


  • Please log in to reply
2 replies to this topic

#1 JeroenG

JeroenG

    Member

  • Members
  • PipPip
  • 13 posts

Posted 14 May 2013 - 12:50 PM

Hi

 

I have an interrupt problem. When i use the onboard sw then is everything OK. But when i change (pins.ONBOARD_SW1 to pins.GPIO_PIN_D0) and i run it then the boolean bRedyToStart is not stable. The boolean changed from state af few times. I use my own button.

I connect the button with one side to the D0 pin and the other side of the button i connect with GND.

 

 

Code:

Dim swStartStop As New InterruptPort(Pins.ONBOARD_SW1, True, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow)

 

AddHandler swStartStop.OnInterrupt, AddressOf StartMachine

 

Private Sub StartMachine(ByVal data1 As UInteger, ByVal data2 As UInteger, ByVal time As Date)

If bRedyToStart = False Then

bRedyToStart = True

buffer = encoding.GetBytes("H")

rs232.Write(buffer, 0, buffer.Length)

Thread.Sleep(1000)

 

Else

bRedyToStart = False

buffer = encoding.GetBytes("L")

rs232.Write(buffer, 0, buffer.Length)

Thread.Sleep(1000)

End If

End Sub

 

Thanks for help



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 May 2013 - 09:17 PM

Hi JeroenG, 

 

In your InterruptPort constructor, you're turning off the pin's internal pullup with Port.ResistorMode.Disabled.

 

Try setting that to Port.ResistorMode.PullUp instead.  You've connected your button to ground so that it is driven LOW when you press it--but you need it to be weakly pulled HIGH by default.  That's what a pull-up does.

 

Does that help?

 

Chris



#3 JeroenG

JeroenG

    Member

  • Members
  • PipPip
  • 13 posts

Posted 15 May 2013 - 11:54 AM

Hi Thyanks for help but it dont working. Is it possible that my hardware is connected properly? Do I need an external pull up resistor?  






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.