LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to perform reset operation after performing one operation??

Solved!
Go to solution

If the code is implemented as a state machine, a pause state can easily be added.

0 Kudos
Message 11 of 36
(1,563 Views)

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....

0 Kudos
Message 12 of 36
(1,551 Views)

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?

 

 

0 Kudos
Message 13 of 36
(1,545 Views)

do nothing.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 14 of 36
(1,541 Views)

@.aCe. wrote:

do nothing.png


I think it is worth the pain to convert it to a state machine and just add a "pause" state.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 36
(1,532 Views)

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.

0 Kudos
Message 16 of 36
(1,524 Views)

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.)

0 Kudos
Message 17 of 36
(1,517 Views)

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-....

0 Kudos
Message 18 of 36
(1,515 Views)

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...

Download All
0 Kudos
Message 19 of 36
(1,500 Views)

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, ...

http://www.ni.com/training

0 Kudos
Message 20 of 36
(1,476 Views)