|
-
April 24th, 2009, 07:37 AM
#1
calling a serialport handle from a loop
Hi guys his my problem:
I am trying to run the function:
Code:
Private Sub port_dataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles port.DataReceived
from inside a while loop of a different function ie.
Code:
While A_switch = 0
System.Threading.Thread.Sleep(100) ' Sleep for .1 second
calabrate_send = calabrate_send - 5
port.WriteLine("9 1 ")
port.WriteLine(calabrate_send)
port.WriteLine("a")
end While
the real problem is that the serial call updates the value of A_switch which is need to exit the loop at the correct time
if anyone knows how to do this or has a better method i would love to hear -cheers robbo
-
April 25th, 2009, 04:55 PM
#2
Re: calling a serialport handle from a loop
-
April 25th, 2009, 08:01 PM
#3
Re: calling a serialport handle from a loop
solved the problem using
Code:
System.Windows.Forms.Application.DoEvents()
however this results in a heep of data at the serialport buffer built up hence i might need to use clear to send i guess
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|