cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Simultaneous Data Acquisition from Two Terminals of One Encoder (ELVIS II)

Simultaneous Data Acquisition from Two Terminals of One Encoder (ELVIS II)

Hi Forum Members,
   I have a query detailed below:
Hardware: ELVIS II (QNET DC Motor Trainer)
Software Platform: MATLAB/Simulink
Component Concerned: Incremental optical encoder (ONE encoder, three terminals A, B & Z)
Objective: To obtain direction of rotation of motor (Clockwise/Anti-clockwise) from encoder.
How to Achieve Objective: As per working principle of encoder, the direction  can be measured by comparing the data from two terminals of Encoder. So, if data of Terminal A leads data of Terminal B, the motor is rotating in one direction. In case of lags in the two data, the motor is rotating in other direction. So, it means we need to measure data of the two terminals A and B so as to comment on direction.
Problem:
    MATLAB DAQ command "addCounterInputChannel(s, 'Dev2',0, 'position')" by default gives position data of Terminal A of counter (encoder) 0 of Device 2.
How I can get position data of Terminal B of the same counter (encoder) 0 of the same Device 2?
0 Kudos
Message 1 of 3
(1,081 Views)

Re: Simultaneous Data Acquisition from Two Terminals of One Encoder (ELVIS II)

Hello Jlqbal:

Just a simple question where did you find the information about syntax and functions that can be used in this application?. With this information, I can help by understanding better the code and function interactions with the input parameters from the point of view how task are managed in National Instruments products. 

 

Also, did you already check the Forums of Matlab related to this information?. This question is because sometimes the function needs more or fewer parameters.

 

I hope you have a nice day.

Message 2 of 3
(1,021 Views)

Re: Simultaneous Data Acquisition from Two Terminals of One Encoder (ELVIS II)

Hello JKarma,

  Thanks for your reply. The documentation of the function "addCounterInputChannel" is available at [1]. The syntax is:

                addCounterInputChannel(s, 'Dev2',’PhysicalPortName, 'position')
Here, I would like to clarify that the command 
              addCounterInputChannel(s, 'Dev2',’0’, 'position')  % reads Counter 0 (or Encoder 0) Terminal A (by default). Whereas the command
 
             addCounterInputChannel(s, 'Dev2',’1’, 'position') % reads Counter 1 (or Encoder 1) Terminal A (by default)
 
So changing the parameter 0 ->1 reads Encoder data of another Encoder. I want to read Encoder data of Terminals A and B (of the same encoder)
  Also, the attached snapshot will help to clarify our problem. Thanks again.

[1] https://www.mathworks.com/help/daq/ref/addcounterinputchannel.html

0 Kudos
Message 3 of 3
(988 Views)