Jump to main content

##

# 2.99.18 RTC_Timer32CompareSet Function

## C

    void RTC_Timer32CompareSet ( uint32_t compare )

## Summary

Set the 32-bit timer period value.

## Description

This function sets the 32-bit timer compare value. The counter value will be compared against the compare value and a compare match event will occur when the counter matches the compare value. If the library is configured for interrupt mode and if a event handler function has been set through the RTC_Timer32CallbackRegister() function, the event handling function will be called. When the match occurs, the counter can optionally be reset if clear on compare is enabled to generate periodic interrupt.

## Precondition

RTC_Initialize must have been called for the associated RTC instance. The RTC peripheral should have been configured in 32-bit Timer Counter mode.

## Parameters

Param | Description
--- | ---
compare | Compare value

## Returns

None.

## Example

    uint32_t period = 0x00000FFF;
    RTC_Initialize();
    RTC_Timer32CompareSet(period);
    RTC_Timer32CounterSet(0);
    RTC_Timer32Start();
    while(!RTC_Timer32CompareHasMatched());

## Remarks

This API is available for devices that have only one compare register in 32-bit mode. The RTC_Timer32Start() should typically be called after the period has been set.