LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to stop event structure manually

Solved!
Go to solution

Hello,

 

 I have a fully functional State machine program to control a stepper motor.

 

However, I face a problem where I am not able to break the program inbetween execution by clicking the stop button for while loop MANUALLY.

 

I dont know why it cannot exit upon User input.

 

 

 

 

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Download All
0 Kudos
Message 1 of 7
(2,795 Views)

You shouldn't have an event structure buried inside of a case structure.  Especially when you have some of thoe event cases set to Lock the Front Panel until This Event Case completes.  Even if the event structure is not in the path of execution, it is still capturing events.  If cases are set to lock the front panel, you can't do anything.  But if you need to click a button to get into the correct case structure that has the event structure, you are stuck.

 

Read Caveats and Recommendations when Using Events in LabVIEW and then rearchitect your VI to get the event structure to be the top level of code inside the loop.

0 Kudos
Message 2 of 7
(2,789 Views)

So in any state machine archictecture an Event Structure shoukd be after the while loop ?? 

 

The examples show that a while loop followed by a case structure is a State machine architecture. Am I getting it wrong somewhere ?

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 3 of 7
(2,779 Views)

you need not to post the same question in multiple posts.....

0 Kudos
Message 4 of 7
(2,765 Views)

Often it is best for the event structure and the state machine to be in parallel loops rather than in the same loop.  Look at the Producer/Consumer (Events) Design Pattern.  The state machine would be in the Consumer loop.

 

(Some simple systems can manage to have the state machine case structure inside the Timeout case of the event structure in a single loop architecture, but this design tends to be hard to manage as requirements change and it is not easy to assure that it will work correctly. I do not recommend this to someone who is new to both event structures and state machines.)

 

By having its own loop the event structure never gets into a condition where it cannot execute.  That is cause of the locking problems your VIs are having as has been pointed out by others.

 

Lynn

Message 5 of 7
(2,758 Views)
Thanks. Will not repeat this. Both post have similar problems but entirely different origin of problems. In this case its VI (front paenl) locking problem.
Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 6 of 7
(2,749 Views)
Solution
Accepted by abikutn

Uggh. I typed a response here to your note but NI website timeout kicked me out and I lost everything I typed.

 

What RavensFan mentioned is shown in attached image, you have to unclick that option on every case of your events structure so that it doesn't lock up the front-panel.

 

But more importantly as Lynn and other folks mentioned, you have a bigger problem with your design implementation.  My previous example was to show how a state-machine based design can be made clean/small/efficient/etc.  I have two 30" monitors on my Mac and your block diagram extends well into my second monitor!! 🙂  (I'm a bit of a neat-freak so I like making things look nice/wires laid out properly/into straight lines, no unnecessary wires crossing/etc - all that makes it easier for yourself and others to see the design.)

 

Sorry, back to the main point - you should definitely follow Lynn's advice on using Consumer/Producer (events) model - a simpler start would be to separate out your events structure into its own while loop that runs parallel to your existing loop.  With that, at least you will execute events structure at a regular interval.  Another strong advice is to simplify your design so that you don't use nested (one-inside-another) state-machine design. I have decades of LabVIEW experience yet I stay away from that kind of complication because it only causes more problems as you grow your design. Why not just add more cases to your existing state-machine design rather than adding a nested state-machine structure inside it?

 

-DP

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 7 of 7
(2,696 Views)