<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Starting a ReadWaveform on an external trigger? in Measurement Studio for .NET Languages</title>
    <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3248753#M17536</link>
    <description>&lt;P&gt;The DAQ card is the PXIe-6535.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can clearly see the PFI trigger line go high on my scope, and I have driven (and confirmed) that PFI line before. &amp;nbsp;The PFI trigger line is definitely going high.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code behaves the same way because reader.ReadWaveform(samplesToCollect) is a synchronous call. &amp;nbsp;I had forgotten there is a BeginReadWaveform method that might do what I want. &amp;nbsp;However, I'm currently having problems with a NI dll BSODing my computer that I need figure out first.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2016 20:58:33 GMT</pubDate>
    <dc:creator>CurtisHx</dc:creator>
    <dc:date>2016-02-04T20:58:33Z</dc:date>
    <item>
      <title>Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3247668#M17528</link>
      <description>&lt;P&gt;I have a DigitalMultiChannelReader that I need to start reading a waveform when an external line changes. &amp;nbsp;For example, I want to read Port3 lines 3 and 4 when PFI5 goes high, for a certain number of samples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;          readWaveformTask = new NationalInstruments.DAQmx.Task();
          readWaveformTask.DIChannels.CreateChannel("PXI1Slot6/Port3/Line3, PXI1Slot6/Port3/Line4", "", ChannelLineGrouping.OneChannelForEachLine);
          readWaveformTask.Timing.ConfigureSampleClock(
            "",
            samplesPerSecond,
            SampleClockActiveEdge.Rising,
            SampleQuantityMode.FiniteSamples,
            samplesToCollect);
          readWaveformTask.Stream.Timeout = 1000;
          readWaveformTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PXI1Slot6/PFI5", DigitalEdgeStartTriggerEdge.Rising);

          DigitalMultiChannelReader reader = new DigitalMultiChannelReader(readWaveformTask.Stream);
          //TODO: How do I make the reader not start the task here?
          reader.ReadWaveform(samplesToCollect);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The code above will start the task and start reading the waveform as soon as "reader.ReadWaveform(samplesToCollect)" is called.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I trigger a waveform aquisition using an external trigger?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 14:59:35 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3247668#M17528</guid>
      <dc:creator>CurtisHx</dc:creator>
      <dc:date>2016-02-03T14:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3248743#M17535</link>
      <description>&lt;P&gt;Hi CurtisHx,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At first glance it seems like you're setting up your external triggering correctly in software. I have a few followup questions, though:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Which DAQ card are you using? (not all cards support hardware triggering, so this may affect how your task executes)&lt;/LI&gt;
