Install NI Software and Drivers
Install the latest compatible version of LabVIEW and the NI-VISA driver. Refer to the following for compatibility information.
Connect Instrument to Network
Directly connect the instrument’s Ethernet port to the Ethernet port on the target machine via an Ethernet cable. Refer to your instrument’s user manual for more information.
Test Network Communication
Ping your device to make sure you can communicate with your instrument over the network.
Open the Command Prompt from the Start menu.
Type in the following command:
Where xxx.xxx.xxx.xxx is the IP address of the instrument and yyyy is the port. Depending on the instrument, you may not need to specify the port. Press Enter.
If you get a reply response back, you are able to communicate with the instrument and are ready to configure it in Measurement & Automation Explorer (MAX).
Configure Ethernet Instrument in MAX
Use Measurement and Automation Explorer (MAX) to create and configure the VISA TCP/IP Resource used to communicate with your instrument.
Open MAX from the Start menu.
Right-click on Devices and Interfaces and select Create New…
In the Create New… window, select VISA TCP/IP Resource. Click Next.
- Select the type of TCP/IP resource to add.
If your instrument conforms to the VXI-11 LAN or LXI instrument specifications, select one of the following
- Auto-detect of LAN Instrument – This option provides a list of LAN instruments found on the local subnet.
- Manual Entry of LAN instrument - Add the IP address and LAN device name for your instrument manually.
Otherwise, select Manual Entry of Raw Socket
to add your Ethernet instrument as a Raw Socket. With this option, you will have to enter an IP address and port number for your instrument. The instrument's port number should be indicated in its Ethernet Interface Specification found in manufacturer documentation.
- Validate and finish the configuration. There should now be a new VISA TCP/IP Resource under Devices and Interfaces >> Network Devices in MAX in one of the following formats:
- LAN Instrument - TCPIP[board]::host address[::LAN device name][::INSTR]
- Raw Socket Instrument - TCPIP[board]::host address::port::SOCKET
Test Communication in VISA Test Panels
After set up and configuration, use VISA Test Panels to verify communication with the instrument and test different instrument commands.
In MAX, select the Tools tab >> NI-VISA >> VISA Interactive Control.
Select the VISA TCP/IP resource of your instrument.
In the Test Panel windows, select the Input/Output tab.
In the Basic I/O tab, input a supported command and select Query. Refer to manufacturer documentation for a valid list of commands to use with your instrument.
The display window will outline the write and read operations.
Install Instrument Driver
After completing your configuration and verifying communication with the instrument, you can easily transition from interactive mode to programming mode by using an instrument driver.
Refer to Choosing the Right Interface to Control Instruments in LabVIEW to determine which instrument driver type is best for your application. Follow the links in the document to install and use the instrument driver.
Run an Example
The instrument driver and NI-VISA driver will install examples and the API required to communicate with your instrument. Use these examples as programming references and an easy way to start using your instrument.
Note: Close MAX before you start running a LabVIEW example. Having MAX Test Panels open and running a LabVIEW example simultaneously will result in an access resource error.
Instrument Driver Examples
If you installed an instrument driver, refer to the following examples:
NI-VISA Driver Example
If you are using NI-VISA, refer to the following LabVIEW snippet. This example opens a session to the Ethernet instrument, performs a write of *IDN?\n, reads the specified number of bytes back from the instrument, closes the session, and handles any errors.
Drag the snippet directly onto an empty LabVIEW block diagram.
On the front panel, configure the VISA resource name to be the VISA TCP/IP resource of your instrument previously configured in this tutorial.
Run the VI.
For more information on VISA functions, refer to LabVIEW Help: VISA VIs and Functions.