LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there no way to Programmatically trigger a Latch Boolean?

Hi all,
 
I want to programmatically trigger the Latch Boolean placed on the other VI. Looks like it is not possible in LabVIEW?
 
Any Help..
 
Thanks,
logic
0 Kudos
Message 1 of 13
(5,643 Views)
Hi logic,

it's not possible to have a local of a boolean with 'latch...' mechanical modes.
But you can mimic the latching on your own, but there should be only one place where you read from this boolean.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(5,633 Views)
It looks like the only way would be to simulate a mouse click and for that you will have to make sure you bring that VI's panel forward. It's better to find some other way to do this. If you're running code inside an event structure you might wish to consider looking at some of the patterns found in the File>>New dialog, like the queued message handler. That detaches the actual code from the event structure, but requires more coding and planning.

___________________
Try to take over the world!
0 Kudos
Message 3 of 13
(5,633 Views)

Hi tst,

I did not understand your statement about "File>>New dialog" patterns. Can you elaborate more on that?

I dont understand why NI doesnt give up this capability, when they given option to trigger for a Switch boolean (value signaling). It is developer responsibility to understand that the local variable for a latch might not work correctly. But Value signaling the Latch boolean will be useful option in many cases. Its sad that i am struck.Smiley Sad

thanks,

logic

0 Kudos
Message 4 of 13
(5,629 Views)
If you go to the File menu and select New, you will get a dialog which lets you select from preset templates. Some of these show how you can have your actual code in one construct and use the event structure just to trigger the other construct. This allows you to trigger the same actions from different places.
 
As for why you can't set a latched boolean, that's another matter. The reason for not being able to read a latched boolean is relatively easy - the boolean latches when the terminal is read in the diagram. If you try to read it from other locations there is no way of knowing which state the boolean is in and you could end up with a race condition. Writing could probably be done, but it seems that it was decided not to do it in order to have compatibility. NI did actually create a property which allows you to write and read the state of a latched boolean (maybe as an option for doing what you want in future versions), but that property is private and could be unstable or disappear in future versions. If you really want to access it (although I would advise against it), you can try reading the LAVA forums' scripting board.

___________________
Try to take over the world!
Message 5 of 13
(5,619 Views)

Hi tst,

I have found a way to set the LatchValue using the property node with the help of LAVA Forum. However, it is not going to trigger any events as Value Signaling does.

What i need is to generate a Value change event of a Latch boolean running in another VI.

Thanks,

logic

0 Kudos
Message 6 of 13
(5,589 Views)
You can create a user event (not so complicated once you did it the first time Smiley Wink😞 you need to pass the event reference to the vi containing the boolean and setup the event structure to respond to the user event with the same case of the boolean Value Changed.

Message Edited by pincpanter on 07-19-2006 12:07 PM

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 13
(5,585 Views)
Hi,
 
The problem is i cant make any changes (rather i dont have access) to the code that has the boolean, i just have to generate the boolean value change event.
 
Thanks,
logic
0 Kudos
Message 8 of 13
(5,576 Views)
Beh, allora...
No more ideas here. I don't think you have any real chance.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 13
(5,571 Views)

Since you can't access the code, the best solution would probably be to add another loop which will poll the value of the boolean and use that to fire an event. If you run the loop fast enough it should probably work alright.

Another option (although I wouldn't recommend it) - since the button is in a fixed spot, you can register for a mouse down event for that VI and find out when the mouse was clicked while it was over the button.

P.S. If you kept the thread alive on the LAVA forums as well, it would be polite to close it there by informing what responses you already got.


___________________
Try to take over the world!
0 Kudos
Message 10 of 13
(5,558 Views)