473,387 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TimeoutException called

Alright, here is my issue. I am using the IO.Ports.SerialPort namespace
for the following method. In a previous method, I already set the
serial port up using the proper baudrate, parity, etc.

The issue I am having is that the code will execute fine the first time
it runs through, but any time after that it is called, the timeout
exception occurs. Any ideas on why this might happen?

Here is the code...

Public Sub GetSonyGageValues(ByVal serialPort As IO.Ports.SerialPort)
Try
Dim byteArrList As New ArrayList
Dim intCheckSum As Integer

byteArrList.Clear()
intCheckSum = 0

serialPort.ReadTimeout = 500
serialPort.WriteTimeout = 50

serialPort.DiscardInBuffer()
serialPort.Write("R" & vbCrLf)

Dim strData As String = serialPort.ReadLine

If strData.Length 0 Then
Dim tempArray() As String

'parses out the information gathered from the COM port
to a temp location
tempArray =
Split(strData.TrimEnd(vbCrLf).TrimEnd(vbCr), " ")

Dim intloop As Integer
For intloop = 0 To tempArray.Length - 1
Dim arrLoc As Integer = CInt("&h" &
Hex(tempArray(intloop).Substring(0, 2)))
If InStr(tempArray(intloop).Substring(5, 8),
"Error") Then
sngSonyValues(arrLoc) = 4096
Else
If tempArray(intloop).Substring(5, 1) = "+"
Then
sngSonyValues(arrLoc) =
CSng(tempArray(intloop).Substring(6, 7))
Else
sngSonyValues(arrLoc) =
CSng(tempArray(intloop).Substring(5, 8))
End If
End If
Next
End If
Catch tex As TimeoutException
_boolMuxError = True
InputBadReadings()
Catch ioex As IO.IOException
'do nothing as this may occur when going into calibration
Catch invalopEx As System.InvalidOperationException
'do nothing as this may occur when going into calibration
Catch ex As Exception
tListener.AddMethodError(ex)
End Try
End Sub

Sep 12 '06 #1
0 1013

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: beveled edges | last post by:
I'm using the XML functions in PHP 5. The callback function I set for namespace declarations doesn't get called. Can anyone help me out? The code is: $xml = '<addressbook...
1
by: beveled edges | last post by:
I'm using the XML functions in PHP 5. The callback function I set for namespace declarations doesn't get called. Can anyone help me out? The code is: $xml = '<addressbook...
3
by: Jun | last post by:
I have following script <script> var Animal = function(name){ this.name = name; } Animal.prototype.eat = function (food) {
3
by: Richard Urwin | last post by:
I'm using C# and having problems getting the 'Parse' EventHandler of my binding object to be called. Interestingly, the 'Format' method is always called however. A code snippet: (rdDocument is a...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
20
by: Charles Law | last post by:
I have an application that creates a class. The class has unmanaged resources, so must end gracefully. How can I guarantee that the unmanaged resources are freed? I have looked at IDisposable,...
35
by: Peter Oliphant | last post by:
I'm programming in VS C++.NET 2005 using cli:/pure syntax. In my code I have a class derived from Form that creates an instance of one of my custom classes via gcnew and stores the pointer in a...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.