LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear encoder

Solved!
Go to solution

Hi Ivy-

 

What do you mean when you say that it does not work?  Does that mean that you do not get any data (or at least not the expected data)?  Or do you get some error from DAQmx?

 

I suspect that your programming on one task may be consuming digital/PFI lines that the other task needs.  It should be possible to work around this, but it might be helpful to post a screenshot of your code and a bit more info about what behavior you are observing.

Tom W
National Instruments
0 Kudos
Message 21 of 33
(2,229 Views)

Hi Tom,

 

By "does Not work", I mean I get wrong data. Data from counter1 are all 1. I am expecting to get a increasing number.

 

Please check the attached screen shot. Thank you and have a nice day!

 

2.1.png

0 Kudos
Message 22 of 33
(2,221 Views)

Hi Ivy-

 

Two questions:  What values do you have specified for Z-index enable and the other settings?  And what is your sample clock source?  I can't see it because it is scrolled off of the screen in the screenshot.  If you post your VI I will try to take a look.

Tom W
National Instruments
0 Kudos
Message 23 of 33
(2,219 Views)

Hi,

For the set up of Linear encoder, please see the attached photo.

 

Sampling source is from analog card.2.2.png

0 Kudos
Message 24 of 33
(2,214 Views)

Hi Ivy-

 

I'll ask the obvious question: since you are always reading "1" and your z-index value is "1" and z-index resets are enabled, is it possible that your z-index Phase is being met and that the counter is always being reset?  Do you actually want z-indexing enabled?  What happens if you disable it; do you see better or at least changing results?

Tom W
National Instruments
0 Kudos
Message 25 of 33
(2,212 Views)

But When I swap counter, I have the same results. Counter 0 works fine but counter 1 recorded all 1.

 

2.3.png

0 Kudos
Message 26 of 33
(2,209 Views)

Hi Ivy-

 

How do you have your signals wired into the module?  If you are only swapping the counter names in software without changing the hardware configuration then I think you may be making some assumptions about the signal routing internal to the module and chassis that might not be exactly correct.

 

Do you have a schematic of how you have everything wired up to the module(s) and what type of behavior you are hoping to achieve?

Tom W
National Instruments
0 Kudos
Message 27 of 33
(2,204 Views)

Hi Tom,

 

I didn't do anything to the hardware. I am using NI 9411 chasis 9174. There is no counter in NI 9411. So my program use the counter of Chasis 9174.(I do NOT know how do the counters of 9174 wire to my digital input of NI 9411)

 

For the wiring of NI 9411: bit0--A pulse, bit1--B pulse. bit3--R pulse.

 

A,B,R pulses are for the the encoder.

0 Kudos
Message 28 of 33
(2,202 Views)
Solution
Accepted by topic author Ivymerciqq

Hi Ivy-

 

You're right- the 9411 does not have counters, but there are default terminals for routing through the 9411 and into the 9174 chassis counters.  How do you have the signal that is to be counted on the simple event counting channel wired?  Or is it to be one of the signals from the encoder?  In order to properly import the signals you may need to use a DAQmx Channel Property Node to select the Input Terminal for the edge counting channel if it is a signal that is wired from one source into multiple terminals.  You can do the same setting for each of the A, B, and Z/R lines as well.  DIO0 corresponds to PFI0, and so on.

Tom W
National Instruments
0 Kudos
Message 29 of 33
(2,200 Views)

Yes, simple encoder count A pulse(so it only looks at the position. Do care about the direction).

 

I am still confused about why can't I use ctr0 and ctr1 together?

0 Kudos
Message 30 of 33
(2,195 Views)