01-03-2011 10:01 AM
My problem is simple, I'm looking for a way to route the clock signal of my E-Series device (6254) to a digital out line. Is this possible to do in the C API? If so are there docs anywhere that show me how to do it?
Solved! Go to Solution.
01-04-2011 11:37 AM - edited 01-04-2011 11:37 AM
Hi neurostu,
Yes there is a way. The function is called DAQmxConnectTerms. You can find the function definition by going to Start»Programs»National Instruments»NI-DAQ»Text-Based Code Support»NI-DAQmx C Reference Help. On the left select NI-DAQmx C Functions»Advanced Functions»Signal Routing»DAQmxConnectTerms.
01-04-2011 01:57 PM - edited 01-04-2011 01:57 PM
Thanks, that is exactly what I needed. However it isn't clear what terminal corresponds to the internal clock signal, or how I would figure that out.
01-04-2011 02:04 PM
Hi neurostu,
I actually recommend to use the DAQmxExportSignal function so your routes are tied to the specific task.
Routes made with DAQmxConnectTerms will remain until DAQmxDisconnectTerms is explicitly called to clear the route (or the device is reset). The routes are not tied to the task being executed, and there is not a good way to determine which routes are currently in-use. However, if you do want to use this, the terminal you want to use is named "/Dev1/ai/SampleClock", assuming you are trying to export the sample clock from an ai task.
You can check which routes are available on your device through MAX (explanation)
Best Regards,
01-04-2011 05:08 PM
John P,
Thanks for the recommendation.
When I try to use the function you suggested I get the following error:
DAQmx 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.
Source Device: Dev1
Source Terminal: 10MHzClock
Destination Device: Dev1
Destination Terminal: PFI9
Task Name: _unnamedTask<0>
Status Code: -89120
End of program, press Enter key to quit
I've tried routing the signal to several different PFI channels and they all fail with the same error. I've also tried a slew of other terminal names which have all given me the same error, does this mean that I cannot route the 10MHzClock signal to a digital out?
01-05-2011 11:00 AM
I was able to export the 10Mhz Reference Clock using this command
DAQmxErrChk (DAQmxExportSignal(taskHandle,DAQmx_Val_10MHzRefClock,"/Dev4/PFI9"));
This assumes your task is called taskHandle and the device is called Dev4
Make sure that you are using the correct signal ID. You can find these in the NI-DAQmx C Reference Help in the DAQmxExportSignal function definition.
01-05-2011 12:37 PM
Thanks again for your reply. I looked at the function documentation and tried every listed signal, none of them worked.
I've reduced my code down to a simple function that produces this error:
http://c.pastebin.com/7DyWWvJc
I'm running this under linux and my card is a NI-6254
I've tried replacing using a task that is acquiring analog signals instead of one that is counting edges, i've also tried changing the output terminal of the signal and in the input terminal of the counter, both of which do not appear to have an effect.
01-06-2011 02:01 PM
I was able to run your code without error on my Windows 7 machine. I can try it on a Linux machine, but I'd like to know which distribution of Linux are you running?
Thanks,
01-06-2011 02:05 PM
I'm running Cent OS 5.4. I know its not on the list of supported distributions, but its is a near clone of RHEL 5.4 (which I believe is supported).
01-06-2011 02:12 PM
Can you confirm which device you're on:
I'm looking for a way to route the clock signal of my E-Series device (6254)
The 6254 is an M Series device, on which you should be able to export the 10 MHz Reference Clock signal. E Series devices (e.g. 6024e) don't have a 10 MHz reference clock.
Best Regards,