02-26-2009 04:14 AM
I would like to know the time taken by a while loop to execute one iteration without a delay.
Thank you
02-26-2009 04:23 AM
Hi teddy_aua,
it depends on the code inside of your while loop. You can use the "Tick Count (ms)" function to measure it. Use one before the loop and one after. Make sure that the second Tick Count will first execute if the while loop is over. Subtract the last value from the first and that's the time in ms. If you get 0 as result, then you should run your loop for more iterations.
Mike
02-26-2009 06:37 AM
I would recommend a globally initialized feedback node. The following code will display the correct ms/iteration, (except at the first iteration).
How fast is the loop? If it is a very fast math loop, measuring and displaying the time will slow donw the code, of course.
02-27-2009 02:08 AM
Thank you for your reply.
I have another question. I have a program that uses one while loop to acquire data from a sensor and another while loop to acquire data from a web cam. Although they should execute independantly, I realized that when both the sensor and the web cam is initiated, the sensor data acquisition stalls. However, seperately, they both run fine. Any advice??
02-27-2009 01:44 PM
Please show us some code.
Most likely you have a dataflow issue, creating a data dependency between the two while loops. Make sure that no wires exit one loop and enter the other loop. This would force the second loop to wait until the first loop has finished.
03-02-2009 03:12 AM
Hello,
Thank you for your reply, but there is no data dependancy. There is absolutely no connection between the two while loops. Anyhow, I have attached the code sample.
Any help is greatly appreciated.
03-04-2009 12:01 AM
Thank you for your reply. However, I have another problem. I am using a program to stream data from a sensor connected via a USB port. (Configured as COM4) I am also using a USB web cam to capture images as well. I have been trying to acquire data from the two sources at the same time in two different while loops. However, it does not work, and the sensor streaming stalls. I have already tried starting one source before the other. The problam still remains. When seperated, they both work fine. Could this be due to any conflicts being created with the USB ports?
Thank you