Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

StartTrigger called on both Rising Edge and Falling Edge?

I am attempting to perform a finite sample analog input, triggered by an external digital signal.
I modified one of the NI sample programs as a test.
The problem I am getting is that my analog in callback is being called on both the rising edge and the falling edge of the digital signal, so I am collecting 2 samples at each step.
 
Here is the code that sets up the task:
 
myTask = new Task();
myTask.AIChannels.CreateVoltageChannel(physicalChannelComboBox.Text, "",
   AITerminalConfiguration.Rse, 0, 10, AIVoltageUnits.Volts);
 
//Configure Timing Specs
myTask.Timing.ConfigureSampleClock("", 30000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 1000);
 
//Configure Start Trigger
myTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeStartTriggerEdge.Rising);
 
//Verify the Task
myTask.Control(TaskAction.Verify)
 
// Create the analog reader
myTask.Stream.Timeout = -1;
analogInReader = new AnalogMultiChannelReader(myTask.Stream);
analogInReader.SynchroniseCallbacks = true;
analogReader,BeginReadMultiSample(1000, myAsyncCallback, null);
 
 
// My Callback
private void AnalogInCallback(IAsyncResult ar)
{
    data = analogInReader.EndMultiSample(ar);
 
    analogInReader.BeginMultiSample(1000, myAsyncCallback, null);
}
 
Any suggestions on how to prevent the start trigger from triggering on both rising and falling edge?
0 Kudos
Message 1 of 2
(3,161 Views)
OK, while waiting I did some further tests, and it appears that I have noise on the line, causing the problem.
0 Kudos
Message 2 of 2
(3,156 Views)