Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results
Port.BytesToRead unexpected results Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Go Back  Xtreme Visual Basic Talk > > > Port.BytesToRead unexpected results


Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2007, 09:23 PM
CodeCruncher CodeCruncher is offline
Junior Contributor
 
Join Date: Jul 2006
Posts: 355
Default Port.BytesToRead unexpected results


I am writing an app in VB2005 that makes a call to my cars ECU. It sends ok but during the DataReceived event I am getting an unusual result.

I am trying to find out how many bytes are in the buffer so I can set up an array to write the data to so I have used the following.

intBTR = _Port.BytesToRead
_Port.Read(bytIncoming, 0, intBTR -1)

problem is when I hold the mouse over the _Port.BytesToRead it shows there are 50 bytes but intBTR shows only 14.

I am confused as to why intBTR is receiving a different value to that shown in _Port.BytesToRead.

Suggestions please...
Reply With Quote
  #2  
Old 09-28-2007, 12:36 AM
vcCoder vcCoder is offline
Newcomer
 
Join Date: Sep 2007
Posts: 1
Default EEven I am having the same problem...Did u gt a solution for this problem?

Quote:
Originally Posted by CodeCruncher View Post
I am writing an app in VB2005 that makes a call to my cars ECU. It sends ok but during the DataReceived event I am getting an unusual result.

I am trying to find out how many bytes are in the buffer so I can set up an array to write the data to so I have used the following.

intBTR = _Port.BytesToRead
_Port.Read(bytIncoming, 0, intBTR -1)

problem is when I hold the mouse over the _Port.BytesToRead it shows there are 50 bytes but intBTR shows only 14.

I am confused as to why intBTR is receiving a different value to that shown in _Port.BytesToRead.

Suggestions please...
Hi,
Even I am facing this problem.Did u gt a solution for this?
I wls really appreciate if u share the solution.

vcCoder
Reply With Quote
  #3  
Old 07-08-2010, 07:18 AM
raideraid raideraid is offline
Newcomer
 
Join Date: Jul 2010
Posts: 1
Default possible issue

I have a suggestion. Try putting a wait of a few ms (maybe 20 - 40ms) prior to checking how many bytes to read there are. If this is time sensitive, you may not have such luxuries. It maybe a case where at the time you are checking how many bytes to read there are, the bytes are still getting populated and therefore the counter is not quite at it's steady state value.

Good luck, I too am facing timing issues similar to this. Explore all the functions available in the serialport library and you might find some other creative ways to deal with this issue.

Note: I realize I am replying to an ancient thread, I am doing this to try and help someone else in the future who may have encountered a similar situation.
Reply With Quote
  #4  
Old 04-21-2011, 10:17 PM
CodeCruncher CodeCruncher is offline
Junior Contributor
 
Join Date: Jul 2006
Posts: 355
Default

Thank Raideraid... the car was written off in 2008 so further development on that app ceased. Was so long ago I can't recall if I ever solved this issue, but thanks for the suggestion.
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
 
Port.BytesToRead unexpected results
Port.BytesToRead unexpected results
 
-->