# OS_SetPeriodicAlarm

## Syntax

      #include <nitro/os.h>

      void OS_SetPeriodicAlarm(
                      OSAlarm*       alarm,
                      OSTick          start ,
                      OSTick          period ,
                      OSAlarmHandler handler,
                      void*           arg );

## Arguments

alarm | Pointer to an alarm structure that is initialized for this alarm.
start | Tick count for first actuation of the alarm (calling the handler) (This is not a relative value from the current time, but an absolute value.)
period | Interval at which the alarm will be activated
handler | Alarm handler.
arg | Argument used when the alarm handler is called

## Return Values

None.

## Description

Sets a periodic alarm.

The alarm handler handler is first called when the tick value equals start . The V-Count alarm handler `handler` is an `OSVAlarmHandler` function defined by the following:

> `typedef void (*OSAlarmHandler)( void* );`

When the `handler` is called, it takes `arg` as an argument. The `handler` argument is passed from the OS timer interrupt handler. Therefore, interrupts are prohibited.

One tick count unit is 1/64 of the hardware system clock.

If `alarm` specifies the pointer to the `OSAlarm` structure which the alarm has set, `OS_Panic` stops the alarm.

`OS_CancelAlarm` is used to stop the alarm.

## See Also

`OS_InitAlarm, OS_CreateAlarm, OS_SetAlarm, OS_CancelAlarm
OS_*SecondsToTick
`

## Revision History

2005/03/08 Standardized the use of the term interrupt in Japanese.
2004/12/22 Added a statement about the alarm handler's being called from the timer interrupt handler.
2004/08/30 Added a statement about not being able to use the set alarm structure.
2004/02/25 Changed `systemClock` to tick.
2004/02/04 Initial version.

CONFIDENTIAL