24.6.4.10.1 Function tc_set_top_value()

Set the timer TOP/period value.

enum status_code tc_set_top_value( const struct tc_module *const module_inst, const uint32_t top_value)

For 8-bit counter size this function writes the top value to the period register.

For 16- and 32-bit counter size this function writes the top value to Capture Compare register 0. The value in this register can not be used for any other purpose.

Note: This function is designed to be used in PWM or frequency match modes only. When the counter is set to 16- or 32-bit counter size. In 8-bit counter size it will always be possible to change the top value even in normal mode.
Table 24-33. Parameters
Data directionParameter nameDescription

[in]

module_inst

Pointer to the software module instance struct

[in]

top_value

New timer TOP value to set

Returns

Status of the TOP set procedure.

Table 24-34. Return Values
Return valueDescription

STATUS_OK

The timer TOP value was updated successfully

STATUS_ERR_INVALID_ARG

The configured TC module counter size in the module instance is invalid