1.29.21.29 RTC_Timer16CounterGet Function

C

uint16_t RTC_Timer16CounterGet ( void )

Summary

Get the current 16-bit counter value.

Description

This function returns the current 16-bit count value. This function can be used to retrieve the counter value at the end of a time measurement.

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

Parameters

None.

Returns

uint16_t returns the current 16 bit counter value.

Example

// The following code example stops the counter when the counter value
// has reached 0xFFF.

RTC_Initialize();
RTC_Timer16PeriodSet(0);
RTC_Timer16CounterSet(0);
RTC_Timer16Start();
while(RTC_Timer16CounterGet() < 0xFFF);

// Stop the counter.
RTC_Timer16Stop();

Remarks

None.