Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

RPM using a quadrature encoder

Solved!
Go to solution

Was there any additional error text to identify *which* resource was reserved?

 

What you describe is not a typical limitation of NI's encoder-capable counters.  I haven't used the 9361 myself nor do I have detailed knowledge of it.  But I seem to recall from past threads around here that it has some unique capabilities as well as some unique constraints.

 

<time passes>

 

A little searching around the site identified one problem -- the 9361 seems to be limited to supporting only 1 task at a time.  But it also seems to allow you to put multiple counter channels (possibly doing different measurements?) into a single task.

 

Here's one KB article.   And here's another.   And then there's this example which puts 2 counter channels & measurement types into 1 task.

 

Again, as I said, I haven't used the 9361 personally.  I recall being intrigued when hearing about some of its unique features.  But then as I encountered more info about its limitations, I made myself a mental note that it sounded like it would often be more trouble than its worth.  A simple digital module to provide I/O access to a cDAQ chassis' internal counters would often be both sufficient and more straightforward.

 

Hopefully those links help give you a path forward with the 9361.  Its unique feature for bi-directional angular velocity measurement may make it worth some hassles for your particular case.

 

 

-Kevin P

 

 

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 11 of 14
(145 Views)

@Kevin_Price, Thank you for your feedback. I went over the examples of using the NI 9361 for simultaneous measurements using a single task. In the attached VI, I use 'CI Angular Velocity' and 'CI Angular Encoder' to measure the motor's rpm and angular location. However, I get an error message (screenshot attached).

 

I then tried to use the DAQ Assistant to individually get the speed and angle and that seemed to work fine. What am I doing wrong in the code?

 

Thanks,

lza

0 Kudos
Message 12 of 14
(119 Views)
Solution
Accepted by laz_2331

First I used MAX to create a simulated 9361, tried your code and got the same error.

 

Back in MAX, the first thing I noticed was that the "Device Routes" tab showed up completely blank, implying no possibility of any routing.  That made me suspect that you'd be stuck using the default PFI pins for A,B,Z.   I put a diagram disable structure around both of the places where you assigned PFI pins, and then the code ran without error.

 

I then went back and re-enabled the assignments one at a time.  Assigning only for the RPM counter still ran without error but when assigning for the Angle counter, the error returned.

 

Then the Aha! happened.  You need to expand the DAQmx Channel property node upwards and make the uppermost field be "Active Channels (if subset)".  Then you need to wire the corresponding physical channel name to that property so that when assigning PFI pins, they are assigned for the correct counter channel.

   It probably worked ok for assigning only the RPM counter because at that point in the code, there was only 1 channel in the task.

 

The ability to put multiple counter input channels into a single task is unique to the 9361, a device I haven't used, so I'm not

accustomed to needing to designate "Active Channels" in property nodes for counter tasks.

 

 

-Kevin P

 

 

[Edit:  P.S. Just after posting, I tried changing some pin assignments after noticing that all your assignments were to the default pins. Every non-default assignment I tried produced a -200077 error, suggesting that maybe even that minimal amount of routing isn't allowed on the 9361, corresponding to the completely empty Device Routes tab in MAX.

   Looks like maybe the simplest thing is to physically wire to the default PFI pins and skip the explicit PFI pin assignment altogether.  It appears that DAQmx will expect to use the default, and that'll be a correct assumption so things should probably work.  <fingers crossed>]

 

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 13 of 14
(109 Views)

"Looks like maybe the simplest thing is to physically wire to the default PFI pins and skip the explicit PFI pin assignment altogether." That did the trick for me. Since I was already using the default pins on NI 9361, I removed the part where I was assigning the PFI pins, and now I can read both the motor RPM and the shaft position.

 

Thank you  and 

 

0 Kudos
Message 14 of 14
(100 Views)