LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Latch action problems with property node disable?

Solved!
Go to solution

Hey guys,

 

I have recently learned how to use event structures to handle the control of two linear stages. This was cool. Before, I was running a state machine, and it was a bit cumbersome.


I'm trying to develop a nice user interface to control these stages, and there are two types of motion that I want the user to choose from. The first could be called "joystick motion"; you press the left button (and hold), and the stage moves left until you release the button or move out of the button (I have one event case for each, and they do the same thing, namely to stop motion). The second kind of motion is "incremental motion". Here, the user would push the left button and the stage would move 1 mm to the left and stop.

 

Here's my problem. When I first programmed the "joystick motion", it works great. Perfectly. Then I wanted to do the incremental motion. That also works, perfectly. Ok. Then I wanted the user to select which type of motion using a boolean; i.e. they press "joystick motion" and then those controls become activated. So I thought I'd get fancy and use property nodes to disable/gray out the buttons that shouldn't be used and enable the buttons that should be used. This seems to work GREAT with my "incremental motion", because right now those boolean buttons are latch-when-pressed, and the buttons on the block diagram reside inside the event case [that handles value change]. However, my "joystick motion" buttons reside outside the event structure (but within the while loop that surrounds it), and it seems that even though the property node "correctly" grays them out when the motion selector button is pressed, you can still click them and the stage moves. This DOESN'T happen with the "incremental motion" buttons.

 

My hunch is that

a) I'm not smart enough

b) that the location on the block diagram of my buttons which control the "joystick motion" is wrong (i.e. they should be inside the event structure somewhere)

c) that I should use another type of mechanical action on the buttons

 

I read/saw somewhere that latch-when-pressed should reside in the event case that handles value change, but I really don't know what to do with booleans buttons that have event cases like "mouse down/up/leave". Any assistance would be awesome. Thanks in advance!

 

 

 

 

0 Kudos
Message 1 of 6
(4,224 Views)

Attach the VI that shows this happening.

0 Kudos
Message 2 of 6
(4,219 Views)

I forgot to mention that I have the property node disable/enable in the timeout case of the event structure. The way I interpreted this part of an event structure is similar to the "idle" case in a state machine, and it seems to function as such (I have subVIs in the timeout case that check for position, and they seem to be fine and update very rapidly). Maybe that's another problem?

 

Anyway, I uploaded the stripped-down VI which shows the relevant code. Hope that helps.

0 Kudos
Message 3 of 6
(4,197 Views)
Solution
Accepted by topic author Cowbell

The problem is that you're using the "Mouse Down" and "Mouse Up" events for the joystick buttons, and those events still occur when a button is disabled even though the button value doesn't change. For the joystick buttons, try using the Value Change event. In the event structure, use the NewVal element (or the appropriate button's terminal) to determine whether to start or stop motion, based on whether that value is true or false. Or, if you want to keep using the Mouse Down event, then you need to use the Joystick Active value stored in the shift register to determine whether or not to act on those events (wrap the VISA functions in case structures so they execute only when Joystick Active is true).

Message 4 of 6
(4,193 Views)

I still had to clean up a lot of errors with what you attached.  All of the VISA stuff should have beens stripped out.

 

Once I did that and got a solid run arrow, I tried running your code.  I now have no idea what is working or not working.  It all seems to function okay for me.

0 Kudos
Message 5 of 6
(4,190 Views)

Ah, awesome. Thanks nathand. I changed the front panel buttons to switch-until-released, made the event cases value change events, and wired the "new value" to a case structure that either commanded the stages to move or stop. Now the disable works great. Thanks again!

0 Kudos
Message 6 of 6
(4,174 Views)