1.8.22.32 1.25.23.32 1.26.20.32 1.27.23.32 1.28.25.32 1.34.23.32 1.35.16.32 1.36.18.32 1.41.21.32 1.42.20.32 TCx_QuadratureSpeedGet Function
C
/* x = TC instance number */ /* 16 bit counter */ uint16_t TCx_QuadratureSpeedGet ( void ) /* 32 bit counter */ uint32_t TCx_QuadratureSpeedGet ( void )
Summary
Reads the quadrature index change speed.
Description
This function reads the number of quadrature pulses captured in timer channel for given time base.
Precondition
TCx_QuadratureInitialize function must have been called first for the given channel.
Parameters
None
Returns
Number of quadrature pulses counted in given time base which is used to determine speed of motion tracked by the encoder. Type of the return value varies with the bit width of the counter.
Example
16 bit counter
uint16_t speed; TC0_QuadratureInitialize(); TC0_QuadratureStart(); speed = TC0_QuadratureSpeedGet();
32 bit counter
uint32_t speed; TC0_QuadratureInitialize(); TC0_QuadratureStart(); speed = TC0_QuadratureSpeedGet();
Remarks
Caller must calculate the actual speed based on returned speed count value, time base and number of quadrature encoder pulses.