Download ECT_16B8C Block User Guide V01.06
Transcript
Freescale Semiconductor, Inc. DOCUMENT NUMBER S12ECT16B8CV1/D Freescale Semiconductor, Inc... ECT_16B8C Block User Guide V01.06 Original Release Date: 2-Sep-1999 Revised: Jul 05, 2004 Motorola Inc. Motorola reserves the right to make changes without further notice to any products herein to improve reliability, function or design. Motorola does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. 1 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. ReviRevision History Version Revision Number Date Freescale Semiconductor, Inc... 0.1 0.2 2-Sep-99 24-Sep-99 Effective Date Author Description of Changes Original draft. Distributed only within Motorola QS9000 Verified. 2-Sep-99 24-Sep-99 0.3 25-Oct-99 25-Oct-99 0.4 11-Nov-99 11-Nov-99 • Changed the specs as per MSRS format. • Modified ECT16b8c Block diagram. • Modified IP Bus signal names and their description. • Modified ECT output signal names. • Deleted bits 3-0 of TSCR1 register in Register Map(Sheet 1 of 2). • Modified register addresses in the description of TSFRZ,WAIT,NORMAL mode(Modes of Operation). • In Figure 1-6 changed text font to Halvetica. • Renamed TMSK1 and TMSK2 register as TIE and TSCR2 also renamed TSCR as TSCR1. • Modified TFLG2 bit setting sentence. • Added explanation about the abbreviation(M clock,PACLK) used. • Removed duplication of lines at the end of register description of PACN3/PACN2. • Corrected the reset value of MCCNT from $FF to $FFFF in the description of register MCCTL. • Corrected Table format for delay counter select and Modulus counter Prescalar Select. • Corrected all the cross-references used in section 3 of the document. • Deleted and added some module specific signals. • Changed all interrupts from active LOW to active HIGH. • Added description about successful output comapre and forced output compare taking place simultaneously and their effect on flag. • Added abbreviation section. • • In Fig 1-3 changed host data bus to IPbus. Changed block name in Section 2. • Removed signals ipp_ect_ic_ibe and ipp_ect_ic_offval from port list. Removed signal ipb_read & ipb_write from portlist. ipb_rwb added • 2 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Version Revision Number Date 0.5 1-Dec-99 Effective Date 1-Dec-99 Author Description of Changes • • Freescale Semiconductor, Inc... 01.00 10-May-01 11-May-01 01.01 19-July-01 01.02 10-Jan-02 10-Jan-02 01.03 18-Jul-02 18-Jul-02 01.04 11-Nov-02 11-Nov-02 01.05 12-Mar-04 12-Mar-04 • updated cross-references • • marked TIMTST register description with ’non_cust’ tag Document names have been added • Names and Variable definitions have been hidden • • Note added in Section 3.3.18 for PACN1/PACN0 Changed the register bit information of MCCTL on bits • ICLAT and FLMC • • Eliminated all references of "n" to "x" .e.g. IOSn to IOSx Description of OC7M and TCTL1 registers modified, note on OC added in section 4. Included description about delay counter in section 4.2.1.3 • 01.06 05-Jul-04 05-Jul-04 Incorporated feedback received from Joachim Kruecken on 30-Nov-99 formal changes for SRS compliance (cover, master pages, paragraph formats, register templates) • Modified the description about TCNT in section 3. 3.5 3 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 4 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Table of Contents Section 1 Introduction 1.1 1.2 1.3 1.4 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Freescale Semiconductor, Inc... Section 2 Signal Description 2.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 2.2 Detailed Signal Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.1 IOC7 - Input capture and Output compare channel 7 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.2 IOC6 - Input capture and Output compare channel 6 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.3 IOC5 - Input capture and Output compare channel 5 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.4 IOC4 - Input capture and Output compare channel 4 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.5 IOC3 - Input capture and Output compare channel 3 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.6 IOC2 - Input capture and Output compare channel 2 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.7 IOC1 - Input capture and Output compare channel 1 . . . . . . . . . . . . . . . . . . . . . . . .15 2.2.8 IOC0 - Input capture and Output compare channel 0 . . . . . . . . . . . . . . . . . . . . . . . .15 Section 3 Memory Map and Registers 3.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 3.2 Module Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 3.3 Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 3.3.1 TIOS — Timer Input Capture/Output Compare Select Register . . . . . . . . . . . . . . . .19 3.3.2 CFORC — Timer Compare Force Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 3.3.3 OC7M — Output Compare 7 Mask Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 3.3.4 OC7D — Output Compare 7 Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 3.3.5 TCNT — Timer Count Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 3.3.6 TSCR1 — Timer System Control Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 3.3.7 TTOV — Timer Toggle On Overflow Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 3.3.8 TCTL1/TCTL2 — Timer Control Register 1/Timer Control Register 2 . . . . . . . . . . . .23 3.3.9 TCTL3/TCTL4 — Timer Control Register 3/Timer Control Register 4 . . . . . . . . . . . .24 3.3.10 TIE — Timer Interrupt Enable Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 3.3.11 TSCR2 — Timer System Control Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 5 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 3.3.12 3.3.13 3.3.14 3.3.15 3.3.16 3.3.17 3.3.18 3.3.19 3.3.20 3.3.21 3.3.22 3.3.23 3.3.24 3.3.25 3.3.26 3.3.27 3.3.28 3.3.29 3.3.30 Semiconductor, Inc. TFLG1 — Main Timer Interrupt Flag 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 TFLG2 — Main Timer Interrupt Flag 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 Timer Input Capture/Output Compare Registers 0-7 . . . . . . . . . . . . . . . . . . . . . . . . .28 PACTL — 16-Bit Pulse Accumulator A Control Register . . . . . . . . . . . . . . . . . . . . . .29 PAFLG — Pulse Accumulator A Flag Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 PACN3, PACN2 — Pulse Accumulators Count Registers . . . . . . . . . . . . . . . . . . . . .32 PACN1, PACN0 — Pulse Accumulators Count Registers . . . . . . . . . . . . . . . . . . . . .33 MCCTL — 16-Bit Modulus Down-Counter Control Register . . . . . . . . . . . . . . . . . . .33 MCFLG — 16-Bit Modulus Down-Counter FLAG Register . . . . . . . . . . . . . . . . . . . .35 ICPAR — Input Control Pulse Accumulators Register. . . . . . . . . . . . . . . . . . . . . . . .36 DLYCT — Delay Counter Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 ICOVW — Input Control Overwrite Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 ICSYS — Input Control System Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . .37 TIMTST — Timer Test Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 PBCTL — 16-Bit Pulse Accumulator B Control Register . . . . . . . . . . . . . . . . . . . . . .39 PBFLG — Pulse Accumulator B Flag Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 PA3H–PA0H — 8-Bit Pulse Accumulators Holding Registers . . . . . . . . . . . . . . . . . .41 MCCNT — Modulus Down-Counter Count Register . . . . . . . . . . . . . . . . . . . . . . . . .42 Timer Input Capture Holding Registers 0-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 Section 4 Functional Description 4.1 General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 4.2 Enhanced Capture Timer Modes of Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 4.2.1 IC Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 4.2.1.1 Non-Buffered IC Channels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 4.2.1.2 Buffered IC Channels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 4.2.1.3 Delayed IC channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 4.2.2 Pulse Accumulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 4.2.2.1 Pulse Accumulator latch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 4.2.2.2 Pulse Accumulator queue mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 4.2.3 Modulus Down-Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 4.2.4 Channel Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 Section 5 Reset 5.1 General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 6 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Freescale Semiconductor, Inc... Section 6 Interrupts 6.1 General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2 Description of Interrupt Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2.1 Channel [7:0] Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2.2 Modulus Counter Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2.3 Pulse Accumulator B Overflow Interrupt) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2.4 Pulse Accumulator A Input Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 6.2.5 Pulse Accumulator A Overflow Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58 6.2.6 Timer Overflow Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58 7 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 8 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Freescale Semiconductor, Inc... List of Figures Figure 1-1 Figure 3-1 Figure 3-2 Figure 3-3 Figure 3-4 Figure 3-5 Figure 3-6 Figure 3-7 Figure 3-8 Figure 3-9 Figure 3-10 Figure 3-11 Figure 3-12 Figure 3-13 Figure 3-14 Figure 3-15 Figure 3-16 Figure 3-17 Figure 3-18 Figure 3-19 Figure 3-20 Figure 3-21 Figure 3-22 Figure 3-23 Figure 3-24 Figure 3-25 Figure 3-26 Figure 3-27 Figure 3-28 Figure 3-29 Figure 3-30 Figure 3-31 Figure 3-32 Timer Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Timer Input Capture/Output Compare Register (TIOS) . . . . . . 19 Timer Compare Force Register (CFORC) . . . . . . . . . . . . . . . . 20 Output Compare 7 Mask Register (OC7M) . . . . . . . . . . . . . . . 20 Output Compare 7 Data Register (OC7D). . . . . . . . . . . . . . . . 21 Timer Count Register (TCNT) . . . . . . . . . . . . . . . . . . . . . . . . . 21 Timer System Control Register 1 (TSCR1) . . . . . . . . . . . . . . . 22 Timer Toggle On Overflow Register 1 (TTOV) . . . . . . . . . . . . 23 Timer Control Register 1/Timer Control Register 2 (TCTL1/TCTL2)23 Timer Control Register 3/Timer Control Register 4 (TCTL3/TCTL4)24 Timer Interrupt Enable Register (TIE) . . . . . . . . . . . . . . . . . . . 25 Timer System Control Register 2 (TSCR2) . . . . . . . . . . . . . . . 25 Main Timer Interrupt Flag 1 (TFLG1). . . . . . . . . . . . . . . . . . . . 26 Main Timer Interrupt Flag 2 (TFLG2). . . . . . . . . . . . . . . . . . . . 27 Timer Input Capture/Output Compare Registers 0-7. . . . . . . . 29 16-Bit Pulse Accumulator Control Register (PACTL) . . . . . . . 29 Pulse Accumulator A Flag Register (PAFLG) . . . . . . . . . . . . . 31 Pulse Accumulators Count Register 3 (PACN3) . . . . . . . . . . . 32 Pulse Accumulators Count Register 2 (PACN2) . . . . . . . . . . . 32 Pulse Accumulators Count Register 1 (PACN1) . . . . . . . . . . . 33 Pulse Accumulators Count Register 0 (PACN0) . . . . . . . . . . . 33 16-Bit Modulus Down-Counter Control Register (MCCTL) . . . 33 16-Bit Modulus Down-Counter FLAG Register (MCFLG) . . . . 35 Input Control Pulse Accumulators Register (ICPAR). . . . . . . . 36 Delay Counter Control Register (DLYCT) . . . . . . . . . . . . . . . . 36 Input Control Overwrite Register (ICOVW) . . . . . . . . . . . . . . . 37 Input Control System Register (ICSYS). . . . . . . . . . . . . . . . . . 37 Timer Test Register (TIMTST). . . . . . . . . . . . . . . . . . . . . . . . . 39 16-Bit Pulse Accumulator B Control Register (PBCTL) . . . . . . 39 Pulse Accumulator B Flag Register (PBFLG) . . . . . . . . . . . . . 40 8-Bit Pulse Accumulators Holding Register 3 (PA3H) . . . . . . . 41 8-Bit Pulse Accumulators Holding Register 2 (PA2H) . . . . . . . 41 8-Bit Pulse Accumulators Holding Register 1 (PA1H) . . . . . . . 41 9 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 Figure 3-33 Figure 3-34 Figure 3-35 Figure 3-36 Figure 3-37 Figure 3-38 Figure 4-1 Figure 4-2 Figure 4-3 Figure 4-4 Figure 4-5 Figure 4-6 Semiconductor, Inc. 8-Bit Pulse Accumulators Holding Register 0 (PA0H) . . . . . . . 41 Modulus Down-Counter Count Register (MCCNT) . . . . . . . . . 42 Timer Input Capture Holding Register 0 (TC0H) . . . . . . . . . . . 43 Timer Input Capture Holding Register 1 (TC1H) . . . . . . . . . . . 43 Timer Input Capture Holding Register 2 (TC2H) . . . . . . . . . . . 43 Timer Input Capture Holding Register 3 (TC3H) . . . . . . . . . . . 43 Detailed Timer Block Diagram in Latch mode . . . . . . . . . . . . . 46 Detailed Timer Block Diagram in Queue mode . . . . . . . . . . . . 47 8-Bit Pulse Accumulators Block Diagram . . . . . . . . . . . . . . . . 48 16-Bit Pulse Accumulators Block Diagram . . . . . . . . . . . . . . . 49 Block Diagram for Port7 with Output compare/Pulse Accumulator A50 Channel Input validity with delay counter feature . . . . . . . . . . 52 10 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Freescale Semiconductor, Inc... List of Tables Table 3-1 Table 3-2 Table 3-3 Table 3-4 Table 3-5 Table 3-6 Table 3-7 Table 3-8 Table 6-1 Module Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Compare Result Output Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 Edge Detector Circuit Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 Prescaler Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Pin Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 Clock Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 Modulus Counter Prescaler Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 Delay Counter Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 ECT Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 11 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 12 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 1 Introduction 1.1 Overview The HCS12 Enhanced Capture Timer module has the features of the HCS12 Standard Timer module enhanced by additional features in order to enlarge the field of applications, in particular for automotive ABS applications. This design specification describes the standard timer as well as the additional features. Freescale Semiconductor, Inc... The basic timer consists of a 16-bit, software-programmable counter driven by a prescaler. This timer can be used for many purposes, including input waveform measurements while simultaneously generating an output waveform. Pulse widths can vary from microseconds to many seconds. A full access for the counter registers or the input capture/output compare registers should take place in one clock cycle. Accessing high byte and low byte separately for all of these registers may not yield the same result as accessing them in one word. 1.2 Features • 16-Bit Buffer Register for four Input Capture (IC) channels. • Four 8-Bit Pulse Accumulators with 8-bit buffer registers associated with the four buffered IC channels. Configurable also as two 16-Bit Pulse Accumulators. • 16-Bit Modulus Down-Counter with 4-bit Prescaler. • Four user selectable Delay Counters for input noise immunity increase. 1.3 Modes of Operation STOP: Timer and modulus counter are off since clocks are stopped. FREEZE: Timer and modulus counter keep on running, unless TSFRZ in TSCR($06) is set to one. WAIT: Counters keep on running, unless TSWAI in TSCR ($06) is set to one. NORMAL: Timer and modulus counter keep on running, unless TEN in TSCR($06) respectively MCEN in MCCTL ($26) are cleared. 13 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 1.4 Block Diagram Bus clock Prescaler 16-bit Counter Freescale Semiconductor, Inc... Modulus counter Interrupt 16-bit Modulus Counter Channel 0 Input capture Output compare Channel 1 Input capture Output compare Channel 2 Input capture Output compare Timer overflow interrupt Timer channel 0 interrupt Channel 3 Input capture Output compare Registers Channel 4 Input capture Output compare Channel 5 Input capture Output compare Timer channel 7 interrupt PA overflow interrupt PA input interrupt PB overflow interrupt 16-bit Pulse accumulator A 16-bit Pulse accumulator B Channel 6 Input capture Output compare Channel 7 Input capture Output compare Figure 1-1 Timer Block Diagram 14 For More Information On This Product, Go to: www.freescale.com IOC0 IOC1 IOC2 IOC3 IOC4 IOC5 IOC6 IOC7 Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 2 Signal Description 2.1 Overview The ECT_16B8C module has a total 8 external pins. 2.2 Detailed Signal Descriptions 2.2.1 IOC7 - Input capture and Output compare channel 7 Freescale Semiconductor, Inc... This pin serves as input capture or output compare for channel 7. 2.2.2 IOC6 - Input capture and Output compare channel 6 This pin serves as input capture or output compare for channel 6. 2.2.3 IOC5 - Input capture and Output compare channel 5 This pin serves as input capture or output compare for channel 7. 2.2.4 IOC4 - Input capture and Output compare channel 4 This pin serves as input capture or output compare for channel 4. 2.2.5 IOC3 - Input capture and Output compare channel 3 This pin serves as input capture or output compare for channel 3. 2.2.6 IOC2 - Input capture and Output compare channel 2 This pin serves as input capture or output compare for channel 2. 2.2.7 IOC1 - Input capture and Output compare channel 1 This pin serves as input capture or output compare for channel 1. 2.2.8 IOC0 - Input capture and Output compare channel 0 This pin serves as input capture or output compare for channel 0. NOTE: For the description of interrupts see Section 6 Interrupts. 15 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 16 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 3 Memory Map and Registers 3.1 Overview This section provides a detailed description of all memory and registers. 3.2 Module Memory Map Freescale Semiconductor, Inc... The memory map for the ECT module is given below in Table 3-1. The Address listed for each register is the address offset. The total address for each register is the sum of the base address for the ECT module and the address offset for each register. Table 3-1 Module Memory Map Offset Use Access $_00 Timer Input Capture/Output Compare Select (TIOS) Read/Write $_01 Timer Compare Force Register (CFORC) Read/Write1 $_02 Output Compare 7 Mask Register (OC7M) Read/Write $_03 Output Compare 7 Data Register (OC7D) Read/Write $_04 Timer Count Register High (TCNT) Read/Write2 $_05 Timer Count Register Low (TCNT) Read/Write2 $_06 Timer System Control Register1 (TSCR1) Read/Write $_07 Timer Toggle Overflow Register (TTOV) Read/Write $_08 Timer Control Register1 (TCTL1) Read/Write $_09 Timer Control Register2 (TCTL2) Read/Write $_0A Timer Control Register3 (TCTL3) Read/Write $_0B Timer Control Register4 (TCTL4) Read/Write $_0C Timer Interrupt Enable Register (TIE) Read/Write $_0D Timer System Control Register2 (TSCR2) Read/Write $_0E Main Timer Interrupt Flag1 (TFLG1) Read/Write $_0F Main Timer Interrupt Flag2 (TFLG2) Read/Write $_10 Timer Input Capture/Output Compare Register0 High (TC0) Read/Write3 $_11 Timer Input Capture/Output Compare Register0 Low (TC0) Read/Write3 $_12 Timer Input Capture/Output Compare Register1 High (TC1) Read/Write3 $_13 Timer Input Capture/Output Compare Register1 Low (TC1) Read/Write3 $_14 Timer Input Capture/Output Compare Register2 High (TC2) Read/Write3 $_15 Timer Input Capture/Output Compare Register2 Low (TC2) Read/Write3 $_16 Timer Input Capture/Output Compare Register3 High (TC3) Read/Write3 17 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Freescale Semiconductor, Inc... Table 3-1 Module Memory Map $_17 Timer Input Capture/Output Compare Register3 Low (TC3) Read/Write3 $_18 Timer Input Capture/Output Compare Register4 High (TC4) Read/Write3 $_19 Timer Input Capture/Output Compare Register4 Low (TC4) Read/Write3 $_1A Timer Input Capture/Output Compare Register5 High (TC5) Read/Write3 $_1B Timer Input Capture/Output Compare Register5 Low (TC5) Read/Write3 $_1C Timer Input Capture/Output Compare Register6 High (TC6) Read/Write3 $_1D Timer Input Capture/Output Compare Register6 Low (TC6) Read/Write3 $_1E Timer Input Capture/Output Compare Register7 High (TC7) Read/Write3 $_1F Timer Input Capture/Output Compare Register7 Low (TC7) Read/Write3 $_20 16-Bit Pulse Accumulator A Control Register (PACTL) Read/Write $_21 Pulse Accumulator A Flag Register (PAFLG) Read/Write $_22 Pulse Accumulator Count Register3 (PACN3) Read/Write $_23 Pulse Accumulator Count Register2 (PACN2) Read/Write $_24 Pulse Accumulator Count Register1 (PACN1) Read/Write $_25 Pulse Accumulator Count Register0 (PACN0) Read/Write $_26 16-Bit Modulus Down Counter Register (MCCTL) Read/Write $_27 16-Bit Modulus Down Counter Flag Register (MCFLG) Read/Write $_28 Input Control Pulse Accumulator Register (ICPAR) Read/Write $_29 Delay Counter Control Register (DLYCT) Read/Write $_2A Input Control Overwrite Register (ICOVW) Read/Write $_2B Input Control System Control Register (ICSYS) Read/Write4 $_2C Reserved -- $_2D Timer Test Register (TIMTST) Read/Write2 $_2E Reserved -- $_2F Reserved -- $_30 16-Bit Pulse Accumulator B Control Register (PBCTL) Read/Write $_31 16-Bit Pulse Accumulator B Flag Register (PBFLG) Read/Write $_32 8-Bit Pulse Accumulator Holding Register3 (PA3H) Read/Write5 $_33 8-Bit Pulse Accumulator Holding Register2 (PA2H) Read/Write5 $_34 8-Bit Pulse Accumulator Holding Register1 (PA1H) Read/Write5 $_35 8-Bit Pulse Accumulator Holding Register0 (PA0H) Read/Write5 $_36 Modulus Down-Counter Count Register High (MCCNT) Read/Write 18 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Freescale Semiconductor, Inc... Table 3-1 Module Memory Map $_37 Modulus Down-Counter Count Register Low (MCCNT) Read/Write $_38 Timer Input Capture Holding Register0 High (TC0H) Read/Write5 $_39 Timer Input Capture Holding Register0 Low (TC0H) Read/Write5 $_3A Timer Input Capture Holding Register1 High(TC1H) Read/Write5 $_3B Timer Input Capture Holding Register1 Low (TC1H) Read/Write5 $_3C Timer Input Capture Holding Register2 High (TC2H) Read/Write5 $_3D Timer Input Capture Holding Register2 Low (TC2H) Read/Write5 $_3E Timer Input Capture Holding Register3 High (TC3H) Read/Write5 $_3F Timer Input Capture Holding Register3 Low (TC3H) Read/Write5 1. Always read $00. 2. Only writable in special modes (test_mode = 1). 3. Write to these registers have no meaning or effect during input capture. 4. May be written once (test_mode = 0) but writes are always permitted when test_mode = 0 5. Write has no effect. 3.3 Register Descriptions This section consists of register descriptions in address order. Each description includes a standard register diagram with an associated figure number. Details of register bit and field function follow the register diagrams, in bit order. 3.3.1 TIOS — Timer Input Capture/Output Compare Select Register Register offset: $_00 R W RESET: BIT7 6 5 4 3 2 1 BIT0 IOS7 IOS6 IOS5 IOS4 IOS3 IOS2 IOS1 IOS0 0 0 0 0 0 0 0 0 Figure 3-1 Timer Input Capture/Output Compare Register (TIOS) Read or write anytime. IOS[7:0] — Input Capture or Output Compare Channel Configuration 0 = The corresponding channel acts as an input capture 1 = The corresponding channel acts as an output compare. 19 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 3.3.2 CFORC — Timer Compare Force Register Register offset: $_01 R W RESET: BIT7 0 FOC7 0 6 0 FOC6 0 5 0 FOC5 0 4 0 FOC4 0 3 0 FOC3 0 2 0 FOC2 0 1 0 FOC1 0 BIT0 0 FOC0 0 Figure 3-2 Timer Compare Force Register (CFORC) Freescale Semiconductor, Inc... Read anytime but will always return $00 (1 state is transient). Write anytime. FOC[7:0] — Force Output Compare Action for Channel 7-0 A write to this register with the corresponding data bit(s) set causes the action which is programmed for output compare “n” to occur immediately. The action taken is the same as if a successful comparison had just taken place with the TCn register except the interrupt flag does not get set. NOTE: A successful channel 7 output compare overrides any channel 6:0 compares.If forced output compare on any channel occurs at the same time as the successful output compare then forced output compare action will take precedence and interrupt flag won’t get set. 3.3.3 OC7M — Output Compare 7 Mask Register Register offset: $_02 R W RESET: BIT7 6 5 4 3 2 1 BIT0 OC7M7 OC7M6 OC7M5 OC7M4 OC7M3 OC7M2 OC7M1 OC7M0 0 0 0 0 0 0 0 0 Figure 3-3 Output Compare 7 Mask Register (OC7M) Read or write anytime. Setting the OC7Mn (n ranges from 0 to 6) bit of OC7M register configures the corresponding port to be an output port when the IOS7 bit and the corresponding IOSn (n ranges from 0 to 6) bit of TIOS register are set to be an output compare. Refer to the note on Section 4.2.4 for more insight. NOTE: A successful channel 7 output compare overrides any channel 6:0 compares. For each OC7M bit that is set, the output compare action reflects the corresponding OC7D bit. 20 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.4 OC7D — Output Compare 7 Data Register Register offset: $_03 R W BIT7 6 5 4 3 2 1 BIT0 OC7D7 OC7D6 OC7D5 OC7D4 OC7D3 OC7D2 OC7D1 OC7D0 0 0 0 0 0 0 0 0 RESET: Figure 3-4 Output Compare 7 Data Register (OC7D) Freescale Semiconductor, Inc... Read or write anytime. A channel 7 output compare can cause bits in the output compare 7 data register to transfer to the timer port data register depending on the output compare 7 mask register. 3.3.5 TCNT — Timer Count Register Register offset: $_04-$_05 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 W tcnt 15 tcnt 14 tcnt 13 tcnt 12 tcnt 11 tcnt 10 tcnt 9 tcnt 8 tcnt 7 tcnt 6 tcnt 5 tcnt 4 tcnt 3 tcnt 2 tcnt 1 tcnt 0 RESET: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 R Figure 3-5 Timer Count Register (TCNT) The 16-bit main timer is an up counter. A full access for the counter register should take place in one clock cycle. A separate read (any mode)/ write (test mode) for high byte and low byte will give a different result than accessing them as a word. Read anytime. Write has no meaning or effect in the normal mode; only writable in special modes (test_mode = 1). The period of the first count after a write to the TCNT registers may be a different size because the write is not synchronized with the prescaler clock. 21 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 3.3.6 TSCR1 — Timer System Control Register 1 Register offset: $_06 R W RESET: BIT7 6 5 4 TEN TSWAI TSFRZ TFFCA 0 0 0 0 3 2 1 BIT0 0 0 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-6 Timer System Control Register 1 (TSCR1) Freescale Semiconductor, Inc... Read or write anytime. TEN — Timer Enable 0 = Disables the main timer, including the counter. Can be used for reducing power consumption. 1 = Allows the timer to function normally. If for any reason the timer is not active, there is no ÷64 clock for the pulse accumulator since the ÷64 is generated by the timer prescaler. TSWAI — Timer Module Stops While in Wait 0 = Allows the timer module to continue running during wait. 1 = Disables the timer module when the MCU is in the wait mode. Timer interrupts cannot be used to get the MCU out of wait. TSWAI also affects pulse accumulators and modulus down counters. TSFRZ — Timer and Modulus Counter Stop While in Freeze Mode 0 = Allows the timer and modulus counter to continue running while in freeze mode. 1 = Disables the timer and modulus counter whenever the MCU is in freeze mode. This is useful for emulation. TSFRZ does not stop the pulse accumulator. TFFCA — Timer Fast Flag Clear All 0 = Allows the timer flag clearing to function normally. 1 = For TFLG1($0E), a read from an input capture or a write to the output compare channel ($10–$1F) causes the corresponding channel flag, CnF, to be cleared. For TFLG2 ($0F), any access to the TCNT register ($04, $05) clears the TOF flag. Any access to the PACN3 and PACN2 registers ($22, $23) clears the PAOVF and PAIF flags in the PAFLG register ($21). Any access to the PACN1 and PACN0 registers ($24, $25) clears the PBOVF flag in the PBFLG register ($31). This has the advantage of eliminating software overhead in a separate clear sequence. Extra care is required to avoid accidental flag clearing due to unintended accesses. 22 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.7 TTOV — Timer Toggle On Overflow Register 1 Register offset: $_07 R W RESET: BIT7 6 5 4 3 2 1 BIT0 TOV7 TOV6 TOV5 TOV4 TOV3 TOV2 TOV1 TOV0 0 0 0 0 0 0 0 0 Figure 3-7 Timer Toggle On Overflow Register 1 (TTOV) Freescale Semiconductor, Inc... Read or write anytime. TOVn — Toggle On Overflow Bits TOVn toggles output compare pin on overflow. This feature only takes effect when in output compare mode. When set, it takes precedence over forced output compare but not channel 7 override events. 0 = Toggle output compare pin on overflow feature disabled 1 = Toggle output compare pin on overflow feature enabled 3.3.8 TCTL1/TCTL2 — Timer Control Register 1/Timer Control Register 2 Register offset:$_08 R W RESET BIT7 6 5 4 3 2 1 BIT0 OM7 OL7 OM6 OL6 OM5 OL5 OM4 OL4 0 0 0 0 0 0 0 0 BIT7 6 5 4 3 2 1 BIT0 OM3 OL3 OM2 OL2 OM1 OL1 OM0 OL0 0 0 0 0 0 0 0 0 Register offset:$_09 R W RESET Figure 3-8 Timer Control Register 1/Timer Control Register 2 (TCTL1/TCTL2) Read or write anytime. OMn — Output Mode OLn — Output Level These eight pairs of control bits are encoded to specify the output action to be taken as a result of a successful OCn(n varies from 0 to 7) compare. When either OMn or OLn is one, the port associated with OCn becomes an output tied to OCn when the corresponding IOSn bit of TIOS register is set and TEN bit of TSCR1 register is set. Refer to the note on Section 4.2.4 for more insight. 23 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 NOTE: Semiconductor, Inc. To enable output action by OMn and OLn bits on timer port, the corresponding bit in OC7M should be cleared. Table 3-2 Compare Result Output Action OMn OLn Action 0 0 Timer disconnected from output pin logic 0 1 Toggle OCn output line 1 0 Clear OCn output line to zero 1 1 Set OCn output line to one Freescale Semiconductor, Inc... To operate the 16-bit pulse accumulators A and B (PACA and PACB) independently of input capture or output compare 7 and 0 respectively the user must set the corresponding bits IOSn = 1, OMn = 0 and OLn = 0. OC7M7 or OC7M0 in the OC7M register must also be cleared. 3.3.9 TCTL3/TCTL4 — Timer Control Register 3/Timer Control Register 4 Register offset: $_0A R W RESET: BIT7 6 5 4 3 2 1 BIT0 EDG7B EDG7A EDG6B EDG6A EDG5B EDG5A EDG4B EDG4A 0 0 0 0 0 0 0 0 BIT7 6 5 4 3 2 1 BIT0 EDG3B EDG3A EDG2B EDG2A EDG1B EDG1A EDG0B EDG0A 0 0 0 0 0 0 0 0 Register offset: $_0B R W RESET: Figure 3-9 Timer Control Register 3/Timer Control Register 4 (TCTL3/TCTL4) Read or write anytime. EDGnB, EDGnA — Input Capture Edge Control These eight pairs of control bits configure the input capture edge detector circuits. The four pairs of control bits of TCTL4 also configure the 8 bit pulse accumulators PAC0 - 3. For 16 - bit pulse accumulator PACB, EDGE0B & EDGE0A, control bits of TCTL4 will decide the active edge. Table 3-3 Edge Detector Circuit Configuration EDGnB EDGnA Configuration 0 0 Capture disabled 0 1 Capture on rising edges only 1 0 Capture on falling edges only 1 1 Capture on any edge (rising or falling) 24 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.10 TIE — Timer Interrupt Enable Register Register offset: $_0C R W RESET: BIT7 6 5 4 3 2 1 BIT0 C7I C6I C5I C4I C3I C2I C1I C0I 0 0 0 0 0 0 0 0 Figure 3-10 Timer Interrupt Enable Register (TIE) Freescale Semiconductor, Inc... Read or write anytime. The bits in TIE correspond bit-for-bit with the bits in the TFLG1 status register. If cleared, the corresponding flag is disabled from causing a hardware interrupt. If set, the corresponding flag is enabled to cause a interrupt. C7I–C0I — Input Capture/Output Compare “n” Interrupt Enable 3.3.11 TSCR2 — Timer System Control Register 2 Register offset: $_0D BIT7 R W RESET: TOI 0 6 5 4 0 0 0 0 0 0 3 2 1 BIT0 TCRE PR2 PR1 PR0 0 0 0 0 = Unimplemented or Reserved Figure 3-11 Timer System Control Register 2 (TSCR2) Read or write anytime. TOI — Timer Overflow Interrupt Enable 0 = Interrupt inhibited 1 = Hardware interrupt requested when TOF flag set TCRE — Timer Counter Reset Enable This bit allows the timer counter to be reset by a successful output compare 7 event. This mode of operation is similar to an up-counting modulus counter. 0 = Counter reset inhibited and counter free runs 1 = Counter reset by a successful output compare 7 If TC7 = $0000 and TCRE = 1, TCNT will stay at $0000 continuously. If TC7 = $FFFF and TCRE = 1, TOF will never be set when TCNT is reset from $FFFF to $0000. PR2, PR1, PR0 — Timer Prescaler Select 25 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. These three bits specify the number of ÷2 stages that are to be inserted between the bus clock and the main timer counter. Freescale Semiconductor, Inc... Table 3-4 Prescaler Selection PR2 PR1 PR0 Prescale Factor 0 0 0 1 0 0 1 2 0 1 0 4 0 1 1 8 1 0 0 16 1 0 1 32 1 1 0 64 1 1 1 128 The newly selected prescale factor will not take effect until the next synchronized edge where all prescale counter stages equal zero. 3.3.12 TFLG1 — Main Timer Interrupt Flag 1 Register offset: $_0E R W RESET: BIT7 6 5 4 3 2 1 BIT0 C7F C6F C5F C4F C3F C2F C1F C0F 0 0 0 0 0 0 0 0 Figure 3-12 Main Timer Interrupt Flag 1 (TFLG1) TFLG1 indicates when interrupt conditions have occurred. To clear a bit in the flag register, write a one to the bit. Use of the TFMOD bit in the ICSYS register ($2B) in conjunction with the use of the ICOVW register ($2A) allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. Read anytime. Write used in the clearing mechanism (set bits cause corresponding bits to be cleared). Writing a zero will not affect current status of the bit. When TFFCA bit in TSCR register is set, a read from an input capture or a write into an output compare channel ($10–$1F) will cause the corresponding channel flag CnF to be cleared. C7F–C0F — Input Capture/Output Compare Channel “n” Flag. C0F can also be set by 16 - bit Pulse Accumulator B (PACB). C3F - C0F can also be set by 8 - bit pulse accumulators PAC3 - PAC0. 26 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.13 TFLG2 — Main Timer Interrupt Flag 2 Register offset: $_0F BIT7 R W RESET: TOF 0 6 5 4 3 2 1 BIT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = Unimplemented or Reserved Freescale Semiconductor, Inc... Figure 3-13 Main Timer Interrupt Flag 2 (TFLG2) TFLG2 indicates when interrupt conditions have occurred. To clear a bit in the flag register, write the bit to one. Read anytime. Write used in clearing mechanism (set bits cause corresponding bits to be cleared). Any access to TCNT will clear TFLG2 register if the TFFCA bit in TSCR register is set. TOF — Timer Overflow Flag Set when 16-bit free-running timer overflows from $FFFF to $0000. This bit is cleared automatically by a write to the TFLG2 register with bit 7 set. (See also TCRE control bit explanation.) 27 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 3.3.14 Timer Input Capture/Output Compare Registers 0-7 TC0 — Timer Input Capture/Output Compare Register 0 Register offset: $_10–$_11 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc0 15 tc0 14 tc0 13 tc0 12 tc0 11 tc0 10 tc0 9 tc0 8 tc0 7 tc0 6 tc0 5 tc0 4 tc0 3 tc0 2 tc0 1 tc0 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Freescale Semiconductor, Inc... TC1 — Timer Input Capture/Output Compare Register 1 Register offset: $_12–$_13 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc1 15 tc1 14 tc1 13 tc1 12 tc1 11 tc1 10 tc1 9 tc1 8 tc1 7 tc1 6 tc1 5 tc1 4 tc1 3 tc1 2 tc1 1 tc1 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TC2 — Timer Input Capture/Output Compare Register 2 Register offset: $_14–$_15 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc2 15 tc2 14 tc2 13 tc2 12 tc2 11 tc2 10 tc2 9 tc2 8 tc2 7 tc2 6 tc2 5 tc2 4 tc2 3 tc2 2 tc2 1 tc2 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TC3 — Timer Input Capture/Output Compare Register 3 Register offset: $_16–$_17 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc3 15 tc3 14 tc3 13 tc3 12 tc3 11 tc3 10 tc3 9 tc3 8 tc3 7 tc3 6 tc3 5 tc3 4 tc3 3 tc3 2 tc3 1 tc3 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TC4 — Timer Input Capture/Output Compare Register 4 Register offset: $_18–$_19 BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc4 15 tc4 14 tc4 13 tc4 12 tc4 11 tc4 10 tc4 9 tc4 8 tc4 7 tc4 6 tc4 5 tc4 4 tc4 3 tc4 2 tc4 1 tc4 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TC5 — Timer Input Capture/Output Compare Register 5 Register offset: $_1A–$_1B BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc5 15 tc5 14 tc5 13 tc5 12 tc5 11 tc5 10 tc5 9 tc5 8 tc5 7 tc5 6 tc5 5 tc5 4 tc5 3 tc5 2 tc5 1 tc5 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TC6 — Timer Input Capture/Output Compare Register 6 Register offset: $_1C–$_1D BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc6 15 tc6 14 tc6 13 tc6 12 tc6 11 tc6 10 tc6 9 tc6 8 tc6 7 tc6 6 tc6 5 tc6 4 tc6 3 tc6 2 tc6 1 tc6 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C TC7 — Timer Input Capture/Output Compare Register 7 Register offset: $_1E–$_1F BIT15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 R W tc7 15 tc7 14 tc7 13 tc7 12 tc7 11 tc7 10 tc7 9 tc7 8 tc7 7 tc7 6 tc7 5 tc7 4 tc7 3 tc7 2 tc7 1 tc7 0 RESET 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Figure 3-14 Timer Input Capture/Output Compare Registers 0-7 Depending on the TIOS bit for the corresponding channel, these registers are used to latch the value of the free-running counter when a defined transition is sensed by the corresponding input capture edge detector or to trigger an output action for output compare. Freescale Semiconductor, Inc... Read anytime. Write anytime for output compare function. Writes to these registers have no meaning or effect during input capture. All timer input capture/output compare registers are reset to $0000. 3.3.15 PACTL — 16-Bit Pulse Accumulator A Control Register Register offset: $_20 BIT7 R 0 W RESET: 0 6 5 4 3 2 1 BIT0 PAEN PAMOD PEDGE CLK1 CLK0 PAOVI PAI 0 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-15 16-Bit Pulse Accumulator Control Register (PACTL) 16-Bit Pulse Accumulator A (PACA) is formed by cascading the 8-bit pulse accumulators PAC3 and PAC2. When PAEN is set, the PACA is enabled. The PACA shares the input pin with IC7. Read: any time Write: any time PAEN — Pulse Accumulator A System Enable 0 = 16-Bit Pulse Accumulator A system disabled. 8-bit PAC3 and PAC2 can be enabled when their related enable bits in ICPAR ($28) are set. Pulse Accumulator Input Edge Flag (PAIF) function is disabled. 1 = 16-Bit Pulse Accumulator A system enabled. The two 8-bit pulse accumulators PAC3 and PAC2 are cascaded to form the PACA 16-bit pulse accumulator. When PACA in enabled, the PACN3 and PACN2 registers contents are respectively the high and low byte of the PACA. PA3EN and PA2EN control bits in ICPAR ($28) have no effect. Pulse Accumulator Input Edge Flag (PAIF) function is enabled. PAEN is independent from TEN. With timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. 29 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Freescale Semiconductor, Inc... PAMOD — Pulse Accumulator Mode This bit is active only when the Pulse Accumulator A is enabled (PAEN = 1). 0 = event counter mode 1 = gated time accumulation mode PEDGE — Pulse Accumulator Edge Control This bit is active only when the Pulse Accumulator A is enabled (PAEN = 1). For PAMOD bit = 0 (event counter mode). 0 = falling edges on PT7 pin cause the count to be incremented 1 = rising edges on PT7 pin cause the count to be incremented For PAMOD bit = 1 (gated time accumulation mode). 0 = PT7 input pin high enables bus clock divided by 64 to Pulse Accumulator and the trailing falling edge on PT7 sets the PAIF flag. 1 = PT7 input pin low enables bus clock divided by 64 to Pulse Accumulator and the trailing rising edge on PT7 sets the PAIF flag Table 3-5 Pin Action PAMOD PEDGE Pin Action 0 0 Falling edge 0 1 Rising edge 1 0 Div. by 64 clock enabled with pin high level 1 1 Div. by 64 clock enabled with pin low level If the timer is not active (TEN = 0 in TSCR), there is no divide-by-64 since the ÷64 clock is generated by the timer prescaler. CLK1, CLK0 — Clock Select Bits Table 3-6 Clock Selection CLK1 CLK0 Clock Source 0 0 Use timer prescaler clock as timer counter clock 0 1 Use PACLK as input to timer counter clock 1 0 Use PACLK/256 as timer counter clock frequency 1 1 Use PACLK/65536 as timer counter clock frequency For the description of PACLK please refer Figure 4-4. If the pulse accumulator is disabled (PAEN = 0), the prescaler clock from the timer is always used as an input clock to the timer counter. The change from one selected clock to the other happens immediately after these bits are written. PAOVI — Pulse Accumulator A Overflow Interrupt enable 0 = interrupt inhibited 1 = interrupt requested if PAOVF is set PAI — Pulse Accumulator Input Interrupt enable 0 = interrupt inhibited 1 = interrupt requested if PAIF is set 30 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.16 PAFLG — Pulse Accumulator A Flag Register Register offset: $_21 R BIT7 6 5 4 3 2 0 0 0 0 0 0 0 0 0 0 0 0 W RESET: 1 BIT0 PAOVF PAIF 0 0 = Unimplemented or Reserved Freescale Semiconductor, Inc... Figure 3-16 Pulse Accumulator A Flag Register (PAFLG) Read or write anytime. When the TFFCA bit in the TSCR register is set, any access to the PACNT register will clear all the flags in the PAFLG register. PAOVF — Pulse Accumulator A Overflow Flag Set when the 16-bit pulse accumulator A overflows from $FFFF to $0000,or when 8-bit pulse accumulator 3 (PAC3) overflows from $FF to $00. When PACMX = 1, PAOVF bit can also be set if 8 - bit pulse accumulator 3 (PAC3) reaches $FF followed by an active edge on PT3. This bit is cleared automatically by a write to the PAFLG register with bit 1 set. PAIF — Pulse Accumulator Input edge Flag Set when the selected edge is detected at the PT7 input pin. In event mode the event edge triggers PAIF and in gated time accumulation mode the trailing edge of the gate signal at the PT7 input pin triggers PAIF. This bit is cleared by a write to the PAFLG register with bit 0 set. Any access to the PACN3, PACN2 registers will clear all the flags in this register when TFFCA bit in register TSCR($06) is set. 31 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 3.3.17 PACN3, PACN2 — Pulse Accumulators Count Registers Register offset: $_22 BIT7 R W RESET: 6 5 4 3 2 pacnt7(15) pacnt6(14) pacnt5(13) pacnt4(12) pacnt3(11) pacnt2(10) 0 0 0 0 0 0 1 BIT0 pacnt1(9) pacnt0(8) 0 0 Figure 3-17 Pulse Accumulators Count Register 3 (PACN3) Register offset: $_23 Freescale Semiconductor, Inc... R W RESET: BIT7 6 5 4 3 2 1 BIT0 pacnt7 pacnt6 pacnt5 pacnt4 pacnt3 pacnt2 pacnt1 pacnt0 0 0 0 0 0 0 0 0 Figure 3-18 Pulse Accumulators Count Register 2 (PACN2) Read or write any time. The two 8-bit pulse accumulators PAC3 and PAC2 are cascaded to form the PACA 16-bit pulse accumulator. When PACA in enabled (PAEN=1 in PACTL, $20) the PACN3 and PACN2 registers contents are respectively the high and low byte of the PACA. When PACN3 overflows from $FF to $00, the Interrupt flag PAOVF in PAFLG ($21) is set. Full count register access should take place in one clock cycle. A separate read/write for high byte and low byte will give a different result than accessing them as a word. NOTE : When clocking pulse and write to the registers occurs simultaneously , write takes priority and the register is not incremented. 32 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.18 PACN1, PACN0 — Pulse Accumulators Count Registers Register offset: $_24 BIT7 R 6 5 4 3 2 pacnt7(15) pacnt6(14) pacnt5(13) pacnt4(12) pacnt3(11) pacnt2(10) W RESET: 0 0 0 0 0 0 1 BIT0 pacnt1(9) pacnt0(8) 0 0 Figure 3-19 Pulse Accumulators Count Register 1 (PACN1) Register offset: $_25 Freescale Semiconductor, Inc... R W RESET: BIT7 6 5 4 3 2 1 BIT0 pacnt7 pacnt6 pacnt5 pacnt4 pacnt3 pacnt2 pacnt1 pacnt0 0 0 0 0 0 0 0 0 Figure 3-20 Pulse Accumulators Count Register 0 (PACN0) Read or write any time. The two 8-bit pulse accumulators PAC1 and PAC0 are cascaded to form the PACB 16-bit pulse accumulator. When PACB in enabled, (PBEN=1 in PBCTL, $30) the PACN1 and PACN0 registers contents are respectively the high and low byte of the PACB. When PACN1 overflows from $FF to $00, the Interrupt flag PBOVF in PBFLG ($31) is set. Full count register access should take place in one clock cycle. A separate read/write for high byte and low byte will give a different result than accessing them as a word NOTE : When clocking pulse and write to the registers occurs simultaneously , write takes priority and the register is not incremented. 3.3.19 MCCTL — 16-Bit Modulus Down-Counter Control Register Register offset: $_26 R W RESET: BIT7 6 5 MCZI MODMC RDMCL 0 0 0 4 3 0 0 ICLAT FLMC 0 0 2 1 BIT0 MCEN MCPR1 MCPR0 0 0 0 Figure 3-21 16-Bit Modulus Down-Counter Control Register (MCCTL) Read or write any time. MCZI — Modulus Counter Underflow Interrupt Enable 0 = Modulus counter interrupt is disabled. 33 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 1 = Modulus counter interrupt is enabled. MODMC — Modulus Mode Enable 0 = The counter counts once from the value written to it and will stop at $0000. 1 = Modulus mode is enabled. When the counter reaches $0000, the counter is loaded with the latest value written to the modulus count register. NOTE: For proper operation, the MCEN bit should be cleared before modifying the MODMC bit in order to reset the modulus counter to $FFFF. Freescale Semiconductor, Inc... RDMCL — Read Modulus Down-Counter Load 0 = Reads of the modulus count register will return the present value of the count register. 1 = Reads of the modulus count register will return the contents of the load register. ICLAT — Input Capture Force Latch Action When input capture latch mode is enabled (LATQ and BUFEN bit in ICSYS ($2B) are set, a write one to this bit immediately forces the contents of the input capture registers TC0 to TC3 and their corresponding 8-bit pulse accumulators to be latched into the associated holding registers. The pulse accumulators will be automatically cleared when the latch action occurs. Writing zero to this bit has no effect. Read of this bit will return always zero. FLMC — Force Load Register into the Modulus Counter Count Register This bit is active only when the modulus down-counter is enabled (MCEN=1). A write one into this bit loads the load register into the modulus counter count register. This also resets the modulus counter prescaler. Write zero to this bit has no effect. When MODMC=0, counter starts counting and stops at $0000. Read of this bit will return always zero. MCEN — Modulus Down-Counter Enable 0 = Modulus counter disabled. 1 = Modulus counter is enabled. When MCEN=0, the counter is preset to $FFFF. This will prevent an early interrupt flag when the modulus down-counter is enabled. MCPR1, MCPR0 — Modulus Counter Prescaler select These two bits specify the division rate of the modulus counter prescaler. The newly selected prescaler division rate will not be effective until a load of the load register into the modulus counter count register occurs. Table 3-7 Modulus Counter Prescaler Select MCPR1 MCPR0 Prescaler division rate 0 0 1 34 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Table 3-7 Modulus Counter Prescaler Select MCPR1 MCPR0 Prescaler division rate 0 1 4 1 0 8 1 1 16 3.3.20 MCFLG — 16-Bit Modulus Down-Counter FLAG Register Register offset: $_27 BIT7 R MCZF W Freescale Semiconductor, Inc... RESET: 0 6 5 4 3 2 1 BIT0 0 0 0 POLF3 POLF2 POLF1 POLF0 0 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-22 16-Bit Modulus Down-Counter FLAG Register (MCFLG) Read: any time Write: Only for clearing bit 7 MCZF — Modulus Counter Underflow Flag The flag is set when the modulus down-counter reaches $0000. A write one to this bit clears the flag. Write zero has no effect. Any access to the MCCNT register will clear the MCZF flag in this register when TFFCA bit in register TSCR($06) is set. POLF3 – POLF0 — First Input Capture Polarity Status This are read only bits. Write to these bits has no effect. Each status bit gives the polarity of the first edge which has caused an input capture to occur after capture latch has been read. Each POLFn corresponds to a timer PORTn input. 0 = The first input capture has been caused by a falling edge. 1 = The first input capture has been caused by a rising edge. 35 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 3.3.21 ICPAR — Input Control Pulse Accumulators Register Register offset: $_28 R BIT7 6 5 4 0 0 0 0 0 0 0 0 W RESET: 3 2 1 BIT0 PA3EN PA2EN PA1EN PA0EN 0 0 0 0 = Unimplemented or Reserved Freescale Semiconductor, Inc... Figure 3-23 Input Control Pulse Accumulators Register (ICPAR) The 8-bit pulse accumulators PAC3 and PAC2 can be enabled only if PAEN in PATCL ($20) is cleared. If PAEN is set, PA3EN and PA2EN have no effect. The 8-bit pulse accumulators PAC1 and PAC0 can be enabled only if PBEN in PBTCL ($30) is cleared. If PBEN is set, PA1EN and PA0EN have no effect. Read or write any time. PAnEN — 8-Bit Pulse Accumulator Enable 0 = 8-Bit Pulse Accumulator is disabled. 1 = 8-Bit Pulse Accumulator is enabled. 3.3.22 DLYCT — Delay Counter Control Register Register offset: $_29 R BIT7 6 5 4 3 2 0 0 0 0 0 0 0 0 0 0 0 0 W RESET: 1 BIT0 DLY1 DLY0 0 0 = Unimplemented or Reserved Figure 3-24 Delay Counter Control Register (DLYCT) Read or write any time. If enabled, after detection of a valid edge on input capture pin, the delay counter counts the pre-selected number of bus clock cycles, then it will generate a pulse on its output. The pulse is generated only if the level of input signal, after the preset delay, is the opposite of the level before the transition.This will avoid reaction to narrow input pulses. After counting, the counter will be cleared automatically. Delay between two active edges of the input signal period should be longer than the selected counter delay. 36 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C DLYn — Delay Counter Select Table 3-8 Delay Counter Select DLY1 DLY0 Delay 0 0 Disabled (bypassed) 0 1 256 bus clock cycles 1 0 512 bus clock cycles 1 1 1024 bus clock cycles 3.3.23 ICOVW — Input Control Overwrite Register Freescale Semiconductor, Inc... Register offset: $_2A R W RESET: BIT7 6 5 4 3 2 1 BIT0 NOVW7 NOVW6 NOVW5 NOVW4 NOVW3 NOVW2 NOVW1 NOVW0 0 0 0 0 0 0 0 0 Figure 3-25 Input Control Overwrite Register (ICOVW) Read or write any time. An IC register is empty when it has been read or latched into the holding register. A holding register is empty when it has been read. NOVWn — No Input Capture Overwrite 0 = The contents of the related capture register or holding register can be overwritten when a new input capture or latch occurs. 1 = The related capture register or holding register cannot be written by an event unless they are empty (see 4.2.1 IC Channels). This will prevent the captured value to be overwritten until it is read or latched in the holding register. 3.3.24 ICSYS — Input Control System Control Register Register offset: $_2B R W RESET: BIT7 6 5 4 3 2 1 BIT0 SH37 SH26 SH15 SH04 TFMOD PACMX BUFEN LATQ 0 0 0 0 0 0 0 0 Figure 3-26 Input Control System Register (ICSYS) Read: any time Write: Can be written once (test_mode =0). Writes are always permitted when test_mode =1. SHxy — Share Input action of Input Capture Channels x and y 37 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Freescale Semiconductor, Inc... 0 = Normal operation 1 = The channel input ‘x’ causes the same action on the channel ‘y’. The port pin ‘x’ and the corresponding edge detector is used to be active on the channel ‘y’. TFMOD — Timer Flag-setting Mode Use of the TFMOD bit in the ICSYS register ($2B) in conjunction with the use of the ICOVW register ($2A) allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. By setting TFMOD in queue mode, when NOVW bit is set and the corresponding capture and holding registers are emptied, an input capture event will first update the related input capture register with the main timer contents. At the next event the TCn data is transferred to the TCnH register, The TCn is updated and the CnF interrupt flag is set. In all other input capture cases the interrupt flag is set by a valid external event on PTn. 0 = The timer flags C3F–C0F in TFLG1 ($0E) are set when a valid input capture transition on the corresponding port pin occurs. 1 = If in queue mode (BUFEN=1 and LATQ=0), the timer flags C3F–C0F in TFLG1 ($0E) are set only when a latch on the corresponding holding register occurs. If the queue mode is not engaged, the timer flags C3F–C0F are set the same way as for TFMOD=0. PACMX — 8-Bit Pulse Accumulators Maximum Count 0 = Normal operation. When the 8-bit pulse accumulator has reached the value $FF, with the next active edge, it will be incremented to $00. 1 = When the 8-bit pulse accumulator has reached the value $FF, it will not be incremented further. The value $FF indicates a count of 255 or more. BUFEN — IC Buffer Enable 0 = Input Capture and pulse accumulator holding registers are disabled. 1 = Input Capture and pulse accumulator holding registers are enabled. The latching mode is defined by LATQ control bit. Write one into ICLAT bit in MCCTL ($26), when LATQ is set will produce latching of input capture and pulse accumulators registers into their holding registers. LATQ — Input Control Latch or Queue Mode Enable The BUFEN control bit should be set in order to enable the IC and pulse accumulators holding registers. Otherwise LATQ latching modes are disabled. Write one into ICLAT bit in MCCTL ($26), when LATQ and BUFEN are set will produce latching of input capture and pulse accumulators registers into their holding registers. 0 = Queue Mode of Input Capture is enabled. The main timer value is memorized in the IC register by a valid input pin transition. With a new occurrence of a capture, the value of the IC register will be transferred to its holding register and the IC register memorizes the new timer value. 1 = Latch Mode is enabled. Latching function occurs when modulus down-counter reaches zero or a zero is written into the count register MCCNT (see 4.2.1.2 Buffered IC Channels). With a latching event the contents of IC registers and 8-bit pulse accumulators are transferred to their holding registers. 8-bit pulse accumulators are cleared. 38 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.25 TIMTST — Timer Test Register Register offset: $_2D R BIT7 6 5 4 3 2 0 0 0 0 0 0 0 0 0 0 0 0 W RESET: 1 TCBYP 0 BIT0 0 0 = Unimplemented or Reserved Freescale Semiconductor, Inc... Figure 3-27 Timer Test Register (TIMTST) Read: any time Write: only in special mode (test_mode = 1). TCBYP — Main Timer Divider Chain Bypass 0 = Normal operation 1 = For testing only. The 16-bit free-running timer counter is divided into two 8-bit halves and the prescaler is bypassed. The clock drives both halves directly. When the high byte of timer counter TCNT ($04) overflows from $FF to $00, the TOF flag in TFLG2 ($0F) will be set. 3.3.26 PBCTL — 16-Bit Pulse Accumulator B Control Register Register offset: $_30 BIT7 R 0 W RESET: 0 6 PBEN 0 5 4 3 2 0 0 0 0 0 0 0 0 1 PBOVI 0 BIT0 0 0 = Unimplemented or Reserved Figure 3-28 16-Bit Pulse Accumulator B Control Register (PBCTL) Read or write any time. 16-Bit Pulse Accumulator B (PACB) is formed by cascading the 8-bit pulse accumulators PAC1 and PAC0. When PBEN is set, the PACB is enabled. The PACB shares the input pin with IC0. PBEN — Pulse Accumulator B System Enable 0 = 16-bit Pulse Accumulator system disabled. 8-bit PAC1 and PAC0 can be enabled when their related enable bits in ICPAR ($28) are set. 39 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 1 = Pulse Accumulator B system enabled. The two 8-bit pulse accumulators PAC1 and PAC0 are cascaded to form the PACB 16-bit pulse accumulator. When PACB in enabled, the PACN1 and PACN0 registers contents are respectively the high and low byte of the PACB. PA1EN and PA0EN control bits in ICPAR ($28) have no effect. PBEN is independent from TEN. With timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. PBOVI — Pulse Accumulator B Overflow Interrupt enable 0 = interrupt inhibited 1 = interrupt requested if PBOVF is set 3.3.27 PBFLG — Pulse Accumulator B Flag Register Freescale Semiconductor, Inc... Register offset: $_31 R BIT7 6 5 4 3 2 0 0 0 0 0 0 0 0 0 0 0 0 W RESET: 1 PBOVF 0 BIT0 0 0 = Unimplemented or Reserved Figure 3-29 Pulse Accumulator B Flag Register (PBFLG) Read or write any time. PBOVF — Pulse Accumulator B Overflow Flag This bit is set when the 16-bit pulse accumulator B overflows from $FFFF to $0000, or when 8-bit pulse accumulator 1 (PAC1) overflows from $FF to $00. This bit is cleared by a write to the PBFLG register with bit 1 set. Any access to the PACN1 and PACN0 registers will clear the PBOVF flag in this register when TFFCA bit in register TSCR($06) is set. When PACMX = 1, PBOVF bit can also be set if 8 - bit pulse accumulator 1 (PAC1) reaches $FF and followed an active edge comes on PT1. 40 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.28 PA3H–PA0H — 8-Bit Pulse Accumulators Holding Registers Register offset: $_32 R BIT7 6 5 4 3 2 1 BIT0 PA3H7 PA3H6 PA3H5 PA3H4 PA3H3 PA3H2 PA3H1 PA3H0 0 0 0 0 0 0 0 0 W RESET: = Unimplemented or Reserved Figure 3-30 8-Bit Pulse Accumulators Holding Register 3 (PA3H) Freescale Semiconductor, Inc... Register offset: $_33 R BIT7 6 5 4 3 2 1 BIT0 PA2H7 PA2H6 PA2H5 PA2H4 PA2H3 PA2H2 PA2H1 PA2H0 0 0 0 0 0 0 0 0 W RESET: = Unimplemented or Reserved Figure 3-31 8-Bit Pulse Accumulators Holding Register 2 (PA2H) Register offset: $_34 R BIT7 6 5 4 3 2 1 BIT0 PA1H7 PA1H6 PA1H5 PA1H4 PA1H3 PA1H2 PA1H1 PA1H0 0 0 0 0 0 0 0 0 W RESET: = Unimplemented or Reserved Figure 3-32 8-Bit Pulse Accumulators Holding Register 1 (PA1H) Register offset: $_35 R BIT7 6 5 4 3 2 1 BIT0 PA0H7 PA0H6 PA0H5 PA0H4 PA0H3 PA0H2 PA0H1 PA0H0 0 0 0 0 0 0 0 0 W RESET: = Unimplemented or Reserved Figure 3-33 8-Bit Pulse Accumulators Holding Register 0 (PA0H) 41 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Read: any time Write: has no effect. These registers are used to latch the value of the corresponding pulse accumulator when the related bits in register ICPAR ($28) are enabled (see 4.2.2 Pulse Accumulators). 3.3.29 MCCNT — Modulus Down-Counter Count Register Register address:$_36-$_37 BIT15 R W Freescale Semiconductor, Inc... RESET 14 13 12 11 10 9 8 7 6 5 4 3 2 1 BIT0 mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt mccnt 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Figure 3-34 Modulus Down-Counter Count Register (MCCNT) Read or write any time. A full access for the counter register should take place in one clock cycle. A separate read/write for high byte and low byte will give different result than accessing them as a word. If the RDMCL bit in MCCTL register is cleared, reads of the MCCNT register will return the present value of the count register. If the RDMCL bit is set, reads of the MCCNT will return the contents of the load register. If a $0000 is written into MCCNT and modulus counter while LATQ and BUFEN in ICSYS ($2B) register are set, the input capture and pulse accumulator registers will be latched. With a $0000 write to the MCCNT, the modulus counter will stay at zero and does not set the MCZF flag in MCFLG register. If modulus mode is enabled (MODMC=1), a write to this address will update the load register with the value written to it. The count register will not be updated with the new value until the next counter underflow. The FLMC bit in MCCTL ($26) can be used to immediately update the count register with the new value if an immediate load is desired. If modulus mode is not enabled (MODMC=0), a write to this address will clear the prescaler and will immediately update the counter register with the value written to it and down-counts once to $0000. 42 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 3.3.30 Timer Input Capture Holding Registers 0-3 Register offset: $_38-$_39 BIT15 R 14 13 12 11 10 TC15 TC14 TC13 TC12 TC11 TC10 9 8 7 6 5 4 3 2 1 BIT0 TC9 TC8 TC7 TC6 TC5 TC4 TC3 TC2 TC1 TC0 0 0 0 0 0 0 0 0 0 0 W RESET: 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-35 Timer Input Capture Holding Register 0 (TC0H) Freescale Semiconductor, Inc... Register offset: $_3A-$_3B BIT15 R 14 13 12 11 10 TC15 TC14 TC13 TC12 TC11 TC10 9 8 7 6 5 4 3 2 1 BIT0 TC9 TC8 TC7 TC6 TC5 TC4 TC3 TC2 TC1 TC0 0 0 0 0 0 0 0 0 0 0 W RESET: 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-36 Timer Input Capture Holding Register 1 (TC1H) Register offset: $_3C-$_3D BIT15 R 14 13 12 11 10 TC15 TC14 TC13 TC12 TC11 TC10 9 8 7 6 5 4 3 2 1 BIT0 TC9 TC8 TC7 TC6 TC5 TC4 TC3 TC2 TC1 TC0 0 0 0 0 0 0 0 0 0 0 W RESET: 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-37 Timer Input Capture Holding Register 2 (TC2H) Register offset: $_3E-$_3F BIT15 R 14 13 12 11 10 TC15 TC14 TC13 TC12 TC11 TC10 9 8 7 6 5 4 3 2 1 BIT0 TC9 TC8 TC7 TC6 TC5 TC4 TC3 TC2 TC1 TC0 0 0 0 0 0 0 0 0 0 0 W RESET: 0 0 0 0 0 0 = Unimplemented or Reserved Figure 3-38 Timer Input Capture Holding Register 3 (TC3H) 43 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Read: any time Write: has no effect. Freescale Semiconductor, Inc... These registers are used to latch the value of the input capture registers TC0 – TC3. The corresponding IOSn bits in TIOS ($00) should be cleared (see 4.2.1 IC Channels). 44 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 4 Functional Description 4.1 General Freescale Semiconductor, Inc... This section provides a complete functional description of the ECT block, detailing the operation of the design from the end user perspective in a number of subsections. 45 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Refer to the Timer Block Diagrams from Figure 4-1 to Figure 4-5 as necessary. Figure 4-1 Detailed Timer Block Diagram in Latch mode TIMCLK ÷ 1, 2, ..., 128 bus clock Prescaler 16-bit Free-running 16 BIT MAIN mainTIMER timer PCLK 16-bit load register ÷ 1, 4, 8, 16 bus clock 16-bit modulus down counter Prescaler RESET 0 P0 Pin logic Delay counter EDG0 TC0 capture/compare register TC0H hold register Underflow Comparator PAC0 PA0H hold register RESET 0 Comparator P1 Pin logic Freescale Semiconductor, Inc... Delay counter EDG1 TC1 capture/compare register TC1H hold register PAC1 PA1H hold register RESET 0 P2 Comparator Pin logic Delay counter EDG2 TC2 capture/compare register TC2H hold register PAC2 PA2H hold register RESET 0 Comparator Pin logic Delay counter EDG3 TC3 capture/compare register TC3H hold register P4 PAC3 PA3H hold register LATCH P3 Comparator Pin logic EDG4 EDG0 TC4 capture/compare register MUX ICLAT, LATQ, BUFEN (force latch) SH04 Comparator P5 Pin logic EDG5 EDG1 TC5 capture/compare register MUX Write $0000 to modulus counter SH15 P6 Comparator Pin logic EDG6 EDG2 TC6 capture/compare register MUX SH26 P7 Comparator Pin logic EDG7 EDG3 TC7 capture/compare register MUX SH37 46 For More Information On This Product, Go to: www.freescale.com LATQ (MDC latch enable) Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Figure 4-2 Detailed Timer Block Diagram in Queue mode 16-bit Free-running 16 BIT MAIN mainTIMER timer TIMCLK ÷1, 2, ..., 128 bus clock bus clock Prescaler 16-bit load register ÷ 1, 4, 8, 16 16-bit modulus down counter Prescaler PCLK 0 RESET Comparator Pin logic Delay counter EDG0 TC0 capture/compare register TC0H hold register PAC0 LATCH0 P0 PA0H hold register 0 RESET Comparator Pin logic EDG1 TC1 capture/compare register TC1H hold register PAC1 PA1H hold register 0 RESET Comparator Pin logic Delay counter EDG2 TC2 capture/compare register TC2H hold register PAC2 PA2H hold register 0 RESET LATCH2 P2 Comparator P3 Pin logic Delay counter EDG3 TC3 capture/compare register TC3H hold register PAC3 PA3H hold register LATCH3 Freescale Semiconductor, Inc... Delay counter LATCH1 P1 Comparator P4 Pin logic EDG4 TC4 capture/compare register EDG0 SH04 Comparator P5 Pin logic LATQ, BUFEN (queue mode) MUX EDG5 Read TC3H hold register TC5 capture/compare register MUX EDG1 Read TC2H hold register SH15 Comparator P6 Pin logic EDG6 TC6 capture/compare register MUX EDG2 Read TC1H hold register SH26 Comparator P7 Pin logic EDG7 EDG3 TC7 capture/compare register Read TC0H hold register MUX SH37 47 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Figure 4-3 8-Bit Pulse Accumulators Block Diagram Load holding register and reset pulse accumulator 0 8-bit PAC0 (PACN0) EDG0 P0 Edge detector Delay counter PA0H holding register Freescale Semiconductor, Inc... Interrupt 0 EDG1 P1 Edge detector 8-bit PAC1 (PACN1) Delay counter PA1H holding register 0 EDG2 P2 Edge detector 8-bit PAC2 (PACN2) Delay counter PA2H holding register Interrupt 0 EDG3 P3 Edge detector 8-bit PAC3 (PACN3) Delay counter PA3H holding register 48 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Figure 4-4 16-Bit Pulse Accumulators Block Diagram TIMCLK (Timer clock) CLK1 CLK0 Freescale Semiconductor, Inc... Clock select (PAMOD) Edge detector P7 PACLK PACLK / 256 PACLK / 65536 Prescaled clock (PCLK) 4:1 MUX Interrupt 8-bit PAC3 (PACN3) 8-bit PAC2 (PACN2) MUX PACA Divide by 64 bus clock Interrupt 8-bit PAC1 (PACN1) 8-bit PAC0 (PACN0) Delay counter PACB Edge detector P0 49 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. Figure 4-5 Block Diagram for Port7 with Output compare/Pulse Accumulator A 16-bit Main Timer Pn Edge detector Delay counter Set CnF Interrupt TCn Input Capture Reg. Freescale Semiconductor, Inc... TCnH I.C. Holding Reg. BUFEN • LATQ • TFMOD 4.2 Enhanced Capture Timer Modes of Operation The Enhanced Capture Timer has 8 Input Capture, Output Compare (IC/OC) channels same as on the HC12 standard timer (timer channels TC0 to TC7). When channels are selected as input capture by selecting the IOSn bit in TIOS register, they are called Input Capture (IC) channels. Four IC channels are the same as on the standard timer with one capture register each which memorizes the timer value captured by an action on the associated input pin. Four other IC channels, in addition to the capture register, have also one buffer each called holding register. This permits to memorize two different timer values without generation of any interrupt. Four 8-bit pulse accumulators are associated with the four buffered IC channels. Each pulse accumulator has a holding register to memorize their value by an action on its external input. Each pair of pulse accumulators can be used as a 16-bit pulse accumulator. The 16-bit modulus down-counter can control the transfer of the IC registers contents and the pulse accumulators to the respective holding registers for a given period, every time the count reaches zero. The modulus down-counter can also be used as a stand-alone time base with periodic interrupt capability. 4.2.1 IC Channels The IC channels are composed of four standard IC registers and four buffered IC channels. An IC register is empty when it has been read or latched into the holding register. A holding register is empty when it has been read. 50 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 4.2.1.1 Non-Buffered IC Channels The main timer value is memorized in the IC register by a valid input pin transition. If the corresponding NOVWx bit of the ICOVW register is cleared, with a new occurrence of a capture, the contents of IC register are overwritten by the new value. If the corresponding NOVWx bit of the ICOVW register is set, the capture register cannot be written unless it is empty. This will prevent the captured value to be overwritten until it is read. 4.2.1.2 Buffered IC Channels Freescale Semiconductor, Inc... There are two modes of operations for the buffered IC channels. • IC Latch Mode: When enabled (LATQ=1), the main timer value is memorized in the IC register by a valid input pin transition. See Figure 4-1 The value of the buffered IC register is latched to its holding register by the Modulus counter for a given period when the count reaches zero, by a write $0000 to the modulus counter or by a write to ICLAT in the MCCTL register. If the corresponding NOVWn bit of the ICOVW register is cleared, with a new occurrence of a capture, the contents of IC register are overwritten by the new value. In case of latching, the contents of its holding register are overwritten. If the corresponding NOVWn bit of the ICOVW register is set, the capture register or its holding register cannot be written by an event unless they are empty (see 4.2.1). This will prevent the captured value to be overwritten until it is read or latched in the holding register. • IC queue mode: When enabled (LATQ=0), the main timer value is memorized in the IC register by a valid input pin transition. See Figure 4-2 If the corresponding NOVWn bit of the ICOVW register is cleared, with a new occurrence of a capture, the value of the IC register will be transferred to its holding register and the IC register memorizes the new timer value. If the corresponding NOVWn bit of the ICOVW register is set, the capture register or its holding register cannot be written by an event unless they are empty (see 4.2.1). In queue mode, reads of holding register will latch the corresponding pulse accumulator value to its holding register. 4.2.1.3 Delayed IC channels There are four delay counters in this module associated with IC channels 0 - 3. The use of this feature is 51 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. explained in the diagram and notes below. Figure 4-6 Channel Input validity with delay counter feature BUS CLOCK DLY_CNT 0 2 1 INPUT ON CH0-3 254 255 256 255 cycles INPUT ON CH0-3 Freescale Semiconductor, Inc... 253 3 rejected 255.5 cycles rejected INPUT ON CH0-3 255.5 cycles accepted INPUT ON CH0-3 256 cycles accepted In the diagram above a delay counter value of 256 bus cycles is considered. 1. Input pulses with a duration of (DLY_CNT - 1) cycles or shorter are rejected. 2. Input pulses with a duration between (DLY_CNT - 1) and DLY_CNT cycles may be rejected or accepted, depending on their relative alignment with the sample points. 3. Input pulses with a duration between (DLY_CNT - 1) and DLY_CNT cycles may be rejected or accepted, depending on their relative alignment with the sample points. 4. Input pulses with a duration of DLY_CNT or longer are accepted. 4.2.2 Pulse Accumulators There are four 8-bit pulse accumulators with four 8-bit holding registers associated with the four IC buffered channels. A pulse accumulator counts the number of active edges at the input of its channel. The user can prevent 8-bit pulse accumulators counting further than $FF by PACMX control bit in ICSYS ($2B). In this case a value of $FF means that 255 counts or more have occurred. Each pair of pulse accumulators can be used as a 16-bit pulse accumulator. See Figure 4-4 There are two modes of operation for the pulse accumulators. 52 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C 4.2.2.1 Pulse Accumulator latch mode The value of the pulse accumulator is transferred to its holding register when the modulus down-counter reaches zero, a write $0000 to the modulus counter or when the force latch control bit ICLAT is written. At the same time the pulse accumulator is cleared. 4.2.2.2 Pulse Accumulator queue mode When queue mode is enabled, reads of an input capture holding register will transfer the contents of the associated pulse accumulator to its holding register. At the same time the pulse accumulator is cleared. Freescale Semiconductor, Inc... 4.2.3 Modulus Down-Counter The modulus down-counter can be used as a time base to generate a periodic interrupt. It can also be used to latch the values of the IC registers and the pulse accumulators to their holding registers. The action of latching can be programmed to be periodic or only once. 4.2.4 Channel Configurations Timer Channels can be configured as input capture channels or output compare channels. Following are the ways a port can be configured as an output for OC. The pin associated with channel 7 becomes output-tied to OC7 when • TEN = 1, IOS7 = 1, and either or both of OM7 and OL7 are set. or • OC7M7 =1 and IOS7 = 1. When masking, the timer does not have to be enabled so that the pin associated with OCn becomes an output tied to OCn. The pins associated with channels 0-6 become output-tied to OCn (n=0..6) when • TEN = 1, IOSn = 1, and either or both of OMn and OLn are set or • OC7Mn =1, IOS7 = 1 and IOSn = 1 Once the pin is configured as OC, its initial state is zero and its status is changed (if needed) on consecutive clock cycles following the write which enabled the ECT to drive the pin. In other words after a pin starts to be driven by ECT OC logic, it is forced low for at least one clock cycle. 53 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 54 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 5 Reset 5.1 General Freescale Semiconductor, Inc... The reset state of each individual bit is listed within the Register Description section (Section 3 Memory Map and Registers) which details the registers and their bit-fields. 55 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 56 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Section 6 Interrupts 6.1 General This section describes interrupts originated by the ECT_16B8C block.The MCU must service the interrupt requests. Table 6-1 lists the interrupts generated by the ECT to communicate with the MCU. Table 6-1 ECT Interrupts Interrupt Source Timer Channel 7-0 Freescale Semiconductor, Inc... Modulus counter underflow Description Active high timer channel interrupts 7-0 Active high modulus counter interrupt Pulse Accumulator B Overflow Active high pulse accumulator B interrupt Pulse Accumulator A Input Active high pulse accumulator A input interrupt Pulse Accumulator A Overflow Pulse accumulator overflow interrupt Timer Overflow Timer Overflow interrupt 6.2 Description of Interrupt Operation The ECT_16B8C only originates interrupt requests. The following is a description of how the module makes a request and how the MCU should acknowledge that request. The interrupt vector offset and interrupt number are chip dependent. 6.2.1 Channel [7:0] Interrupt This active high output will be asserted by the module to request a timer channel 7 - 0 interrupt to be serviced by the system controller. 6.2.2 Modulus Counter Interrupt This active high output will be asserted by the module to request a modulus counter underflow interrupt to be serviced by the system controller. 6.2.3 Pulse Accumulator B Overflow Interrupt) This active high output will be asserted by the module to request a timer pulse accumulator B overflow interrupt to be serviced by the system controller. 6.2.4 Pulse Accumulator A Input Interrupt This active high output will be asserted by the module to request a timer pulse accumulator A input interrupt to be serviced by the system controller. 57 For More Information On This Product, Go to: www.freescale.com ECT_16B8C Block User GuideFreescale V01.06 Semiconductor, Inc. 6.2.5 Pulse Accumulator A Overflow Interrupt This active high output will be asserted by the module to request a timer pulse accumulator A overflow interrupt to be serviced by the system controller. 6.2.6 Timer Overflow Interrupt Freescale Semiconductor, Inc... This active high output will be asserted by the module to request a timer overflow interrupt to be serviced by the system controller. 58 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Block User Guide V01.06 ECT_16B8C Freescale Semiconductor, Inc... User Guide End Sheet 59 For More Information On This Product, Go to: www.freescale.com Semiconductor, Inc. Freescale Semiconductor, Inc... ECT_16B8C Block User GuideFreescale V01.06 FINAL PAGE OF 60 PAGES 60 For More Information On This Product, Go to: www.freescale.com