EasyManua.ls Logo

NXP Semiconductors LPC1768 - Example Timer Calculations; Example 1); Example 2); Example 3)

NXP Semiconductors LPC1768
841 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
UM10360 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2013. All rights reserved.
User manual Rev. 3 — 19 December 2013 509 of 841
NXP Semiconductors
UM10360
Chapter 23: LPC176x/5x System Tick Timer
23.6 Example timer calculations
The following examples illustrate selecting System Tick Timer values for different system
configurations. All of the examples calculate an interrupt interval of 10 milliseconds, as the
System Tick Timer is intended to be used.
Example 1)
This example is for the System Tick Timer running from the CPU clock (cclk), which is
100 MHz.
STCTRL = 7. This enables the timer and its interrupt, and selects cclk as the clock source.
RELOAD = (cclk / 100) - 1 = 1,000,000 - 1 = 999,999 = 0xF423F
In this case, there is no rounding error, so the result is as accurate as cclk.
Example 2)
This example is for the System Tick Timer running from the CPU clock (cclk), which is
80 MHz.
STCTRL = 7. This enables the timer and its interrupt, and selects cclk as the clock source.
RELOAD = (cclk / 100) - 1 = 800,000 - 1 = 799,999 = 0xC34FF
In this case, there is no rounding error, so the result is as accurate as cclk.
Example 3)
This example is for the CPU clock (cclk) is taken from the Internal RC Oscillator (IRC),
factory trimmed to 4 MHz.
STCTRL = 7. This enables the timer and its interrupt, and selects cclk as the clock source.
RELOAD = (F
IRC
/ 100) - 1 = 40,000 - 1 = 39,999 = 0x9C3F
In this case, there is no rounding error, so the result is as accurate as the IRC.
Example 4)
This example is for the System Tick Timer running from an external clock source (the
STCLK pin), which in this case happens to be 32.768 kHz.
STCTRL = 3. This enables the timer and its interrupt, and selects the STCLK pin as the
clock source. STCLK must be selected as the function of the relevant pin. See
Section 8.5.6
.
RELOAD = (cclk / 100) - 1 = 327.6 - 1 = 327 (rounded up) = 0x0147
In this case, there is rounding error, so the interrupt rate will drift slightly relative to the
input frequency.

Table of Contents

Other manuals for NXP Semiconductors LPC1768

Related product manuals