advertisement
Agilent IO Libraries Suite
Agilent VISA User’s Guide
N O T E
5
Programming via LAN
This chapter provides guidelines for programming via a LAN (Local
Area Network). A LAN allows you to extend the control of instrumentation beyond the limits of typical instrument interfaces.
The chapter contents are:
• LAN Interfaces Overview
• Communicating with LAN-Connected Devices
This chapter describes programming using the VISA TCPIP interface type to communicate directly with a LAN-connected device, as well as using a remote interface (also known as a LAN client) to emulate a
GPIB, serial (ASRL), or USB interface on the local machine to communicate with a LAN-connected device.
See the Agilent IO Libraries Suite Online Help for information on how to start and stop the Remote IO Server software, and on how to create and configure LAN interfaces and remote GPIB/USB/serial interfaces.
See the Connectivity Guide for detailed information on connecting instruments to a LAN, and for a discussion of network protocols.
Agilent Technologies
117
5
Programming via LAN
LAN and Remote Interfaces Overview
This section provides an overview of LAN (Local Area Network) interfaces. A LAN is a way to extend the control of instrumentation beyond the limits of typical instrument interfaces. To communicate with instruments over the LAN, you must first configure a LAN interface or a remote GPIB, USB, or serial interface, using the Agilent Connection
Expert.
Direct LAN Connection versus Remote IO Server/Client
Connection
Some instruments support direct connection to the LAN. These instruments include an RJ-45 or other standard LAN connector and software support for operating as an independent device on the network.
Some of these instruments are Web-enabled, meaning that they host a
Web page which you can access over the LAN.
With the Agilent IO Libraries Suite, you can connect to instruments across the LAN even if they do not have direct LAN capability, if they are connected to gateways (such as the Agilent E5810A) or to another
PC running the Remote IO Server software.
Refer to the IO Libraries Suite and the Connectivity Guide for information on connecting and configuring different types of LAN instrument connections.
Remote IO Server/Client Architecture
The Remote IO Server and Client software provided with Agilent IO
Libraries Suite allows instrumentation to be controlled over a LAN.
Using standard LAN connections, instruments can be controlled from computers that do not have special interfaces for instrument control.
Client/Server Model
The IO Libraries Suite software uses the client/server model of computing. Client/server computing refers to a model in which an application (the client) does not perform all necessary tasks of the application itself. Instead, the client makes requests of another computing device (the remote I/O server) for certain services.
118 Agilent VISA User’s Guide
Programming via LAN
5
As shown in the following figure, a remote I/O client (a Windows PC) makes VISA requests over the network to a remote I/O server (such as a
Windows PC, an E5810 LAN/GPIB Gateway, or a Series 700 HP-UX workstation).
Gateway Operation
The remote I/O server is connected to the instrumentation or devices to be controlled. Once the remote I/O server has completed the requested operation on the instrument or device, the remote I/O server sends a reply to the client. This reply contains the requested data and status information that indicates whether or not the operation was successful.
The remote I/O server acts as a gateway between the LAN software that the client system supports and the instrument-specific interface that the device supports.
Agilent VISA User’s Guide 119
5
Programming via LAN
Client
Windows PCs
LAN
Remote
I/O
Server
Series 700 workstation or
Windows PC
GPIB bus
(or other)
E5810
LAN/GPIB
Gateway
GPIB
Instrument
LAN Instruments
(VXI-11.2 GPIB Emulation
or
VXI-11.3 LAN Instruments)
GPIB
Instruments
GPIB bus
120 Agilent VISA User’s Guide
Programming via LAN
5
Addressing LAN-Connected Devices
VISA can communicate with LAN-connected devices in one of two ways:
• TCPIP interface type
• Remote interface type (available only with Agilent IO Libraries
Suite)
Using the TCPIP Interface Type for LAN Access
VISA provides the TCPIP interface type to communicate with
LAN-connected devices. These can be devices connected directly to the
LAN, or they can be connected to the LAN through a LAN gateway such as the Agilent E5810 LAN/GPIB gateway or through Remote IO
Server software running on a remote computer with instruments connected to it.
The format of a TCPIP VISA resource string is:
TCPIP[<board>]::<hostname>[::<LAN device name>][::INSTR] where:
• <board> = board number (default is 0)
• <hostname> = the hostname or IP address of the LAN device or server
• <LAN device name> = the remote device name (case sensitive with default name of inst0)
Using Connection Expert, you can configure a LAN interface to use either the VXI-11 protocol or the SICL-LAN protocol. The protocol(s) you will use depends upon the devices you are using and the protocol(s) that they support.
The VXI-11 protocol constrains the LAN device name to be of the form
inst0, inst1, … for VXI-11.3 devices and gpib0,n, gpib1,n, … for
VXI-11.2 (GPIB Emulation) devices.
The SICL-LAN protocol allows any valid SICL name for the LAN device name. A valid SICL name must be a unique string of alphanumeric characters, starting with a letter.
Agilent VISA User’s Guide 121
5
Programming via LAN
Some examples of TCPIP resource strings follow.
Table 28 Example TCPIP Resource Strings
String
TCPIP0::[email protected]::gpib0,2::INST
R
TCPIP0::123.456.0.21::gpib0,2::INSTR
TCPIP0::myMachine::inst0::INSTR
TCPIP::myMachine
TCPIP0::testMachine1::COM1,488::INSTR
TCPIP0::myMachine::gpib0,2::INSTR
TCPIP0::myMachine::UsbDevice1::INSTR
Description
A VXI-11.2 GPIB device at hostname
A VXI-11.2 GPIB device at a machine whose IP address is
123.456.0.21.
A VXI-11.3 LAN instrument at hostname myMachine.
A VXI-11.3 LAN instrument at hostname myMachine. Note that default values for board = 0, LAN device name = inst0, and the
::INSTR resource class are used.
An RS-232 device connected to a LAN server or gateway at hostname testMachine1. This device must use SICL-LAN protocol since RS-232 devices are not supported by the VXI-11 protocol.
A GPIB device at hostname myMachine. This device must use
SICL-LAN protocol since gpib0,2 is not a valid remote name with the VXI-11 protocol.
A USB device with a SICL alias of UsbDevice1 connected to a
LAN server at hostname myMachine. Note that the SICL alias is defined on the remote machine, not on the local machine.
Although the SICL and VISA alias names are normally the same, if they are not, you must be sure to use the SICL alias and not the
VISA alias.
This device must use the SICL-LAN protocol since USB devices are not supported by the VXI-11 protocol.
122 Agilent VISA User’s Guide
Programming via LAN
5
Table 28 Example TCPIP Resource Strings
String
TCPIP0::myMachine::usb0[2391::1031::SN_00123
::0]::INSTR
Description
A USB device with:
Manufacture ID = 2391
Model Code = 1031
Serial Number = 'SN_00123'
USBTMC Intfc # = 0 connected to a LAN server at hostname myMachine.
This device must use SICL-LAN protocol since USB devices are not supported by the VXI-11 protocol.
N O T E
Agilent VISA User’s Guide
A LAN session to a remote interface provides the same VISA function support as if the interface were local, except that VXI-specific functions are not supported over LAN.
Addressing a Session Using the TCPIP Interface Type
This sample shows one way to open a device session with a GPIB device at primary address 23 on a remote PC that is running a LAN
server. The hostname of the remote PC is myMachine. See Chapter 3,
“Programming with VISA”, for more information on addressing device
sessions.
ViSession defaultRM, vi;.
.
viOpenDefaultRM(&defaultRM); viOpen(defaultRM,
"TCPIP0::myMachine::gpib0,23::INSTR", VI_NULL,
VI_NULL, &vi);
.
.
viClose(vi);
123
5
Programming via LAN
124 viClose(defaultRM);
Using a Remote Interface for LAN Access
Agilent VISA provides three types of VISA LAN Client interfaces, implemented in Agilent IO Libraries Suite as remote interfaces:
• Remote serial interface (ASRL VISA LAN Client)
• Remote GPIB interface (GPIB VISA LAN Client)
• Remote USB interface (USB VISA LAN Client)
Remote interfaces are configured using Connection Expert; they provide virtual GPIB, serial, or USB interfaces. They make it possible to remotely access a LAN-connected device as if it were connected to a local interface. If, for example, the GPIB2 interface is configured as a remote GPIB interface, a program controlling the devices
GPIB2::5::INSTR and GPIB2::7::INSTR would not be aware of the fact that these devices are actually connected via LAN and not to a
GPIB interface connected to the local machine.
See the Agilent IO Libraries Suite Online Help for specific information on configuring remote interfaces.
Remote Serial Interface (ASRL VISA LAN Client)
A remote serial interface can use only the SICL-LAN protocol. A remote serial interface can be configured to use the serial port on the
Agilent E5810 LAN/GPIB gateway or the serial ports on a PC running the Remote IO Server software.
Remote GPIB Interface (GPIB VISA LAN Client)
A remote GPIB interface can use both the VXI-11 and SICL-LAN protocols. Typical uses for remote GPIB interfaces are with LAN/GPIB gateways (e.g. Agilent E5810), PCs with GPIB interfaces that are running a LAN server, and VXI-11.2 LAN-based instruments.
A remote GPIB interface can only be used to communicate with
VXI-11.2 (GPIB Emulation) devices. This is because the VISA GPIB interface type requires a primary and (optionally) a secondary address when communicating with a device. VXI-11.3 devices do not support the concept of a primary address, so they cannot be accessed with a remote GPIB interface.
Agilent VISA User’s Guide
Agilent VISA User’s Guide
Programming via LAN
5
Remote USB Interface (USB VISA LAN Client)
A remote USB interface can use only the SICL-LAN protocol. It can communicate with USB devices attached to a remote PC running the
Remote IO Server software.
Note that if you have defined a VISA alias for a USB device on the remote I/O server, you must either define the same (or another) alias for the remote USB device on the client PC, or use the full USB resource string. Alias definitions are not shared between the remote I/O server and the client.
Addressing a Session Using a Remote Interface
In general, the rules to address a remote session are the same as to address a local session. The only difference for a remote session is that you use the VISA interface ID (provided during I/O configuration via
Connection Expert) that relates to the remote interface.
The following sample shows one way to open a device session with a
GPIB device at primary address 23 on a remote PC that is running
Remote IO Server software. A remote GPIB interface has been
configured at GPIB2 to communicate with that machine. See Chapter 3,
“Programming with VISA”, for more information on addressing device
sessions.
ViSession defaultRM, vi;.
.
viOpenDefaultRM(&defaultRM); viOpen(defaultRM, "GPIB2::23::INSTR", VI_NULL,
VI_NULL, &vi);
.
.
viClose(vi); viClose(defaultRM);
125
5
Programming via LAN
126 Agilent VISA User’s Guide
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 3 Agilent VISA User’s Guide
- 7 Introduction
- 8 What’s in This Guide?
- 9 VISA Overview
- 9 Using VISA, VISA COM, and SICL
- 10 VISA Support
- 10 VISA Documentation
- 12 Contacting Agilent
- 13 Building a VISA Application in Windows
- 14 Building a VISA Program (C/C++)
- 14 Compiling and Linking VISA Programs (C/C++)
- 14 Linking to VISA Libraries
- 14 Microsoft Visual C++ Version 6.0 Development Environment
- 15 Microsoft Visual Studio .NET
- 15 Sample VISA Program (C/C++)
- 15 Sample C/C++ Program Source Code
- 17 C/C++ Sample Program Contents
- 18 Building a VISA Program (Visual Basic)
- 18 Visual Basic Programming Considerations
- 18 Required Module for a Visual Basic VISA Program
- 18 Adding the visa32.bas File to Your Project
- 18 VISA Limitations in Visual Basic
- 19 Format Conversion Commands
- 19 Numeric Arrays
- 20 Strings
- 20 Sample VISA Program (Visual Basic)
- 20 Steps to Running the Program
- 21 Sample Program Source Code
- 23 Sample Program Contents
- 25 Logging Error Messages
- 25 Using the Event Viewer
- 25 Using the Debug Window
- 27 Programming with VISA
- 28 VISA Resources and Attributes
- 28 VISA Resources
- 29 VISA Attributes
- 29 Example: Reading a VISA Attribute
- 30 Using Sessions
- 30 Including the VISA Declarations File (C/C++)
- 30 Adding the visa32.bas File (Visual Basic)
- 31 Opening a Session
- 31 Resource Manager Sessions
- 31 Resource Sessions
- 32 Example: Opening a Resource Session
- 33 Addressing a Session
- 36 Example: Opening a Session
- 37 Closing a Session
- 37 Searching for Resources
- 39 Example: Searching the VXI Interface for Resources
- 40 Sending I/O Commands
- 40 Types of I/O
- 41 Formatted I/O Conversion
- 41 Example: Receiving Data From a Session
- 42 Formatted I/O Buffers
- 43 Example: Sending and Receiving Formatted I/O
- 44 Using Non-Formatted I/O
- 44 Non-Formatted I/O Functions
- 44 Example: Using Non-Formatted I/O Functions
- 46 Using Events and Handlers
- 46 Events and Attributes
- 46 Event Notification
- 47 Events that can be Enabled
- 54 Example: Reading Event Attributes
- 54 Using the Callback Method
- 54 Example: Using the Callback Method
- 55 Installing Handlers
- 56 Example: Installing an Event Handler
- 56 Writing the Handler
- 56 Enabling Events
- 57 Example: Enabling a Hardware Trigger Event
- 58 Example: Trigger Callback
- 60 Example: SRQ Callback
- 62 Using the Queuing Method
- 63 Example: Using the Queuing Method
- 63 Enabling Events
- 64 Example: Enabling a Hardware Trigger Event
- 64 Wait on the Event
- 65 Example: Wait on Event for SRQ
- 65 Example: Trigger Event Queuing
- 68 Trapping Errors
- 68 Trapping Errors
- 68 Example: Checking for VI_SUCCESS
- 68 Example: Printing Error Code
- 69 Example: Checking Instrument Errors
- 69 Exception Events
- 70 Exception Handling Model
- 71 Using the VI_EVENT_EXCEPTION Event
- 71 Example: Exception Events
- 74 Using Locks
- 74 Lock Functions
- 74 viLock/viUnlock Functions
- 75 VISA Lock Types
- 76 Example: Exclusive Lock
- 77 Example: Shared Lock
- 79 Programming via GPIB and VXI
- 80 GPIB and VXI Interfaces Overview
- 80 General Interface Information
- 80 What is an I/O Interface?
- 80 VXI Device Types
- 81 GPIB Interfaces Overview
- 82 Example: GPIB (82350) Interface
- 84 VXI Interfaces Overview
- 84 Example: VXI (E8491B) Interfaces
- 85 GPIB-VXI Interfaces Overview
- 86 Example: GPIB-VXI (E1406A) Interface
- 88 Using High-Level Memory Functions
- 88 Programming the Registers
- 88 High-Level Memory Functions
- 89 Using viIn and viOut
- 90 Using viMoveIn and viMoveOut
- 90 High-Level Memory Functions: Sample Programs
- 91 Sample: Using VXI Interface (High-Level) Memory Functions
- 92 Sample: Using GPIB-VXI Interface (High-Level) Memory Functions
- 94 Using Low-Level Memory Functions
- 94 Programming the Registers
- 94 Low-Level Memory Functions
- 95 Mapping Memory Space
- 96 Reading and Writing to Device Registers
- 96 Sample: Using viPeek16
- 96 Unmapping Memory Space
- 97 Low-Level Memory Functions: Code Samples
- 97 Sample: Using the VXI Interface (Low-Level) Memory Functions
- 98 Sample: Using the GPIB-VXI Interface (Low-Level) Memory Functions
- 100 Using Low/High-Level Memory I/O Methods
- 100 Using Low-Level viPeek/viPoke
- 101 Using High-Level viIn/viOut
- 101 Using High-Level viMoveIn/viMoveOut
- 102 Sample: Using VXI Memory I/O
- 106 Using the Memory Access Resource
- 106 Memory I/O Services
- 106 High-Level Memory I/O Services
- 106 Low-Level Memory I/O Services
- 107 Sample: MEMACC Resource Program
- 109 MEMACC Attribute Descriptions
- 109 Generic MEMACC Attributes
- 110 VXI and GPIB-VXI Specific MEMACC Attributes
- 111 GPIB-VXI Specific MEMACC Attributes
- 112 MEMACC Resource Event Attribute
- 113 Using VXI-Specific Attributes
- 113 Using the Map Address as a Pointer
- 113 VI_ATTR_WIN_ACCESS Settings
- 114 Sample: Determining Window Mapping
- 114 Setting the VXI Trigger Line
- 117 Programming via LAN
- 118 LAN and Remote Interfaces Overview
- 118 Direct LAN Connection versus Remote IO Server/Client Connection
- 118 Remote IO Server/Client Architecture
- 118 Client/Server Model
- 119 Gateway Operation
- 121 Addressing LAN-Connected Devices
- 121 Using the TCPIP Interface Type for LAN Access
- 123 Addressing a Session Using the TCPIP Interface Type
- 124 Using a Remote Interface for LAN Access
- 124 Remote Serial Interface (ASRL VISA LAN Client)
- 124 Remote GPIB Interface (GPIB VISA LAN Client)
- 125 Remote USB Interface (USB VISA LAN Client)
- 125 Addressing a Session Using a Remote Interface
- 127 Programming via USB
- 128 USB Interfaces Overview
- 129 Communicating with a USB Instrument Using VISA
- 131 Glossary
- 131 access board
- 131 Active Controller
- 131 address
- 131 Agilent 488
- 131 alias
- 131 API
- 132 attribute
- 132 board
- 132 board descriptor
- 132 board-level
- 132 bus error
- 132 bus error handler
- 132 CIC
- 132 command bytes
- 133 commander
- 133 commander session
- 133 communication channel
- 133 Connection Expert
- 133 Controller
- 133 Controller in Charge
- 134 device
- 134 device descriptor
- 134 device driver
- 134 device session
- 134 device-level
- 134 direct I/O
- 134 driver
- 135 explorer view
- 135 handler
- 135 instrument
- 135 instrument driver
- 135 Interactive IO
- 135 interface
- 135 interface descriptor
- 135 interface driver
- 136 interface messages
- 136 interface session
- 136 interrupt
- 136 IO Control
- 136 IO Libraries
- 136 Listener
- 136 lock
- 137 logical unit
- 137 mapping
- 137 non-Controller role
- 137 notification area
- 137 operation
- 137 primary VISA
- 137 process
- 138 programming alias
- 138 refresh
- 138 register
- 138 resource (or resource instance)
- 138 resource class
- 138 resource descriptor
- 138 SCPI
- 139 secondary VISA
- 139 session
- 139 SICL
- 139 side-by-side
- 139 SRQ
- 139 Standby Controller
- 140 status byte
- 140 symbolic name
- 140 System Controller
- 140 system tray
- 140 Talker
- 140 task guide
- 140 taskbar notification area
- 141 test system
- 141 thread
- 141 ViFind32
- 141 virtual instrument
- 141 VISA
- 141 VISA address
- 142 VISA alias
- 142 VISA COM
- 142 VISA Instrument Control Resources
- 142 VISA name
- 142 VISA resource manager
- 142 VISA resource template
- 142 VXI Resource Manager
- 143 Windows notification area
- 145 Index