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 Routing multiple counter signals for 2x encoders with 9361

Solved!
Go to solution

Hello

 

I'm looking to change the routing of the signals in my Labview program. 

 

I have two encoders and I can happily acquire correct data from both using a trimmed down version of the Read encoder (continuous clock) example. If I stick to the default signal routing both will work using ctr0 and ctr1 which I define in DAQmx create channel as "cDAQ1_9361_CI/ctr0:1" and wire the counters accordingly.

 

But I'd like to reroute the signals to use a third encoder for speed (of a different component), and there is no combination of the default routing that will allow for this. By this I mean CTR0 uses DI0, DI4, DI7, CTR1 uses DI1, DI5, DI6, so I need DI2 and DI3 for the velocity encoder.

 

However, if I want to change the signal routing using DAQmx channel property node I can only specify the routing of one signal, and if I select both counters (as above) the signal routing I define defines the routing I select to both these counters (i.e. I'm only using one encoder).

 

I've tried a variety of combinations, placing multiple DAQmx create channels in a row, each followed by the property node, but it doesn't give te desired output (always overwriting both counters with the last defined property node).

 

I attach a basic code of what I'm trying to do.

 

Thanks in advance.

James

0 Kudos
Message 1 of 4
(2,229 Views)
Solution
Accepted by topic author J_MC

I've done a lot with counters, but never with a device that allowed multiple counter input channels in the same task.

 

Here's what I came up with.  It's pretty similar to something I'm more famliar with -- multiple AI channels in the same task that each need individual configuration.  It ran without error for me on a *simulated* 9361 which usually means that the configuration syntax is at least legal.  It doesn't necessarily guarantee that everything works as expected.

 

Give it a try and let's see.

 

 

-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 4
(2,160 Views)

Hi Kevin

 

That works exactly as hoped, thanks so much for your reply. I'm fairly new to LabVIEW so it's nice to learn how to implement a bit more control using the property nodes.

 

Thanks again!

James 

0 Kudos
Message 3 of 4
(2,130 Views)

I came across this post in getting multiple counter channels working on the 9361 as well, ended up with a *slightly* different solution, as I usually find myself adding channels to a task in a shift register on a for loop to build up multiple channels (rather than the "single shot" shown here"). I'm also using a line driver encoder, so the terminal configuration and logic level needed to be altered from default.

 

The key to getting all of this working, for me, was to make sure to set the "Active Chans" property to the current virtual channel. If that property doesn't get set then all of the other properties get applied to all channels in the task and you'll see one counter being output on all of the channels.

0 Kudos
Message 4 of 4
(1,762 Views)