Hi,
I've been trying to get this working for a while now, and I'm stuck. I would greatly appreciate anyone's help.
I am trying to do the following. I have a unit under test that outputs (1) a strobe signal, (2) two analog signals, and (3) 16 digital signals. I've hooked this up to a NI card, with the strobe signal on PFI9, the two analog signals on ai1 and ai0, and the digital signals on /dev1/port1/line7:0 and /dev1/port0/line7:0. I want to take one sample of all of the signals upon each rising edge on the strobe signal. I want those samples, either one by one or a batch of them, to be sent to a callback.
So, having looked at the samples and the docs, I've come up with this snippet of code (below). But, it never gets past the verify.. It reports the error:
Requested value is not a supported value for this property
Property: NationalInstruments.DAQmx.Timing.SampleTimingType
Requested Value: NationalInstruments.DAQmx.SampleTimingType.SampleClock
Task Name: diTask
Status Code: -200077
Code:
//Create a new Task
myAnalogTask = new Task("aiTask");
myDigTask = new Task("diTask");
//Create a new virtual channel for analog input
myAnalogTask.AIChannels.CreateVoltageChannel("/Dev1/ai1:0", "",
AITerminalConfiguration.Rse,
0.0,
3.5,
AIVoltageUnits.Volts);
myDigTask.DIChannels.CreateChannel("/Dev1/Port2/Line0,/Dev1/Port1/Line7:0,/Dev1/Port0/Line7:0", "", ChannelLineGrouping.OneChannelForAllLines);
// Create a new virtual channel for digital input myAnalogTask.Timing.ConfigureSampleClock("/Dev1/PFI9",750.0e3,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples);
myDigTask.Timing.ConfigureSampleClock("/Dev1/PFI9", 750.0e3,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples);
/*
myDigTask.Timing.ConfigureChangeDetection(
"/Dev1/Port2/Line0", "", SampleQuantityMode.ContinuousSamples);
*/
//Verify the Tasks
myAnalogTask.Control(TaskAction.Verify);
myDigTask.Control(TaskAction.Verify);
//Create a new Task
myAnalogTask = new Task("aiTask");
myDigTask = new Task("diTask");
//Create a new virtual channel for analog input
myAnalogTask.AIChannels.CreateVoltageChannel("/Dev1/ai1:0", "",
AITerminalConfiguration.Rse,
0.0,
3.5,
AIVoltageUnits.Volts);
myDigTask.DIChannels.CreateChannel("/Dev1/Port2/Line0,/Dev1/Port1/Line7:0,/Dev1/Port0/Line7:0", "", ChannelLineGrouping.OneChannelForAllLines);
myAnalogTask.Timing.ConfigureSampleClock("/Dev1/PFI9",750.0e3,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples);
myDigTask.Timing.ConfigureSampleClock("/Dev1/PFI9", 750.0e3,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples);
//Verify the Tasks
myAnalogTask.Control(TaskAction.Verify);
myDigTask.Control(TaskAction.Verify);