Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Measure AC Voltage on a Keysight® 34410A Digital Multimeter Using the IVI-C Driver

This example shows how to initialize the driver, read a few properties of the driver, measure AC voltage using Agilent Technologies 34410A digital multimeter and output the result in MATLAB®.

Requirements

This example requires the following:

  • Keysight IO libraries version 17.1

  • Keysight 34410A Digital Multimeter IVI driver version 1.1.0.0

Enumerate Available IVI-C Drivers on the Computer

This enumerates the IVI drivers that have been installed on the computer

IviInfo = instrhwinfo('ivi');
IviInfo.Modules
ans = 

  Columns 1 through 6

    'Ag33220'    'Ag3352x'    'Ag34410'    'Ag34970'    'Ag532xx'    'AgAC6800'

  Columns 7 through 11

    'AgE36xx'    'AgInfiniiVision'    'AgMD1'    'AgRfSigGen'    'AgXSAn'

  Columns 12 through 13

    'KtRFPowerMeter'    'rsspecan'

Create a MATLAB Instrument Driver and Connect to the Instrument

% Create the MATLAB instrument driver
makemid('Ag34410','Ag34410.mdd')

% Use icdevice with the MATLAB instrument driver name and instrument's
% resource name to create a device object. In this example the instrument
% is connected by GPIB at board index 0 and primary address 1.
myInstrument = icdevice('Ag34410.mdd', 'GPIB0::01::INSTR','optionstring','simulate=true');

% Connect driver instance
connect(myInstrument);

Attributes and Variables Definition

% These values are defined in the driver's header file 'Ag34410.h'
AG34410_VAL_AC_VOLTS = 2;
AG34410_VAL_IMMEDIATE = 1;

Get General Device Properties

Query information about the driver and instrument

% Get information about the driver
Utility = get(myInstrument, 'Utility');
Revision = invoke(Utility, 'revisionquery');
DriverIdentification = get(myInstrument,'Inherentiviattributesdriveridentification');
InstrumentIdentification = get(myInstrument,'Inherentiviattributesinstrumentidentification');
Vendor = get(DriverIdentification, 'Specific_Driver_Vendor');
Description = get(DriverIdentification, 'Specific_Driver_Description');
InstrumentModel = get(InstrumentIdentification, 'Instrument_Model');
FirmwareRev = get(InstrumentIdentification, 'Instrument_Firmware_Revision');

% Print the queried driver properties
disp(['Revision:        ', Revision]);
disp(['Vendor:          ', Vendor]);
disp(['Description:     ', Description]);
disp(['InstrumentModel: ', InstrumentModel]);
disp(['FirmwareRev:     ', FirmwareRev]);
fprintf('\n');
Revision:        1.1.0.0 
Vendor:          Agilent Technologies
Description:     IVI driver for the Agilent 34410/11 family of digital multimeters. [Compiled for 64-bit.]
InstrumentModel: 34410A
FirmwareRev:     Sim1.1.0.0

Configure the AC Voltage Measurement

AutoRange = -1;
Resolution = 0.001;
ConfigGroup = get(myInstrument, 'Configuration');
invoke(ConfigGroup, 'configuremeasurement', AG34410_VAL_AC_VOLTS, AutoRange, Resolution);

Configure Multipoint Acquisition

TriggerCount = 1;
SampleCount = 10;
SampleInterval = 0.0001;
ConfigMultipoint = get(myInstrument, 'Configurationmultipoint');
invoke(ConfigMultipoint, 'configuremultipoint', TriggerCount,SampleCount,AG34410_VAL_IMMEDIATE,SampleInterval);

Initiate the Low Level Measurement

Call the INITIATE function

LowLevelMeasurement = get(myInstrument, 'Measurementlowlevelmeasurement');
invoke(LowLevelMeasurement, 'initiate');
fprintf('Measuring AC Volts\n');
Measuring AC Volts

Fetch Data

ReadingArray = zeros(1,10);
[ReadingArray,actualPoints] = invoke(LowLevelMeasurement, 'fetchmultipoint', 5000,10,ReadingArray);

Visualize Data and Display any Errors

% Display the fetched data
fprintf('Measured Data: ');
fprintf('%d ',ReadingArray(1:actualPoints));
fprintf('\n\n');

% If there are any errors, query the driver to retrieve and display them.
ErrorNum = 1;
while (ErrorNum ~= 0)
    [ErrorNum, ErrorMsg] = invoke(Utility, 'errorquery');
    fprintf('ErrorQuery: %d, %s\n', ErrorNum, ErrorMsg);
end
Measured Data: 0 0 0 

ErrorQuery: 0, No error. 

Disconnect Device Object and Clean Up

disconnect(myInstrument);
% Remove instrument objects from memory
delete(myInstrument);

Additional Information:

This example shows the setup and making measurements from a digital multimeter using the IVI driver. Once the measured data is retrieved from the instrument, MATLAB can be used to visualize and perform analyses on the data using the rich library of functions in the Signal Processing Toolbox™ and Communications Systems Toolbox™. Using Instrument Control Toolbox™, it is possible to automate control of instruments, and, build test systems that use MATLAB to perform analyses that may not be possible using the built-in capability of the hardware.

Was this topic helpful?