1.35.16.13 TCx_CHy_ComparePeriodSet Function
C
/* x = TC instance number, y= channel number */ /* 16 bit counter */ void TCx_CHy_ComparePeriodSet ( uint16_t period ); /* 32 bit counter */ void TCx_CHy_ComparePeriodSet ( uint32_t period );
Summary
Sets the period value of a given TC channel in compare mode.
Description
This function writes the TC compare timer's period value. When counter matches the period value, it is reset, the waveform phase is updated and an interrupt can be generated.
Precondition
TCx_CHy_CompareInitialize() function must have been called first for the given channel.
Parameters
Param | Description |
---|---|
period | The timer period value necessary to achieve the desired waveform frequency. Type of this parameter varies with the bit width of the counter |
Returns
None.
Example
TC0_CH1_CompareInitialize();
TC0_CH1_ComparePeriodSet(0x500U);
Remarks
The caller must know the number of significant bits of timer. The Period value is right-aligned.