From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a Counter as a start trigger to one or more tasks

I am using the NI USB-6251. I want to configure a counter (e.g. Dev1/ctr0) at a user-specified frequency and the rising edge on this counter should act as a start trigger for an analog input task and a digital output task. 

 

I've tried to do this by creating a task for the counter:

 

                integStartTriggerTask.COChannels.CreatePulseChannelFrequency(
                    "Dev1/ctr0", 
                    "Integration Start Trigger", 
                    COPulseFrequencyUnits.Hertz, 
                    COPulseIdleState.Low,
                    0,
                    integFreqHz,
                    0.5);

and then connecting this to the StartTrigger for the analog input task:

 

analogReadTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("Dev1/ctr0", DigitalEdgeStartTriggerEdge.Rising);

However running this gives the error: 

 

Source terminal to be routed could not be found on the device.

Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names.

Property: NationalInstruments.DAQmx.DigitalEdgeStartTrigger.Source
Property: NationalInstruments.DAQmx.DigitalEdgeStartTrigger.Edge
Source Device: Dev1
Source Terminal: Dev1/ctr0

Task Name: analogReadTask

I have also tried "Dev1/ctr0/StartTrigger" instead of "Dev1/ctr0". What am I doing incorrectly? Thanks.

0 Kudos
Message 1 of 3
(4,226 Views)

Hi zkhan.cimtec,

 

To use a digital trigger for your start task you need to use a PFI line to read a signal that is coming in. You are setting up a task that outputs a start trigger on your counter line, but you can't read off that same line to start the task since that line is already configured for output. An example of how to setup a start trigger coming into a PFI line can be found in the examples here:

 

<National Instruments Public>\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Ext Clk-Dig Start

 

Hope this helps,

 

Kevin

0 Kudos
Message 2 of 3
(4,204 Views)

Thank you, that does help.

 

I also needed to change the address from "Dev1/PFI10" to "/Dev1/PFI10". I found this strange because all my other addresses work properly without the leading slash, but this one would not work otherwise.

0 Kudos
Message 3 of 3
(4,126 Views)