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

DFROBOT Buggy


  • Please log in to reply
21 replies to this topic

#21 Big Bear Brian

Big Bear Brian

    Member

  • Members
  • PipPip
  • 17 posts

Posted 19 May 2014 - 09:15 PM

Paul,

 

I've already gotten versions of code that do polling, as you're doing starting in Program.cs at line 220:

 

            // Loop forever
            while (true)
 
I'll have to go back to my code, BUT... allowing for six+ months of not working on this, my recollection is that I wanted to do this in INTERRUPTS, not a loop/polling. The idea is, why have a thread that's constantly spinning, doing nothing, while other threads could be delayed.
 
I'm looking more for something in which, during initialization in Main, I would do something on the order of the following pseudo-code:
 
     InterruptPort ethernetListener = new InterruptPort(EthernetPin);
     ethernetListener+= EthernetDataReceivedHandler;
 
And the method EthernetDataReceivedHander would process the data coming in across the wire.
 
Honestly, right now, I can't remember if I had some PARTICULAR reasoning for wanting to do it in Interrupts, or just aesthetic. :-) I DID get code working that used polling, and had my UDP broadcasts going out (as well as a Windows-based test harness that listened for the packets and could send its own arbitrary UDP packets.)
 
I KNOW that I've read a number of comments on Arduino forums regarding the W5100 that it "can be more efficient to use Interrupts". You have to bridge one set of solder connections on most of the W5100-based shields I've seen, but it's do-able. You then initialize your Arduino equivalent of InterruptPort, using the pins of the shield which it communicates back to the board (varies by manufacturer, IIRC). Does the built-in Ethernet on the Netduino Plus have equivalent capabilities?


#22 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 20 May 2014 - 06:24 AM

Answered in other post.

 

My understanding is that the receive thread is sleeping while it wait for data to arrive on socket, then it forwards message to main thread similar to an interrupt arriving.






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.