Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do set the Clock Signal as a Digital Out in the C-API?

Solved!
Go to solution

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?

0 Kudos
Message 1 of 18
(4,659 Views)
Solution
Accepted by topic author neurostu

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.

Steven K.
National Instruments
Software Engineer
Message 2 of 18
(4,637 Views)

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. 

 

0 Kudos
Message 3 of 18
(4,627 Views)

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,

John Passiak
0 Kudos
Message 4 of 18
(4,623 Views)

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?

0 Kudos
Message 5 of 18
(4,615 Views)

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.

Steven K.
National Instruments
Software Engineer
0 Kudos
Message 6 of 18
(4,583 Views)

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.

 

 

 

0 Kudos
Message 7 of 18
(4,574 Views)

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,

Steven K.
National Instruments
Software Engineer
0 Kudos
Message 8 of 18
(4,545 Views)

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).  

0 Kudos
Message 9 of 18
(4,540 Views)

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,

John Passiak
0 Kudos
Message 10 of 18
(4,536 Views)