ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge counter with hardware reset

Hello all,

 

I have a PCI-6220 and I would like to configure a counter to count edges with a hardware reset or use my counter to measure linear position without the B input, after words, only with the A input to count edges and the Z input to make the initial position.

 

Somebody knows how?

 

Thanks in advance, best regards,

 

Paulo Carmo

0 Kudos
Message 1 of 6
(4,060 Views)

In order to reset the count on a z-index input with your M-series board, you'll need to configure this as an encoder position measurement.  Since you only have an A channel, you won't be able to configure as a quadrature encoder.  What you

*can* do is configure as a "Two Pulse Encoder"  which counts up for each edge at the channel A input and counts down

for each edge at the channel B input.  Just wire one of those inputs direct to DGND to eliminate any possibility of edges.

 

You'll further need to configure and enable the z-index reload feature for encoders.  Here's the tricky part - you are required

to define the A,B state in which a high state of Z will reload the z-index value.  The problem is that the z-index signal may

not have the timing characteristics you'd like.   I don't know if your app is particularly sensitive to this issue, but I'll lay it

out:

 

Let's suppose you set z-index reload phase to be A-Low, B-Low with one of them hardwired to DGND (guaranteed Low).

Here are 3 things that could happen:

1. A is low throughout the Z-index signal's high time.  Your reload works just as you want.  (It will probably also work as

you want for other situations where A is low during exactly one segment of the Z-index signal's high time.  A could be

high during 0,1,or 2 distinct segments of that time.  The key thing is that once A is low, it can't transition to high and back

to low in order to work as you probably want.)

2. A is high throughout the Z-index signal's high time.  No reload takes place due to the wrong A,B phase.

3. A has 2 or more distinct segments of low time during the Z-index signal's high time.  2 or more reloads will take place,

causing the intervening edge counts to be ignored.

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 6
(4,055 Views)

Some years back I had a flow sensor with pulse output but only a (fieldpoint) encoder input left to read out.  I created my B channel with a RC delay and divided my reading by 4 . Done 🙂

 

Critical point is the max pulse rate you expect. (I think I was fine with a 470R from A to B and 100nF from B to GND, all connected at  the screw termial ) 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 3 of 6
(4,044 Views)

Thought I would contribute a 3rd approach:

 

Counter_Reset_Count_Edges.png

 

Pro:

 

-Does not depend on phase of z index

-No external components required

 

 

Con:

 

-May only sample the count register based off of software-timing (although the reset is done in hardware)

-EDIT: Will not work on M Series or TIO (Counter/Timer) boards.  Verified on X and E series.  Would possibly work with 621x bus-powered M Series but I am not certain without trying it.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 6
(4,032 Views)

I like John P's period measurement method better than my earlier suggestion -- insensitivity to A(,B) state is a *big* plus.  I reread your initial post and there's no mention of needing a hardware-timed buffer of count measurements, so I think you're in good shape.   Just one other thing I'd note -- count reset during period measurement *only* resets to 0, but odds are pretty high that's exactly what you want to reset to.

 

John -- I'm surprised by your comment that this won't work on M-series or TIO series but *will* work on E-series.  I don't have hw at hand to test it, but I don't see where the problem would be.  What am I missing?

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 6
(4,006 Views)

Hi Kevin,

 

I was surprised too to be honest...

 

I filed this as a bug (CAR 284722) for R&D to take a look.  I'm not sure if it's a hardware pecuiliarity or if it's fixable in software though.

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 6
(4,002 Views)