LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx: Gating Pulses with Pause Trigger

Solved!
Go to solution

I have an NI 9401 module in a 9171 chassis and would like to gate the output of one counter with the output of another counter. Counter 1 (the signal to be gated) generates a 3 Mhz signal and Counter 0 (the gate) generates a 10 Hz signal that is externally routed to Counter 1's Gate pin. I expected this would gate Counter 1's signal to produce the 3 Mhz pulse only when Counter 0 is high, but the wiring had no affect on the output of Counter 1, it still generated a continuous 3 Mhz pulse train.  I found that some code is needed to get a counter to pay attention to the signal at its Gate pin (this post was particularly helpful) and that this can be done with the Pause Trigger property node. After setting up the node, however, I ran into this error:

 

Error -20124 occured at DAQmx Start Task.vi:2
Lines 4 to 7 of this port are configured for input. Cannot configure these lines for output at this time.

 

I'm pretty perplexed by this.  The problem seems to be coming from trying to designate PFI 5 ("CTR 1 Gate" on the 9401) as the Pause Trigger source.  If anything, I would think the error would be that lines 4 to 7 are configured for output, since those lines are grouped under CTR 1 which is configured as a CO channel to generate the 3 Mhz pulse train, and that setting line 5 as the Pause Trigger source is changing the configuration to an input.  Searching for this error in the NI forums and Google doesn't pull up any troubleshooting information.  I've tried to create a task to configure line 5 as a seperate digital input channel, but then I get the opposite error (Error -200125) saying that lines 4 to 7 are configured for output and cannot be configured to input, to make things more confusing.

 

Any thoughts would be appreciated.  I'm concerned that I'm missing something obvious about gating pulses or configuring CO channels since I keep reading that one of the advantages of DAQmx over DAQ Legacy is that it makes signal routing easier.  I'm using LabVIEW 2012 (32-bit) with DAQmx 9.5.5 installed.

0 Kudos
Message 1 of 4
(3,511 Views)
Solution
Accepted by agoncalves

Hi agoncalves,

 

I took a quick look at your VI and I see two immediate problems:

 

1.  There is not guarantee that both tasks will reserve before either one starts.  This explains your error and why it seems confusing.  The 9401 is nibble configurable but you can't change the direction while the device is in use (why the reserves are important).  The module powers up with both nibbles set to input.  Your first task drives an output so it switches direction on one of them.  When your task is committed (started) it locks in that configuration.  The second task then tries to also drive an output but on the other nibble which is input and cannot be switched because the first task is running.  The solution is to use the error wire to force the execution order (or use a flat sequence structure).

 

2.  You'll run into problems with your gating signal unless you wire it into a separate input (and put both pulse trains on the same nibble).  You can change that by setting the channel property CO.Pulse.Term.  That's if you want to route your signal through some external circuitry and back in.  If you are using the signal directly, you could just use it internally.  Such as /cDAQ1Mod1/ctr0InternalOutput

Message 2 of 4
(3,466 Views)

Thank you, I didn't know that ctr0InternalOutput existed!  The "I/O Name Filtering" was taking out the advanced terminal names from the list I was using to select the source from.  Just setting the pause trigger source to ctr0InternalOutput made the errors go away and gate the pulse train, but I also added a case structure around the two "DAQmx Start Task.vi"s to hold the execution until both nibbles are configured.

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

@agoncalves wrote:

Thank you, I didn't know that ctr0InternalOutput existed!  The "I/O Name Filtering" was taking out the advanced terminal names from the list I was using to select the source from.  


Shameless plug for my proposal to Show "Advanced" DAQmx Terminals by Default.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(3,427 Views)