1.36.18.31 TCx_QuadratureRevolutionsGet Function
C
/* x = TC instance number */ /* 16 bit counter */ uint16_t TCx_QuadratureRevolutionsGet ( void ) /* 32 bit counter */ uint32_t TCx_QuadratureRevolutionsGet ( void )
Summary
Reads the number of revolutions from the quadrature encoder.
Description
This function reads the number of revolutions 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
Number of revolutions of the encoder. Type of the return value varies with the bit width of the counter.
Example
16 bit counter
int16_t revolutions; TC0_QuadratureInitialize(); TC0_QuadratureStart(); revolutions = TC0_QuadratureRevolutionsGet();
32 bit counter
int32_t revolutions; TC0_QuadratureInitialize(); TC0_QuadratureStart(); revolutions = TC0_QuadratureRevolutionsGet();
Remarks
In counter-clockwise direction, revolution counter works in down counting mode. This function is available only if quadrature encoder provides index pulse.