1.8.22.30 1.25.23.30 1.26.20.30 1.27.23.30 1.28.25.30 1.34.23.30 1.35.16.30 1.36.18.30 1.41.21.30 1.42.20.30 TCx_QuadraturePositionGet Function

C

/* x = TC instance number */

/* 16 bit counter */
int16_t TCx_QuadraturePositionGet ( void )

/* 32 bit counter */
int32_t TCx_QuadraturePositionGet ( void )

Summary

Reads the angular position from the quadrature encoder.

Description

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

Precondition

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

Parameters

None.

Returns

Position of the encoder.Type of the return value varies with the bit width of the counter.

Example

16 bit counter

int16_t position;

TC0_QuadratureInitialize();
TC0_QuadratureStart();
position = TC0_QuadraturePositionGet();

32 bit counter

int32_t position;

TC0_QuadratureInitialize();
TC0_QuadratureStart();
position = TC0_QuadraturePositionGet();

Remarks

In counter-clockwise direction, position counter works in down counting mode.