02-05-2014 07:02 AM - edited 02-05-2014 07:04 AM
I have an application in which I need to read data from two serial port one after other.
One read will read 14 byte and other 08 bytes(Just info).
Now in between if user need to stop the VI then how to stop it?
02-05-2014 07:55 AM
02-05-2014 10:48 AM
A state machine could do this easily. Just have a state to check for the stop (or any other events).
02-05-2014 09:54 PM
Here is my VI
02-05-2014 10:43 PM
What modification I need?
02-06-2014 02:35 AM - edited 02-06-2014 02:36 AM
Hi Ranjeet,
What modification I need?
At first you should consider using the auto-cleanup tool before posting your VIs…
Next you should remove the local variables and use wires instead! THINK DATAFLOW!
Then you should not use a timeout of 200s for your serial port communication. As you can't break a VISARead function while it waits for some data on the port you really should use a different scheme for reading the ports!
As said before: use a state machine. You can stop the state machine after each state…
02-06-2014 04:10 AM
Thanks, next time I will keep this in mind(I wasnt aware of it ).
Ok will use wire
@GerdW wrote:
Then you should not use a timeout of 200s for your serial port communication. As you can't break a VISARead function while it waits for some data on the port you really should use a different scheme for reading the ports!
As you suggested, small timeout will work here? I think that is good idea. Ok l will try to use state machine. As I told in my question that I have two read, will I need to make same timeout?
02-06-2014 07:04 AM
Hi Ranjeet,
smaller timeouts should work too (default is 10s). The timeout value depends on the responsiveness of your devices. When you do some real error handling you might filter TimedOut-errors…
- You don't need to set the same timeout value for both ports, each is handled on its own.