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

ondatarecieved vs timer?


  • Please log in to reply
2 replies to this topic

#1 Sean Whaley

Sean Whaley

    New Member

  • Members
  • Pip
  • 1 posts

Posted 08 January 2014 - 03:10 AM

I am learning how to use the serial port by reading GPS NEMA output. My question is I've seen both timer and ondatarecieved events used to check/receive the input. Is there a reason to use one method over the other?



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 January 2014 - 06:15 AM

Sean, Use SerialPort_DataReceived. Event-driven code is the way to go. If you use timers (and I presume you mean using SerialPort.Read(...) with a non-infinite ReadTimeout) that does work--but it blocks anything else in your thread from executing. Welcome to the Netduino community, Chris

#3 rharding64

rharding64

    New Member

  • Members
  • Pip
  • 8 posts

Posted 08 January 2014 - 10:09 AM

on the PC host side, I have been doing much in creating c# terminal emulator applications along with design/build of electronic test fixtures to provide interface and test of the DUT since 2004. DataReceived should only be performing one job; take in the raw data and push into incoming queue. buffer. Once received, data can be parsed and pushed into individual bins based on requirements.

 

Primarily, particularly when talking with modem devices, you are concerned with sending command and getting back expected responses. Here you can detect whether you actually send out what you intended to and detect whether the response coming back from the DUT is what was expected. 

 

Secondly, there is also non-solicited, asynchronous data to contend with.  These are status indicators that can come at any time.  Push these into a separate set of bins. 

 

by applying various design patterns such as Singleton, Observer and others along with multi-threaded coding techniques provides ability for serial interface that captures both solicited and unsolicited data streams.

 

My last job dealt with NMEA GPS parsing.  I created c# based utility to test the GPS receiver in the new products. A figure of merit for GPS receivers is the 'TTFF' or 'time to first fix'. There are a series of 12 satellites where you are looking for the best RSSI signal strength results. This occurs across the top 4(since the fix is based the 4 dimensions of latitude, longitude, altitude and time). if you have specific questions i would be happy to answer them for you. 

 

Ron






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.