LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Something like callback in Labview?

Hi everybody!
First things first: I've been programming computers for some years now, but I've no clue of labview. Now I'd like to setup a ui to power on and off some devices. I.e. have a bunch of toggle switches and whenever the user toggles a switch, some dll function gets called. Besides the user, I have to implement a means of haveing the computer toggle switches. In traditional programming I'd have the switch call some callback which on its part calls the dll, but I don't know how to achieve the same in labview. I could implement a while loop (being exited by an "exit" button), but I don't want to call the dll all the time, even when no button got toggled.
Next, I'll have to have every button provide a bit to a number (i.e. when buttons 1 and 3 are "on", I'd have to provide a 5 (101 binary)); how would I go on about this one?

If this sounds pretty weird, just let me know - I'll gladly provide more details.

Kind regards,
Severin

Message Edited by severin on 06-19-2006 05:25 AM

0 Kudos
Message 1 of 8
(2,993 Views)

hi there,

in LabVIEW this can be done with the "Event Structure". see the attached example. right click "help" on the structure to learn more about how it works.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 8
(2,986 Views)
great, that's exactly what I needed - works like a charme. Now do you (or anybody else) have an idea as to how to have the computer toggle the switches? Seems switches do not have any input terminals; can I simply create an event?
0 Kudos
Message 3 of 8
(2,963 Views)
Hello severin,

if you mean a boolean control by 'switch' you can have kind of inputs by using local variables or (better suited for use with event structure) a 'value (signalling)' property node of this control. Just right click on the terminal of the control and select Create ->local or property node.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(2,957 Views)
hi there,
 
you can use the property "Val(Sgnl)" to change the value of a control and raise the "Value change" event by software (just like a user would have pressed the button). there's a property "Val" which only changes the value, but won't raise the event.
 
 
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 8
(2,952 Views)
Thanks guys! chrisger, do you create these examples on the fly? Jesus, what commitment. So this is as far as I got: I managed to 'radio' the result from some comparison to some control. Now another problem arises:
1. If I radio the result to the very switch, the switch gets overridden - whenever the user tries to toggle it, it snaps back to the position determined by the comparison; this is kind of what I want: I *want* the switch to snap back to off when the comparison yields TRUE, but I want to be able to switch it off, *even* if the comparison yields FALSE
2. On the other hand I can radio the result to some preliminary boolean "safe_1", using the "AND" of safe_1 and the switch as my data. If I set my event structure to react to a value change in safe_1 I get flooded in events, even if safe_1 keeps its value.
Any ideas?

P.S.: How does one create those post it notes I found in your example?
Download All
0 Kudos
Message 6 of 8
(2,947 Views)
With respect to your second query, the value(signaling) will ALWAYS throw an event, no matter if the value changes or not. I was having some relatively similar problems with events last week, and some meaningful responses can be found in this thread, which might help you with some of your questions.

As far as the 'sticky notes' go, you just double click on the front panel/block diagram and type away! For the front panel however, the default background is not the yellowy colour you see. It's transparent, however you may colour it to whatever you like.
0 Kudos
Message 7 of 8
(2,941 Views)

hi there,

please post your VIs as 7.1 (use "save with options.." from the menu), i'm still not up to date. you should always add a version info to the vis you upload, like "myvi_7.1.vi", so everyone can see what LV-version is required.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 8 of 8
(2,927 Views)