My code looks like this:Imports.SetSimpleTrigger (handle, 1, Imports.Channel.ChannelA, 1000, Imports.Threshold Direction.Rising, 0, 0);
Imports.RunStreaming (handle, 25, Imports.ReportedTimeUnits.MicroSeconds, 0, 4000, 1, 1, Imports.RatioMode.None, (uint) sample count);
Imports.GetStreamingLatestValues(handle, StreamingCallback, IntPtr.Zero);
Which I thought would result in that samples would only be added to the buffer from and after that a the trigger-Threshold had been reached. Thus no pretriggering samples, and in my callback function the StartIndex = triggerAt = 0.
But that does not seem to be the case. Why is that? I thought that if the maxPreTriggerSamples argument was set to 0 in RunStreaming() That no pre-triggering samples would be added to the buffer.
This is not really a problem for me because it can be corrected it in the code. I just wonder why it is not as I imagined it to be:)
Something that is a bigger problem for me is the following. In my callback function I print some values for debugging. The code looks like this:
if (_sampleCount != 0 )
Array.Copy(buffers, _startIndex, appBuffers, _startIndex, _sampleCount);
Console.WriteLine(" noofSamples:" + noOfSamples + " TriggeredAt" + triggerAt + " StartIndex:" + startIndex +" Triggered:"+triggered);
And I have noticed that I occasionally get this output:noofSamples:504 TriggeredAt0 StartIndex:0 Triggered:0
noofSamples:1008 TriggeredAt118 StartIndex:504 Triggered:1
noofSamples:504 TriggeredAt0 StartIndex:1512 Triggered:0
noofSamples:1008 TriggeredAt0 StartIndex:2016 Triggered:0
noofSamples:970 TriggeredAt0 StartIndex:3024 Triggered:0
noofSamples:628 TriggeredAt0 StartIndex:3994 Triggered:0
Edit by Admin:
Changed text colour to make it readable
On the first line it states that it has collected 504 samples but without being triggered?? Can anyone explain that?