09-15-2005 01:14 PM
09-16-2005 06:24 PM
Jeff,
It sounds like the position measurement is on the right track -- you want it to take backward rotation into account. Basically, you could perform some math on the counter output to derive the inputs for the other counter to generate an output pulse (either high-time/low-time, frequency/duty-cycle, or high-ticks/low-ticks). Play around with that and let me know.
Erik F
Applications Engineer
National Instruments
09-18-2005 11:19 PM
09-19-2005 08:59 AM
09-21-2005 12:25 PM
09-22-2005 09:55 AM
Hi Lorne,
Thanks for the response, however I don't have Labview so I can't use your VI. Maybe we can work things out by just going through the logic.
My setup is as described in the previous post - angular position measurement (ticks), A and B inputs coming from the encoder, counter output (exported - pulse mode, active high polarity) directly connected to the Z-input (GATE) so as to cause the reset when terminal count (TC) is reached.
So far I've been able to almost get things to work properly. I'm puzzled however as to why I can only get the counter to reset to the Z-index value during 1 of the possible 4 Z-index phases. Assuming that the TC pulse is asserted (high) so long as the counter is on its last count (count = 2^32-1 = 4294967295), it seems like any of the 4 possible Z-index phases should work. However, the reset only works if I select the phase which is present as soon as the count is changing to TC, i.e. A High B Low when A leads B and A Low B Low when B leads A. I would prefer to use one of the other phases which occur later on in the cycle to avoid having an extremely narrow TC pulse (since the TC pulse is cut short by the reset). Any ideas?
Jeff
09-22-2005 03:09 PM
Oh yea, I forgot to metion that I'm using X1 type decoding.....
Cheers,
Jeff
09-23-2005 10:17 AM
...assuming that the TC pulse is asserted (high) so long as the counter is on its last count (count = 2^32-1 = 4294967295)
it seems like any of the 4 possible Z-index phases should work. However, the reset only works if I select the phase which is present as soon as the count is changing to TC, i.e. A High B Low when A leads B and A Low B Low when B leads A.
09-23-2005 11:49 AM
Hi Kevin,
Thanks for your help.
I don't think this is actually how the TC pulse duration is determined. I'm quite sure that in many other counter operating modes where the counter is configured to "pulse on TC", the duration of the pulse is exactly 1 cycle of the counter's source signal. I think I recall that for encoder measurement, the pulse duration is determined by the (default) 20 MHz internal timebase -- i.e., a 50 nsec pulse.
This comment might explain my observations concering the Z-index phase. What must be happening is the TC pulse is no longer high for the later phases (the 3 coming after that which is present as soon as the count is changing to TC) - therefore no reset. Hmm, isn't the usual behavior for hardware counters that the TC pulse is asserted for the duration of the terminal count? I realize the TIO is not your average counter chip, but what reason is there for changing this behavior?
Recalling a previous thread I was in, it is probably fortunate that you're in X1 mode. The count value only changes once per 4 states, so you could probably assign one of the intermediate states (A-HIGH, B-HIGH) as the z-index reload phase.
That is exactly what I wanted to do but it just didn't work, at least now we (probably) know why.
Maybe there's a solution if you bring another counter into play, especially if the TC pulse is of a fixed short duration such as 50 nsec.
Agreed. The simplest attempt would probably be to use the TC pulse as external timebase for a pulse generation (ticks) task on another counter. There might be an issue of whether the pulse is wide enough to serve as an external timebase though.
Hmmmm, let's see. Ideally, you'd like the TC pulse to stay high just long enough to activate the z-index reload and then revert low so it won't cause multiple reloads.
I thought about this before. Under my previous assumption that the TC pulse was asserted for the duration of terminal count, I figured the reset would change the count thereby deactivating TC, then, as long as TC could be deactivated before the next timebase pulse then no reloads would occur. Now the picure is not quite so clear....
You'd need one that would accept the TC pulse as a trigger that would cause the circuit to instantly generate a HIGH output that you'd wire back as the z-index signal. The circuit would also have to be reset to LOW output on a High-to-Low transition of phase B. For either direction, you'll encounter the High-High state after reaching TC but before the next High-Low transition of B. I'm not a circuitry expert, but this functionality feels like a fairly simple flip-flop, such as a Set-Reset variety.
Agreed. I was hoping to get by without any external circuitry but it seems like this might be the way to go.
Thanks again for your help,
Jeff