1.8.22.6 1.25.23.6 1.26.20.6 1.27.23.6 1.28.25.6 1.34.23.6 1.35.16.6 1.36.18.6 1.41.21.6 1.42.20.6 TCx_CHy_TimerCounterGet Function
C
/* x = TC instance number, y= channel number */ /* 16 bit timer */ uint16_t TCx_CHy_TimerCounterGet ( void ); /* 32 bit timer */ uint32_t TCx_CHy_TimerCounterGet ( void );
Summary
Reads the timer channel counter value
Description
This function reads the timer channel counter value.
Precondition
TCx_CHy_TimerInitialize() function must have been called first for the given channel.
Parameters
None
Returns
The timer's counter value. Type of the return value is different based on the timer bit width.
Example
16 bit timer
uint16_t counter; TC0_CH2_TimerInitialize(); TC0_CH2_TimerStart(); counter = TC0_CH2_TimerCounterGet();
32 bit timer
uint32_t counter; TC0_CH2_TimerInitialize(); TC0_CH2_TimerStart(); counter = TC0_CH2_TimerCounterGet();
Remarks
None