From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

activex - Reg Event Callback - Leds

Solved!
Go to solution

 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:

 

  1. "start" ActiveX server
  2. "load" a design file for the laser.
  3. "end" program

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,

Download All
0 Kudos
Message 1 of 47
(4,908 Views)

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.

 



Remember Cunningham's Law
0 Kudos
Message 2 of 47
(4,858 Views)

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.

0 Kudos
Message 3 of 47
(4,838 Views)

Hey,

 

I was refering to thisVariant.PNG

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.



Remember Cunningham's Law
0 Kudos
Message 4 of 47
(4,804 Views)

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?

 

 LaserFront.pngLaserBlock.png

0 Kudos
Message 5 of 47
(4,798 Views)

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:

 

 

CWKnobFront.pngCWKnobBlock.pngCWKnobCallback.png

 

0 Kudos
Message 6 of 47
(4,782 Views)

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)



Remember Cunningham's Law
0 Kudos
Message 7 of 47
(4,756 Views)

I did what you told me:

 

NewCallback.png

 

But I got still error: "Register Event Callback Contains unwired or bad terminal"

 

I tdon't understand what can be wrong.....

0 Kudos
Message 8 of 47
(4,752 Views)

The second Event "sigLaserEnd" appears unwired...



Remember Cunningham's Law
0 Kudos
Message 9 of 47
(4,724 Views)

where? this is the modified one, and still "unwired terminal".

Download All
0 Kudos
Message 10 of 47
(4,694 Views)