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 VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

setting 2 counters - one with FiniteSamps and another with ContSamps

Solved!
Go to solution

I am trying to use 2 counters on the USB-6229 (or USB-6259), where one counter has FiniteSamps and another has ContSamps. I have the following code:

 

ErrChk DAQmxCreateCOPulseChanTicks(hCnt0, "Dev1/ctr0", "", "20MHzTimebase", DAQmx_Val_Low, 0, 400, 400); 
ErrChk DAQmxCfgImplicitTiming(hCnt0, DAQmx_Val_FiniteSamps, 100);

ErrChk DAQmxCreateCOPulseChanTicks(hCnt1, "Dev1/ctr1", "", "20MHzTimebase", DAQmx_Val_Low, 0, 400, 400);

ErrChk DAQmxCfgImplicitTiming(hCnt1, DAQmx_Val_ContSamps, 2);

 

When I run it, I get a run-error 50103 "The specified resource is reserved". If I change the FiniteSamps to ContSamps on the first counter, everything works fine.

If I use only one counter with FiniteSamps, everything also works fine. 

Is this a bug in DAQmx or the dual counter use on M-series devices is limited to ContSamps?

 

Vic

0 Kudos
Message 1 of 2
(5,900 Views)
Solution
Accepted by topic author vicpik

Hi Vicpik,

 

What you are seeing is not a bug, the issue here is that finite pulse train generation actually requires two counters for a single task. The details are outlined quite well in the following KB:

 

How Many Counters Does Each Type of Counter Input or Output Task Take?

 

If you need to do both task you may need an additional DAQ card, or you could try our new X series cards, that have 4 available counters.

 

Let us know if you need any further assistance.

 

Thanks

Scott M.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(5,884 Views)