Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 24

TIMERS IN LPC 2148

Features

Applications
Interval Timer for Counting internal events
Free running timer
Pulse Width Modulator

Pins for Timers

Timer Register

TC gets incremented by 1 for every PR+1 cycles


PR register specifies the maximum value of PC
PC will be incremented for every single clock cycle until
it reaches PR then it will be RESET
Example

Before 1st clock pulse


TC = 0 ;
PR = 0 ; (has to be initialized by User)
PC = 0 ; (Read Only)
After 1st clock pulse
TC = 1 ;
PR = 0 ; (has to be initialized by User)
PC = 1 ; (Read Only) then again becomes PC = 0;

MATCH TYPES
Internal Match (Action is performed Internally)
External Match (Action is performed Externally i.e., on
Pins)
Match channels and its Registers

CH0
CH1
CH2
CH3

MR0
MR1
MR2
MR3

register
register
register
register

Match Registers (MR0 MR3)


The Match register values are continuously compared to
the Timer Counter value. When the two values are
equal, actions can be triggered automatically. The
action possibilities are to generate an interrupt, reset
the Timer Counter or stop the timer. Actions are
controlled by the settings in the MCR register
Always TC is compared with MR0-MR3 registers
If any match is generated then a particular action can be
performed
Action can be selected by using MCR Register.

Capture Channels and its Registers


CH0 CR0 Register
CH1 CR1 Register
CH2 CR2 Register
CH3 CR3 Register
For any external events on Capture Pins TC register is
stored in respective Capture Channel Register

Capture Control

External Match
External Match Pins
MAT0.0 (2pins): P0.3 and P0.22
MAT0.1 (2pins): P0.5 and P0.27
MAT0.2 (2pins): P0.16 and P0.28
MAT0.3 (1pin): P0.29
MAT1.0 (1pin): P0.12
MAT1.1 (1pin): P0.13
MAT1.2 (2pins): P0.17 and P0.19
MAT1.3 (2pins): P0.18 and P0.20
Whenever TC equals any of match register then an action can be performed
on the above match pins and that action is decided by EMR Register

You might also like