1.7.22.37 RTC_Timer16Start Function
C
void RTC_Timer16Start ( void )
Summary
Starts the 16-bit timer.
Description
This function starts the 16-bit timer. The timer will start counting up from the value that was set using the RTC_Timer16CounterSet() function. The timer will count at a rate configured by the input clock and the input prescalar.
The timer can be configured to count up till a specific non-zero value. This value is specified using the RTC_Timer16PeriodSet() function. Setting a non-zero will cause the timer counter to operate as timer. The counter will count up to the period value and then reset and start counting again. This causes a period expiry event. Timer type operations are preferred to implement a delay or obtain periodic notification.
Setting the period to 0 will result in a counter type operation. In this mode, starting the timer will cause the counter to count up to 0xFFFF and then overflow to 0 and continue counting. This causes an overflow event. A counter can be used to count in timer input clock units. This is useful when needed to perform temporal measurements.
The counter can be stopped by calling the RTC_Timer16Stop function. Calling the RTC_Timer16Start() will again start the counting from the current counter value.
Precondition
RTC_Initialize must have been called for the associated RTC instance. The RTC peripheral should have been configured in 16-bit Timer Counter mode. The RTC_Timer16PeriodSet and RTC_Timer16CounterSet function should have been called to set the desired period and starting count.
Parameters
None.
Returns
None.
Example
RTC_Initialize(); // Operate as a timer by setting a non-zero period. RTC_Timer16PeriodSet(0x3000); RTC_Timer16CounterSet(0); RTC_Timer16Start(); // Wait till the counter overflows. while(RTC_Timer16CounterHasOverflowed()); // Refer to the description of the RTC_Timer16CounterHasOverflowed() // function for example of counter mode operation.
Remarks
None.