Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple encoders on multiple 6602 with RTSI

I want to use 2 6602 cards to read 7 encoders (a master encoder and 6 under test. The master encoder has a Z (reset) line. When the master hits a preset value, all the test encoders would be read and reset to zero.

Will this approach work? Do you recommend buffered or unbuffered acquisition?

Can I use the RTSI bus to synchronise the reset so that all test encoders will be reset and read at the same time?

Does anyone have a vi that does this?

There are several examples given for RTSI that use C like commands. For example:
status = Select_Signal (deviceNum, ND_RTSI0, ND_GPCTR3_OUTPUT,ND_DONT_CARE);
How do I use this kind of command in Labview?
Thanks in advance.
0 Kudos
Message 1 of 3
(3,638 Views)
Frank;

If you need to use the Z channel of the Master encoder, you will need to have a second counter preset with that specific value which will buffer the reading of the other counters, and configured to work as event counter toggling its output when the preset value is reached. The source of that counter would be channel A or B of the encoder. Lets call this as second counter and the counter doing encoder position measurement as first counter.
Then, you would route the second counter output signal, to the gate of the other counters. When that signal takes place, the value store at the other counters registers will be buffered.
If you need to reset those counters to zero, you won't be able to do buffered position measurement, since the gate of those counter
s would be used to reset their values.
In summary, you will either do a buffered position measurement at the other encoders, or will be able to reset their count to zero. You won't be able to do both operations.
There is a good Application Note that you can refer to in order to get more familiar about how to use RTSI bus and how to synchronize multiple DAQ tasks in Labview.
The correspondent VI to the Select_Signal function is called Route Signal.vi.
I'm attaching the App Note for your convenience.
Hope this helps.
Filipe
0 Kudos
Message 2 of 3
(3,638 Views)
1. Yes you can reset all the encoders' counters to zero at the same time, but it'll involve lots of wire.

2. It sounds as though the only time you care about the value in the 6 test encoder counters is when the master encoder reaches a specified value. Then immediately after capturing the six test encoder values, you'd like to reset them to zero. Is this correct? I'm further supposing that you aren't needing to buffer the master encoder position -- you just need to trigger the capture & reset when it hits a target, right?

Here goes then:

3. Setup 3 buffered position acquisitions on each of your 6602's, and wire the A & B channels of your 6 test encoders to their corresponding Source and Aux/UpDn pins. Each of the counters' default gate pins needs to be physically wired to the output of a counter whose function is explained below. Setup the counters to enable Z-channel indexing with a reload value of zero. Setup gating to use RTSI, say RTSI 6 with 'Counter Gate (NI-TIO).vi' More on this below also.

4. A counter needs to be setup that will fire a trigger-like signal when the master encoder reaches a specific value. Wire the master encoder to a counter and configure for (non-buffered) position measurement. Bring its Z-channel into the gate pin and enable Z-channel indexing, but don't use zero for a reload value. The correct value will depend on whether the master typically counts up or down.
Supposing you want to "fire" when the position is 1000 counts beyond the Z-index position, then you would set the reload value to 1000 if counting down or to (2^32 - 1000) if counting up. That way, 1000 counts after the Z-channel index, the counter value will be zero.

5. On this same counter, setup the output to *pulse* upon reaching terminal count, and route the output onto RTSI 6, as presented earlier. Here it will act as a gating signal to latch the test encoders' positions at the instant that the master reaches the desired value.

6. Setup another counter for retriggered pulse generation. Use the prior counter's output as the gate signal. Might as well config for RTSI 6 since it's already there anyway and doesn't require a screwdriver. Setup a minimal delay time and a reasonable pulse time. Physically wire the output of this counter to all the default gate pins of the 6 test encoders. While it's high, all the test encoder counters will get reset to zero.

7. Summing up steps 3-6. When the master reaches a precise specified position relative to its Z-index position, a counter will generate a pulse that is used to buffer the positions of the 6 test encoders. The same pulse will trigger a single pulse from another counter, which is wired as the Z-channel index of the 6 test encoders, resetting their values to zero. The wiring and config involved guarantees that the position values are latched before being reset to zero.
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 3 of 3
(3,638 Views)