Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read from start to reference Trigger?

Solved!
Go to solution

Hi!

 

I develop a little system on a NI DAQmx 6025 and want to know how i can become the data from a start to reference trigger.

I have use the example "AcqVoltageSamples_IntClkDigStartAndRef.2008" to control the Device in C#

If i configure the Starttrigger only, i can trigger... (the measure is start by PFI0 rising edge)

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

myTask.AIChannels.CreateVoltageChannel(physicalChannelComboBox.Text,"", (AITerminalConfiguration)(-1),rangeMin,rangeMax,AIVoltageUnits.Volts);

myTask.Timing.ConfigureSampleClock("", sampleRate, SampleClockActiveEdge.Rising,SampleQuantityMode.FiniteSamples, 1000);

myTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeStartTriggerEdge.Rising);

 

reader = new AnalogMultiChannelReader(myTask.Stream);

...

reader.SynchronizeCallbacks = true;

reader.BeginReadWaveform(-1, new AsyncCallback(myCallback), null);

 

...MyCallback...

 

data = reader.EndReadWaveform(ar);

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Now i want to stop my measure by the reference trigger, so i have configure the Referencetrigger on the same source (PFI0)

 

myTask.Triggers.ReferenceTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeReferenceTriggerEdge.Falling, 10);

 

(This Line is after the the StartTrigger configuration)

 

If i start the task and give the triggersignal, the measure starts. But now the measure have to stop if i trigger PFI0 again!

I dont know, what i have to do, to become a measure from Start to Stop trigger... so i mean PFI0 rising Edge to PFI0 rising Edge

 

Thanks for supports!

0 Kudos
Message 1 of 4
(4,919 Views)

Hello, in my opinion, you just have to configure a digital reference trigger. With that configuration, the driver will sample into the onboard fifo until the trigger occurs.

Then the pretrigger- plus post-trigger-samples will be transferred to the host. NI-DAQmx comes with an ready to use example which you can find here:

 

C:\Dokumente und Einstellungen\All Users\Dokumente\National Instruments\NI-DAQ\Examples\DotNET3.5\Analog In\Measure Voltage\AcqVoltageSamples_IntClkDigRef\CS

 

 

regards

 

Marco Brauner NIG

0 Kudos
Message 2 of 4
(4,889 Views)

Hi Marco!

 

THX for your help, but it don't solved realy my problem.

I want to use the reference-trigger as a stopp signal for my measure. Now i want to know how i have to use or to configure the referencetrigger and must read the data to get all the samples from the start to the reference trigger in C#.

 

I can start my measure with the start trigger, and i can use the reference-trigger after the measure is started. But i dont want some fixed samples before or after the referencetrigger. I want variation samples from a start to a stop! And the Reference-Trigger can used for this case, but i don't know how to configure...

 

other ideas?

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Hi Marco!

 

Danke für deine Hilfe, aber es löst leider nicht mein Problem.

Ich möchte den Referenztrigger als Stopsignal für meine Messung nutzen. Nun muss ich wissen, wie ich den Referenztrigger in C# konfigurieren muss, um all die Samples vom Start- bis zum Referenztrigger zu bekommen.

 

Ich kann meine Messung mit den Starttrigger starten und anschließend den Referenztrigger nutzen. Ich will aber keine feste anzahl von samples vor und nach dem Referenztrigger, ich will eine beliebige Anzahl von samples vom Start zum Stopp (Referenztrigger). Der Referenztrigger sollte für diesen Fall benutzt werden können, ich weiß leider nur nicht wie.

 

Andere Ideen?

0 Kudos
Message 3 of 4
(4,885 Views)
Solution
Accepted by topic author S.B.

 

Für alle die noch immer nach einer Antwort suchen, ich habs jetz!

For all the people who search for this answer, i get it now!

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

            myTask = new Task("aiTask");        //Create a new Task
            //Initialize Local Variables
            double sampleRate = Convert.ToDouble(rateNumeric.Value);
            double rangeMin = Convert.ToDouble(minimumValueNumeric.Value);
            double rangeMax = Convert.ToDouble(maximumValueNumeric.Value);
            //Create a virtual channel
            myTask.AIChannels.CreateVoltageChannel(physicalChannelComboBox.Text, "", (AITerminalConfiguration)(-1),
                rangeMin, rangeMax, AIVoltageUnits.Volts);
            //Configure Timing Specs
            myTask.Timing.ConfigureSampleClock("", sampleRate, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 1000);
            
            //Configure Start and Reference Triggers
            myTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeStartTriggerEdge.Rising);
            myTask.Triggers.ReferenceTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeReferenceTriggerEdge.Rising, 100);

            //Verify the Task
            myTask.Control(TaskAction.Verify);
            //Create the reader object
            reader = new AnalogMultiChannelReader(myTask.Stream);
            //Start the Task and set the read position
            myTask.Start();
            myTask.Stream.ReadRelativeTo = ReadRelativeTo.CurrentReadPosition;

            AnalogWaveform<double>[] temp;

            while(!myTask.IsDone){
                temp = reader.ReadWaveform(60000);
            }

            myTask.Dispose();

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Mit dieser Lösung kann man von Flanke zu Flanke messen.

With this solve you can measure from edge to edge.

0 Kudos
Message 4 of 4
(4,790 Views)