Example Code

VI Server Example using Shared Variables

Code and Documents

Attachment

Overview
This VI uses a host VI to open and run a target VI on a target computer through VI Server.  Shared Variables are used on both of the VIs to control LEDs and a stop button.

 
Description
This VI uses a host VI to open and run a target VI on a target computer through VI Server.  Shared variables are used to control the blinking light and stop button from the host.vi. If the program is running correctly, the LEDs will begin to blink on both the host.vi and the target.vi.  The stop button will only be controlled by the host.vi and once pushed, will stop both of the VIs that are running.

In order for this to run, both the host and target computers must have VI Server enabled. This can be done by going to Tools-->Options-->VI Server in LabVIEW. Under the Protocols title, make sure that the TCP/IP box is checked and that the correct port is used (default 3363). Under the Machine Access title, make sure that the IP address of the target computer is under the Machine access list or type a * to allow all IP addresses.   

 


Requirements

LabVIEW 2013 (or later)


Steps to Implement or Execute Code

1.Specify the IP address to the target.

2.Specify the VI Server port.

3.Specify the path to BlinkLight_Target.vi on the target PC

4.Run the Host.vi

5.Verify that the light on the target PC is blinking

 

Additional Images or Video

Host VI Snippet.pngTarget VI Snippet.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Taylor

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.