<< mdaqEncoderInit Data acquisition mdaqKeyRead >>

MicroDAQ Support Package for Matlab/Simulink >> MicroDAQ Support Package for Matlab/Simulink > Data acquisition > mdaqEncoderRead


Reads quadrature encoder

Calling Sequence

[position, direction] = mdaqEncoderRead(module)


This function reads current value of quadrature encoder (ENC1, ENC2) position register on selected ENC module. Function returns current position and rotation direction. Value of direction indicates rotation direction (0 - no motion, 1 - CW, 2 - CCW).

The quadrature encoder pulse (ENC) module is used for direct interface with a linear or rotary incremental encoder to get position, direction, and speed information from a rotating machine for use in a high-performance motion and position-control systems.

Input arguments

Output arguments


% initialize quadrature encoder with 0 
mdaqEncoderInit(1, 0); 
% read quadrature encoder module 1
sprintf('Encoder position: %d\n', mdaqEncoderRead(1))

See Also

Report an issue
<< mdaqEncoderInit Data acquisition mdaqKeyRead >>