Prerequisites
Consult the pinout or documentation for your GPIB instrument and make sure you have the correct cables and GPIB instrument control device to connect the instrument to the computer.
Cables
- Shop NI GPIB cables
- GPIB Cabling Requirements and Limitations
GPIB Instrument Control Device
Install NI Software and Drivers
Install the latest compatible version ofLabVIEW, theNI-VISAdriver, and theNI-488.2driver. Refer to the following for compatibility information.
- LabVIEW and Microsoft Windows Compatibility
- NI-VISA and Operating System Compatibility
- NI-VISA and LabVIEW Version Compatibility
- NI Hardware and Software Operating System Compatibility
- NI-488.2 and LabVIEW Version Compatibility
Install GPIB Controller
If you are using an NI GPIB controller or a NI GPIB-ENET device, refer to theGPIB Hardware Installation Guideto install the hardware.
Configure Hardware in MAX
In Measurement and Automation Explorer (MAX), NI-VISA detects the instrument and creates the VISA resource that you use to communicate with the instrument.
- Open MAX from the Start menu.
- ExpandDevices and Interfaces. You should see the VISA resource name of the NI GPIB controller listed asGPIB<controller>::INSTRwhere <controller> is the controller number. If not specified, the controller number defaults to 0.
If you are unable to see the controller, refer toCannot Detect NI GPIB-USB HS Device in MAX.
- After the controller has been successfully recognized, securely connect the GPIB instrument to the controller via a GPIB cable and power it on.
- In MAX, select the GPIB controller and selectScan for Instruments. NI-VISA will attempt to identify the connected GPIB instrument by conducting a FindLstn() test and a *IDN? query. The instrument VISA resource name should appear under the GPIB controller resource asGPIB::<primary address>::INSTR.
Note:If your instrument is not SCPI compliant, it will not appear in MAX. Check the instrument’s user manual for supported commands and continue to theTest Communicationsection below.
IfScan for Instrumentsis missing, refer toNI MAX GPIB Scan for Instruments Missing.
If you experience issues withScan for Instruments, refer toCan’t See GPIB Instrument Using Scan for Instruments in MAX.
Figure 1. Scanning for Instruments in MAX
- After your instrument has been successfully recognized, select the instrument in MAX and then theVISA Propertiestab at the bottom of the window. You can configure the VISA Alias of the instrument for easier identification.
Test Communication
After set-up and configuration,use an interactive control to verify communication with the instrument and test different instrument commands.
If your device is SCPI compliant, select its VISA resource and selectCommunicate with Instrument.
- The NI-488.2 Communicator should launch.
- Type a supported command in theSend Stringfield. Refer to manufacturer documentation for a list of valid commands.
- Select one of the following:
Query– writes the command to the instrument and reads the response back.
Write– writes the command to the instrument.
Read– reads the response from the instrument.
If your device is not SCPI compliant, use GPIB Interactive Control (IBIC) for more advanced communication.
- In MAX, navigate to theToolstab >>NI-488.2>>Interactive Control.
- Enterhelpto launch IBIC help documentation and refer to your instrument’s manual for supported commands.
If you are able to communicate with the instrument in IBIC, then you should also be able to communicate with the instrument from any other programming language, such as G code or C.
Install Instrument Driver
After completing your configuration and verifying communication with the instrument, you need an easy way to transition from interactive mode to programming mode.The best way to achieve this is by using instrument drivers.
Refer toChoosing 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, NI-488.2, 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. For more information on whether to use the NI-488.2 or NI-VISA API, refer toNI-VISA Help: GPIB Summary.
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 articles for instructions on running examples:
- Using Plug-and-Play Instrument Drivers in LabVIEW
- Using IVI Drivers in LabVIEW or LabWindows™/CVI™
NI-488.2 or NI-VISA Driver Example
If you are using NI-488.2 or NI-VISA, refer to the shipping examplesSimple GPIB.vi.orGPIB with VISA Functions.vi.
- To locate the examples, open LabVIEW and navigate to theHelptab >>Find Examples>>Hardware Input and Output>>GPIB.
- Ensure the proper VISA resource name is selected.
- Run the VI.
For more information on the NI-488.2 functions, refer toLabVIEW Help: GPIB Functions .
For more information on the NI-VISA functions, refer toLabVIEW Help: VISA Functions and VIs .
For a comparison on the NI-488.2 and NI-VISA functions, refer toNI-VISA Help: Comparison Between NI-VISA and NI-488.2 APIs.