1.10.17.5 QEIx_PositionGet Function

C

/* x = QEI instance number */

uint32_t QEIx_PositionGet ( void )

Summary

Reads the position from the quadrature encoder.

Description

This function reads the position from the quadrature encoder as tracked by the channel counter.

Precondition

QEIx_Initialize function must have been called first for the given channel.

Parameters

None.

Returns

Position of the encoder.

Example

uint32_t position;

QEI1_Initialize();
QEI1_Start();
position = QEI1_PositionGet();

Remarks

In counter-clockwise direction, position counter works in down counting mode. The operating mode of position count is controlled by Counter Control Mode (QEIxCON.CCM) bit