&lt;LI&gt;Are you making sure that the PFI trigger you're using isn't already high when the task starts?&lt;/LI&gt;
&lt;LI&gt;How does your task behave if you comment out the triggering code?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I would also recommend going through the SyncAIAOUsingDigTrigger Example in the DAQmx cs Example files, which can be found in your directory at&amp;nbsp;&lt;STRONG&gt;Documents\National Instruments\Measurement Studio\DotNET\Examples\DAQmxWithUI\SynchronizeAIAOUsingDigTrigger\cs&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 20:41:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3248743#M17535</guid>
      <dc:creator>danniwithNI</dc:creator>
      <dc:date>2016-02-04T20:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3248753#M17536</link>
      <description>&lt;P&gt;The DAQ card is the PXIe-6535.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can clearly see the PFI trigger line go high on my scope, and I have driven (and confirmed) that PFI line before. &amp;nbsp;The PFI trigger line is definitely going high.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code behaves the same way because reader.ReadWaveform(samplesToCollect) is a synchronous call. &amp;nbsp;I had forgotten there is a BeginReadWaveform method that might do what I want. &amp;nbsp;However, I'm currently having problems with a NI dll BSODing my computer that I need figure out first.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 20:58:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3248753#M17536</guid>
      <dc:creator>CurtisHx</dc:creator>
      <dc:date>2016-02-04T20:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3249361#M17539</link>
      <description>&lt;P&gt;Hi CurtisHx,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;I would recommend following&amp;nbsp;this example&amp;nbsp;with your hardware to rule out software as an error source.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 18:40:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3249361#M17539</guid>
      <dc:creator>danniwithNI</dc:creator>
      <dc:date>2025-06-09T18:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3249971#M17544</link>
      <description>&lt;P data-unlink="true"&gt;Alright. &amp;nbsp;I have absolutely no idea why this code is not working. &amp;nbsp;I want to trigger the start of a waveform aquisition when PFI5 goes high. &amp;nbsp;According to the "Device Routes" tab for the PXIe-6535 in NI MAX, PFI5 is directly connected to PXI_Trig0, so I should not have to manually configure that route. &amp;nbsp;The actual waveform aquisition sample clock should be the PXIe-6535 internal timing engine. &amp;nbsp;I just want to start aquisition on an external trigger. &amp;nbsp;I think I followed the instructions here&amp;nbsp;correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this code throws a "failed to get all of the samples" excpetion when I end reading the waveform. &amp;nbsp;How is it that the callback is being called&amp;nbsp;&lt;EM&gt;before&lt;/EM&gt; all of the samples are being aquired?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;      ManualResetEventSlim resetMe = new ManualResetEventSlim();
      using (NationalInstruments.DAQmx.Task task = new NationalInstruments.DAQmx.Task("Trigger Me"))
      {
        task.DIChannels.CreateChannel("PXI1Slot6/Port3/Line3", "Vibrator Line", ChannelLineGrouping.OneChannelForAllLines);
        task.Timing.ConfigureSampleClock("", 2000000, SampleClockActiveEdge.Rising,
            SampleQuantityMode.FiniteSamples, 2000000);
        task.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PXI_Trig0", DigitalEdgeStartTriggerEdge.Rising);

        DigitalSingleChannelReader reader = new DigitalSingleChannelReader(task.Stream);
        DigitalWaveform outputWaveform;

        task.Control(TaskAction.Verify);
        task.Start();

        reader.BeginReadWaveform(2000000, (result) =&amp;gt;
        {&lt;BR /&gt;          //This line throws the DAQmx exception below.
          outputWaveform = reader.EndReadWaveform(result);
          resetMe.Set();
        }, null);

        resetMe.Wait();
      }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Exception:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NationalInstruments.DAQmx.DaqException was unhandled by user code
  Error=-200284
  HResult=-2146233087
  Message=Some or all of the samples requested have not yet been acquired.

To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger,  make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.

Property: NationalInstruments.DAQmx.DaqStream.ReadRelativeTo
Requested Value: NationalInstruments.DAQmx.ReadRelativeTo.FirstSample

Property: NationalInstruments.DAQmx.DaqStream.ReadOffset
Requested Value: 0

Task Name: Trigger Me

Status Code: -200284
  InnerException: &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the end of the day, I want to measure the frequency and duty cycle of a PWM signal. &amp;nbsp;Is there a better way of doing this?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 18:40:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3249971#M17544</guid>
      <dc:creator>CurtisHx</dc:creator>
      <dc:date>2025-06-09T18:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3250754#M17550</link>
      <description>&lt;P&gt;CurtisHx,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;Actually, even if the Device Routes shows a direct connection between your PFI line and the trigger line in MAX, that only means that there is a &lt;EM&gt;possible&lt;/EM&gt;&amp;nbsp;connection between those lines. You will still need to manually connect those terminals, which can be done easily with the DAQmx Connect Terminals method. If you need a more in-depth explanation of the method, you can find it &lt;A href="https://www.ni.com/docs/en-US/bundle/ni-daqmx-labview-api-ref/page/lvdaqmx/mxconnectterminals.html" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 18:41:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3250754#M17550</guid>
      <dc:creator>danniwithNI</dc:creator>
      <dc:date>2025-06-09T18:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a ReadWaveform on an external trigger?</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3250769#M17551</link>
      <description>&lt;P&gt;Gotchya. &amp;nbsp;I thought I was missing a step in there somewhere. &amp;nbsp;MAX was just indicating what could connect to what. &amp;nbsp;The actual connection still has to specified in software. &amp;nbsp;That makes more sense.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 17:50:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Starting-a-ReadWaveform-on-an-external-trigger/m-p/3250769#M17551</guid>
      <dc:creator>CurtisHx</dc:creator>
      <dc:date>2016-02-09T17:50:27Z</dc:date>
    </item>
  </channel>
</rss>

