1.8.22.12 1.25.23.12 1.26.20.12 1.27.23.12 1.28.25.12 1.34.23.12 1.35.16.12 1.36.18.12 1.41.21.12 1.42.20.12 TCx_CHy_ComparePeriodGet Function

C

/* x = TC instance number, y= channel number */

/* 16 bit counter */
uint16_t TCx_CHy_ComparePeriodGet ( void )

/* 32 bit counter */
uint32_t TCx_CHy_ComparePeriodGet ( void )

Summary

Gets the period value of given timer channel in compare mode.

Description

This function gets the current value of period of given timer channel in compare mode.

Precondition

TCx_CHy_CompareInitialize() function must have been called first for the given channel.

Parameters

None

Returns

The timer's period value. Type varies with the bit width of the counter.

Example

16 bit counter

uint16_t period;
TC0_CH1_CompareInitialize();
period = TC0_CH1_ComparePeriodGet();

32 bit counter

uint32_t period;
TC0_CH1_CompareInitialize();
period = TC0_CH1_ComparePeriodGet();

Remarks

The caller must know the number of significant bits of timer. Period value is right-aligned.