05-27-2015 02:07 PM - edited 05-27-2015 02:09 PM
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.
05-28-2015 11:27 AM
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
06-01-2015 08:42 AM
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.