LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start a subdiagram when meeting a specific condition

Solved!
Go to solution

I have a batch file (epoc.bat)

 

I use Labview to call this batch file. The batch file will run a task on windows command prompt and it will print out my hardware sensor value continuously (at the frequency of 128Hz) into a text file on disk. Please note that the batch file creates the empty text file by itself and then writes values onto that text file.

 

The problem is that the batch file needs a short period of time to initialize the hardware (about a hundred of miliseconds) before it prints the first sensor value. My work is to determine when the first sample is printed, in order to run my events right after the first sensor value is printed.

 

I put my question in the VI file attached. Also this below picture describes it clearly.  I put all the events in the right order in a flat sequence.

How can I determine when the first sample is printed. I think there are 2 steps: first checking whether if the text file is available and then checking the file size?. How can I do this job. Afterwards and more importantly, how can I construct a condition to execute the next frame?

 

 

untitled.JPG

0 Kudos
Message 1 of 4
(2,263 Views)

You wrote : "as long as the batch file is running, there is no way to open the text file with LV"

 

It does not work by using "read-only" option for opening your text file ? I suggest you try.

Open Text File - Read Only Mode.JPG

0 Kudos
Message 2 of 4
(2,249 Views)

Otherwise you can such a solution to check file size (before reading its content for example) :

Get File Size.JPG

0 Kudos
Message 3 of 4
(2,242 Views)
Solution
Accepted by topic author khahuras

This technique works...I have just tested it...

Read-Only Mode and Check File Size.JPG

0 Kudos
Message 4 of 4
(2,237 Views)