Agilent TechnologiesAgilent IO Libraries SuiteE2094SAgilent VISA User’s Guide for IO Libraries Suite 15.5
10 Agilent VISA User’s Guide1 IntroductionVISA SupportThis 32-bit version of VISA is supported on Microsoft Windows 2000, Windows XP and Windows Vista
100 Agilent VISA User’s Guide4 Programming via GPIB and VXIUsing Low/High-Level Memory I/O MethodsVISA supports three different memory I/O methods for
Programming via GPIB and VXI 4Agilent VISA User’s Guide 101• Only one active viMapAddress is allowed per vi session. • There may be a limit to the num
102 Agilent VISA User’s Guide4 Programming via GPIB and VXIThe disadvantage of viMoveIn/viMoveOut calls is that they have higher initial overhead than
Programming via GPIB and VXI 4Agilent VISA User’s Guide 103/* ================================================= Using viPeek ==================
104 Agilent VISA User’s Guide4 Programming via GPIB and VXI /* Unmap memory space */ viUnmapAddress (vi); /*===================================
Programming via GPIB and VXI 4Agilent VISA User’s Guide 105/* Demonstrate block read. Read instrument id register and device type register int
106 Agilent VISA User’s Guide4 Programming via GPIB and VXIUsing the Memory Access ResourceFor VISA 1.1 and later, the Memory Access (MEMACC) resource
Programming via GPIB and VXI 4Agilent VISA User’s Guide 107Although the resource handles the allocation and operation of the window, the programmer mu
108 Agilent VISA User’s Guide4 Programming via GPIB and VXI ViUInt16*addr16; ViStatusstatus; ViUInt16offset; status = viOpenDefaultRM ( &
Programming via GPIB and VXI 4Agilent VISA User’s Guide 109 /* Print the results. */ printf( "inData16 : 0x%04hx\n", inData16 ); pri
Introduction 1Agilent VISA User’s Guide 11VXIbus Consortium specifications (when using VISA over LAN)TCP/IP Instrument Protocol Specification - VXI-11
110 Agilent VISA User’s Guide4 Programming via GPIB and VXIVXI and GPIB-VXI Specific MEMACC AttributesThe following attributes, most of which are read
Programming via GPIB and VXI 4Agilent VISA User’s Guide 111GPIB-VXI Specific MEMACC AttributesThe following read-only attributes provide specific addr
112 Agilent VISA User’s Guide4 Programming via GPIB and VXIMEMACC Resource Event AttributeThe following read-only events provide notification that an
Programming via GPIB and VXI 4Agilent VISA User’s Guide 113Using VXI-Specific Attributes VXI-specific attributes can be useful to determine the state
114 Agilent VISA User’s Guide4 Programming via GPIB and VXISample: Determining Window MappingViAddr address; Vi UInt16 access; ViUInt16 value; . . .vi
Programming via GPIB and VXI 4Agilent VISA User’s Guide 115The above function sets the VXI trigger line to TTL trigger line 0 (VI_TRIG_TTL0). The foll
116 Agilent VISA User’s Guide4 Programming via GPIB and VXI
117Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies5Programming via LANThis chapter provides guidelines for programming via a L
118 Agilent VISA User’s Guide5 Programming via LANLAN and Remote Interfaces OverviewThis section provides an overview of LAN (Local Area Network) inte
Programming via LAN 5Agilent VISA User’s Guide 119As shown in the following figure, a remote I/O client (a Windows PC) makes VISA requests over the ne
12 Agilent VISA User’s Guide1 IntroductionContacting Agilent• In the USA, you can reach Agilent Technologies by telephone at:USA: 1-800-829-4444 • Out
120 Agilent VISA User’s Guide5 Programming via LAN Windows PCsClientLANRemoteI/OServerSeries 700workstation orWindows PCGPIBbusGPIBInstrumentGPIBInst
Programming via LAN 5Agilent VISA User’s Guide 121Addressing LAN-Connected DevicesVISA can communicate with LAN-connected devices in one of two ways:•
122 Agilent VISA User’s Guide5 Programming via LANSome examples of TCPIP resource strings follow.Table 28 Example TCPIP Resource StringsString Descrip
Programming via LAN 5Agilent VISA User’s Guide 123Addressing a Session Using the TCPIP Interface TypeThis sample shows one way to open a device sessio
124 Agilent VISA User’s Guide5 Programming via LANviClose(defaultRM);Using a Remote Interface for LAN AccessAgilent VISA provides three types of VISA
Programming via LAN 5Agilent VISA User’s Guide 125Remote USB Interface (USB VISA LAN Client)A remote USB interface can use only the SICL-LAN protocol.
126 Agilent VISA User’s Guide5 Programming via LAN
127Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies6Programming via USBThis chapter provides guidelines for VISA programming of
128 Agilent VISA User’s Guide6 Programming via USBUSB Interfaces OverviewUSBTMC/USBTMC-USB488 instruments are detected and automatically configured by
Programming via USB 6Agilent VISA User’s Guide 129Communicating with a USB Instrument Using VISATo establish communications with a USB device using VI
13Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies2Building a VISA Application in WindowsThis chapter provides guidelines for b
130 Agilent VISA User’s Guide6 Programming via USBAlthough the case of a VISA alias is preserved, case is ignored when the alias is used in place of t
131Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent TechnologiesGlossaryaccess boardThe GPIB interface to which a particular device is conne
132 Agilent VISA User’s GuideGlossaryattributeIn VISA and SICL, a value that indicates the operational state of a resource. Some attributes can be cha
GlossaryAgilent VISA User’s Guide 133commanderIn test-system architectures, a device that has the ability to control another device. In a specialized
134 Agilent VISA User’s GuideGlossarydeviceA unit that receives commands from a Controller. A device is typically an instrument, but can also be a com
GlossaryAgilent VISA User’s Guide 135explorer viewThe tree view within the Connection Expert window that shows all devices connected to a test system.
136 Agilent VISA User’s GuideGlossaryinterface messagesGPIB commands encoded as individual bytes. Also called GPIB commands or command bytes.interface
GlossaryAgilent VISA User’s Guide 137logical unitA number associated with an interface. A logical unit, in SICL and Agilent VEE, uniquely identifies a
138 Agilent VISA User’s GuideGlossaryprogramming aliasSee VISA alias.refreshIn Connection Expert, the action that invokes the discovery mechanism for
GlossaryAgilent VISA User’s Guide 139secondary VISAA VISA installation that does not install visa32.dll in the standard VISA location. The secondary V
14 Agilent VISA User’s Guide2 Building a VISA Application in WindowsBuilding a VISA Program (C/C++)This section provides guidelines for building VISA
140 Agilent VISA User’s GuideGlossarystatus byteA byte of information returned from a remote device that shows the current state and status of the dev
GlossaryAgilent VISA User’s Guide 141test systemAn entire test setup including a controller (often a PC), instruments, interfaces, software, and any r
142 Agilent VISA User’s GuideGlossaryVISA aliasA string that can be used instead of a resource descriptor in VISA programs. Using VISA aliases rather
GlossaryAgilent VISA User’s Guide 143Windows notification areaSee notification area.
144 Agilent VISA User’s GuideGlossary
Agilent VISA User’s Guide 145IndexAaddressingaddressing device sessions, 33devices, 33Agilent 488, 131Agilent web site, 12attributessetting VXI tr
146 Agilent VISA User’s GuideIndexLLANhardware architecture, 118interfaces overview, 118locking, 32, 74locksusing, 74low-level memory functions,
Building a VISA Application in Windows 2Agilent VISA User’s Guide 15• Click at the bottom of the list box and type: C:\Program Files\IVIfoundation\IV
16 Agilent VISA User’s Guide2 Building a VISA Application in WindowsAGILENT TECHNOLOGIES,54622A,987654312,A.01.50If the program does not run, see the
Building a VISA Application in Windows 2Agilent VISA User’s Guide 17C/C++ Sample Program ContentsA summary of the VISA function calls used in the prec
18 Agilent VISA User’s Guide2 Building a VISA Application in WindowsBuilding a VISA Program (Visual Basic)This section provides guidelines for buildin
Building a VISA Application in Windows 2Agilent VISA User’s Guide 19VISA cannot call back to a VB function. Thus, you can only use the VI_QUEUE mechan
# Agilent VISA User’s GuideNotices© Agilent Technologies, Inc. 71995-1996, 1998, 2000-2009No part of this manual may be reproduced in any form or by a
20 Agilent VISA User’s Guide2 Building a VISA Application in WindowsStringsWhen reading in a string value with viVScanf or viVQueryf, you must pass a
Building a VISA Application in Windows 2Agilent VISA User’s Guide 21Libraries Suite\ProgrammingSamples\VB6\VISA\idn.5 Select the file idn.bas and clic
22 Agilent VISA User’s Guide2 Building a VISA Application in WindowsIf the program does not run, see the Event Viewer for a list of run-time errors. T
Building a VISA Application in Windows 2Agilent VISA User’s Guide 23 Sample Program ContentsA summary of the VISA function calls used in the preceding
24 Agilent VISA User’s Guide2 Building a VISA Application in WindowsviOpen This function establishes a communication channel with the device specified
Building a VISA Application in Windows 2Agilent VISA User’s Guide 25Logging Error MessagesWhen developing or debugging your VISA application, you may
26 Agilent VISA User’s Guide2 Building a VISA Application in Windowsprogram using an application such as Microsoft Visual Studio. In this case, VISA m
27Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies3Programming with VISAThis chapter describes how to program with VISA. The ba
28 Agilent VISA User’s Guide3 Programming with VISAVISA Resources and AttributesThis section introduces VISA resources and attributes, including:• VIS
Programming with VISA 3Agilent VISA User’s Guide 29VISA AttributesAttributes are associated with resources or sessions. You can use attributes to dete
Agilent VISA User’s Guide 3Agilent VISA User’s Guide1 IntroductionWhat’s in This Guide? 8VISA Overview 9Using VISA, VISA COM, and SICL
30 Agilent VISA User’s Guide3 Programming with VISAUsing SessionsThis section shows how to use VISA sessions, including:• Including the VISA Declarati
Programming with VISA 3Agilent VISA User’s Guide 31Opening a SessionA session is a channel of communication. Sessions must first be opened on the defa
32 Agilent VISA User’s Guide3 Programming with VISAYour program may have several sessions open at the same time after creating multiple session identi
Programming with VISA 3Agilent VISA User’s Guide 33The example again uses the session returned from the resource manager, with another VISA address, t
34 Agilent VISA User’s Guide3 Programming with VISAThe following table describes the parameters used above.Table 6 The Format of the rsrcName (VISA Ad
Programming with VISA 3Agilent VISA User’s Guide 35Some examples of valid VISA addresses follow.manufacturer ID Manufacturer’s ID for a USB Test &
36 Agilent VISA User’s Guide3 Programming with VISAExample: Opening a Session This sample shows one way to open a VISA session with the GPIB device a
Programming with VISA 3Agilent VISA User’s Guide 37Closing a SessionYou must use the viClose function to close each session. Closing the specific reso
38 Agilent VISA User’s Guide3 Programming with VISAThe parameters are defined as follows.The handle returned from viFindRsrc should be closed to free
Programming with VISA 3Agilent VISA User’s Guide 39Example: Searching the VXI Interface for Resources This code sample searches the VXI interface for
4 Agilent VISA User’s GuideClosing a Session 37Searching for Resources 37Sending I/O Commands 40Types of I/O 40Using Non-Formatte
40 Agilent VISA User’s Guide3 Programming with VISASending I/O CommandsThis section provides guidelines for sending I/O commands, including:• Types of
Programming with VISA 3Agilent VISA User’s Guide 41Using Formatted I/OAs noted, the VISA formatted I/O functions are viPrintf, viQueryf, and viScanf.•
42 Agilent VISA User’s Guide3 Programming with VISAFormatted I/O BuffersThe VISA software maintains both a read and write buffer for formatted I/O ope
Programming with VISA 3Agilent VISA User’s Guide 43Example: Sending and Receiving Formatted I/O The following C sample program demonstrates sending a
44 Agilent VISA User’s Guide3 Programming with VISAUsing Non-Formatted I/OThere are two non-buffered, non-formatted I/O functions that synchronously t
Programming with VISA 3Agilent VISA User’s Guide 45/*nonfmtio.c This example program measures the AC voltage on a multimeter and prints the results. Y
46 Agilent VISA User’s Guide3 Programming with VISAUsing Events and Handlers This section provides guidelines to using events and handlers, including:
Programming with VISA 3Agilent VISA User’s Guide 47The queuing and callback mechanisms are suitable for different programming styles. The queuing mech
48 Agilent VISA User’s Guide3 Programming with VISAEvent Attribute Description APData Type RangeVI_ATTR_EVENT_TYPE Unique logical identifier of the ev
Programming with VISA 3Agilent VISA User’s Guide 49VI_ATTR_RET_COUNT Actual number of elements that were asynchronously transferred.ROViUInt32 0 to FF
Agilent VISA User’s Guide 5Using Low-Level viPeek/viPoke 100Using High-Level viIn/viOut 101Using High-Level viMoveIn/viMoveOut 101Using
50 Agilent VISA User’s Guide3 Programming with VISATable 12 Memory Access (MEMACC) Resource EventVI_EVENT_IO_COMPLETIONNotification that an asynchrono
Programming with VISA 3Agilent VISA User’s Guide 51Event Attribute Description APData Type RangeVI_ATTR_EVENT_TYPE Unique logical identifier of the ev
52 Agilent VISA User’s Guide3 Programming with VISAEvent Attribute Description APData Type RangeVI_ATTR_EVENT_TYPE Unique logical identifier of the ev
Programming with VISA 3Agilent VISA User’s Guide 53VI_ATTR_EVENT_TYPE Unique logical identifier of the event.ROViEventTypeVI_EVENT_VXI_VME_ SYSFAILVI_
54 Agilent VISA User’s Guide3 Programming with VISAExample: Reading Event Attributes Once you have decided which attribute to check, you can read the
Programming with VISA 3Agilent VISA User’s Guide 55. . viInstallHandler(vi, VI_EVENT_SERVICE_REQ, my_handler, addr); viEnableEvent(vi, VI_EVENT_SERV
56 Agilent VISA User’s Guide3 Programming with VISAThe userHandle parameter allows you to assign a value to be used with the handler on the specified
Programming with VISA 3Agilent VISA User’s Guide 57Using VI_QUEUE in the mechanism parameter specifies a queuing method for the events to be handled.
58 Agilent VISA User’s Guide3 Programming with VISAExample: Trigger Callback This sample program installs an event handler and enables the trigger ev
Programming with VISA 3Agilent VISA User’s Guide 59 printf("TTL0"); break; default: printf("<other 0x%x>"
6 Agilent VISA User’s Guide
60 Agilent VISA User’s Guide3 Programming with VISAExample: SRQ Callback This program installs an event handler and enables an SRQ event. When the ev
Programming with VISA 3Agilent VISA User’s Guide 61 printf( "\nStray event of type 0x%lx\n", eventType ); return VI_SUCCESS; } /*
62 Agilent VISA User’s Guide3 Programming with VISA /* Send a bogus command to the message-based device to cause an SRQ. Note: 'IDN' caus
Programming with VISA 3Agilent VISA User’s Guide 63• When ready to query, use the viWaitOnEvent function to check for queued events. If the specified
64 Agilent VISA User’s Guide3 Programming with VISAWhen you use VI_QUEUE in the mechanism parameter, you are specifying that the events will be put in
Programming with VISA 3Agilent VISA User’s Guide 65Example: Wait on Event for SRQ This example shows how to install a wait on event for service reque
66 Agilent VISA User’s Guide3 Programming with VISAvoid main(){ ViSession defaultRM,vi; ViEventType eventType; ViEvent eventVi; ViStatus err;
Programming with VISA 3Agilent VISA User’s Guide 67 printf("TTL0"); break; default: printf("<other 0x%x>",trigI
68 Agilent VISA User’s Guide3 Programming with VISATrapping ErrorsThis section provides guidelines for trapping errors, including:• Trapping Errors• E
Programming with VISA 3Agilent VISA User’s Guide 69 char err_msg[1024]={0}; viStatusDesc (vi, err, err_msg); printf ("ERROR = %s\n", er
7Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies1IntroductionThis Agilent VISA User’s Guide describes the Agilent Virtual Inst
70 Agilent VISA User’s Guide3 Programming with VISAException Handling ModelThe exception-handling model follows the event-handling model for callbacks
Programming with VISA 3Agilent VISA User’s Guide 713 Code in any operation (after calling an exception handler) may not be called if the handler does
72 Agilent VISA User’s Guide3 Programming with VISAhandler must be installed and exception events enabled on all sessions where the exception handler
Programming with VISA 3Agilent VISA User’s Guide 73 status = viOpenDefaultRM( &drm ); if ( status < VI_SUCCESS ) { printf( "ERROR:
74 Agilent VISA User’s Guide3 Programming with VISAUsing Locks In VISA, applications can open multiple sessions to a VISA resource simultaneously. App
Programming with VISA 3Agilent VISA User’s Guide 75VISA Lock TypesVISA defines two different types of locks: Exclusive Lock and Shared Lock.Exclusive
76 Agilent VISA User’s Guide3 Programming with VISASee the VISA Online Help for function descriptions to determine which are applicable for locking an
Programming with VISA 3Agilent VISA User’s Guide 77 /* Print results */ printf ("Instrument identification string: %s\n", buf); /* C
78 Agilent VISA User’s Guide3 Programming with VISA /* at this time, we can make 'lockkey' available to other processes that we know ab
79Agilent IO Libraries SuiteAgilent VISA User’s GuideAgilent Technologies4Programming via GPIB and VXIVISA supports three interfaces you can use to ac
8 Agilent VISA User’s Guide1 IntroductionWhat’s in This Guide?This guide shows VISA programming techniques using C/C++ and Visual Basic. This chapter
80 Agilent VISA User’s Guide4 Programming via GPIB and VXIGPIB and VXI Interfaces OverviewThis section provides an overview of the GPIB, GPIB-VXI, and
Programming via GPIB and VXI 4Agilent VISA User’s Guide 81message-based device interprets the SCPI command. In this case you can use the VISA formatte
82 Agilent VISA User’s Guide4 Programming via GPIB and VXIExample: GPIB (82350) InterfaceThe GPIB interface system in the following figure consists of
Programming via GPIB and VXI 4Agilent VISA User’s Guide 83582350 GPIB Card #1Windows PC33GPIB InstrumentsGPIB CableInterface VISA Names82350 GPIB Card
84 Agilent VISA User’s Guide4 Programming via GPIB and VXIVXI Interfaces OverviewAs shown in the following figure, a typical VXI (E8491) interface con
Programming via GPIB and VXI 4Agilent VISA User’s Guide 85GPIB-VXI Interfaces OverviewAs shown in the following figure, a typical GPIB-VXI interface c
86 Agilent VISA User’s Guide4 Programming via GPIB and VXIExample: GPIB-VXI (E1406A) InterfaceThe GPIB-VXI interface system in the following figure co
Programming via GPIB and VXI 4Agilent VISA User’s Guide 87The Connection Expert utility has been used to assign the GPIB-VXI driver a VISA name of GPI
88 Agilent VISA User’s Guide4 Programming via GPIB and VXIUsing High-Level Memory FunctionsHigh-level memory functions allow you to access memory on t
Programming via GPIB and VXI 4Agilent VISA User’s Guide 89Using viIn and viOutWhen using the viIn and viOut high-level memory functions to program to
Introduction 1Agilent VISA User’s Guide 9VISA OverviewVISA is an application programming interface (API) for instrument control. It allows you to prog
90 Agilent VISA User’s Guide4 Programming via GPIB and VXIThe val32 parameter is a pointer to where the data read will be stored. If instead you write
Programming via GPIB and VXI 4Agilent VISA User’s Guide 91The first program uses the VXI interface; the second program accesses the backplane with the
92 Agilent VISA User’s Guide4 Programming via GPIB and VXISample: Using GPIB-VXI Interface (High-Level) Memory FunctionsThis program uses high-level m
Programming via GPIB and VXI 4Agilent VISA User’s Guide 93 /* Print results */ printf ("ID Register = 0x%4X\n", id_reg); printf (&q
94 Agilent VISA User’s Guide4 Programming via GPIB and VXIUsing Low-Level Memory Functions Low-level memory functions allow direct access to memory on
Programming via GPIB and VXI 4Agilent VISA User’s Guide 95Mapping Memory SpaceWhen using VISA to access the device's registers, you must map memo
96 Agilent VISA User’s Guide4 Programming via GPIB and VXI/* Maps to A24 address space */ viMapAddress(vi, VI_A24_SPACE, 0x00, 0x80, VI_FALSE, VI_N
Programming via GPIB and VXI 4Agilent VISA User’s Guide 97Low-Level Memory Functions: Code SamplesTwo sample programs follow that use the low-level me
98 Agilent VISA User’s Guide4 Programming via GPIB and VXI /* Read device type register contents */ /* ViAddr is defined as a void so we must cas
Programming via GPIB and VXI 4Agilent VISA User’s Guide 99 /* Open session to VXI device at address 24 */ viOpenDefaultRM(&defaultRM); v
Comentarios a estos manuales