# OS_SetPeriodicVAlarm

## C Specification

      #include <nitro/os.h>

      void OS_SetPeriodicVAlarm(
                      OSVAlarm*        alarm ,
                      s16              count ,
                      s16              delay ,
                      OSVAlarmHandler  handler ,
                      void*            arg );

## Description

Sets a periodic V-Count alarm

`handler` is called when the V-Count reaches `count`. Specify the amount of delay that can be permitted when the exact number of V-Count cannot be reached, such as when the V-count alarm is already being used. For example, at count=100 and delay=5, V-Count is reached if it is possible to reach it by 105, even if it was not possible to reach it by 100. When you specify `0`, it is only called by the specified V-count. If OS_VAlarm_Delay_Max, it is always called when a call is possible for the specified V-Count and subsequent V-Counts. For details, see the explanation of VAlarm in the Overview.

V-Count alarm handler `handler` is a function of the type defined by the following:

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

When `handler` is called, it takes `arg` as an argument.

If `alarm` is specified for the pointer to the `OSAlarm` structure in which the V count has been set, it stops with `OS_Panic()`.

`OS_CancelVAlarm()` or `OS_CancelVAlarms()` is used to stop the V-Count alarm.

## Arguments

`alarm` | Pointer to the V-Count alarm system structure that sets the V-Count alarm
`count` | The V-Count at which the V-Count alarm will be actuated (handler will be called) in each frame
`delay` | The maximum permissible number of V-Counts for delay
`handler` | V-Count alarm handler
`arg` | The argument used when the V-Count alarm handler is called

## Return Values

None

## See Also

`OS_InitVAlarm`, `OS_CreateVAlarm`, `OS_SetVAlarm`, `OS_CancelVAlarm`, `OS_CancelVAlarms`

## Revision History

08/30/2004 Added description that the V alarm structure that has been set is not usable.
07/06/2004 Added description on delay
02/24/2004 Initial version