Beruflich Dokumente
Kultur Dokumente
Module (Timers)
Ed Carryer, Matt Ohline, Betai Koffi, Stellios Leventis
Introduction
PURPOSE OF MODULE
This module provides for 16 independent timer channels. These timers
can be started, stopped and tested for completion. All timers share a
common time base, with a basic tick rate of 1 ms.
INTERFACE
This is a software-only module, with no external hardware interactions.
Module Functions
Module functions are documented on following pages.
TMRArd_InitTimer
TMRArd_StartTimer
PROTOTYPE
PROTOTYPE
PARAMETERS
unsigned char Num the number of the timer to start (0-15)
unsigned char Num the number of the timer to set & start (0-15)
unsigned long NewTime the number of ticks to be counted
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_OK otherwise.
DESCRIPTION
Sets the NewTime into the chosen timer, clears any previous event flag,
and sets the timer active to begin counting immediately.
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_OK otherwise.
DESCRIPTION
Sets the active flag in TMRArd_ActiveFlags to start a timer that was
previously set, or to restart a stopped timer.
TMRArd_StopTimer
PROTOTYPE
TMRArd_SetTimer
PROTOTYPE
TMRArdReturn_t TMRArd_SetTimer(unsigned char Num,
unsigned long NewTime)
PARAMETERS
unsigned char Num the number of the timer to be set (0-15)
unsigned long NewTime the number of ticks to be counted
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_OK otherwise.
DESCRIPTION
Sets the NewTime into the chosen timer, but does not make it active.
PARAMETERS
unsigned char Num the number of the timer to stop (0-15)
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_OK otherwise.
DESCRIPTION
Clears the bit in TMRArd_ActiveFlags associated with this timer. This
will cause it to stop counting..
TMRArd_IsTimerActive
TMRArd_ClearTimerExpired
PROTOTYPE
PROTOTYPE
TMRArdReturn_t TMRArd_ClearTimerExpired(
PARAMETERS
unsigned char Num the number of the timer to check (0-15)
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_NOT_ACTIVE if the requested timer is not active (stopped),
TMRArd_ACTIVE if the requested timer is active (running).
DESCRIPTION
This function is used to determine if a timer is currently counting.
TMRArd_IsTimerExpired
PROTOTYPE
TMRArdReturn_t TMRArd_IsTimerExpired(unsigned char
Num)
PARAMETERS
unsigned char Num the number of the timer to test (0-15)
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_NOT_EXPIRED if the requested timer is not expired,
TMRArd_EXPIRED if the requested timer is expired.
DESCRIPTION
This function tests flags to determine if the requested timer has
expired.
unsigned char
Num)
PARAMETERS
unsigned char Num timer whose event flag is to be cleared (0-15)
RETURNS
TMRArd_ERR if the requested timer does not exist,
TMRArd_OK otherwise.
DESCRIPTION
Clears the appropriate bit in TMRArd_EventFlags to show that the
associated timer expiration event has been serviced.
TMRArd_GetTime
PROTOTYPE
unsigned long TMRArd_GetTime(void)
PARAMETERS
None
RETURNS
An unsigned 32-bit number between 0 and 4,294,967,295 (232-1)
reflecting the current number of ticks on the master timer. Timer
rollover occurs after about fifty days.
DESCRIPTION
Simply returns the value of a free-running counter kept by the module.