arm session 3 2010, spring copyright © 2012 mohammad moallemi

28
ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Upload: gillian-ryan

Post on 24-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

ARMSession 3

2010, Spring

Copyright © 2012 Mohammad Moallemi

Page 2: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Timer - Counter بیتی کامال16سه واحد تایمر/کانتر

مجزا و قابل برنامه ریزی مستقل

رودی کالک خارجی، 3هر کانال دارای

ورودی کالک داخلی و دو ورودی/ 5

خروجی قابل تنظیم توسط کاربر

:کار در دو مد کاری مختلف

Capture Mode به منظور اندازه گیری بر روی :

سیگنال ورودی به سیستم )فرکانس- اختالف فاز –

دوره تناوب و ...(

Waveform Mode به منظور تولید شکل موج های :

مورد نیاز

Page 3: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

: منابع کالک تایمر- کانتر

PB12/ETXER/TCLK0PB19/PWM0/TCLK1PA15/SPI0_NPCS3/TCLK2

PB23/TIOA0/DCD1PB24/TIOB0/DSR1

PB25/TIOA1/DTR1PB26/TIOB1/RI1

PB27/TIOA2/PWM0/AD0PB28/TIOB2/PWM1/AD1

منابع کالک

داخلی

کالک منWWWابع خارجی

ورودی / خروجی TCواحد

TIOA0,TIOA1,TIOA می توانند ورودی 2

کالک هم باشند

Page 4: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

چند نکته

I/O LinesThe pins used for interfacing the compliant external devices may be multiplexed with PIO lines.The programmer must first program the PIO controllers to assign the TC pins to their peripheralfunctions.

Power ManagementThe TC is clocked through the Power Management Controller (PMC), thus the programmer mustfirst configure the PMC to enable the Timer Counter clock.

InterruptThe TC has an interrupt line connected to the Advanced Interrupt Controller (AIC). Handling theTC interrupt requires programming the AIC before configuring the TC.

Page 5: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

منابع کالک تایمر- : کانتر

منابع کالک

داخلی

نماینده کالک خارجی

The clock of each counter can be controlled in two different ways: it can be enabled/disabledand started/stopped

Page 6: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

TC Operating Modes

Each channel can independently operate in two different modes:• Capture Mode provides measurement on signals.• Waveform Mode provides wave generation.The TC Operating Mode is programmed with the WAVE bit in the TC Channel Mode Register.In Capture Mode, TIOA and TIOB are configured as inputs.In Waveform Mode, TIOA is always configured to be an output and TIOB is an output if it is not selected to be the external trigger.

Page 7: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

TriggerA trigger resets the counter and starts the counter clock. Three types of triggers are common toboth modes, and a fourth external trigger is available to each mode.The following triggers are common to both modes:• Software Trigger: Each channel has a software trigger, available by setting SWTRG inTC_CCR.• SYNC: Each channel has a synchronization signal SYNC. When asserted, this signal hasthe same effect as a software trigger. The SYNC signals of all channels are asserted simultaneously by writing TC_BCR (Block Control) with SYNC set.• Compare RC Trigger: RC is implemented in each channel and can provide a trigger when the counter value matches the RC value if CPCTRG is set in TC_CMR.The channel can also be configured to have an external trigger. In Capture Mode, the external trigger signal can be selected between TIOA and TIOB. In Waveform Mode, an external eventcan be programmed on one of the following signals: TIOB, XC0, XC1 or XC2. This external event can then be programmed to perform a trigger by setting ENETRG in TC_CMR.If an external trigger is used, the duration of the pulses must be longer than the master clockperiod in order to be detected.Regardless of the trigger used,

Page 8: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

TC – Capture Mode

Page 9: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

TC – Waveform Mode

Page 10: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 11: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 12: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 13: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 14: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 15: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 16: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 17: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

WAVSEL

Page 18: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

TC Registers

Page 19: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

External Clock Selection

In all cases, if an external clock is used, the duration of each of its levels must be longer than the master clock period. The external clock frequency must be at least 2.5 times lower than the master clock.

External Clock Frequency < 2.5 MCK

Page 20: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

External Clock Selection

ب&رای واح&د را داش&تیم این TCپس در ص&ورتی ک&ه قص&د اس&تفاده از کالک خ&ارجی ( مقدار دهی می کنیم.TC_BMRرجیستر را )

Page 21: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Channel Control Reg.

Page 22: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg.

Page 23: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg. [Capture Mode]

Page 24: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg. [Capture Mode]

Page 25: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg. [Waveform Mode]

Page 26: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg. [Waveform Mode]

1. If TIOB is chosen as the external event signal, it is configured as an input and no longer generates waveforms and subsequently no IRQs.

Page 27: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Chanel Mode Reg. [Waveform Mode]

Page 28: ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi

Counter Value / A-B-C Reg.

ایWه و BرجیسWتر C ترWرجیس هماننWد نWیز A می باشند.