MKMxxZxxACxx5 Bare Metal Software Drivers  R4.1.6
Reference Manual
SYST Generation of Periodic Exceptions

This example shows use of the System Timer (SYST) module for generation of the periodic exceptions. In the example below the System Timer generates exceptions every 1000 system clock cycles.

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* syst_test.c
******************************************************************************/
#include "drivers.h"
static uint32 volatile temp32;
static uint32 volatile counter;
/* System Timer callback prototype */
static void syst_callback(void);
void main (void)
{
/* Initialize system Timer module - generates exception every 1000 system */
/* clock cycles */
while(1)
{
temp32 = SYST_GetCntrVal();
}
}
/* System Timer callback definition */
static void syst_callback(void)
{
counter++;
}
Toolchain support:
IAR EWARM 7.40.7CodeWarrior 10.6KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0