Download presentation
Presentation is loading. Please wait.
Published byGillian Ryan Modified over 9 years ago
1
ARM Session 3 2010, Spring Copyright © 2012 Mohammad Moallemi
2
Timer - Counter سه واحد تایمر/کانتر 16 بیتی کاملا مجزا و قابل برنامه ریزی مستقل هر کانال دارای3 رودی کلاک خارجی، 5 ورودی کلاک داخلی و دو ورودی/ خروجی قابل تنظیم توسط کاربر کار در دو مد کاری مختلف: Capture Mode : به منظور اندازه گیری بر روی سیگنال ورودی به سیستم (فرکانس- اختلاف فاز – دوره تناوب و...) Waveform Mode : به منظور تولید شکل موج های مورد نیاز
3
منابع کلاک تایمر- کانتر : PB12/ETXER/TCLK0 PB19/PWM0/TCLK1 PA15/SPI0_NPCS3/TCLK2 PB23/TIOA0/DCD1 PB24/TIOB0/DSR1 PB25/TIOA1/DTR1 PB26/TIOB1/RI1 PB27/TIOA2/PWM0/AD0 PB28/TIOB2/PWM1/AD1 منابع کلاک داخلی منابع کلاک خارجی ورودی / خروجی واحد TC TIOA0,TIOA1,TIOA2 می توانند ورودی کلاک هم باشند
4
چند نکته I/O Lines The 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 peripheral functions. Power Management The TC is clocked through the Power Management Controller (PMC), thus the programmer must first configure the PMC to enable the Timer Counter clock. Interrupt The TC has an interrupt line connected to the Advanced Interrupt Controller (AIC). Handling the TC interrupt requires programming the AIC before configuring the TC.
5
منابع کلاک تایمر- کانتر : منابع کلاک داخلی نماینده کلاک خارجی The clock of each counter can be controlled in two different ways: it can be enabled/disabled and started/stopped
6
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.
7
Trigger A trigger resets the counter and starts the counter clock. Three types of triggers are common to both 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 in TC_CCR. SYNC: Each channel has a synchronization signal SYNC. When asserted, this signal has the 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 event can 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 clock period in order to be detected. Regardless of the trigger used,
8
TC – Capture Mode
9
TC – Waveform Mode
10
WAVSEL
18
TC Registers
19
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
20
External Clock Selection پس در صورتی که قصد استفاده از کلاک خارجی برای واحد TC را داشتیم این رجیستر را (TC_BMR) مقدار دهی می کنیم.
21
Channel Control Reg.
22
Chanel Mode Reg.
23
Chanel Mode Reg. [Capture Mode]
25
Chanel Mode Reg. [Waveform Mode]
26
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.
27
Chanel Mode Reg. [Waveform Mode]
28
Counter Value / A-B-C Reg. رجیستر های B و C نیز همانند رجیستر A می باشند.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.