LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a process during event?

Hello,

Can you help me to find solution for the following problem?

In the attached program, I have 3 buttons - START, STOP and PAUSE and numeric indicator.
I need that when I press START, the data written in numeric indiator, incremented until I
press STOP button to stop the process or until I press PAUSE to pause the process.
How can I organize this? I created an event - START button mouse up, and inserted an infinite loop in it.
Is there a way to stop this event or pause it?

Thanks

0 Kudos
Message 1 of 7
(3,930 Views)

Hi Tar,

 

at no times, never, never ever put an infinite loop into an event case!

 

Never use infinite loops unless you're using a Realtime/FPGA target !

Best regards,
GerdW


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

Hi Tar,

 

now I looked into your vi.

 

Never, never ever, use UI loops without a timeout. They are just hogging the CPU...

 

See attachment for simple example (needs some more fine tuning). Read the white papers & context help for the event structure and look through the examples, that come with LabView! 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(3,919 Views)

Hello,

Here you go

 

Reg
0 Kudos
Message 4 of 7
(3,918 Views)
In reality, in my program there is not an infinite loop inside event structure. In my real program there is a sequence of commands that must be performed sequentially when I press START button. I need to have a possibility to pause it and continue performing commands later or to stop it.
0 Kudos
Message 5 of 7
(3,917 Views)

Hi Tar,

 

then you should look into StateMachines. There should be an example too!

 

And you should try to ask what you want in the first place... Smiley Wink

 

 

@ReG64:

It's definitely nicer to use an enum instead of simple numeric constants!

 

@Tar:

Use ReG64s example to start building a state machine!

Message Edited by GerdW on 10-06-2009 11:16 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,913 Views)

@GerdW:

 

Yes, it simplifies the understanding 

Reg
0 Kudos
Message 7 of 7
(3,904 Views)