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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQmx functions with PCI-6534 and PCI-6602 VC++ measuring time

Hi.  I am using a PCI-6534 and a PCI-6602 for counting purposes, with the NIDAQmx library in VC++. 
Currently, I am able to count edges with the 6602 over any arbitrary amount of time.  However, I would like to use the internal clock (20MHz Timebase, perhaps) of the devices for the measurement of time, but have had no luck in setting up either device for this purpose.
 
Currently, I have the following for the 6534 device:
 
float64  SampleRate=20000000;
DAQmxErrChk (DAQmxCreateTask("Task 1",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0:3","20MHzTimebase",
             DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"20MHzTimebase",SampleRate,DAQmx_Val_Rising,
             DAQmx_Val_FiniteSamps,100));
 
I get the following error when I try to start the task  [ DAQmxStartTask(taskHandle) ]:
Specified route cannot be satisfied, because the hardware does not support it.
 
If I try to use the counter instead (6602), I never know what to use for the 2nd argument of DAQmxCreateDOChan (nothing works).
Is this the function I need to use in the first place?
 
My general purpose is to use the internal clocks of 6602 or 6534 to measure time, so any help or examples on this topic would be great (i.e. general functions that must be used to initiate the process, sample, etc.).
 
I'm very new to all of this, and I very much appreciate your help.
 
Thanks!
0 Kudos
Message 1 of 4
(3,693 Views)

Dear ASBk,

The reason you are getting the routing error with the 6534 is that you can't route the timebase to the digital output sample clock. If you look in the Measurement and Automation Explorer under the Device Routes tab (click on the device you want to see the routes). This mapping shows that the 20MHz Timebase does not route to the DO Sample clock.

If you want to count edges using the 6602 you would use CO channels instead of DO. There are some examples of how to set up CO lines in C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter. Usually you can do a finite buffered event counter, but I had some issues with the 6602 routing. If you have an M Series board, it is a lot easier. I hope this helps explain the errors that you are getting. Have a great day!

Sincerely,

Marni S.

0 Kudos
Message 2 of 4
(3,675 Views)
I guess I don't completely understand how to read the "Device Routes" panel.  All referring to the PCI-6534:  The "/Dev1/20MHzTimebase" under "Sources" says it's routed to the "/Dev1/RTSI7", "/Dev1/MasterTimebase", "/Dev1/Dig0/SampleClockTimebase", and the "Dev1/Dig1/SampleClockTimebase" under "Destinations", so I assumed it would be available through the sample clock, since it's evidently the sample clock's timebase.  I see it's not routed directly to the "/Dev1/Dig1/SampleClock" however, which I assume is what you're talking about. 
 
How do I read the 20MHz signal based on the routes provided?  At some point, I need to use the counter (PCI-6602) to count for one second at a time, but with a resolution of 20MHz.  I'd like, for now, to use the PCI-6534 20MHz signal for the time and the PCI-6602 for the counting.  How do I tell it to count for one second, give me the count for that second, and then move on to the next second, using the 20MHz signal.
 
Sorry for the verbosity.
 
Thanks again!
 
ASBk
0 Kudos
Message 3 of 4
(3,654 Views)

Dear ASBk,

You are absolutely right, I must have been looking at the device routes incorrectly. If you want to to use the PCI-6534 20MHz signal for the time and the PCI-6602 for the counting, try the following:

1. Export your 20 MHz Timebase from your PCI-6534 to a PFI line or RTSI line using DAQmxSetExported20MHzTimebaseOutputTerm(TaskHandle taskHandle, const char *data);

2. Use the example Cnt-Buf-Cont-ExtClk (C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Count Digital Events\Cnt-Buf-Cont-ExtClk) to read in your counts every second, based off of the external clock that you exported to a PFI line in step 1.

NOTE: There is a 20MHz Timebase on your PCI-6602 as well. Have a great day!

Sincerely,

Marni S.

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