LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to run a VI for very short time, e.g. 100ms?

Hi,

I need to run a VI for very short amounts of time, say 100ms, 200ms, 500ms or 1s. I want to get this time from the user, maybe as a control variable. How may I do this? I tried using the "elapsed time" function but seems like it was not meant for such small time periods. Any ideas?

 

Thanks

Kaiser 

0 Kudos
Message 1 of 20
(3,266 Views)

Sure it will work for such short periods.

 

I would recommend dropping on your VI, right clicking, and pick open front panel.  That way you can see what is going on inside.

0 Kudos
Message 2 of 20
(3,258 Views)

What are you trying to do in the "short time"? When you say "run a VI" do you mean "start, run and stop running", or do you mean for the vi to do something for the specified time, i.e. flash a front panel LED for a precise period after the operator clicks a button? In the later case 100mS is actually fairly long, and can be accomplished with various timing functions, with varying degrees of accuracy. The most accurate, in a Windows environment, would probably be the timed loop. If you need really accurate, particularly if you are interfacing with hardware (a pushbutton, an actual lamp, etc.) a real-time system would be the best bet.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 20
(3,257 Views)

Thanks for your prompt replies and sorry for not replying for a while. got busy.

 

The thing is, when I compare with the elapsed time, it compares with the time for which the VI is running, which is much greater than 100ms, actually around 3s, though the hardware runs for only 100ms to get the data. Would it be possible to get the data of 100ms, which would be the 100ms of the device, and not the running time of the VI? If the only way is to use the real-time component, can you please tell what that would entail: I've never used the real-time component before so have no idea how to convert my current VIs to real-time, and how hard or how much time it would take.

 

Thanks 

0 Kudos
Message 4 of 20
(3,203 Views)

Also, for some reason the values which are supposed to be stored in the buffer, are only stored if I run the VI in highlight mode. If I run it without it, the entire buffer shows the default values('0'). Do you know what could be causing this? 

 

Thanks

Kaiser 

0 Kudos
Message 5 of 20
(3,187 Views)

Hi Kaiser,

 

you want us to have a look into the glass ball to guess which buffer you're talking about? My glass ball just says "Look for race conditions" Smiley Wink

 

Why not attach your vi here?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 20
(3,178 Views)

I'll try to see if it contains a race condition. Anyway, I was able to find another way to do it using the data itself. Thanks for your responses.

 

Kaiser 

0 Kudos
Message 7 of 20
(3,160 Views)
Is it possible to attach your vi, it is unclear what you are trying to do, what buffer is not having the correct value, etc. When you run in the highlighted mode things can definitely be different, particularly when there are timing issues involved.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 8 of 20
(3,131 Views)
Kindly attach your VI. This will help a lot.
Regards
Asad Tirmizi
Design Engineer
Institute of Avionics and Aeronautics

" Its never too late to be, what u want to be"
Using LabVIEW 8.2
Message 9 of 20
(3,118 Views)

Hi

 

is this what you are asking ? (see attached vi)

Somil Gautam
Think Weird
0 Kudos
Message 10 of 20
(3,106 Views)