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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Error (-50103) when driving two counters (ctr0/ctr1) on PXI-6602

I count ticks of two two counters (ctr0/ctr1) on PXI-6602 to produce a pulse train like shown below. The trigger comes from PXI-6602 DIO every 500 mSec.

tzantzai_0-1663852908984.png

Everything is working fine, but when I change the "Samples per channel = 2", I get an error:

tzantzai_1-1663853434053.png

The idea is to double the pulses like shown below:

tzantzai_2-1663853613868.png

If I exclude (comment out) the 2nd counter (ctr1), I get the desired double pulse train, but I need the 2nd counter as well:

tzantzai_3-1663854068756.png

 

Attached is my LabVIEW 2012 VI.

Any idea what is wrong.

 

 

0 Kudos
Message 1 of 8
(1,019 Views)

Solution first, explanation second.

 

Solution: instead of using ctr0 and ctr1, use ctr0 and ctr2.  More generally, use any other combo except using both of what it considers its pairs of adjacent counters, i.e. (0 & 1), (2 & 3), (4 & 5), or (6&7) when you need 2 or more multi-pulse finite pulse trains.

 

Explanation: the 660x counter/timer boards require the use of *both* counters in a pair to produce a finite pulse train.  You designate the main one explicitly and then under the hood DAQmx uses the other one to act as a gate (a.k.a. a Pause Trigger) to control the exact amount of time the main one is enabled such that you get the correct finite # pulses.  So only 1 counter of a pair can generate a finite pulse train at a time.  Pick any 2 counters that aren't paired and it'll work.

 

Note: asking for a 1-pulse finite pulse train seems to be a special exception.   Once upon a long time ago, DAQmx threw errors for this usage, declaring that 2 pulses were the minimum # allowed in a finite pulse train.  I suspect that restriction is still true technically, but DAQmx has enough smarts to configure *single* pulses for you instead of finite pulse trains with a count of 1.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 8
(996 Views)

Thanks Kevin.

Ultimately, I will need to use all 8 counters of PXI-6602 to form 4 pairs of signals (4 channels).

So, the correct combination is:

ctr0/ctr2

ctr1/ctr3

ctr4/ctr6

ctr5/ctr7

Is this correct?

 

0 Kudos
Message 3 of 8
(993 Views)

I'm not entirely sure I understand what you're saying.

 

You should be able to produce 4 simultaneous finite pulse trains by explicitly programming 4 of your counters.  Each of those counters will consume the one its paired with, so the 4 you explicitly program can't contain both counters from any of the pairings.

 

So you could program explicitly for ctr0, ctr2, ctr4, ctr6 because they're all part of different pairings.  Or you could use 0,3,5,6 or any other combo that only uses 1 counter from each pairing.  The remaining 4 counters would then be reserved to act as paired helpers and not be available for programming.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 8
(988 Views)

OK.

Is this a true statement:

If I use

ctr0/ctr2 and ctr4/ctr6

I can not use

ctr1/ctr3 and ctr5/ctr7

with them for double pulse generation?

 

0 Kudos
Message 5 of 8
(981 Views)

I'm not sure why you *seem* to be referring to the following as though they are pairs:

ctr0/ctr2

ctr4/ctr6

 

And I don't know your exact definition of "double pulse generation".

 

I'll restate what I know to be true of the 6602.  The max # of simultaneous *finite* pulse trains possible is 4, using 1 from each of the following pairs: (0,1), (2,3), (4,5), (6,7).  Each one you explicitly program will in turn reserve its own paired counter, making it unavailable.

 

(Note: single pulses or continuous pulses do *not* consume the paired counter, so you can have up to 8 of them simultaneously.)

 

Do you have any newer DAQ hardware available?  Many newer devices (starting circa 2010 with X-series) no longer need to use 2 counters working together to make a finite pulse train, they can do it with just 1 counter. 

 

And taking a step back, what is the app all about?  What's the external triggering signal?  What's the purpose of multiple distinct and possibly delayed pulse trains?   Just trying to figure out if a different approach might be workable...

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 8
(968 Views)

I'll try to be more specific.

This is acoustic sensor test in which I have to drive 4 channel transmitter with double pulse train. Each channel has 2 drive lines (+) and (-). I need 8 counters( 2 per tx channel = 8). The pulse train must be in specific time order. See the snippet. 

tzantzai_0-1663871649187.png

In my original post, I attached a simplified version of my LabVIEW code with only 4 counters, here is attached the actual test VI that uses all 8 counters.

The trigger is a pulse that comes from PXI-6602 Digital output every 500 mSec.

This VI works with 1 Sample cycle. I am trying to use this old PXI-6602. I understand there are new time-based PXI products, but that will expense the project. 

0 Kudos
Message 7 of 8
(955 Views)

Thanks.  And then sorry to say but no, you won't be able to do that with the 6602, not with 2 pulses for each of 8 counters.

 

A newer dedicated counter timer card like the PXIe-6612 *could* do it, but you'd need a chassis that supports PXIe.  Another likely advantage of the newer device is a configurable behavior about how it treats delay after the first trigger vs. subsequent ones when set up to be retriggerable.  As far as I know the 6602 would be stuck with the less-desirable behavior illustrated in this article. 

    But beware, the article looks to have been edited in recent years and made to be no longer fully true and relevant, at least according to my memory of it.  In particular, the article is all about "initial delay" but the example never even tries to define it for the counter tasks it shows.  Still, it's mostly pretty good and the best I could find to explain the problem.

    A better example for a solution can be found here.  I don't think it'll work for your 6602, but I suppose it wouldn't hurt to try and find out for sure.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 8
(939 Views)