LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Interface frozen

Hello,

We are using labVIEW for implementing receprocating motion of a motor controlled stage for a user defined cycle number.We have a few different built-in subVIs(provided by the company).There is one subVI that "Run Command" which basically takes a message input as some pre-defined commands as a string as an input for moving a certain distance in one direction.When we used this subVI to implement the reciprocating motion.But now we want to keep track of the current cycle number that is running and for that we implemented a while loop which uses the Get Position subVI and whenever the position is within 10% of the one end of the track it adds one to the current half cycle number variable and then waits for a certain time(which is estmated to be time for one half cycle i,e amplitude/small x velocity) and then again start checking if it's within 10% of the other end of the track and adds 1 accordingly.The whole process is implemented under the event loop in the case named as "Take measurement".

Now the problem is when the stage starts moveing the user interface gets frozen and we cant access the pause or stop  or terminate buttons.

Anyone has any idea why it does so?Or any possible suggetsions.Any help will be appreciated.

(Note:Iwas trying producer/consumer loop but it seems I dont see any data to be put in the queue and to be consumed,probably because it is not very suitable.)

To open the file please open

0 Kudos
Message 1 of 5
(3,275 Views)

Your code suffers from a severe case of localitis and squenceitis. It is written like text based code, with frames used as lines and local variabel used as locals. This is not that great to begin with. (see also)

 

Still, here's your main problem:

 

All you events are set to lock the front panel until the event completes, and it seems that some of your event cases have a hard time completing in a reasonable time (some contain e.g. while loops, etc.).

 

You need to decouple the background operations and the UI, e.g. with a queued state machine architecture or similar.

 

 

 

Message 2 of 5
(3,267 Views)

Here are some good launching off points:

 

  • A personal favorite. Very powerful template for a queued state machine architecture. Might be a tad bit complicated to wrap your head around at first, but it will be worth the effort! And there's a getting started video, so there you go...
  • Standard Producer Consumer. Probably a little easier to start with and flexible enough for most application design. It gets a little tricky if the consumer loop that does the processing needs to message back to the producer loop, but it's doable. Also takes more advantage of multi-threading in LabVIEW.
Jarrod S.
National Instruments
Message 3 of 5
(3,254 Views)

Thanks a lot to both of you for your replies.I still find the JKI QMS a bit confusing so I used QMS template from functions palette.Now my user interface is not frozen anymore (I can access the stop and pause buttons) but my cycle count does not work (the value of the current half cycle number indicator doesnt update anymore once one  half cycle  is complete).As can be seen from the highlighting ,I think the message generator loop doesnt work at all.

 

I would greatly appreciate any suggestions.

 

Thanks a lot

Aru

0 Kudos
Message 4 of 5
(3,182 Views)

You never update the Current Half Cycle indicator.

 

On your block diagram, you have terminal at the top with nothing wired to it.  Do a right click find with it.  Select Local Variables.  It finds a single local variable that has a zero wired to it.  (And backwards at that.)  It runs once at the beginning of the program.

 

Nowhere else do you ever write to a local variable or property node of that indicator.

0 Kudos
Message 5 of 5
(3,176 Views)