05-19-2010 06:45 PM
Hi,
How do I stop a while loop that collects data from a home made instrument. I don't know how many bytes of data it is collecting. I want to repeat this loop n times but have to stop it after each cycle. Your help is appreciated.
thanks
sbz
05-19-2010 07:05 PM - edited 05-19-2010 07:06 PM
While loop. you stop them on a condition. what type of condition do you want to stop on?
05-19-2010 07:20 PM
after collecting data i want to stop it but it's not a constant data coming back(each time might change) so i need sth to listen to it when data collection stops. Can't find any UDP listen function.
05-20-2010 11:30 AM
You are not explaining yourself very well. Does your data come back in a burst, then no more data comes? You could use a timer to stop after a certain time with no data being received. Start timer. If data is receive, reset timer. If no data, check timer. Do this until timer expires, then stop the loop.
05-20-2010 12:27 PM
Hi sbz,
UDP is not a protocol that "listens" in the sense that it will wait until bits appear or uses any handshaking. For that type of scheme you may have to move to TCP. I'm not sure a bit confused if the issue you're encountering involves network communication or loop condition. Please let us know how we can help.
05-20-2010 12:48 PM
Hi sbz,
If I understand you correctly, you want to pause at the end of each iteration to check that data has come in on a UDP port.
I am by no means an expert on this, but Labview does have some UDP functionality which might be what you need. The UDP Read function will wait for data until a specified timeout.
To find the UDP functions, go to Functions->Data Communication->Protocols->UDP or on the Functions palette, search for UDP.
These pages have more information:
http://zone.ni.com/devzone/cda/tut/p/id/4950
http://zone.ni.com/reference/en-XX/help/371361B-01/TOC28.htm
Hope this helps.
05-20-2010 12:54 PM
Thanks to all for replying. The data comes in burst and then stops. I have to press the stop button manually and then the next iteration will start. I don't want it to be manually.
thanks
sbz
05-20-2010 01:11 PM
Use a timer as I had described in my earlier post. After 1 or 2 seconds of no data, stop the loop. Do you need sample code to do this? Can you try to code something yourself?
05-20-2010 01:14 PM
I've never used a timer. will try to figure it out.
thanks
05-20-2010 01:40 PM