02-10-2017 10:40 AM
I'm trying to get measurements on a PXIe4139, and I can't set the AperatureTime property. Here's the exception I get:
Ivi.Driver.IviCDriverException was unhandled ErrorCode=0 HResult=-2146233088 Message=ModularInstruments.NIDCPower: Specified property cannot be set while the task is running. Set the property prior to starting the task, or stop the task prior to setting the property. Property: Aperture Time
And the code, in it's entierty...
power = new NIDCPower("PXI5Slot3", false, true); power.Outputs["0"].Source.Output.Function = DCPowerSourceOutputFunction.DCVoltage; power.Outputs["0"].Source.Voltage.VoltageLevel = voltage; power.Outputs["0"].Source.Output.Enabled = true; power.Outputs["0"].Measurement.ApertureTime = 0.000001; power.Outputs["0"].Measurement.SamplesToAverage = 0; while (true) { var measurement = power.Measurement.Fetch("0", new NationalInstruments.PrecisionTimeSpan(1.0), 1); Console.Writeline(measurement.VoltageMeasurements[0]); Console.Writeline(measurement.CurrentMeasurements[0]); }
What am I missing?
02-13-2017 04:00 PM - edited 02-13-2017 04:01 PM
Hi,
While I am more directly familiar with LabVIEW's API for the 4139, I believe the error comes from trying to change a setting after you've configured and enabled the output. Try placing the aperture time setting above the enabled line.
power.Outputs["0"].Measurement.ApertureTime = 0.000001;
power.Outputs["0"].Source.Output.Enabled = true;
Regards,
Finch Train