I'm interfacing with an Agilent 34411a DMM and an Agilent power supply via GPIB, using the drivers from the NI website. I'm trying to output a voltage with the supply, then take a multipoint reading with the DMM. The power supply works as intended, but the dmm does not. Here's my code:
int e1 = hp34401a_ConfigureMeasurement(dmm, HP34401A_VAL_DC_VOLTS, HP34401A_VAL_AUTO_RANGEON, 0.0001); int e2 = hp34401a_ConfigureTrigger(dmm, HP34401A_VAL_IMMEDIATE, 10 * resLoad * capEst); int e3 = hp34401a_ConfigureMultiPoint(dmm, 1000, 1000, HP34401A_VAL_INTERVAL, resLoad *capEst / 100); int e4 = hpe363xa_ConfigureAllOutputEnabled(supply, VI_TRUE); int e5 = hpe363xa_ConfigureVoltageLevel(supply, "2", capMax); int actual; int e6 = hp34401a_ReadMultiPoint (dmm, HP34401A_VAL_MAX_TIME_INFINITE, 1000, capSamples, actual); int e7 = hpe363xa_ConfigureVoltageLevel(supply, "2", 0.0);
Here, resLoad and capEst are a resistance and a capacitance in the circuit I'm testing. So my process is to configure the DMM to measure DC voltage, give it a delay of 10 time constants for the circuit to fully discharge before triggering, then (after increasing the supply voltage from 0V) configure it so that it takes 1000 measurements spaces 1/100 of a time constant apart. The configuration functions don't return any error codes, but
hp34401a_ReadMultiPoint() returns an error code of
0xBFFA2003, an IVI error, according to the driver. In addition, the value of
actual is 0, meaning no data has been acquired, and array
capSamples is empty.
I think I've called some of these functions incorrectly, given the sparse documentation. Any help would be greatly appreciated.
I solved the problem by using a software trigger and low-level measurement functions.
Configure Trigger -> Configure MultiPoint -> Initiate -> SendSoftwareTrigger -> FetchMultiPoint
To access the Agilent 34411a or 34410a DMM using FetchMultiPoint, first you need to use the NI drivers. The IVI Foundation Ag34401a driver was not updated to allow more than 511 points, which was the old 34401 capability. (Who owns the driver? Agilent tech support disavows ownership.) The NI driver, named Hp34401a, is correct (and supported by capable folks!) and can acquire the 50k points. Did not test whether it would do the 1M point capability of the 34411a. But there are still a few tricks once using the NI driver. The sequence of routines, with error checking removed for clarity, is as follows:
// Initialize the instrument
hp34401a_InitWithOptions (resource, VI_TRUE, VI_TRUE, "Simulate=false, RangeCheck=1, QueryInstrStatus=0, Cache=1", &session);
// Must not use HP34401A_VAL_AUTO_RANGE_ON or HP34401A_VAL_AUTO_RANGE_ONCE
// These will cause failure. Also, don’t request finer than 30ppm resolution (0.0003V in this case)
hp34401a_ConfigureMeasurement (session, HP34401A_VAL_DC_VOLTS, 10.0, 0.0003); // 10V range, 30ppm resolution
// Need to set the trigger as software to allow program control
hp34401a_ConfigureTrigger (session, HP34401A_VAL_SOFTWARE_TRIG, 0.0);
// Next, set up the multi-point access. SampleCount=50000 and SampleInterval=0. 000025 (40kHz)
// Note that the SampleInterval is ignored unless HP34401A_VAL_INTERVAL set
hp34401a_ConfigureMultiPoint (session, 1, SampleCount, HP34401A_VAL_INTERVAL, SampleInterval);
// Now, ready the instrument to collect data
// Next, trigger the instrument.
// After this point, other instruments can be controlled as part of the test while the 50k points are acquired
// For example, this power supply (configuration not shown) can be disabled
AgE36xx_SetAttributeViBoolean (sessionSupply, "Output2", AGE36XX_ATTR_OUTPUTS_ENABLED, VI_FALSE); // Disable supply
// Finally read the data from the instrument. This routine is blocking, and only returns after reading all data into array double Measurements
hp34401a_FetchMultiPoint (session, 5000, SampleCount, Measurements, &actualPoints); // Number of samples set by ConfigureMultiPoint
// The array Measurements has the data requested, but best to check the actualPoints acquired.