LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control InteropAssembly VI from external?

Hello,

i have this idea:

1. A VI contains only a while-loop with a evenstructure inside (z_loop.vi).

2. The evenstructure is executinig code depending of the value of a global variable (z_global.vi)

3. The value of the global variable is set via z_setData.vi

4. Everything is compiled as a .Net InteropAssembly dll

5. Then i want to use the dll to execute the "z_loop" in c# as new thread so it is running parallel

6. I execute "z_setData" to perform different events in already running z_loop

 

The question is now:

1. Are the global variables working in a compiled assembly?

2. Currently i get an exception in C# when trying to execute "z_global" "System.BadImageFormatException: Could not load file or assembly 'InteropAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Es wurde versucht, eine Datei mit einem falschen Format zu laden.

is there a problem with DotNet? Labview and C# are on the same computer.

3. Is there an easier way to something like this?

 

 

Thanks

best regards

 

Download All
0 Kudos
Message 1 of 7
(2,005 Views)

Hello OnlyOne,

 

Could you please describe what is final goal?

 

Do you mean LabVIEW here?    1. Are the global variables working in a compiled assembly?

__________________________________________
The best way to thank, is to give KUDOS
Message 2 of 7
(1,863 Views)

Hi VA.KI,

Yes i mean the labview global variable which is the file "z_global.vi".

Then final goal is to bring data into the compiled labview vi.

The idea was to do this with a global variable.

 

Then i would not need any interface parameter and could do everything over a global variable

 

BR

TM

0 Kudos
Message 3 of 7
(1,840 Views)

Hi 1,

 


@OnlyOne wrote:

Hello,

i have this idea:

1. A VI contains only a while-loop with a evenstructure inside (z_loop.vi).

2. The evenstructure is executinig code depending of the value of a global variable (z_global.vi)


Wrong.

Writing the value of the global to the local "Changed" indicator using a "Value" property node does NOT create an event, and so the "Value change" event case will not execute!

 


@OnlyOne wrote:

1. Are the global variables working in a compiled assembly?


I guess so, as all 3 VIs (including the global.vi) are compiled into the executable.

 


@OnlyOne wrote:

3. Is there an easier way to something like this?


When you already start a parallel running thread I would use network communication to send commands to this thread: no event structure, no globals, no locals. Just waiting for some messages - with the advantage of being able to send those messages from all other executables (LabVIEW, C#, whatever) running on your computer…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(1,830 Views)

Hi GerdW,

in the timeout section of the event the content of the global is written to the local variable.

The event "value Change" is working fine in labview direct if i change the global using the Vi z_SetData.vi.

I dont understand why it is not running at your side.

 

The problem is how can i send data to a already running VI, so i used the global. I dont want to send data to the thread.

Here is got stuck with the errormessage  in the first posting.

TM

0 Kudos
Message 5 of 7
(1,825 Views)

Hi 1,

 


@OnlyOne wrote:

in the timeout section of the event the content of the global is written to the local variable.

The event "value Change" is working fine in labview direct if i change the global using the Vi z_SetData.vi.

I dont understand why it is not running at your side.


You don't write to a local variable, you write to a "Value" property node.

This "value" property node DOES NOT create an event - this is basic LabVIEW knowledge…

 


@OnlyOne wrote:

The problem is how can i send data to a already running VI, so i used the global. I dont want to send data to the thread.


So you want to send data to another VI, but then you don't want to send data to this other VI (because it now runs in a different "thread")?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(1,822 Views)

Ok, this is then also another problem. Thanks.

 

But my first problem is that i cannot execute the created ".Net Interop Assembly" DLL in C# as the mentioned error appears.

0 Kudos
Message 7 of 7
(1,816 Views)