timers

24
TIMERS IN LPC 2148

Upload: tj-rimes

Post on 25-Jan-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: timers

TIMERS IN LPC 2148

Page 2: timers

Features

Page 3: timers

Applications

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

Page 4: timers

Pins for Timers

Page 5: timers

Timer Register

Page 6: timers
Page 7: timers
Page 8: timers
Page 9: timers
Page 10: timers
Page 11: timers
Page 12: timers

• 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;

Page 13: timers

MATCH TYPES

• Internal Match (Action is performed Internally)• External Match (Action is performed Externally i.e., on Pins)• Match channels and its Registers• CH0 – MR0 register• CH1 – MR1 register• CH2 – MR2 register• CH3 – MR3 register

Page 14: timers

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.

Page 15: timers
Page 16: timers
Page 17: timers

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

Page 18: timers

Capture Control

Page 19: timers
Page 20: timers
Page 21: timers

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

Page 22: timers
Page 23: timers
Page 24: timers