07-13-2015 04:33 AM
Hi there,
I am building a control for a Laser machine which base its controls in ActiveX control technology. I had a program in C# that works, but I because I wanted to change parameters and later on connect it to another Labview program, I am "translating it".
I am starting from a very basic operation:
and then based on event (using reg event callback):
if laser signal 'QueryStart' is activated by a switch, then "execute" program.
if laser "starts", then light a led
if laser "ends", then light a led.
I have problems to light a led using the VI ref (LaserStartedLed). I am using as a template the Labview example: CWKnob to visualize a number from the knob. But In that case they use numbers from the knob, in my case is just Boolean, and I am trying to get it from the Event Common Data.
Can you help me with some more ideas, and corrections?
thanks in advanced,
Solved! Go to Solution.
07-13-2015 05:39 AM
OK, here are a few questions:
- Why do you use variant to data in your LaserStartedLED SubVI? It seems you're just converting I32 to I32.
- Do you know about dataflow? In your Main vi most of the code executes whenever labview deems fit. If that's OK, it's OK.
Regarding your actual problem: What does the callback Event look like? What data can be passed to it? What information does the callback give you when triggered?
It's been a while since I have last used callback Events.
07-13-2015 06:14 AM
Hey Peter,
Thanks for answering. Here some answers:
-I tried to used variant to data because that's what I saw in the example, how can I get the boolean variable and introduce it in the led reference parameter?
-I know about dataflow, I missed some error links, but mainly you are right, the program executes once the loading, and then executes the led lighting when a event is shown.
The event callback are just boolean variables that return True once the event is triggered:
sigLaserStart: tells you when the laser begin to work
sigLaserEnd: tells you when the laser finish to work
sigQueryStart: This signal fires when an external start request occurs.
All this events are void type, which void variables.
07-13-2015 07:14 AM
Hey,
I was refering to this
Seems a bit pointless to convert an I32 to I32.
That VI in general seems a bit off: you check the event source and convert it to a boolean array and then you and over the array. Does event source really return 32 true bits?
The sigLaserStart Event triggers, once the laser is on. Can't you just wire a True constant then, just to try it out? You could also call a one button dialog to see if the event triggers. I think the property node in your subVI has to be wired to the other (nameless) Reference, too.
07-13-2015 07:20 AM
Hello again,
I made a change in my program, so instead of the ON switch connected to the reg event callback, I used a "case structure".
But there are still some errors within the VI ref, how can I send a "True" signal to the led?
07-13-2015 07:32 AM
Yes, that "variant to data" was unnecesary. I really didn't know how to introduce a Boolean to the led value.
I tried putting a True constant as a User parameter, but sends me an error, and then, how can I see it in a Led?
i can try the One buttom dialog.
See this example: that's why I thought it was really the same case:
07-13-2015 08:02 AM
OK, but if you compare your subVI to the picture you posted you note two things:
1. The property node is wired to the nameless reference.
2. The cluster this is connected to, does no longer exist. Instead you wired it to another cluster.
So I would suggest:
Try wiring a true constant to the property node (that you connect to the correct reference) to see if oyu can access the FP Element. If that works we can start figuring out how to actually get data from the event. (I assume very similar to oyur example, by variant to boolean conversion)
07-13-2015 08:15 AM
I did what you told me:
But I got still error: "Register Event Callback Contains unwired or bad terminal"
I tdon't understand what can be wrong.....
07-13-2015 09:04 AM
The second Event "sigLaserEnd" appears unwired...
07-14-2015 02:18 AM
where? this is the modified one, and still "unwired terminal".