Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Serial port handling


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2008, 09:45 PM
Junior Member
 
Join Date: May 2008
Posts: 24
Default Serial port handling

I have been using the serial library with some partial success, and am looking how I may avoid data loss. This is with no lower-level handshaking, just a package protocol (actually from Garmin for their GPS).

The Help for the serial keywords doesn't say much about how they interact. For instance I assume that doing InputArray() empties the input buffer so that the same data cannot be read again.

But what is the effect of the Timeout? What actions does it influence, and how to tell if there has been a timeout event?

Regards, Mike.
Reply With Quote
  #2 (permalink)  
Old 06-26-2008, 04:52 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,815
Default

InputArray reads (and empties) all the data that is waiting in the input buffer.
It is however possible that while you read the data, new data arrives.

Timeout affects the time to wait before the program raises a timeout error when you read or write data to the serial port.
The default is Infinite.
If a timeout occurs an error will be raised.
Reply With Quote
  #3 (permalink)  
Old 06-26-2008, 09:13 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,336
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
Originally Posted by Erel View Post
The default is Infinite.
I hesitate to correct the master but on my system it is 100mS! I investigated why. See "private void SharedNew()" in the Serial object!
Reply With Quote
  #4 (permalink)  
Old 06-26-2008, 09:28 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,815
Default

You are absolutely right!
Reply With Quote
  #5 (permalink)  
Old 06-26-2008, 10:36 AM
Junior Member
 
Join Date: May 2008
Posts: 24
Default

Ah, thanks for correcting the "infinite" timeout; I had already tried displaying the default value and infinity might have overloaded the message box somewhat!

100mS isn't very long, so now I wonder why I haven't triggered this timeout already.

I have now started looking at ErrorLabel and exception handling...

Regards, Mike
Reply With Quote
  #6 (permalink)  
Old 06-26-2008, 10:48 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,336
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

For infinite timeout set the property to -1. Any other positive number is the timeout in mS. Any other -ve number will trigger an exception.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send data to serial port for other application schimanski Questions & Help Needed 6 04-08-2008 05:45 PM
Serial Port won't open djmrozinski Questions & Help Needed 6 03-16-2008 04:25 PM
GPS and Virtual Serial Port alfcen Questions & Help Needed 2 10-05-2007 01:56 PM
Serial Port Profile & Bluetooth Paul Questions & Help Needed 5 07-27-2007 04:08 PM
Open serial port crashes program on device Steve Bug Reports 2 05-23-2007 09:52 PM


All times are GMT. The time now is 05:37 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0