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: 

Event call between Two VI - Bidirectional

 Hi All,

 

I was wondering if someone could help me in providing an example which depicts two VI' calling each other via creating a User event.

I have a scenario where a server listens to a client who sends a String. As soon as I read the String via a TCP read in my server, I need to call another VI via an Event to use that String (from server), perform some operations. Then after send a Message back so that the server via TCP send the exact message to the client.

 

I have an implemented server which as of now can manage READ and WRITE (attached), but I cannot manage to call other VI and receive its message. A little help could be very appreciable.

 

Thanks

RG 

0 Kudos
Message 1 of 20
(3,156 Views)

I can't open your vi, because I haven't LV18
Here only draft of communicate between two loops. Both of them can be a subVI (except Panel close event)

event.png

0 Kudos
Message 2 of 20
(3,131 Views)

Thank you for your reply. However, I am still in doubt with, how to connect if these two (string processor and server) are a different VI files?

That is one main problem for my case.

 

Regards

RG

0 Kudos
Message 3 of 20
(3,128 Views)

@erraunakgupta wrote:

Thank you for your reply. However, I am still in doubt with, how to connect if these two (string processor and server) are a different VI files?

That is one main problem for my case.


Simply select the loop or sequence (either one), and select Create SubVI. That would give you the sub VI with correct inputs. Not that you should do it like that, but examine the result, and learn how to do it that way.

Message 4 of 20
(3,124 Views)

@erraunakgupta wrote:

Thank you for your reply. However, I am still in doubt with, how to connect if these two (string processor and server) are a different VI files?

That is one main problem for my case.


have sad the 1st way create subVI

also you can configure Create User Event vi and after that right-click on "user event out" terminal, select Create indicator and you'll get correct indicator for your subVIs

0 Kudos
Message 5 of 20
(3,115 Views)

You don't need a connection between the server and client. Both get the same events, one uses them to send, the other to receive. 

 

Of course one or two channel wires will do the trick as well. That would actually look like a connection, and might therefor be more intuitive for the OP.

0 Kudos
Message 6 of 20
(3,102 Views)

The client here is not a Labview Vi but an external software which connects to an open port.

0 Kudos
Message 7 of 20
(3,096 Views)

@Artem.SPb wrote:

I can't open your vi, because I haven't LV18
Here only draft of communicate between two loops. Both of them can be a subVI (except Panel close event)

event.png


Just to clarify, the sequence frames are not actually needed. Other than identifying each section of code they serve no purpose in the code as the wires will control the actual sequencing of code execution.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 20
(3,092 Views)

@erraunakgupta wrote:

The client here is not a Labview Vi but an external software which connects to an open port.


I mend two channel wires between the two loops. Where the current running example uses user events. Replace each user event with a channel wire.

 

I'm not suggesting a channel wire as a replacement for the TCP\IP communication. That's not possible (at the moment), even if the other device is running a LabVIEW program.

0 Kudos
Message 9 of 20
(3,087 Views)

You've asked about LV-event and haven't say about "external software".
You can't use user-events for communicate between 2 apps, even if both are LV-apps.
So, say real and full structure of your "system"?

0 Kudos
Message 10 of 20
(3,083 Views)