Jump to main content

##

# 2.99.20 RTC_Timer32Compare1Set Function

## C

    void RTC_Timer32Compare1Set ( 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_Timer32Compare1Set(period);
    RTC_Timer32CounterSet(0);
    RTC_Timer32Start();
    while(!RTC_Timer32Compare1HasMatched());

## Remarks

This API is available for devices that have more than one compare register in 32-bit mode.