Introduction to Programming Ethernet Devices in VISA

NI-VISA

Introduction to Programming Ethernet Devices in VISA

For users writing new code to communicate with an Ethernet instrument, the most important consideration in choosing the right API is which protocol(s) the device supports. The LAN instrument protocol, also known as VXI-11, was designed to mimic the message-based IEEE 488 style of programming with which instrumentation users have become accustomed; VISA is the best API to program devices using this protocol.

Some devices may be classified as LAN eXtensions for Instrumentation (LXI)-compatible devices. Many of these devices also use the LAN instrument communication protocol. However, some LXI devices may use a different communication protocol. For devices that have a published communication protocol, VISA is typically the best API to program these devices. If the protocol is not known or proprietary, a vendor-supplied instrument driver may be more appropriate.

For other devices, if the vendor merely documents the TCP/IP port number and proprietary raw packet format, VISA or any sockets API may be the best solution. Finally, some devices use other common well-defined protocols over either TCP/IP or UDP or some other layer; in these cases, an existing standard implementation of that protocol may be more appropriate than VISA.

For devices compatible with the LAN instrument protocol including most LXI devices, the simplest resource string is "TCPIP::<hostname>::INSTR". The hostname can be represented as either an IP address (dot-notation) or network machine name. If an Ethernet device supports multiple internal device names or functions, you can access such a device with "TCPIP::<hostname>::<device name>::INSTR". Recall that the "INSTR" resource class informs VISA that you are doing instrument (device) communication. Programming these LAN instruments in most cases is similar to programming GPIB instruments, in that most applications perform simple message-based transfers (write command, read response) and receive service request event notifications. For more information about VISA message-based functionality, refer to Message-Based Communication.