LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tare function DAQ assist and restart function for the vi program

Solved!
Go to solution

Hi Maurlind,

 

just renaming a VI doesn't convert it's version. Please attach a real LV2011 VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 22
(2,088 Views)

Hi GerdW

 

I saved it as a previous version for LV 2011, but maybe I must change it to version 11.0 

 

Se if this file works, it should do it.

 

Best Regards Maurlind

0 Kudos
Message 12 of 22
(2,085 Views)

Hi Maurlind,

 

you need to rework your logic a little bit:

- Don't use local variables, when the terminal isn't used so far ("Stop Program")

- Don't create Events for controls used in different loops to force you into blocking your UI ("Stop Recording")

- You can invert the loop condition terminal, no need to use an additional boolean NOT function…

 

You should make a better state machine: create a state for reading the raw data instead of putting this in it's own loop before the event loop!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 22
(2,073 Views)

Hi

 

Thanks for your tips!

 

Do I need a state for reading my raw data to do a total reset of my VI ? 

 

Because i don't  see how I'm suppossed to do it. 

 

Best Regards Maurlind

0 Kudos
Message 14 of 22
(2,064 Views)

MainLoop.png

0 Kudos
Message 15 of 22
(2,026 Views)

Top priority for this code (restart vi)  is to break it into logical cohesive units and create sub VIs. Top priority!!!!!

Learn to create sub VIs that accept only the pertinent data, and return only the results of the processing that goes on inside that sub VI.  Do it now.

This VI is a rat's nest of confusion.

Step one, learn how to use the block on the upper right corner of the front panel that controls the parameters coming into and returning from the VI.

Control VI flow by passing an error cluster into and out of your sub VIs.

Step 2, give your sub VIs a very descriptive name and use the VI to do just one thing. "Do everything" VIs are the wrong approach.

 

0 Kudos
Message 16 of 22
(2,027 Views)

Hi Dirtboy!

 

Now I know what a sub vi is. I can see the use of that, and will try to implement it. But even if I clear up my mess and use sub vi's how do I restart my main program? I want it to be so you don't have to close the program and start it again. Pressing the run button isn't an option since I'm going to make this one as an .exe file.

 

But if I put everything in a while loop, and then apply a state machine wouldn't it solve that problem ?I tried that, and used the example program that I linked before, but that doesn't work. Does the invoke node DefaultVals.Reinit.All not apply for signals from the DAQ assistant?

 

Is there a way to restart my code, or is it to complicated to do so since it is a mess?

 

Best Regards Maurlind!

0 Kudos
Message 17 of 22
(2,014 Views)

I deleted the text because I don't know how to delete a post.

0 Kudos
Message 18 of 22
(1,982 Views)

Have a loop at the snippet I posted here, 08-11-2014 12:08 PM

I think this is just what you want.

Do you understand it? 

You don't want to restart the main program. Put a main loop in the main VI that runs until  an "end program" condition is true. Probably a simple boolean button.

You run you main sub VI inside that loop. When that VI ends, you are ready to click "start" and run that main VI again.

This is where I have a comment that says "Main VI code in here"  

Wrap your code into a VI named "main.vi" and put that in the case statement, inside the big while loop.

You don't need another while loop inside the case statement. Your "main" VI can control itself and "run to completion" and then return to the case statement.

But, if you don't put all of your code into the "main" sub VI, then you'd have to paste ALL of your code into the inner-most while loop. (Bad idea. Don't do it.)

0 Kudos
Message 19 of 22
(1,976 Views)

Hi Dirtboy

 

Thank you for your reply!

 

I tried your soulution but with my current code I didn't get it to work. I may need to convert some of my code to sub vi's as you have mentioned before, and then try your solution. 

There is alot a want to do with this program, but all of my ideas only work halfway, which is a shame. 

 

Best Regards Maurlind

0 Kudos
Message 20 of 22
(1,956 Views)