Texas Instruments Stellaris LM4F Timer Programming Guide

This article introduces the features and usage of the timer (Timer) module of the TI Stellaris LM4F chip, including timer mode and capture mode. Timer mode can be used for single run and continuous run, and can set the count direction and count size. Capture mode includes edge counting and edge timing, and can be used for split and whole work. The article also provides corresponding example programs.


Texas Instruments Stellaris LM4F Timer Programming Guide - cover page
Brand
TI
Category
Other Electronics
Document type
Programming Manual
Language
Chinese
Pages
18
File format
PDF
File size
548 KB
Published
13 March, 2012
Updated
28 September, 2023
MD5 checksum
4060E227ECA7E790A6052E9A79E20C6F

About this manual

The document introduces the timer module of the Stellaris LM4F series, describing the available 32/16‑bit and 64/32‑bit timers, their operating modes (one‑shot, periodic, real‑time clock) and split‑pair configurations. It also covers the capture mode, including edge‑count and edge‑time functions, and the PWM mode.

Programming details are provided, such as enabling the timer peripheral, configuring mode and count range, setting up interrupts, and example code that generates a one‑second UART output using a wide timer. An appendix supplies a console‑initialization routine for UART communication. This manual is written in Chinese.

What's inside

  • Function Overview
  • Timer Mode
  • Capture Mode
  • Example Programs
  • Appendix

Specifications

Timer bit‑width options32/16‑bit and 64/32‑bit
Supported timer modesTimer, Capture, PWM
Capture edge selectionRising, Falling, Both edges

Frequently asked questions

How do I enable a timer peripheral on the LM4F?

Call SysCtlPeripheralEnable with the timer’s peripheral identifier, for example SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0).

How can I configure a timer for one‑shot mode?

Use TimerConfigure with the TIMER_CFG_ONE_SHOT (or TIMER_CFG_ONE_SHOT_UP) flag for the desired timer instance.

What function sets the edge type for capture mode?

TimerControlEvent selects the edge to capture, using TIMER_EVENT_POS_EDGE, TIMER_EVENT_NEG_EDGE, or TIMER_EVENT_BOTH_EDGES.

How do I start a configured timer?

Call TimerEnable with the timer base address and the appropriate channel (TIMER_A, TIMER_B, or TIMER_BOTH).

Download PDF (548 KB)