MATLAB Answers

How to read multiple quadrature encoders using data acquisition tool box?

3 views (last 30 days)
hassan talat
hassan talat on 9 Jul 2019
I want to read 3 encoders in matlab using NI USB 6343. I am using data acquisition tool box in matlab. These are the steps that i followed:
1. Daq session created
s = daq.createSession('ni');
2. Channels defined
ch = addCounterInputChannel(s, 'Dev1', [0 1 2], 'Position');
3. Read angles using
inputSingleScan(s) * 360/1000
ans =
0 0 13.3200
Now the probem is that I only receive updated value of the last encoder i.e encoder 2. First and second values are always '0'. Same is the case when I add two encoder channels. Only the last one gets updated. I have checked each encoder individually (they works fine). When I keep only encoder it always gives the required updated value on giving command inputSingleScan(s).
I have interfaced three encoders simultaneously in LabView they work fine.
Can someone identify the mistake or propose a possible approach ??


Sign in to comment.

Answers (0)

Translated by