08-04-2015 10:54 PM
I have more or less completed my programme (as attached).
I am just left with two doubts - first: is it possible to let the user know the estimated time to finish executing the entire code/ running the entire experiment on my devices?
I am currently trying to calculate this estimated time by using the arithmetic functions and time stamp. I tried putting on both the left and right sides of my case structure but it never runs - I tired running the code and after all other commands are executed, the estimated time is still not displayed. I suspect that even if the estimated time is displayed, it would only be displayed after all other commands are executed.
I have tried looking up on timed structures but they don't seem to fit the job.
Do you have any advice on this?
Second: While loops could only be stopped (by pressing my 'STOP' button/Boolean that is linked to the loop condition) only after the first execution of the loop. How could I let my user stop the execution of code during the first run of the loop or should I wire my code differently using another structure?
As for the 'Pause' button to pause the VI, I have read about the 'Wait for' function (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/wait_for_front_panel_act/). I am not sure if this is the right function I am looking for and if this function enables the user to 'un-pause'/toggle the switch and enable the execution of the subsequent commands.
This function seems useful but it does not solve the problem of the while loop having to execute at least once before I terminate it and it seems like this function acts like a 'Stop' function that exits the loop, terminating all commands instead of pausing the VI.
What is your advice on this?
Thank you so so much!
08-05-2015 12:55 AM - edited 08-05-2015 12:57 AM
Wow, what a mess. Your pogram is basically 80% deeply stacked sequences with no regard to dataflow. None of your inner while loops will ever sense a change of the stop button. Basic dataflow! The little while loop on the right will never be able to stop and use 100% of a CPU core forever.
Tear it all down, do some basic LabVIEW tutorials, learn about dataflow, learn about state machine architecture and shift registers and you will be able to rewrite the entire thing in 10% of the time and without the need of local variables, value property nodes and stacked sequencese. Try it!
08-05-2015 01:04 AM
I used to do my code in another manner with less stacking as attached. I did go and learn about state machines on my own and I thought it is neater to used stacked structures. Do you mean if I were to remove the stacking, and adjust the loops accordingly, the stop button would be sensed?
08-05-2015 01:07 AM
@hqwoon wrote:
Do you mean if I were to remove the stacking, and adjust the loops accordingly, the stop button would be sensed?
No. Your new code doesn't even have a stop button.
08-05-2015 01:10 AM
No that was not my new code. It was just one of my old codes and I am wondering if this has a better flow and should be the right style I am supposed to write my code.
08-05-2015 03:04 AM
Here's my lastest code which I finished. The problems I have asked earlier are solved. The stop button could not be used to stop my loop based on logics. The pause button would not be included because it would be too tedious to do so. Hence, I would just use the LabVIEW interface's 'Pause' and 'Abort' buttons instead.
08-05-2015 04:28 AM
@hqwoon wrote:
The pause button would not be included because it would be too tedious to do so. Hence, I would just use the LabVIEW interface's 'Pause' and 'Abort' buttons instead.
You are kidding, right?
08-05-2015 04:41 AM
Hi hqwoon,
I guess you followed the advice given to you in your older thread on the same topic?
Creating double posts on the same topic is considered rude behaviour…
08-05-2015 05:43 AM
08-05-2015 05:44 AM - edited 08-05-2015 05:49 AM
Yea I just found out that the pause button could be done. I'll continue working on it. Sorry for all the embarrassing questions I have. I am still really new to LabVIEW.