|
-
Oct 1st, 2013, 01:37 PM
#11
Thread Starter
Addicted Member
Re: SerialPort VB.NET : Write/buffer/timing and Data Received Event (VS2010 and VS200
 Originally Posted by dbasnett
If the code works sending one command at a time, but not if you combine commands into a single string separated by ;, the problem may be with the controller.
Here is an alternative SendCmds
Code:
Private Sub SendCmds()
Dim cmds As New List(Of String)
Dim cmdlist1() As String = {"1TP?", "2TP?", "WT500", "1PA10"}
Dim cmdList2() As String = {"1WS", "2WS", "WT500", "1MD", "2MD", "1TP", "2TP", "WT1000"}
cmds.AddRange(cmdlist1)
cmds.AddRange(cmdList2)
For Each c As String In cmds
cmdDone.WaitOne()
SerialPort1.Write(c & vbCr)
Next
'Me.Invoke(Sub() Button3.Enabled = True)
Dim foo As New but3ondel(AddressOf turnBut3On)
Me.Invoke(foo)
End Sub
Do you need another thread for taking the picture? It doesn't sound like it, but I can't be certain. It seems that with what you have you know in the existing backgroundworker that the motion has stopped, so just take the picture and then continue on.
Where are you?(country) Is this for work?
I'll begin with the end: I live In France but have an Irish father and what about yourself? Its for a uni lab, so yeah its for "work".
The commands appended in one string is what I was doing In my former VB, and it did work well. I passer the parameter the same way you did, just a string argument to serialport.write(). And the controller answered everytime. It was once the serialport.write() was In the loop that the problems appeared.
Tags for this Thread
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
|