MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual

This example shows typical use of the Low-Power Timer (LPTMR) operation in a free-running, timer counter mode. Timer is controlled by internal 1 kHz low power clock and it counts until overflow when counter resets. The timer content is read by LPTMR_ReadCnt() macro and stored to counter variable in a software loop.

You can leverage IAR Embedded Workbench IDE's "Live Watch" debugging window, which is intended to visualize values of variables during debugging. The screenshot below demonstrates on-line monitoring counter variable during debugging.

live_watch.bmp
Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* lptmr_test.c
******************************************************************************/
#include "drivers.h"
static volatile uint16 counter;
void main (void)
{
/* enable clocks to all on chip peripherals */
/* initialize LPTMR in freerun Timer mode */
while (1)
{
counter = LPTMR_ReadCnt();
}
}
Toolchain support:
IAR EWARM 7.40.7KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0