1/27
Flashcards for reviewing general purpose timers in microcontrollers.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Timers
In embedded systems, timers provide an accurate time base to trigger actions and measure timing.
Capture Mode
Measures time between start and stop events, like a stopwatch.
Compare Mode
Signals that a new action should be started after a set time, like an egg timer.
Drawbacks of SW Timers
Execution time depends on optimization level; smallest timer increment is inaccurate. Use on-chip hardware timer instead.
Prescaler
Derives timer clock from CPU clock in General Timer Compare Principle.
Match Flag
When the current count value equals the match value, this flag is raised.
Time-Out Flag
Raised when the current count value reaches 0x0000.
General Purpose Timer Module (TM4C1294)
8 identical timer modules (0-7) with two 16-bit sub timers A/B each.
TIMERxCTLR
Used to start or stop timer x in 16-bit periodic timer compare mode.
TIMERxCFGR
Configures timer x for 2 times16-bit in 16-bit periodic timer compare mode.
TIMERxTAMRR TIMERxTBMRR
Configures sub-timers A/B for periodic mode, timer compare mode, count direction, and enable match flag.
TIMERxTAILRR TIMERxTBILRR
Defines timer (re)load value for subtimers A/B
TIMERxTAMATCHRR TIMERxTBMATCHRR
Defines timer match value for subtimers A/B
TIMERxTAPRR TIMERxTBPRR
Defines the divider factor for subtimers A/B, where timer clock = CPU clock / (prescaler+1).
TIMERxTARR TIMERxTBRR
Shows current count value of subtimers A/B.
TIMERxRISR
Must be cleared by SW after every event.
GPTM Interrupt Clear
After every event, the status bit in register TIMERxRISR must be cleared by SW. This is done the separate register TIMERxICRR in which the bit has to set to 1 to clear the corresponding bit in register TIMERxRISR.
SYSCTLRCGCTIMERR
Activates GPTM Timer modules individually, using control bits for timers 0 to 7.
One-shot Timer
A mode where a timer stops after a time-out without automatic output.
Periodic Timer
A mode where the timer rolls over after timing out, then restarts with the interval load value without automatic output..
PWM
A mode where a pulse width modulation is generated, with automoatic output signal generation at a µC pin connected to the timer.
RTC
A mode where the 32 bit timer is incremented every second and requires a special clock input (32.768 kHz).
Edge-time
Measures the time between two edges (rising and/or falling) of an input signal at a µC pin connected to the timer
Edge count
Measures the number of edges (rising and/or falling) of an input signal at a µC pin connected to the timer.
GPIO Port Configuration for Alternate Function
PWM and capture modes require connection to µC pins. Standard GPIO function deactivated if bit set in GPIOPORTxAFSELR, alternate function (e.g., Timer) module is selected in GPIOPORTxPCTLR
GPIOPORTxPCTL_R
Selects to which alternate function a certain pin gets.
Edge-time Mode
Measures the time between events at a port pin connected to a timer module (event=rising/falling/both edge(s) of an input signal).
Capture Register
When an event (falling/rising/both edges) at the GPIO input pin occurs, this register copies the current count value and sets an event status flag.