LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay in Labview

I have written a vi that communicates with a serial device. I have Labview send one bit to the serial device which tells it to start taking measurements. Then I have Labview read the measurements from the serial device. The problem is that it takes about 5 seconds for the serial device to measure all the sensors attached to it, so I need a 5 second delay between the time that I write to the serial port and the time that I read from the serial port. Is there an easy way to do this? I am fairly new to Labview, so I may be missing something simple. Any help would be appreciated. Thanks!
0 Kudos
Message 1 of 3
(2,693 Views)
From the Time&Dialog palette, use Wait(ms).
LabView functions are available in the Function toolbox. On your diagram, right-click on any blank spot and the Function toolbox will open up. Functions are organized into different palettes. Press H to bring help up, then just browse through the palettes to see what's there. Everybody in this forum is happy to help newcomers, but take a look for yourself, too.
0 Kudos
Message 2 of 3
(2,693 Views)
One additional thing about the wait function. It does not have error in/out connections so it's hard to use dataflow. What I've done is make a VI with the function inside but the VI does have error in and error out connectors and inside the VI I just wire the two together. The other thing to do is to put the wait function inside of a sequence structure. A single sequence frame is about the only use of a sequence structure that I approve of.

Of course there are other ways to accomplish what you're trying to do without having a hard coded wait inside of the program. You could just keep reading the number of bytes at the serial port until a termination character is seen. The advantage of using something more dynamic is that if you get another instru
ment and that one takes 6 seconds, you don't have to rewrite the program. On the other hand, if a new instrument takes 4 seconds, you're unnecessarily wasting time if you have a 5 second delay.
0 Kudos
Message 3 of 3
(2,693 Views)