This example shows typical use of the Quad Timer (TMR) module.
- Source code:
#include "drivers.h"
void GeneralPurposeTimerInit(void);
#define TIMER_MOD 25
void main (void)
{
GeneralPurposeTimerInit();
OneSecTimer=40;
while(1);
}
void GeneralPurposeTimerInit()
{
ModValue = BusClk/1000 ;
ModValue = ModValue / 128;
ModValue=ModValue* TIMER_MOD;
ModValue, 0x0000, 0x0000, ModValue, 0x0000, 1,
&GPTimerEventHander);
}
{
{
if(OneSecTimer)
{
OneSecTimer--;
if(OneSecTimer==0)
{
OneSecTimer=40;
}
}
}
}
- Toolchain support:
IAR EWARM 7.40.7 | KEIL uVision 5.15 | CrossWorks 3.6 | ATOLLIC TrueStudio 5.3.0 | Kinetis Design Studio 3.0.0 |
♦ | ♦ | ♦ | ♦ | ♦ |