08-11-2014 04:25 AM
08-11-2014 04:32 AM
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
08-11-2014 04:44 AM
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!
08-11-2014 05:57 AM
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
08-11-2014 12:08 PM
08-11-2014 12:22 PM
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.
08-12-2014 12:57 AM
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!
08-12-2014 03:31 PM - edited 08-12-2014 03:36 PM
I deleted the text because I don't know how to delete a post.
08-12-2014 03:35 PM - edited 08-12-2014 03:45 PM
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.)
08-13-2014 02:28 AM
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