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

Resistormode


  • Please log in to reply
6 replies to this topic

#1 John West

John West

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 04 August 2011 - 02:27 AM

So I have an external pushbutton wired to my design. I have now learned that I need to have a pullup resistor to prevent spurious readings (a good article about this is http://www.ladyada.n...no/lesson5.html). I changed my code to the following:

button2 = new InterruptPort(Pins.GPIO_PIN_D8, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);

However, this didn't seem to work. However, when I added this line:

button2.Resistor = Port.ResistorMode.PullUp;

It worked. Is this expected? If so, then I'm assuming that the constructor is used to tell it what mode is being used, but has no bearing on whether the resistor is external or internal. In order to actually turn the internal resistor on, you have to use the second line.

Is this correct? I'm posting because I think it is, and if so, it might be handy for others. I haven't seen an example showing the second line of code, so others might have missed it.

Can anyone confirm these findings with certainty? Has it been posted elsewhere and I've just missed it?

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 04 August 2011 - 09:04 AM

Hi John West, If you haven't got a pullup/pulldown circuit next to your button, then yes, that's as expected. For more details, you should read http://en.wikipedia....ull-up_resistor
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 Philip

Philip

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationPreston, England

Posted 17 October 2011 - 09:45 PM

Hi John West,

If you haven't got a pullup/pulldown circuit next to your button, then yes, that's as expected.
For more details, you should read http://en.wikipedia....ull-up_resistor


Hi Stefan,

I'm puzzled by your statements above regarding the software statements. What does:

button2.Resistor = Port.ResistorMode.PullUp;

achieve that

button2 = new InterruptPort(Pins.GPIO_PIN_D8, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);

does not? (apart from the reference to the interrupt). I'm not convinced that setting something twice in software can make up for a (real) missing (hardware) resistor. I'd be interested in why you expect it to be that way. Is it something to do with the configuration of an interrupt, rather than a basic I/O pin?

Phil

#4 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 18 October 2011 - 05:16 AM

Actually, that is strange :) I only set such values in the constructor and never had problems with it. How does your schematic looks like?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#5 Philip

Philip

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationPreston, England

Posted 18 October 2011 - 10:04 AM

Actually, that is strange :)
I only set such values in the constructor and never had problems with it. How does your schematic looks like?


Hi Stefan

No pull-up resistors on my board. I had assumed that setting Port.ResistorMode.PullUp did this for me. Then I had a problem with digital inputs on my project - started reading, and found your post.

Turns out that my problem lay elsewhere in my code.

Once I have configured my inputs as Port.ResistorMode.PullUp, I can leave them open-circuit for a logic 1 and ground them for a logic zero (which confirms my original understanding).

I would be *really* interested to know what the internal pull-up value is - does anyone know? I suppose I should read the Atmel data sheet . . . .

Let me know what you think

Phil

#6 Dan T

Dan T

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationBoston (Greater)

Posted 19 October 2011 - 02:43 AM

Quick check of the datasheet I have ("Prelim" from Feb 09) says pullup current is 60uA max with 3.6V... so 60kOhm?

#7 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 19 October 2011 - 06:45 AM

It's about 10-11kΩ See also: http://www.atmel.com...nts/doc6120.pdf page 610.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs




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.