11-01-2012 10:37 AM
If the code is implemented as a state machine, a pause state can easily be added.
11-01-2012 11:18 AM
But my operation within while loop is very lengthy,so I tried with some logic to create pause button but I didn't get any success.
Here in attachment I attaché one example I tried according that but here in attachment there is only simple function to perform so we can easily perform pause task,in my case I have very lengthy structure in while loop so I have to wait until my one task will finish....
11-01-2012 11:26 AM - edited 11-01-2012 11:27 AM
This is not a state manchine. What is a "lenghty operation"? If it is a sequence structure with an infinite number of frames, you will not be able to escape. If it is a processing loop with many relatively quick iterations, you can go to the wait state at any time between iterations.
Can you attach a VI that more closely represent your code?
11-01-2012 11:29 AM
11-01-2012 11:46 AM
@.aCe. wrote:
I think it is worth the pain to convert it to a state machine and just add a "pause" state.
11-01-2012 01:02 PM - edited 11-01-2012 01:07 PM
here is my vi.
in that i made two switches one for run and one for halt.
but i want to make pause button instead of stop button (which is near to start )so one can make pause any time.
i ll try with your solution tomorrow may be i ll get success...
thank you very much for your help.
11-01-2012 01:46 PM
Well, that's not a state machine.
You need to segment your code so each test is a state, as well as indle states, etc. You need a single outer while loop and a big case structure with one case for each state.
(You code is currently a linear worm of code with lots of very questionable code. You also have two loops that viciously fight for CPU, spinning millions of times per second. (the inner loop, before "teststart" is pressed as well as the useless stopp2 loop). There is also a lack of understanding of dataflow and boolean math. You have two outer case structures that make no sense at all. The small one will always be true, because the only way that it can be reached is if the small FOR loop stops, at which point the boolean is true. Same for the big case structure, the selector will always be false. Since there is only one possible outcome, these two case structures can be removed without change in code functionality. Why do you OR the button with a boolean false? That makes no difference.)
11-01-2012 02:43 PM
hii,
this is already designed code ,i aked to change only and i am very new in labview so may be my basic is not so well.
can you please tell me step by step what kind of cahnges i need to do to make my vi more comfort and which function has no meaning??
thank you very much for your guidence..
i ll follow your suggestion and awaiting for your reply-....
11-02-2012 04:51 AM - edited 11-02-2012 04:56 AM
I want to make switch in my vi.for that I made some changes in my vi , but still my run setup button(switch) is not functioning.
I have made continues loop means when I open my vi its run continuously..And when I press button then its start to doing operations ,after performing one operation when I press again then its not work properly ...here i have attach my vi and some screen shots.
Will you please guide me ....
Thank you...
11-02-2012 09:28 AM
As it has been previously said:
You should use a state machine. That way you wont have to put your buttons in loops like that.#
It will also be a lot easier on your CPU.
But for that you will have to change the structure of your VI.
This is an example of a very simple state machine:
https://decibel.ni.com/content/docs/DOC-22972
By using this architecture you can easily include a pause state, ...
You can turn on the LED in one case and then use a local variable to turn it back off in another state (e.g. state 2 or the idle state)
If youre going to be working with LabVIEW more often I can advise you to hear a LabVIEW course, where you will learn about proper programing techniques, state machines, ...