Go to page of
Similar user manuals
-
Computer Hardware
Freescale Semiconductor MCF5480
1032 pages 8.48 mb -
Computer Hardware
Freescale Semiconductor SC140
760 pages 8.24 mb -
Computer Hardware
Freescale Semiconductor MCF5485
1032 pages 8.48 mb -
Computer Hardware
Freescale Semiconductor MCF5482
1032 pages 8.48 mb -
Computer Hardware
Freescale Semiconductor 56F8122
137 pages 0.85 mb -
Computer Hardware
Freescale Semiconductor MCF5481
1032 pages 8.48 mb -
Computer Hardware
Freescale Semiconductor MC68HC08KH12
262 pages 2.52 mb -
Computer Hardware
Freescale Semiconductor MPC8260
1360 pages 9.52 mb
A good user manual
The rules should oblige the seller to give the purchaser an operating instrucion of Freescale Semiconductor MC68HC908MR32, along with an item. The lack of an instruction or false information given to customer shall constitute grounds to apply for a complaint because of nonconformity of goods with the contract. In accordance with the law, a customer can receive an instruction in non-paper form; lately graphic and electronic forms of the manuals, as well as instructional videos have been majorly used. A necessary precondition for this is the unmistakable, legible character of an instruction.
What is an instruction?
The term originates from the Latin word „instructio”, which means organizing. Therefore, in an instruction of Freescale Semiconductor MC68HC908MR32 one could find a process description. An instruction's purpose is to teach, to ease the start-up and an item's use or performance of certain activities. An instruction is a compilation of information about an item/a service, it is a clue.
Unfortunately, only a few customers devote their time to read an instruction of Freescale Semiconductor MC68HC908MR32. A good user manual introduces us to a number of additional functionalities of the purchased item, and also helps us to avoid the formation of most of the defects.
What should a perfect user manual contain?
First and foremost, an user manual of Freescale Semiconductor MC68HC908MR32 should contain:
- informations concerning technical data of Freescale Semiconductor MC68HC908MR32
- name of the manufacturer and a year of construction of the Freescale Semiconductor MC68HC908MR32 item
- rules of operation, control and maintenance of the Freescale Semiconductor MC68HC908MR32 item
- safety signs and mark certificates which confirm compatibility with appropriate standards
Why don't we read the manuals?
Usually it results from the lack of time and certainty about functionalities of purchased items. Unfortunately, networking and start-up of Freescale Semiconductor MC68HC908MR32 alone are not enough. An instruction contains a number of clues concerning respective functionalities, safety rules, maintenance methods (what means should be used), eventual defects of Freescale Semiconductor MC68HC908MR32, and methods of problem resolution. Eventually, when one still can't find the answer to his problems, he will be directed to the Freescale Semiconductor service. Lately animated manuals and instructional videos are quite popular among customers. These kinds of user manuals are effective; they assure that a customer will familiarize himself with the whole material, and won't skip complicated, technical information of Freescale Semiconductor MC68HC908MR32.
Why one should read the manuals?
It is mostly in the manuals where we will find the details concerning construction and possibility of the Freescale Semiconductor MC68HC908MR32 item, and its use of respective accessory, as well as information concerning all the functions and facilities.
After a successful purchase of an item one should find a moment and get to know with every part of an instruction. Currently the manuals are carefully prearranged and translated, so they could be fully understood by its users. The manuals will serve as an informational aid.
Table of contents for the manual
-
Page 1
M68HC08 Micr ocontr oller s freescale.com MC68HC908MR32 MC68HC908MR16 Data Sheet MC68HC908MR32 Rev. 6.1 07/2005[...]
-
Page 2
[...]
-
Page 3
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 3 Freescale™ and the Freescal e logo are trade marks of Freescale Semicon ductor, Inc. This product incorporates Su perFlash® technology licensed from SST. © Freescale Semiconductor, Inc., 2005. All rights reserved. MC68HC908MR32 MC68HC908MR16 Data Sheet To provide t[...]
-
Page 4
Revision History MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 4 Freescale Semiconductor The following revision history table summarize s changes contained in this document. For your convenience, the page number de signators have been linked to the appropriate loca tion. Revision History Date Revision Level Description Page Number(s) Augus[...]
-
Page 5
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 5 List of Chapters Chapter 1 General Descr iption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Chapter 2 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 6
List of Chapters MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 6 Freescale Semiconductor[...]
-
Page 7
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 7 Table of Contents Chapter 1 General Description 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 8
Table of Contents MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 8 Freescale Semiconductor 2.8.7 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.8.8 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 9
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 9 4.4 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.4.1 Crystal Amplifier Input Pin (OSC1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 10
Table of Contents MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 10 Freescale Semiconductor Chapter 7 Central Processor Unit (CPU) 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 11
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 11 Chapter 10 Input/Output (I/O) Ports (PORTS) 10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 10.2 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 12
Table of Contents MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 12 Freescale Semiconductor 12.6.2 Software Output Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 12.6.3 Output Port Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 13
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 13 13.7.3 SCI Control Register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 13.7.4 SCI Status Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .[...]
-
Page 14
Table of Contents MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 14 Freescale Semiconductor 15.5.1 Clock Phase and Polarity Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 9 15.5.2 Transmission Format When CPHA = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 15
MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 15 Chapter 17 Timer Interface B (TIMB) 17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 17.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 16
Table of Contents MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 16 Freescale Semiconductor 18.3 Monitor ROM (MON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 18.3.1 Functional Descriptio n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
-
Page 17
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 17 Chapter 1 General Description 1.1 Introduction The MC68HC908MR32 is a member of the low-cost , high-performance M68HC08 Family of 8- bit microcontroller units (MCUs). All MCUs in the fa mily use the enhanced M68HC 08 central processor unit (CPU08) and are available wi[...]
-
Page 18
General De scription MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 18 Freescale Semiconductor • Available packages: – 64-pin plastic quad f lat pack (QFP) – 56-pin shrink dual in -line package (SDIP) • Low-power design, fully static with wait mode • Master reset pin (RST ) a nd power-on reset (POR) • Stop mode as an option • [...]
-
Page 19
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 19 MCU Block Diagram Figure 1-1. MCU Block Diagram CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOLTAGE INHIBIT MODULE POWER-ON RESET MODULE COMPUTER OPERATING [...]
-
Page 20
General De scription MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 20 Freescale Semiconductor 1.4 Pin Assignments Figure 1-2 shows the 64-pin QFP pin assignments and Figure 1 -3 shows the 56-pin SDIP pin assignments. Figure 1-2. 64-Pin QF P Pin Assignments PTC1/ATD9 PTA2 V SS PTC0/ATD8 PTB7/ATD7 PTB6/ATD6 PTB5/ATD5 PTB4/ATD4 PTB3/ATD3 PTB2[...]
-
Page 21
Pin Assignments MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 21 Figure 1-3. 56-Pin SDIP Pin Assignments PTA2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 PTA3 PTA4 PTA5 PTA6 PTA7 PTB0/ATD0 PTB1/ATD1 PTB[...]
-
Page 22
General De scription MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 22 Freescale Semiconductor 1.4.1 Power Supply Pins (V DD and V SS ) V DD and V SS are the power supply and grou nd pins. Th e MCU operates from a single power supply. Fast signal transitions on MCU pins place high, short-duration current demands on the power supply. To prev[...]
-
Page 23
Pin Assignments MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 23 1.4.6 External Filter Capacitor Pin (CGMXFC) CGMXFC is an external filter capacitor connection for the CGM. See Chapter 4 Clock Generator Module (CGM) . 1.4.7 Analog Power Supply Pins (V DDAD and V SSAD ) V DDAD and V SSAD are the power supply pins for[...]
-
Page 24
General De scription MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 24 Freescale Semiconductor 1.4.15 PWM Gr ound Pin (PWMGND) PWMGND is the ground pin for the pulse-width modu lator module (PWMMC). This dedicated ground pin is used as the ground for the six high-current PWM pins. See Chapter 12 Pulse-Width Modulator for Motor Control (PWMM[...]
-
Page 25
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 25 Chapter 2 Memory 2.1 Introduction The central processor unit (CPU08) can address 6 4 Kb ytes of memory space. The memory map, shown in Figure 2-1 , includes: • 32 Kbytes of FLASH • 768 bytes of random-access memory (RAM) • 46 bytes of user-define d vectors • 2[...]
-
Page 26
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 26 Freescale Semiconductor 2.4 I/O Section Addresses $0000–$005F, shown in Figure 2-2 , contain most of the control, status, and data registers. Additional I/O registers have these addresses: • $FE00, SIM break status regis ter (SBSR) • $FE01, SIM reset status register (SRSR) • $[...]
-
Page 27
Memory Ma p MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 27 $0000 ↓ $005F I/O REGISTERS — 96 BYTES $0060 ↓ $035F RAM — 768 BYTES $0360 ↓ $7FFF UNIMPLEMENTED — 31,904 BYTES $8000 ↓ $FDFF FLASH — 32,256 BYTES $FE00 SIM BREAK STATUS REGISTER (SBSR) $FE01 SIM RESET STATUS REGISTER (SRSR) $FE02 RESERVED [...]
-
Page 28
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 28 Freescale Semiconductor Addr. Register Name Bit 7 6 5 4 3 2 1 Bit 0 $0000 Port A Data Register (PTA) See page 103 . Read: PTA7 PTA6 PTA5 PTA4 PTA3 PTA2 PTA1 PTA0 Write: Reset: Unaffected by reset $0001 Port B Data Register (PTB) See page 104 . Read: PTB7 PTB6 PTB5 PTB4 PTB3 PTB2 PTB1 [...]
-
Page 29
Memory Ma p MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 29 $000E TIMA Status/Control Regist er (TASC) See page 226 . Read: TOF TOIE TSTOP 00 PS2 PS1 PS0 Write: 0 TRST R Reset: 0 0 1 0 0 0 0 0 $000F TIMA Counter Re gister High (TACNTH) See page 227 . Read: Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Write[...]
-
Page 30
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 30 Freescale Semiconductor $001A TIMA Channel 2 Register High (TACH2H) See page 232 . Read: Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Write: Reset: Indeterminate after rese t $001B TIMA Channel 2 Register L ow (TACH2L) See page 232 . Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 [...]
-
Page 31
Memory Ma p MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 31 $0026 PWM Counter Re gister High (PCNTH) See page 143 . Read: 0 0 0 0 Bit 11 Bit 10 Bi t 9 Bit 8 Write: Reset: 0 0 0 0 0 0 0 0 $0027 PWM Counter Register Low (PCNTL) See page 143 . Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Write: Reset: 0 0 0 0[...]
-
Page 32
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 32 Freescale Semiconductor $0032 PWM 5 Value Regis ter High (PMVAL5H) See page 145 . Read: Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Write: Reset: 0 0 0 0 0 0 0 0 $0033 PWM 5 Value Reg ister Low (PVAL5L) See page 145 . Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Wri[...]
-
Page 33
Memory Ma p MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 33 $003E SCI Baud Rate Regi ster (SCBR) See page 177 . Read: 0 0 SCP1 SCP0 0 SCR2 SCR1 SCR0 Write: R R R Reset: 0 0 0 0 0 0 0 0 $003F IRQ Status/Control Register (ISCR) See page 94. Read: 0 0 0 0 IRQF 0 IMASK1 MODE1 Write: R R R R ACK1 Reset: 0 0 0 0 0 0 0 0 [...]
-
Page 34
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 34 Freescale Semiconductor $0053 TIMB Counter Register Low (TBCNTL) See page 246 . Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Write: R R R R R R R R Reset: 0 0 0 0 0 0 0 0 $0054 TIMB Counter Modulo Regist er High (TBMODH) See page 246 . Read: Bit 15 Bit 14 Bit 13 Bit 12 Bit 11[...]
-
Page 35
Memory Ma p MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 35 $FE00 SIM Break Status Regist er (SBSR) See page 191 . Read: RR R R R R B W R Write: Reset: 0 $FE01 SIM Reset Status Regist er (SRSR) See page 192 . Read: POR PIN COP ILOP ILAD MENRST LVI 0 Write: R R R R R R R R Reset: 1 0 0 0 0 0 0 0 $FE03 SIM Break Flag[...]
-
Page 36
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 36 Freescale Semiconductor Table 2-1 is a list of vector locations. T able 2-1. V ector Ad dresses Address Vector Low $FFD2 SCI t r ansmit v ector (high) $FFD3 SCI t ransmit v ector (low) $FFD4 SCI receive v ector (high) $FFD5 SCI receive v ector (low) $FFD6 SCI error v ector (high) $FFD[...]
-
Page 37
Monitor ROM MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 37 2.6 Monitor ROM The 240 bytes at addresses $FE10–$FEFF are reserved ROM addresses that con tain the instructions for the monitor functions. See 18.3 Monitor ROM (MON) . 2.7 Random-Access Memory (RAM) Addresses $0060–$035F ar e RAM locations. The locati[...]
-
Page 38
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 38 Freescale Semiconductor During a subroutine call, the CPU uses two bytes of the stack to store the return address. The st ack pointer decrements during pu shes and increments during pulls. NOTE Be careful when using nested subrouti nes. The CPU may overwrite data in the RAM during a s[...]
-
Page 39
FLASH Memory (FLASH) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 39 HVEN — High-Voltage Enable Bit This read/write bit enab les the charge pump to dr ive high voltages for program and erase operations in the array. HVEN can only be set if either PGM = 1 or ERASE = 1 and the proper sequence for program or erase i[...]
-
Page 40
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 40 Freescale Semiconductor 2.8.3 FLASH M ass Erase Operation Use this step-by-step proce dure to erase the entire FLASH memory. 1. Set both the ERASE bit and the MASS bit in the FLASH control register. 2. Read the FLASH block protect register. 3. Write any data to any FLASH address (1) w[...]
-
Page 41
FLASH Memory (FLASH) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 41 2.8.4 FLASH Program Operation Use the following step-by-step procedure to progra m a row of FLASH memory. Figure 2-4 shows a flowchart of the programming algorithm. NOTE Only bytes which are currently $FF may be prog rammed. 1. Set the PGM bit. Th[...]
-
Page 42
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 42 Freescale Semiconductor Figure 2-4. FLASH Programming Flowchart SET HVEN BIT READ THE FLASH BLOCK PROTECT REGISTER WRITE ANY DATA TO ANY FLASH ADDRESS WITHIN THE ROW ADDRESS RANGE DESIRED WAIT FOR A TIME, t NVS SET PGM BIT WAIT FOR A TIME, t PGS WRITE DATA TO THE FLASH ADDRESS TO BE P[...]
-
Page 43
FLASH Memory (FLASH) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 43 2.8.5 FLASH Bl ock Protection Due to the ability of the on-board charge pump to erase and program the FL ASH memory in the target application, provision is made for prote cting a bloc k of memory from unintentional erase or pr ogram operations due[...]
-
Page 44
Memory MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 44 Freescale Semiconductor Figure 2-6. FLASH Block Protect Start Addre ss Refer to Table 2-2 for examples of the protect start addre ss. 2.8.7 Wait Mode Putting the MCU into wait mode while the FLASH is in read mode does not affect the opera tion of the FLASH memory directly, but there w[...]
-
Page 45
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 45 Chapter 3 Analog-to-Digital Converter (ADC) 3.1 Introduction This section describes the 10-bit analog-to-digital converter (ADC). 3.2 Features Features of the ADC module include: • 10 channels with multiplexed input • Linear successive approximation • 10-bit res[...]
-
Page 46
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 46 Freescale Semiconductor Analog-to-Digital Converter (ADC) Figure 3-1. Block Diagram Highlighting ADC Block and Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOLTAGE INHIBIT MODU[...]
-
Page 47
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 47 Figure 3-2. ADC Block Diagram 3.3.1 ADC Port I/O Pins PTC1/ATD9:PTC0/ATD8 and PTB7/ATD7:PT B0/ATD0 are general-purpose I/O pins that are shared with the ADC channels. The channel select bits define which ADC channel/p ort pin will be used as the[...]
-
Page 48
Analog-to-Digital Converter (ADC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 48 Freescale Semiconductor 3.3.3 Conversion Time Conversion starts after a write to the ADSCR. A conversion is between 16 and 17 ADC clock cycles, therefore: The ADC conversion time is determined by the clock source chose n and the divide ratio selected. The cl[...]
-
Page 49
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 49 significant bits (LSB), located in the ADC da ta regist er low, ADRL, can be ignored. However, ADRL must be read after ADRH or else the interlocking wi ll prevent all new conversio ns from being stored. Right justification will place only the tw[...]
-
Page 50
Analog-to-Digital Converter (ADC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 50 Freescale Semiconductor 3.4 Interrupts When the AIEN bit is set, the ADC mo dule is capable of generating a CPU interrupt after each ADC conversion. A CPU interrupt is gene rated if the COCO bit is at 0. The COCO bit is not used as a conversion complete flag[...]
-
Page 51
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 51 3.6.5 ADC Voltage In (ADVIN) ADVIN is the input voltage signal from one of the 10 ADC channels to the ADC module. 3.6.6 ADC External Connections This section describes the ADC external con nections: V REFH and V REFL , ANx, and grounding. 3.6.6.1 V REFH [...]
-
Page 52
Analog-to-Digital Converter (ADC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 52 Freescale Semiconductor 3.7.1 ADC Status and Control Register This section describes the funct ion of the ADC status and control register (ADSCR). Writing ADSCR aborts the current conversion and initiates a new conversion. COCO — Conversions Complete Bit I[...]
-
Page 53
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 53 The voltage levels supplied from internal reference n odes as specified in Table 3-1 are used to verify the operation of the ADC both in p roduction test and for user applications. T able 3-1. Mux Channel Select ADCH4 ADCH3 ADCH2 ADCH1 ADCH0 Input Select[...]
-
Page 54
Analog-to-Digital Converter (ADC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 54 Freescale Semiconductor 3.7.2 ADC Data Register High In left justified mode, this 8-bit result register holds the eight MSBs of the 10-bit result. This register is updated each time an ADC single c hannel conversion complete s. Reading ADRH latches the conte[...]
-
Page 55
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 55 In 8-bit mode, this 8-bit result regist er holds the ei ght MSBs of the 10-bit result. This re gister is updated each time an ADC conversion completes. In 8-bit mode, this register contains no interlocking with ADRH. 3.7.4 ADC Clock Register This registe[...]
-
Page 56
Analog-to-Digital Converter (ADC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 56 Freescale Semiconductor ADICLK — ADC Input Clock Select Bit ADICLK selects either bus clock or CGMXCLK as t he input clock source to generate the internal ADC clock. Reset selects CGMXCLK as the ADC clock source. If the external clock (CGMXCLK) is equal to[...]
-
Page 57
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 57 Chapter 4 Clock Generator Module (CGM) 4.1 Introduction This section describes the clo ck generator module (CGM, version A). The CGM generates the crystal clock signal, CGMXCLK, which operates at the fre quency of the crystal. The CGM also generates the base clock sig[...]
-
Page 58
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 58 Freescale Semiconductor Figure 4-1. CGM Block Diagram A d d r . R e g i s t e r N a m e B i t 7 654321 B i t 0 $005C PLL Control Register (PCTL) See page 66. Read: PLLIE PLLF PLLON BCS 1111 Write: R R R R R R e s e t : 00101111 $005D PLL Bandwidth Control Regist[...]
-
Page 59
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 59 4.3.1 Crystal Os cillator Circuit The crystal oscillator circuit consists o f an inverting am plifier and an external cr ystal. The OSC1 pin is the input to the amplifier and the OSC2 pin is the ou t put. The SIMOSCEN signal from the system inte[...]
-
Page 60
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 60 Freescale Semiconductor The lock detector compares the frequencies of the VCO feedback clock, CGMVDV, and the final reference clock, CGMRDV. Therefore, the speed of the lock detector is directly proportional to th e final reference frequency, f RDV . The circuit[...]
-
Page 61
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 61 The PLL also may operate in manual mode (AUTO = 0) . Manual mode is use d by systems that do not require an indicator of the lock condition for proper operatio n. Such systems typically operate well below f BUSMAX and require fast startup. These[...]
-
Page 62
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 62 Freescale Semiconductor 5. Calculate the bus frequency, f BUS , and compare f BUS with f BUSDES . 6. If the calculated f BUS is not within the tolerance limits of the a pplication, select another f BUSDES or another f RCLK . 7. Using the value 4.9152 MHz for f N[...]
-
Page 63
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 63 two to correct the duty cycle. Therefore, th e bus cl ock frequency, which is one-half of the base clock frequency, is one-fourth the frequency o f the selected clock (CGMXCLK or CGMVCLK). The BCS bit in the PLL con trol register (PCTL) selects [...]
-
Page 64
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 64 Freescale Semiconductor Figure 4-3 also shows the external components fo r the PLL: • Bypass capaci tor, C BYP • Filter capacitor, C F NOTE Routing should be done with great care t o minimize signal cross talk and noise. (See 4.8 Acquisition/Lock Time Specif[...]
-
Page 65
CGM Regis ters MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 65 4.4.6 Crystal Output Frequency Signal (CGMXCLK) CGMXCLK is the crystal oscillator output sign al. It runs at the full speed of the crystal (f XCL K ) and comes directly from the crys tal oscillator circuit. Fig ure 4-3 shows only the logical relation of[...]
-
Page 66
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 66 Freescale Semiconductor 4.5.1 PLL Control Register The PLL control registe r (PCTL) contains the interrupt enable a nd flag bits, the on/off switch, and the base clock selector bit. PLLIE — PLL Interrupt Enable Bit This read/write bit enables the PLL to genera[...]
-
Page 67
CGM Regis ters MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 67 if the PLL is off. Therefore, PLLON cannot be cleared when BCS is se t, and BCS cannot be set when PLLON is cl ear. If the PLL is off (PLLON = 0), selecting CGMVCLK requires two writes to the PLL control register . See 4.3.3 Base Clock Selector Circuit [...]
-
Page 68
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 68 Freescale Semiconductor XLD — Crystal Loss Detect Bit When the VCO output, CGMVCLK, is driving CGMOUT, this read/write bit ca n indicate whethe r the crystal reference frequency is active or not. To ch ec k the status of the crystal reference, follo w these st[...]
-
Page 69
Interrupts MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 69 NOTE The multiplier select bits have built-in pr otection that prevents them from being written when the PLL is on (PLLON = 1). VRS[7:4] — VCO Range Select Bits These read/write bits control th e hardware center-of-range linear multiplier L, which control[...]
-
Page 70
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 70 Freescale Semiconductor 4.8 Acquisition/Lock Time Specifications The acquisition and lock times of the PLL are, in many applications, the most critical PLL design parameters. Proper design and use of the PLL ensures the highest stability and lowest acquisition/l[...]
-
Page 71
Acquisition/Lock Ti me Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 71 required to reduce the frequ ency error. Therefore, the slower the reference the longe r it takes to make these corrections. This parameter is also under user co ntrol via the choice of crystal frequency, f XCL K . Another critica[...]
-
Page 72
Clock Generator Modu le (CGM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 72 Freescale Semiconductor The K factor in the equations is derived from internal PLL parameters. K ACQ is the K factor when the PLL is configured in acqu isition mode, and K TRK is the K factor when the PLL is configured in tracking mode. See 4.3.2.2 Acquisition a[...]
-
Page 73
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 73 Chapter 5 Configuration Register (CONFIG) 5.1 Introduction This section describes the configurat ion register (CONFIG). This register contains bits tha t configure these options: • Resets caused by the low-voltage inhibit (LVI) module • Power to the LVI module •[...]
-
Page 74
Configuration Register (CONFIG) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 74 Freescale Semiconductor 5.3 Configuration Register EDGE — Edge - Align Enable Bit EDGE determines if the motor control PWM will o perate in edge-aligned mode or cente r-aligned mode. See Chapter 12 Pulse-Width Mo dulator for Motor Control (PWMMC) . 1 = Edge-[...]
-
Page 75
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 75 Chapter 6 Computer Operating Properly (COP) 6.1 Introduction This section describes the computer operating prop er ly module, a free-running counter that generates a reset if allowed to overflow. The computer operati ng properly (COP) module helps software recover fro[...]
-
Page 76
Computer Opera ting Properly (COP) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 76 Freescale Semiconductor The COP counter is a free-running , 6-bit counter preceded by the 13-bit system integration module (SIM) counter. If not cleared by software, the COP count er overflows and generates an asynchronous reset after 2 18 –2 4 CGMXCLK cy[...]
-
Page 77
COP Control Register MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 77 6.3.6 COPD (COP Disable) The COPD signal reflects the state of the COP disable bit (COPD) in the configuration register (CONFIG). See Chapter 5 Configu ration Register (CONFIG) . 6.4 COP Control Register The COP control register is located at add [...]
-
Page 78
Computer Opera ting Properly (COP) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 78 Freescale Semiconductor[...]
-
Page 79
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 79 Chapter 7 Central Processor Unit (CPU) 7.1 Introduction The M68HC08 CPU (cen tral processor unit) is an e nhanced and fully object-code- compatible version of the M68HC05 CPU. The CPU08 Reference Manual (document order number CPU08RM/AD) contains a description of the [...]
-
Page 80
Central Processor Unit (CPU) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 80 Freescale Semiconductor Figure 7-1. CPU Registers 7.3.1 Accumulator The accumulator is a general-purpose 8-bit registe r. The CPU uses the accumulator to hold operands and the results of arithmetic/logic operation s. 7.3.2 Index Register The 16-bit index register[...]
-
Page 81
CPU Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 81 7.3.3 Stack Pointer The stack pointer is a 16-bit register that contains the address of the next location o n the stack. During a reset, the stack pointer is preset to $00FF. The reset st ack pointer (RSP) instruction sets the least significant byte to $[...]
-
Page 82
Central Processor Unit (CPU) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 82 Freescale Semiconductor 7.3.5 Condition Code Register The 8-bit condition cod e register contains the interrupt mask and five flags that indicate the re sults of the instruction just executed. Bits 6 and 5 are set per manently to 1. The following pa ragraphs desc[...]
-
Page 83
Arithmetic/Logic Unit (ALU ) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 83 Z — Zero Flag The CPU sets the zero flag when an arithmetic o peration, logic operation, or data manipulation produces a result of $00. 1 = Zero result 0 = Non-zero resu lt C — Carry/Borrow Flag The CPU sets the carry/borrow flag when [...]
-
Page 84
Central Processor Unit (CPU) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 84 Freescale Semiconductor 7.7 Instruction Set Summary Table 7-1 provides a summary of the M68HC08 instr uction set. T able 7-1. Instruction Set Summary (Sheet 1 of 6) Source Form Operation De scription Effect on CCR Address Mode Opcode Operand Cycles VH I N Z C ADC[...]
-
Page 85
Instruction Set Summary MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 85 BHS rel Branch if Higher or Same (Same as BCC) PC ← (PC) + 2 + rel ? ( C ) = 0 –––––– R E L 2 4 r r 3 BIH rel Branch if IRQ Pin Hi gh PC ← (PC) + 2 + rel ? IRQ = 1 –––––– R E L 2 F r r 3 BIL rel Branch if IRQ Pin Low[...]
-
Page 86
Central Processor Unit (CPU) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 86 Freescale Semiconductor CLR opr CLRA CLRX CLRH CLR opr ,X CLR ,X CLR opr ,SP Clear M ← $00 A ← $00 X ← $00 H ← $00 M ← $00 M ← $00 M ← $00 0––01– DIR INH INH INH IX1 IX SP1 3F 4F 5F 8C 6F 7F 9E6F dd ff ff 3 1 1 1 3 2 4 CMP # opr CMP opr CMP op[...]
-
Page 87
Instruction Set Summary MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 87 JMP opr JMP opr JMP opr ,X JMP opr ,X JMP ,X Jum p PC ← J u m p A d d r e s s –––––– DIR EXT IX2 IX1 IX BC CC DC EC FC dd hh ll ee ff ff 2 3 4 3 2 JSR opr JSR opr JSR opr ,X JSR opr ,X JSR ,X Jump to Subroutine PC ← (PC) + n ( n[...]
-
Page 88
Central Processor Unit (CPU) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 88 Freescale Semiconductor PULA Pull A from Stack SP ← (SP + 1); Pul l ( A ) –––––– I N H 8 6 2 PULH Pull H from Stack SP ← (SP + 1); Pull ( H ) –––––– I N H 8 A 2 PULX Pull X from Stack SP ← (SP + 1); Pul l ( X ) –––––– I N[...]
-
Page 89
Opcode Map MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 89 7.8 Opcode Map See Table 7-2 . SWI Software Interrupt PC ← (PC) + 1; Push (PCL) SP ← (SP) – 1; Push (PCH) SP ← (SP) – 1; Push (X) SP ← (SP) – 1; Push (A) SP ← (SP) – 1; Push (CCR) SP ← (SP) – 1; I ← 1 PCH ← Interr upt V ector High [...]
-
Page 90
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 90 Freescale Semiconductor Central Processor Unit (CPU) T able 7-2. Opcode Map Bit Manipulation Branch Read-Modify-Write Control Register/Memory DIR DIR REL DIR INH INH IX1 S P1 IX INH INH IMM DIR EXT IX2 SP 2 IX1 SP1 IX 0 1 2 3 4 5 6 9E6 7 8 9 A B C D 9ED E 9EE F 0 5 BRSET0 3D I R 4 BSET0 2D I[...]
-
Page 91
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 91 Chapter 8 External Interrupt (IRQ) 8.1 Introduction This section describes the extern al interrupt (IRQ) module, which supports exte rnal interrupt functions. 8.2 Features Features of the IRQ module include: • A dedicated external interrupt pin, IRQ • Hysteresis b[...]
-
Page 92
External Interrupt (IRQ) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 92 Freescale Semiconductor Interrupt signals on the IRQ pin are latched into the IRQ1 latch. An interrupt latch remains set until one of the following actions occurs: • Vector fetch — A vector fetch automatically gener at es an interrupt acknowledge signal that clea[...]
-
Page 93
IRQ Pin MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 93 Figure 8-3. IRQ Interrupt Flowchart FROM RESET I BIT SET? FETCH NEXT YES NO INTERRUPT? INSTRUCTION SWI INSTRUCTION? RTI INSTRUCTION? NO STACK CPU REGISTERS NO SET I BIT LOAD PC WITH INTERRUPT VECTOR NO YES UNSTACK CPU REGISTERS EXECUTE INSTRUCTION YES YES[...]
-
Page 94
External Interrupt (IRQ) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 94 Freescale Semiconductor A logic 0 on the IRQ pin can latch an interrupt request into the IRQ latch. A vector fetch, software clear, or reset clears the IRQ latch. If the MODE1 bit is set, the IRQ pin is both falling-edge -sensitive and low-level- sensitive. With MODE[...]
-
Page 95
IRQ Status and Control Register MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 95 IMASK1 — IR Q Interrupt Mask Bit Writing a logic 1 to this read/write bit disables IRQ interrupt requests. Reset clea rs IMASK1. 1 = IRQ interrupt requests disabled 0 = IRQ interrupt requests enabled MODE1 — IRQ Edge/Level Select Bi[...]
-
Page 96
External Interrupt (IRQ) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 96 Freescale Semiconductor[...]
-
Page 97
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 97 Chapter 9 Low-Voltage Inhibit (LVI) 9.1 Introduction This section describes the low-vo ltage inhibit (LVI) module, which monitors the voltage on the V DD pin and can force a reset when the V DD voltage falls to the LVI trip voltage. 9.2 Features Features of the LVI mo[...]
-
Page 98
Low-Voltage Inhibit (LVI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 98 Freescale Semiconductor Once an LVI reset o ccurs, the MCU remains in reset until V DD rise s above a voltage, V LVRX + V LVHX . V DD must be above V LVRX + V LVHX for only one CPU cycle to bring the MCU out of reset. See 14.3.2.6 Low-Voltage Inhibit (LVI) Reset . T[...]
-
Page 99
LVI Status and Control Register MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 99 9.4 LVI Status and Control Re gister The LVI status register (LVISCR) flags V DD voltages below the V LVRX level . LVIOUT — LVI Output Bi t This read-only flag becomes set when the V DD voltage falls below the V LVRX voltage for 32 to[...]
-
Page 100
Low-Voltage Inhibit (LVI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 100 Freescale Semiconductor With the LVIRST bit in the confi guration register programmed to 1, the LVI module can generate a reset and bring the MCU out of wait mode. 9.7 Stop Mode If enabled, the LVI module rema ins active in st op mode. If enabled to generat e reset[...]
-
Page 101
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 101 Chapter 10 Input/Output (I/O) Ports (PORTS) 10.1 Introduction Thirty-seven bidirectional input-output (I/O) pins and se ven input pins fo rm six parallel port s. All I/O pins are programmable as inputs or out puts. When using the 56-pin package version: • Set the d[...]
-
Page 102
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 102 Freescale Semiconductor $0005 Data Direction Register B (DDRB) See page 105 . Read: DDRB7 DDRB6 DDRB5 D DRB4 DDRB3 DDRB2 DDRB1 D DRB0 Write: R e s e t : 00000000 $0006 Data Direction Re gister C (DDRC) See page 106 . Read: 0 DDRC6 DDRC5 DDRC4 DDRC3 DDRC2 DDR[...]
-
Page 103
Port A MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 103 10.2 Port A Port A is an 8-bit, general-purpose, bid irectional I/O port. 10.2.1 Port A Data Register The port A data register (PTA) con tains a data latch for each of the eight port A pins. PTA[7:0] — Port A Data Bits These read/write bits are software prog[...]
-
Page 104
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 104 Freescale Semiconductor Figure 10-4. Port A I/O Circuit When bit DDRAx is a logic 1, reading add ress $0000 reads the PTAx data latch. Wh en bit DDRAx is a logic 0, reading address $0000 reads the voltage level on the pin. The data latch can always be writte[...]
-
Page 105
Port B MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 105 10.3.2 Data Dir ection Register B Data direction register B (DDRB) determines whether each port B pin is an input or an output. Writing a logic 1 to a DDRB bit enables the output buffer for the corresp onding port B pin; a logic 0 disable s the output buffer. [...]
-
Page 106
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 106 Freescale Semiconductor 10.4 Port C Port C is a 7-bit, general-purpose, bidi rectional I/O port that shares two of its pins with the analog-to-digital convertor module (ADC). 10.4.1 Port C Data Register The port C data register (PTC) conta ins a dat a latch [...]
-
Page 107
Port D MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 107 Figure 10-10 shows the port C I/O logic. Figure 10-10. Port C I/O Circuit When bit DDRCx is a logic 1, reading address $0002 reads the PTCx data latch. When bit DDRCx is a logic 0, reading address $0002 reads the voltage level on the pin. The data latch can al[...]
-
Page 108
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 108 Freescale Semiconductor Figure 10-12 shows the port D input logic. Figure 10-12. Port D Input Circuit Reading address $0003 reads th e voltage level on the pin. Table 1 0- 4 summarizes the operation of the port D pins. 10.6 Port E Port E is an 8-bit, special[...]
-
Page 109
Port E MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 109 10.6.2 Data Dir ection Register E Data direction register E (DDRE) determines whether each port E pin is an input or an output. Writing a logic 1 to a DDRE bit enables the output buffer for the corresp onding port E pin; a logic 0 disables the output buffer. D[...]
-
Page 110
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 110 Freescale Semiconductor 10.7 Port F Port F is a 6-bit, special function port that shares four of its pins with the serial peripheral interface module (SPI) and two pins with the serial communications interface (SCI). 10.7.1 Port F Data Register The port F da[...]
-
Page 111
Port F MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 111 Figure 10-18 shows the port F I/O logic. Figure 10-18. Port F I/O Circuit When bit DDRFx is a logic 1, r eading address $0009 read s the PTFx data latch. When bit DDRFx is a logic 0, reading address $0009 reads the voltage level on the pin. The data latch can [...]
-
Page 112
Input/Output (I/O) Ports (PORTS) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 112 Freescale Semiconductor[...]
-
Page 113
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 113 Chapter 11 Power-On Reset (POR) 11.1 Introduction This section describes the power-on re set (POR) module. 11.2 Functional Description The POR module provides a known, stable signal to the microcontroller unit (MCU) at power-on. This signal tracks V DD until the MCU [...]
-
Page 114
Power-On Reset (POR) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 114 Freescale Semiconductor[...]
-
Page 115
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 115 Chapter 12 Pulse-Width Modulator for Motor Control (PWMMC) 12.1 Introduction This section describes the pulse-width modulator for motor control (PWMMC, version A). The PWM module can generate three complementar y PWM pairs or six independent PWM signals . These PWM s[...]
-
Page 116
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 116 Freescale Semiconductor Pulse-Width Modulator f o r Motor Control (PWMMC) Figure 12-1. Block Diagram Highlighting PWMMC Block and Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-[...]
-
Page 117
Features MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 117 Figure 12-2. PWM Module Block Diagram Addr. Register Name Bit 7 6 5 4 3 2 1 Bit 0 $0020 PWM Control Regis ter 1 (PCTL1) See page 146. Read: DISX DISY PWMINT PWMF ISENS1 ISENS0 LDOK PWMEN Write: Reset: 0 0 0 0 0 0 0 0 $0021 PWM Control Regis ter 2 (PCTL2) See[...]
-
Page 118
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 118 Freescale Semiconductor $0025 PWM Output Control Register (PWMOUT ) See page 154. Read: 0 OUTCTL OUT6 OUT5 OUT4 OUT3 OUT2 OUT1 Write: Reset: 0 0 0 0 0 0 0 0 $0026 PWM Counter Register Hig h (PCNTH) See page 143. Read: 0 0 0 0 Bit 11 Bit 10 B[...]
-
Page 119
Features MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 119 $0030 PWM 4 Value Register Hig h (PVAL4H) See page 145. Read: Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Write: Reset: 0 0 0 0 0 0 0 0 $0031 PWM 4 Value Register Low (PVAL4L) See page 145. Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Writ[...]
-
Page 120
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 120 Freescale Semiconductor 12.3 Timebase This section provides a discussion of t he timebase. 12.3.1 Resolution In center-aligned mode, a 12-bit up/d own counter is used to create the PWM period. Therefore, the PWM resolution in center-aligned [...]
-
Page 121
Timebase MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 121 For edge-aligned mode, a 12-bit up-onl y counter is used to create the PWM period. Therefore, the PWM resolution in edge-aligned mod e is one clock (highest resolution is125 ns @ f OP = 8 MHz) as shown in Figure 12-5 . Again, the timer modulus regist er is u[...]
-
Page 122
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 122 Freescale Semiconductor 12.3.2 Prescaler To permit lower PWM freq uencies, a prescaler is prov ide d which will divide the PWM clock frequency by 1, 2, 4, or 8. Table 12-1 shows how setting the prescaler bits in PW M control register 2 affec[...]
-
Page 123
PWM Generators MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 123 For ease of software, the LDFQx bits are buffer ed. When the LDFQx bits are changed, the reload frequency will not change until the previous reload cycle is completed. See Figure 12-6 . NOTE When reading the LDFQx bits, the value is the buffered value [...]
-
Page 124
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 124 Freescale Semiconductor Figure 12-8. Center-Aligned PWM Value Loading Figure 12-9. Center-Aligned Loading of Modulus Figure 12-10. Edge-Aligned PWM Value Loading LDOK = 1 MODULUS = 3 PWM V ALUE = 1 LDOK = 1 MODULUS = 3 PWM V ALUE = 2 UP/DOWN[...]
-
Page 125
PWM Generators MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 125 Figure 12-11. Edge-Aligned Modulus Loading 12.4.2 PWM Data Overflow and Underflow Conditions The PWM value registers are 16-bit registers. Althou gh the counter is only 12 bits, the u ser may write a 16-bit signed value to a PWM value reg ister. As sho[...]
-
Page 126
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 126 Freescale Semiconductor 12.5 Output Control This subsection discus ses output control. 12.5.1 Selecting Six I ndependent PWMs or Three Co mplementary PWM Pairs The PWM outputs can be configured as six independent PWM channels or three comple[...]
-
Page 127
Output Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 127 When complementary operation is used, tw o additional features are provided : • Dead-time insertion • Separate top/bottom pulse width correction t o co rrect for distortions caused by the motor drive characteristics If independent operation is chos[...]
-
Page 128
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 128 Freescale Semiconductor Figure 12-14. Dead-Time Gen erators FAULT POLARITY/OUTPUT DRIVE PWMGEN<1:6> PWMPAIR12 PWMPAIR34 PWMPAIR56 DEAD-TIME TOP/BOTTOM GENERATION POSTDT (TOP) TOP/BOTTOM GENERATION TOP/BOTTOM GENERATION TOP BOTTOM TOP B[...]
-
Page 129
Output Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 129 Figure 12-15. Effects of Dead-Time Insertion Figure 12-16. Dead-Time at Duty Cycle Boundaries PWM VALUE = 2 PWM VALUE = 2 PWM VAL UE = 3 PWM1 W/ PWM2 W/ PWM1 W/ PWM2 W/ NO DEAD-TIME NO DEAD-TIME DEAD-TIME = 2 DEAD-TIME = 2 2 2 2 2 UP/DOWN COUNTER MODUL[...]
-
Page 130
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 130 Freescale Semiconductor Figure 12-17. Dead-Time and Small Pulse Widths 12.5.3 Top/Bottom Correct ion with Motor Phase Cu rrent Polarity Sensing Ideally, when complementary pairs a re used, the PWM pairs are inversions of e ach other, as show[...]
-
Page 131
Output Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 131 For a typical motor drive inverter as shown in Figure 12-13 , for a given top/b ottom transistor pair, only one of the transistors will be effective in controlling the output voltage at any given time dependin g on the direction of the motor current fo[...]
-
Page 132
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 132 Freescale Semiconductor To allow for correction based on different current se nsing methods or co rrection controlled by software, the ISENS1 and ISENS0 bits in PWM control register 1 are provided to choose the corr ection method. These bits[...]
-
Page 133
Output Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 133 Figure 12-20. Top/Bottom Correction for PWMs 1 and 2 12.5.4 Output Polarity The output polarity of the PWMs is determined by two options: TOPNEG and BOTNEG. The top polarity option, TOPNEG, controls the polarity of PWMs 1, 3, and 5. The bottom polarity[...]
-
Page 134
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 134 Freescale Semiconductor Figure 12-21. PWM Polarity UP/DOWN COUNTER MODULUS = 4 PWM <= 0 PWM = 1 PWM = 2 PWM = 3 PWM >= 4 UP-ONLY COUNTER MODULUS = 4 PWM <= 0 PWM = 1 PWM = 2 PWM = 3 PWM >= 4 CENTER-ALIGNED POSITIVE POLARITY EDGE-[...]
-
Page 135
Output Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 135 12.5.5 PWM Output Port Control Conditions may arise in which the PWM pins need to be individually controlled. This is made po ssible by the PWM output control register (PW MOUT) shown in Figure 12-22 . If the OUTCTL bit is set, the PWM pins can be cont[...]
-
Page 136
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 136 Freescale Semiconductor Figure 12-23. Dead-Time Insertion During OUTCTL = 1 Figure 12-24. Dead-Time Insertion During OUTCTL = 1 UP/DOWN COUNTER MODULUS = 4 PWM1 PWM2 DEAD-TIME = 2 OUTCTL OUT1 OUT2 2 PWM1/PWM2 2 2 DEAD-TIME INSERTED AS PART O[...]
-
Page 137
Fault Protecti on MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 137 12.6 Fault Protection Conditions may arise in th e exter nal drive circuitry which require t hat the PWM sig nals become inactive immediately, such as an overcurrent fault condition . Furthermore, it may be desirable to selectively disable PWM(s) so[...]
-
Page 138
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 138 Freescale Semiconductor Figure 12-26. PWM Disab ling Scheme FINT2 CYCLE START LOGIC HIGH FOR FAULT BANK X FMODE2 DISX CLEAR BY WRITING 1 TO FTA CK4 INTERRUPT REQUEST SHOT SQ R SQ R SQ R ONE FPIN2 FFLAG2 MANUAL MODE AUTO MODE SOFTWARE X DISAB[...]
-
Page 139
Fault Protecti on MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 139 Figure 12-27. PWM Disabling Decode Scheme 12.6.1.1 Fault Pin Filter Each fault pin incorporates a filter to assist in determining a genuine fault condition. After a fau lt pin has been logic low for one CPU cycle, a rising edge (logic high) will be [...]
-
Page 140
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 140 Freescale Semiconductor Figure 12-28. PWM Disabling in Autom atic Mode IIf prior to a vector fetch, the inte rrupt request latch is cleared by one of the actions listed, a CPU interrupt will no longer be requested. A vector fetch does not al[...]
-
Page 141
Fault Protecti on MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 141 Figure 12-30. PWM Disabling in Manua l Mode (Example 2) 12.6.2 Software Output Disable Setting PWM disable bit DISX or DISY in PWM control register 1 immediately disables the corresponding PWM pins as determined by the bank and disable ma pping regi[...]
-
Page 142
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 142 Freescale Semiconductor 12.7 Initialization and the PWMEN Bit For proper operation, all registers should be initia lized and the LDOK bit should be set before enablin g the PWM via the PWMEN bit. When the PWMEN bit is fi rst set, a reload wi[...]
-
Page 143
PWM Operation in Wait Mode MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 143 12.8 PWM Operation in Wait Mode When the microcontroller is put in low-power wait mode via the WAIT instruction, all clocks to the PWM module will continue to run. If an interrupt is issued from the PWM module (via a reload or a fault), the[...]
-
Page 144
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 144 Freescale Semiconductor 12.9.2 PWM Counte r Modulo Registers The PWM counter modulus registers (PMODH and PMODL) ho ld a 12-bit unsigned number that determines the maximum count for the up/down or up -only counter. In center-aligned mode, th[...]
-
Page 145
Control Logic Block MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 145 12.9.3 PWMx Value Registers Each of the six PWMs has a 16-bit PW M value register. The 16-bit signed value stored in this register determi nes the duty cycle of the PWM. Th e duty cycle is defined as: (PWM value/ modulus) x 100. Writing a number l[...]
-
Page 146
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 146 Freescale Semiconductor 12.9.4 PWM Control Register 1 PWM control register 1 (PCTL1) controls PWM enabling/ disabling, the lo ading of new modulus, prescaler, PWM values, and the PWM correction method. In addition , this register contains th[...]
-
Page 147
Control Logic Block MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 147 NOTE The ISENSx bits are not buffered. Changing the current sensing method can affect the present PWM cycle. LDOK— Load OK Bit This read/write bit loads the prescaler bits of the PMCTL2 register and the entire PMMODH/L and PWMVALH/L registers in[...]
-
Page 148
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 148 Freescale Semiconductor 12.9.5 PWM Control Register 2 PWM control register 2 (PCTL2) con trols the PWM load frequency, the PWM correction method, and the PWM counter prescaler. For ease of software a nd to avoid erroneous PWM periods, some o[...]
-
Page 149
Control Logic Block MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 149 NOTE When reading this bit, th e value read is the buffer value (not necessarily the value the output control block is current ly using). The IPOLx bits take effect at the beginn ing of the next load cycle, regardless of the state of the load o ka[...]
-
Page 150
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 150 Freescale Semiconductor 12.9.6 Dead-Time Write-Once Register The dead-time write-once re gister (DEADTM) holds an 8-bit value which specifies the number of CPU clock cycles to use for the dead-time when complement ary PWM mode is selected. A[...]
-
Page 151
Control Logic Block MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 151 FMODE4 —Fault Mode Selection for Fault Pin 4 Bit ( autom atic versus manual mode) This read/write bit allows the u ser to select between automatic and manual mode faults. For further descriptions of each mode, see 12.6 Fault Protection . 1 = Aut[...]
-
Page 152
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 152 Freescale Semiconductor 12.9.9 Fault Status Register The fault status register (FSR) is a read-only register that indicates the current fault status. FPIN4 — State of Fault Pin 4 Bit This read-only bit allows the user to read the current s[...]
-
Page 153
Control Logic Block MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 153 FFLAG1 — Fault Event Flag 1 The FFLAG1 event bit is set within two CPU cycles after a rising edge on fault pin 1. To clear the FFLAG1 bit, the user must write a 1 to the FTACK1 bit in the fault acknowledge register. 1 = A fault has occurred on f[...]
-
Page 154
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 154 Freescale Semiconductor DT2 — Dead-Time 2 Bit Current sensing pin IS1 is mon itored immediately before dead-time ends due to the assertion of PWM2. DT1 — Dead-Time 1 Bit Current sensing pin IS1 is mon itored immediately before dead-time [...]
-
Page 155
PWM Glossary MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 155 12.10 PWM Glossary CPU cycle — One internal bus cycle (1/ f OP ) PWM clock cycle (or period) — One tick of the PWM counter (1/f OP with no prescaler). See Figure 12-47 . PWM cycle (or period) • Center-aligned mode: The time it takes the PWM counter[...]
-
Page 156
Pulse-Width Modulator f o r Motor Control (PWMMC) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 156 Freescale Semiconductor PWM Load Frequency — Frequency at which new PWM parameters get loaded into the PWM. See Figure 12-48 . Figure 12-48. PWM Load Cycle/Frequ ency Definition RELOAD NEW MODULUS, PRESCALER, & PWM VALUES IF LDOK = 1 R[...]
-
Page 157
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 157 Chapter 13 Serial Communications Interface Module (SCI) 13.1 Introduction This section describes the serial communications interface module (SCI, version D), which allows high-speed asynchronous communications with peri pheral d evices and other microcontroller units[...]
-
Page 158
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 158 Freescale Semiconductor Serial Commun ications Inte rface Module (SCI ) Figure 13-1. Block Diagram Highlighting SCI Block a nd Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOL[...]
-
Page 159
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 159 13.3 Functional Description Figure 13-2 shows the structure of the SCI module. The SC I allows full-du plex, asynchronous, NRZ serial communication among the MCU and remote device s, in cluding other MCUs. The transmitter and receiver of the SC[...]
-
Page 160
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 160 Freescale Semiconductor 13.3.1 Data Format The SCI uses the standard no n-return-to-zero mark/space data fo rmat illustrated in Figure 13-4 . Figure 13-4. SCI Data Formats A d d r . R e g i s t e r N a m e B i t 7 654321 B i t 0 $0038 SCI Contr[...]
-
Page 161
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 161 13.3.2 Transmitter Figure 13-5 shows the structure of the SCI transmitter. Figure 13-5. SCI Transmitter PEN PTY H 876543210L 11-BIT TRANSMIT STOP START T8 SCTE SCTIE TCIE SBK TC f OP PARITY GENERATION MSB SCI DATA REGISTER LOAD FROM SCDR SHIFT [...]
-
Page 162
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 162 Freescale Semiconductor 13.3.2.1 Character Length The transmitter can accommod ate either 8-bit or 9-bit data. The state of the M bit in SCI control register 1 (SCC1) determines character length. When transmitting 9- bit data, bit T8 in SCI con[...]
-
Page 163
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 163 13.3.2.4 Idle Characters An idle character contains all 1s and has no start, st op, or parity bit. Id le character length depends on the M bit in SCC1. The preamble is a synchro nizing idle character that begins every tran smission. If the TE b[...]
-
Page 164
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 164 Freescale Semiconductor Figure 13-6. SCI Receiver Block Diagram 13.3.3.1 Character Length The receiver can accommodat e either 8-bit or 9-bit data. The state of the M bit in SCI control register 1 (SCC1) determines character length. When receiv[...]
-
Page 165
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 165 13.3.3.2 Character Reception During an SCI reception, the receive shift reg ister shi fts characters in from th e PTF4/RxD pin. The SCI data register (SCDR) is the read-onl y buffer between the internal data bus and the receive shift register. [...]
-
Page 166
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 166 Freescale Semiconductor If start bit verification is not successful, the RT cl ock is reset and a new sea rch for a start bit begins. To determine the value of a data bit and to detect noise, recovery logic takes samples at RT8, RT9, and RT10. [...]
-
Page 167
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 167 13.3.3.4 Framing Errors If the data recovery logic does not d etect a 1 where t he stop bit should be in an incoming ch aracter, it sets the framing error bit, FE, in SCS1. T he FE flag is set at the same time that the SCRF bit is set. A break [...]
-
Page 168
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 168 Freescale Semiconductor • Noise flag (NF) — The NF bit is set when t he SCI det ects noise on incoming data or break characters, including start, data, and stop bits. The noise error interrupt enable bit, NEIE, in SCC3 enables NF to generat[...]
-
Page 169
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 169 13.6.2 PTF4/RxD (Receive Data) The PTF4/RxD pin is the serial data in put to the SCI receiver. The SCI shares the PTF4/RxD pin with port F. When the SCI is enabled, the PTF 4/RxD pin is an input regardless of the state of the DDRF4 bit in data direction[...]
-
Page 170
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 170 Freescale Semiconductor ENSCI — Enable SCI Bit This read/write bit enable s the SCI and the SCI baud rate gen erator. Clearing ENSCI sets the SCTE and TC bits in SCI statu s register 1 and disables transmitter interrupts. Reset clears the ENS[...]
-
Page 171
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 171 13.7.2 SCI Cont rol Register 2 SCI control register 2 (SCC2): • Enables these CPU interrupt requests: – Enables the SCTE bit to generate transmitter CPU interrupt requests – Enables the TC bit to generate transmitter CPU interrupt requests – Ena[...]
-
Page 172
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 172 Freescale Semiconductor SCRIE — SCI Receive Interrupt Enable Bit This read/write bit enables th e SCRF bit to generate SCI receiver CPU inte rrupt requests. Setting the SCRIE bit in SCC3 enables the SCRF bit to generat e CPU interrupt request[...]
-
Page 173
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 173 13.7.3 SCI Cont rol Register 3 SCI control register 3 (SCC3): • Stores the ninth SCI data b it received and the ninth SCI data bit to be transmit ted • Enables SCI receiver full (SCRF) • Enables SCI transmitter empty (SCTE) • Enables the followi[...]
-
Page 174
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 174 Freescale Semiconductor 13.7.4 SCI Status Register 1 SCI status register 1 (SCS1) contai ns flags to signal the se conditions: • Transfer of SCDR data to transmit shift register complete • Transmission com plete • Transfer of receive shif[...]
-
Page 175
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 175 IDLE — Receiver Idle Bit This clearable, read-only bit is set when 10 or 11 consecutive 1s appear on the receive r input. IDLE generates an SCI error CPU interrupt request if the ILIE bit in SCC2 is also set. Clear the IDLE bit by reading SCS1 with ID[...]
-
Page 176
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 176 Freescale Semiconductor In applications that are sub ject to software latency or in which it is important to know which byte is lost due to an overrun, the flag -clearing routine can check the OR bit in a seco nd read of SCS1 after reading the [...]
-
Page 177
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 177 RPF —Reception-in-Progress Flag This read-only bit is set when the receiver de tects a logic 0 during the RT1 time period of the start bit search. RPF does not generat e an interrupt request. RPF is reset after the receiver detect s false start bits ([...]
-
Page 178
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 178 Freescale Semiconductor SCR2–SCR0 — SCI Baud Rate Select Bits These read/write bits select the SCI bau d rate divisor as shown in Table 13-6 . Reset clears SCR2–SCR0. Use this formula to calculate the SCI baud rate: where: f OP = internal[...]
-
Page 179
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 179 T able 13-7. SCI Baud Rate Selection Exa mples SCP1:SCP0 Prescaler Divisor (PD) SCR2:SCR1:SCR 0 Baud Rate Divisor (BD) Baud Rate (f OP = 7.3728 MHz) Baud Rate (f OP = 4.9152 MHz) 00 1 000 1 115,200 76,800 00 1 001 2 57,600 38,400 00 1 010 4 28,800 19,20[...]
-
Page 180
Serial Communications In terface Modu le (SCI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 180 Freescale Semiconductor[...]
-
Page 181
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 181 Chapter 14 System Integration Module (SIM) 14.1 Introduction This section describes the system inte gration module (SIM). Together with the centra l processor unit (CPU), the SIM controls all micr ocontroller unit (MCU) activities. A block diagram of the SIM is shown[...]
-
Page 182
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 182 Freescale Semiconductor Figure 14-1. SIM Block Diagram 14.2 SIM Bus Clock Control and G eneration The bus clock generator provides system clock signa ls for the CPU and peripherals on the MCU. T he system clocks are generated from an incoming clock, CGMOUT, a[...]
-
Page 183
Reset and System Initialization MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 183 Figure 14-2. CGM Clock Signals 14.2.3 Clocks in Wait Mode In wait mode, the CPU clocks are inactive. The SIM also pr oduces two sets of clocks for oth er modules. Refer to the wait mode subsection of each mod ule to s ee if the module [...]
-
Page 184
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 184 Freescale Semiconductor Figure 14-3. External Reset Timing 14.3.2 Active Resets from Internal Sources All internal reset sources actively pu ll the RST pin low for 32 CGMXCLK cycles to allow resetting of external peripherals. The internal reset sig nal (IRST)[...]
-
Page 185
Reset and System Initialization MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 185 14.3.2.1 Power-On Reset (POR) When power is first applied to the MCU, the power- on reset (POR) module ge nerates a pulse to indicate that power-on has occurred. The external reset pin (RST ) is held low while the SIM counter count s o[...]
-
Page 186
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 186 Freescale Semiconductor signal on the RST or the IRQ pin. This prevents the COP from becoming disabled as a result of external noise. During a break state, V HI on the RST pin disables the COP module. 14.3.2.3 Illegal Opcode Reset The SIM decodes signals from[...]
-
Page 187
Exception Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 187 14.5 Exception Control Normal, sequential program execution can be changed in three different ways: 1. Interrupts: a. Maskable hardware CPU interrupts b. Non-maskable software interrupt instruction (SWI) 2. Reset 3. Break interrupts 14.5.1 Interrupt[...]
-
Page 188
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 188 Freescale Semiconductor Figure 14-8. Interrupt Processing NO NO YES AS MANY INTERRUPTS AS EXIST ON CHIP SWI INSTRUCTION? RTI INSTRUCTION? FETCH NEXT INSTRUCTION UNSTACK CPU REGISTERS STACK CPU REGISTERS SET I BIT LOAD PC WITH INTERRUPT VECTOR EXECUTE INSTRUCT[...]
-
Page 189
Exception Control MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 189 Figure 14-9. Interrupt Recovery 14.5.1.1 Hardware Interrupt s A hardware interrupt does not stop t he current instruction. Processing of a hardware interrupt be gins after completion of the current instruction. W hen the current instruction is compl[...]
-
Page 190
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 190 Freescale Semiconductor 14.5.1.2 Software Interrupt (SWI) Instruction The software interrupt (SWI) instruction is a non-maska ble instruction that causes an interrupt regardless of the state of the interrupt mask (I bit) in the condition code register. 14.5.2[...]
-
Page 191
SIM Regi sters MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 191 Figure 14-13. Wait Recovery from Internal Reset 14.6.2 Stop Mode In stop mode, the SIM counter is reset an d the system clocks are disabled. An interrupt request from a module can cause an exit from stop mode. Stacking for interrupts begins after the s[...]
-
Page 192
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 192 Freescale Semiconductor SBSW can be read within the break state SWI routine. The user can modify the return address on the stack by subtracting one from it. 14.7.2 SIM Reset Status Register The SIM reset status register (SRSR) co ntains six flags that show th[...]
-
Page 193
SIM Regi sters MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 193 14.7.3 SIM Break Flag Control Register The SIM break control register (SBFCR) con tains a bit that enables software to clear status bits while the MCU is in a break state. BCFE — Break Clear Flag Enable Bit This read/write bit enables software to cle[...]
-
Page 194
System Integration Module (SIM) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 194 Freescale Semiconductor[...]
-
Page 195
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 195 Chapter 15 Serial Peripheral Interface Module (SPI) 15.1 Introduction The serial peripheral interface (SPI) module allows full-duplex, synchronous, serial co mmunications with peripheral devices. 15.2 Features Features of the SPI module include: • Full-duplex opera[...]
-
Page 196
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 196 Freescale Semiconductor Serial Peripheral In terface Module (SPI) Figure 15-1. Block Diagram Highligh ting SPI Block and Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOLTAGE I[...]
-
Page 197
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 197 15.4 Functional Description Figure 15-2 shows the structure of the SPI module and Figure 15-3 shows the locations a nd contents of the SPI I/O registers. The SPI module allows full-duplex, synchronous, se rial communication between the microcon[...]
-
Page 198
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 198 Freescale Semiconductor 15.4.1 Master Mode The SPI operates in master mode wh en the SPI master bit, SPMSTR, is set. NOTE Configure the SPI modules as master or sla ve before enabling them. Enable the master SPI before enabling t he slave SPI. Disab[...]
-
Page 199
Transmission Formats MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 199 SPRF signals the end of a transmission. Software clears SPRF by reading the SPI status and control register with SPRF set and then readin g the SPI data register. Writing to the SPI data register cle ars the SPTE bit. 15.4.2 Slave Mode The SPI op[...]
-
Page 200
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 200 Freescale Semiconductor The clock phase (CPHA) control bit selects one of tw o fundamentally different transmission formats. The clock phase and polarity sh ould be identical for the master SPI device and the communicating slave device. In some case[...]
-
Page 201
Transmission Formats MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 201 When CPHA = 0 for a slave, th e falling edge of SS indicates the beginning of th e transmission. This causes the SPI to leave its idle state and begin driving the MISO pin with t he MSB of its data. Once the transmission begins, no new data is al[...]
-
Page 202
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 202 Freescale Semiconductor When CPHA = 1, the first SPSCK cycl e begins with an edge on the SPSCK line from its inactive to its active level. The SPI clock rate (selected by SPR1 :SPR0) affects the delay from the write to SPDR and the start of the SPI [...]
-
Page 203
Error Conditions MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 203 15.6 Error Conditions These flags signal SPI error conditions: • Overflow (OVRF) — Failing to read the SPI data register bef ore the next full byte enters the shift register sets the OVRF bit. The n ew byte does not transfer to the receive data r[...]
-
Page 204
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 204 Freescale Semiconductor In this case, an overflow can easily be missed. Since no more SPRF interrupts can be generated until this OVRF is serviced, it is not obvious that bytes are being lost as more transmissions are completed. To prevent this, eit[...]
-
Page 205
Error Conditions MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 205 OVRF individually to generate a re ceiver/error CPU interrupt request. However, leaving MODFEN low prevents MODF from being set. In a master SPI with the mode fault enable bit (MODFE N) set, the mode fault flag (MODF) is set if SS goes to logic 0. A [...]
-
Page 206
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 206 Freescale Semiconductor 15.7 Interrupts Four SPI status flags can be enabled to gen erate CPU interrupt requests as shown in Table 15-2 . The SPI transmitter interrupt enable bit (SPTIE) enables the SPTE flag to generate transmitter CPU interrupt re[...]
-
Page 207
Resetting the SPI MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 207 15.8 Resetting the SPI Any system reset completely resets the SPI. Partia l resets occur whenever th e SPI enable bit (SPE) is low. Whenever SPE is low: • The SPTE flag is set. • Any transmission currently in progress is aborted. • The shift r[...]
-
Page 208
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 208 Freescale Semiconductor Figure 15-12. SPRF/SPTE CPU Interrupt Timing 15.10 Low-Power Mode The WAIT instruction puts the MCU in a low power-consumption standby mode. The SPI module remains active aft er the execution of a WAIT instruction. In wait mo[...]
-
Page 209
I/O Signals MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 209 The SPI has limited inter-integrated circuit (I 2 C) capability (requiring software support) as a master in a single-master environment. To communicate with I 2 C peripherals, MOSI becom es an open-drain output when the SPWOM bit in the SPI control regist[...]
-
Page 210
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 210 Freescale Semiconductor When an SPI is configured as a slave, the SS pin is always configured as an input. It cannot be used as a general-purpose I/O regardless of the state of the MODFEN control bit. However, the MODFEN bit can still prevent the st[...]
-
Page 211
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 211 SPRIE — SPI Receiver Interrupt Enable Bit This read/write bit enable s CPU interrupt requests generated by the SPRF bit. T he SPRF bit is set when a byte transfers from the shift register to the receive data register. Reset clears the SPRIE bit. 1 = S[...]
-
Page 212
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 212 Freescale Semiconductor SPE — SPI Enable Bit This read/write bit enabl es the SPI module. Clearing SPE causes a partial reset of the SPI . See 15.8 Resetting the SPI . Reset clears the SPE bit. 1 = SPI module en abled 0 = SPI module disabled SPTIE[...]
-
Page 213
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 213 OVRF — Overflow Bit This clearable, read-only flag is set if software does not read the byte in the receive data register before the next full byte enters the shift registe r. In an ov erflow condition, the byte already in the receive data register is[...]
-
Page 214
Serial Peripheral In terface Module (SPI) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 214 Freescale Semiconductor Use this formula to calculate the SPI baud rate: where: CGMOUT = base clock output of the clock generator module (CGM) BD = baud rate divisor 15.12.3 SPI Data Register The SPI data register consists of the read-only receive d[...]
-
Page 215
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 215 Chapter 16 Timer Interface A (TIMA) 16.1 Introduction This section describes the timer in terface module A (T IMA). The TIMA is a 4-channel timer that provides: • Timing reference with input capture • Output compare • Pulse-width modulator functions Figure 16-2[...]
-
Page 216
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 216 Freescale Semiconductor Timer Interface A (TIMA) Figure 16-1. Block Diagram Highlighting TIMA Block and Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOLTAGE INHIBIT MODULE POW[...]
-
Page 217
Features MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 217 Figure 16-2. TIMA Block Diagram PTE3/TCLKA PRESCALER PRESCALER SELECT TCLK INTERNAL 16-BIT COMPARATOR PS2 PS1 PS0 16-BIT COMPARATOR 16-BIT LATCH TCH0H:TCH0L MS0A ELS0B ELS0A PTE4 TOF TOIE INTER- CHANNEL 0 TMODH:TMODL TRST TSTOP TOV0 CH0IE CH0F CH0MAX MS0B 16[...]
-
Page 218
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 218 Freescale Semiconductor Addr. Register Name Bit 7 6 5 4 3 2 1 Bit 0 $000E TIMA Status/Control Regist er (TASC) See page 226 . Read: TOF TOIE TSTOP 00 PS2 PS1 PS0 Write: 0 TRST R Reset: 0 0 1 0 0 0 0 0 $000F TIMA Counter Re gister High (TACNTH) See page 227 . Read: B[...]
-
Page 219
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 219 16.3 Functional Description Figure 16-2 shows the TIMA structure. The central component of the TI MA is the 16-bit TIMA counter that can operate as a free-running counter or a modulo up-counte r. The TIMA counter provides the timin g reference [...]
-
Page 220
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 220 Freescale Semiconductor x referring to the active channel number). When an ac tive ed ge occurs on the pin of an input capture channel, the TIMA latches the co ntents of the TI MA counter into the TIMA channel registers, TACHxH–TACHxL. Input captures can generate [...]
-
Page 221
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 221 Use this method to synchronize unbu ffered changes in the output compare value on chann el x: • When changing to a smaller value, enable channe l x output compare interrupts and write the new value in the output compare interrupt routine. The[...]
-
Page 222
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 222 Freescale Semiconductor to clear the channel pin on output compare if the polarity of the PWM pulse is 1 (ELSxA = 0). Program the TIMA to set the pin if the polarity of the PWM pulse is 0 (EL SxA = 1). The value in the TIMA counter modulo reg isters and the selected[...]
-
Page 223
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 223 duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. Toggling on output compare also can cause incorrect PWM signal generation when changing t he PWM pulse width to a new, much la[...]
-
Page 224
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 224 Freescale Semiconductor 4. In TIMA channel x status an d control register (TSCx): a. Write 0:1 (for unbuffered output compare or PWM signals) or 1:0 (for buffered output compare or PWM signals) to the mode se lect bits, MSxB–MSxA. (See Table 16-2 .) b. Write 1 to [...]
-
Page 225
I/O Signals MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 225 The TIMA remains active after the execution of a WAIT instruction. In wait mode, the TIMA register s are not accessible by the CPU. Any enabled CPU interrupt request from the TIMA can bring the MCU out of wait mode. If TIMA functions are not re quired dur[...]
-
Page 226
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 226 Freescale Semiconductor TOF — TIMA Overflow Flag This read/write flag is set when the T IMA counter reaches the modulo va lue programmed in the TIMA counter modulo registers. Clear TOF by read ing t he TIMA status and control register wh en TOF is set and then wri[...]
-
Page 227
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 227 PS[2:0] — Prescaler Select Bits These read/write bits select eithe r the PTE3/TCLKA pin or one of the seven prescaler outputs as th e input to the TIMA counter as Table 16 -1 shows. Reset clears the PS[2:0] bits. 16.7.2 TIMA C ounter Registers The two[...]
-
Page 228
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 228 Freescale Semiconductor 16.7.3 TIMA Counter Modulo Registers The read/write TIMA modulo registers contain the mod ulo value for the TIMA counter. When the TIMA counter reaches the modulo value, the overflow flag (TOF) becomes set , and the TIMA counter resumes count[...]
-
Page 229
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 229 CHxF — Channel x Flag Bit When channel x is an input cap ture channel, this read/write bit is set when an active edge occurs on the channel x pin. When channel x is an output com pare channel, CHxF is set when the value in the TIMA counter registers m[...]
-
Page 230
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 230 Freescale Semiconductor MSxB — Mode Select Bit B This read/write bit selects buffere d output compare/PWM operation. MSxB exists only in the TIMA channel 0 and TIMA channel 2 stat us and control registers. Setting MS0B disables the channel 1 status a nd control re[...]
-
Page 231
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 231 TOVx — Toggle-On-Overflow Bit When channel x is an output compare channel, this re ad/write bit controls the behavior of the channel x output when the TIMA counter overflows. When channel x is an input capt ure channel, TOVx has no effect. Reset clear[...]
-
Page 232
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 232 Freescale Semiconductor 16.7.5 TIMA C hannel Registers These read/write registers contain t he captured TIMA counter value of the input capture function or the output compare value of the o utput compare function. The state of the TIMA channel reg isters after reset[...]
-
Page 233
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 233 Register Name and Address : TACH2L — $001B B i t 7 654321 B i t 0 Read: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Write: Reset: Indeterminate after reset Register Name and Address: TACH3 H — $001D B i t 7 654321 B i t 0 Read: Bit 15 Bit 14 Bit[...]
-
Page 234
Timer Interface A (TIMA) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 234 Freescale Semiconductor[...]
-
Page 235
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 235 Chapter 17 Timer Interface B (TIMB) 17.1 Introduction This section describes the timer interface module B (T IMB). The TIMB is a 2-chan nel timer that provides: • Timing reference with input capture • Output compare • Pulse-width modulation functions Figure 17-[...]
-
Page 236
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 236 Freescale Semiconductor Timer Interface B (TIMB) Figure 17-1. Block Diagram Highlighting TIMB Block and Pins CLOCK GENERATOR MODULE SYSTEM INTEGRATION MODULE SERIAL COMMUNICATIONS INTERFACE MODULE SERIAL PERIPHERAL INTERFACE MODULE (2) TIMER INTERFACE MODULE A LOW-VOLTAGE INHIBIT MODULE POW[...]
-
Page 237
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 237 Figure 17-2. TIMB Block Diagram Addr. Register Name Bit 7 6 5 4 3 2 1 Bit 0 $0051 TIMB Status/Control Regist er (TBSC) See page 244 . Read: TOF TOIE TSTOP 00 PS2 PS1 PS0 Write: 0 TRST R Reset: 0 0 1 0 0 0 0 0 $0052 TIMB Counter Re gister High ([...]
-
Page 238
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 238 Freescale Semiconductor 17.3.1 TIMB Counter Prescaler The TIMB clock source can be one of the se ven prescaler outputs or the TIMB clock pin, PTE0/TCLKB . The prescaler generates seven clock rates from the inte rnal bus clock. The prescaler select bits, PS[2:0], in [...]
-
Page 239
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 239 whether the TIMB channel flag (CH0F–CH1F in TBSC0–TBSC 1 registers) is set or clea r. When the status flag is set, a CPU interrupt is generated if enabled. The value of the count latched or “captured” is the time of the event. Because t[...]
-
Page 240
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 240 Freescale Semiconductor 17.3.3.2 Buffered Output Compare Channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the PTE1/TCH0B pin. The TIMB channel registers of the linked pair alternately control the output. Setting the MS[...]
-
Page 241
Functional Description MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 241 The value in the TIMB channel registers determines th e pulse width of the PWM output. The pulse width of an 8-bit PWM signal is variable in 256 incremen ts. Writing $0080 (128) to the TIMB channel registers produces a duty cycle of 128/2 56 or[...]
-
Page 242
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 242 Freescale Semiconductor currently active channel to prevent writing a new value to the active channel. Writing to the active channel reg isters is the same as generating unbuffered PWM signals. 17.3.4.3 PWM Initialization To ensure correct operation when generat ing[...]
-
Page 243
Interrupts MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 243 17.4 Interrupts These TIMB sources can generate interrup t requests: • TIMB overflow flag (TOF) — The timer overflow flag (TOF) bit is set when the TIMB counter reaches the modulo value programmed in the TIMB counter modulo registers. The TIMB overflow[...]
-
Page 244
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 244 Freescale Semiconductor 17.7 I/O Registers These input/output (I/O) registers contro l and monitor TIMB operation: • TIMB status and control register (TBSC) • TIMB control registers (TBCNTH–TBCNTL) • TIMB counter modulo registers (TBMODH–TBMODL) • TIMB c[...]
-
Page 245
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 245 TSTOP — TIMB Stop Bit This read/write bit stops the TIMB counter. Countin g resumes when TSTOP is cleared. Reset sets the TSTOP bit, stopping the TIMB counter un til software clears the TSTOP bit. 1 = TIMB counter stopped 0 = TIMB counter active NOTE [...]
-
Page 246
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 246 Freescale Semiconductor 17.7.2 TIMB C ounter Registers The two read-only TIMB counter registers contain the high and low bytes of the value in the TIMB counte r. Reading the high byte (TBCNTH) latch es the contents of the low byte (TBCNTL) into a buffer. Subsequen t[...]
-
Page 247
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 247 17.7.4 TIMB Channel Stat us and Control Registers Each of the TIMB channel status and cont rol registers: • Flags input captures and output compares • Enables input capture and outp ut compare interrupts • Selects input capture, output compare, o [...]
-
Page 248
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 248 Freescale Semiconductor MSxB — Mode Select Bit B This read/write bit selects buffere d output compare/PWM operation. MSxB exists only in the TIMB channel 0. Setting MS0B disables the channel 1 status a nd control register and reverts TCH1B to general-purpose I/O. [...]
-
Page 249
I/O Registers MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 249 NOTE When TOVx is set, a TIMB counter overflow takes preceden ce over a channel x output compare if both occur at t he same time. CHxMAX — Channel x Maximum Duty Cycle Bit When the TOVx is 1 and clear output on co mpare is selected, setting the CHxMAX[...]
-
Page 250
Timer Interface B (TIMB) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 250 Freescale Semiconductor 17.7.5 TIMB C hannel Registers These read/write registers contain t he captured TIMB counter value of the input capture function or the output compare value of the o utput compare function. The state of the TIMB channel reg isters after reset[...]
-
Page 251
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 251 Chapter 18 Development Support 18.1 Introduction This section describes the break modu le, the moni tor read-only memory (MON), a nd the monitor mode entry methods. 18.2 Break Module (BRK) The break module (BRK) can generate a break interrupt that stops norma l progr[...]
-
Page 252
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 252 Freescale Semiconductor Figure 18-1. Break Module Block Diagram A d d r . R e g i s t e r N a m e B i t 7 654321 B i t 0 $FE00 SIM Break Status Register (SBSR) See page 255. Read: RRRRRR B W R Write: Reset: 0 $FE03 SIM Break Flag Control Register (SBFCR) See page 255. Re[...]
-
Page 253
Break Module (BRK) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 253 18.2.1.2 CPU During Break Interrupts The CPU starts a break interrupt by: • Loading the instruction register with the SWI instruction • Loading the program counter with $FFFC and $FFFD ($FEFC and $FEFD in monitor mode) The break interrupt begin[...]
-
Page 254
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 254 Freescale Semiconductor 18.2.3.1 Break Status and Control Register The break status and control register (BRKSCR) conta ins break module enable and status bits. BRKE — Break Enable Bit This read/write bit enable s breaks on break addres s register matches. Clear BRKE b[...]
-
Page 255
Monitor ROM (MON) MC68HC908MR32 • MC68HC90 8MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 255 18.2.3.3 Break Status Register The break status register (SBSR) contains a flag to indicate that a break caused an exit from wait mode. The flag is useful in application s requiring a return to wait mode after exiting from a break interrupt. BW — [...]
-
Page 256
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 256 Freescale Semiconductor Features include: • Normal user-mode pin functionality • One pin dedicated to serial communicati on between monitor ROM and host computer • Standard mark/space non-return-to-zero (NRZ) communication with host computer • 4800 baud–28.8 Kb[...]
-
Page 257
Monitor ROM (MON) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 257 Figure 18-8. Monitor Mode Circuit + + + + 10 M Ω X1 V DD V HI MC145407 MC74HC125 MC68HC908MR16/ RST IRQ CGMXFC OSC1 OSC2 V SSA V SS V DD PTA0 V DD 10 k Ω 0.1 µ F 0.02 µ F 10 k Ω 6 5 2 4 3 1 DB-25 2 3 7 20 18 17 19 16 15 V DD V DD V DD 20 pF [...]
-
Page 258
MC68HC908MR32 • MC6 8HC908MR16 Data Sheet, Rev . 6.1 258 Freescale Semiconductor Development Support T able 18-2. Monitor Mode Signal Requirements and Options IRQ RESET (S1) $FFFE /$FFFF PLL PTC3 PTC4 PTC2 (S2) External Clock (1) 1. External clock is derived by a 32.768 kHz crystal or a 4.9152/9.8304 MHz off-chip oscillator. CGMOUT Bus Frequency [...]
-
Page 259
Monitor ROM (MON) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 259 Enter monitor mode by either: • Executing a software interr upt instruction (SWI) or • Applying a logic 0 and then a logic 1 to the RST pin Once out of reset, the MCU waits f or the host to send eight security bytes. After receiving the security[...]
-
Page 260
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 260 Freescale Semiconductor 18.3.1.5 Echoing As shown in Figure 18-11 , the monitor ROM immedia tely echoes each received byte back to th e PTA0 pin for error checking. Figure 18-11. Read Transaction Any result of a command appears after the echo of the last byte of the comm[...]
-
Page 261
Monitor ROM (MON) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 261 T able 18-3. READ (Read Memory) Command Description Read byte from memor y Operand 2-byte address in high-byte:low-byte order Data Retur ned Retur ns contents of specified address Opcode $4A Command Sequence T able 18-4. WRITE (Write Mem ory) Comman[...]
-
Page 262
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 262 Freescale Semiconductor A sequence of IREAD or IWRITE commands can acce ss a block of memory sequentially over the full 64-Kbyte memory map. T able 18-6. IWRITE (Index ed Write) Command Descripti on Wr ite to last address accessed + 1 Operand Single data byte Data Return[...]
-
Page 263
Monitor ROM (MON) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 263 18.3.1.8 Baud Rate With a 4.9152-MHz crystal and the PTC2 pin at lo gic 1 durin g reset, data is transferred between the monitor and host at 4800 baud. If the PTC2 pin is at logic 0 during reset, the monitor baud rate is 9600. See Table 18-9 . 18.3.[...]
-
Page 264
Development Support MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 264 Freescale Semiconductor Figure 18-13. Monitor Mode Entry Timing BYTE 1 BYTE 1 ECHO BYTE 2 BYTE 2 ECHO BYTE 8 BYTE 8 ECHO COMMAND COMMAND ECHO PA0 PA7 RST V DD 4096 + 32 CGMXCLK CYCLES 24 BUS CYCLES 256 BUS CYCLES (MINIMUM) 1 3 1 1 2 1 BREAK NOTES: 2 = Data return delay, [...]
-
Page 265
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 265 Chapter 19 Electrical Specifications 19.1 Introduction This section contains electrical an d timing specifications. 19.2 Absolute Maximum Ratings Maximum ratings are the extreme limits to which t he microcon troller unit (MCU) can be exposed without permanently damag[...]
-
Page 266
Electrical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 266 Freescale Semiconductor 19.3 Functional Operating Range 19.4 Thermal Characteristics Characteristic Symbol Value Unit Operating t emperature range (1) MC68HC908MR24CFU MC68HC908MR24VFU 1. See Freescale representati ve for temperature availability. C = Extended temp[...]
-
Page 267
DC Electrical Characteristics MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 267 19.5 DC Electrical Characteristics Charact eristic (1) 1. V DD = 5.0 Vdc ± 10%, V SS = 0 Vdc, T A = T L to T H , unless otherwise noted. Symbol Min Typ (2) 2. Typical values reflect average measur ements at midpoint of voltage range, 25[...]
-
Page 268
Electrical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 268 Freescale Semiconductor 19.6 FLASH Memory Characte ristics 19.7 Control Timing Characteristic Symbol Min Typ Max Unit RAM data retenti on v oltag e V RDR 1.3 — — V FLASH program bus cloc k frequency — 1 — — MHz FLASH read bus clock f requency f Read (1) 1[...]
-
Page 269
Serial Peripheral Inte rface Characteristics MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 269 19.8 Serial Peripheral Interface Characteristics Diagram Number (1) 1. V DD = 5.0 Vdc ± 10%, all timing is shown with respect to 20% V DD and 70% V DD , unless otherwise noted; assumes 100 pF load on all SPI pins Charac t[...]
-
Page 270
Electrical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 270 Freescale Semiconductor Figure 19-1. SPI Master Timing NOTE SS PIN OF MASTER HELD HIGH MSB IN SS INPUT SPCK, CPOL = 0 OUTPUT SPCK, CPOL = 1 OUTPUT MISO INPUT MOSI OUTPUT NOTE 4 5 5 1 4 BITS 6–1 LSB IN MASTER MSB OUT BITS 6–1 MASTER LSB OUT 10 11 10 11 7 6 NOTE [...]
-
Page 271
Serial Peripheral Inte rface Characteristics MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 271 Figure 19-2. SPI Slave Timi ng Note: Not defined, but normally MSB of character just received SLAVE SS INPUT SPCK, CPOL = 0 INPUT SPCK, CPOL = 1 INPUT MISO INPUT MOSI OUTPUT 4 5 5 1 4 MSB IN BITS 6–1 8 6 10 11 11 NOTE SL[...]
-
Page 272
Electrical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 272 Freescale Semiconductor 19.9 TImer Interface Module Characteristics 19.10 Clock Generation Modu le Component Specifications 19.11 CGM Operating Conditio ns Characteristic Symbol Min Max Unit Input capture pulse width t TIH, t TIL 125 — ns Input clock pulse width [...]
-
Page 273
CGM Acquisition/Lock Time Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 273 19.12 CGM Acquisition/Lo ck Time Specifications Description Symbol Min Typ Max Notes Filter capacitor multiply f actor C FA C T — 0.0154 — F/sV Acquisition mode time f actor K ACQ — 0.1135 — V T racking mode time f act[...]
-
Page 274
Electrical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 274 Freescale Semiconductor 19.13 Analog-to-Digital Co nverter (ADC) Characteristics Characteristic Symbol Min Typ Max Unit Notes Supply v olta ge V DDAD 4.5 — 5.5 V V DD AD should be tied to the same potential as V DD via separate traces Input v oltages V ADIN 0— [...]
-
Page 275
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 275 Chapter 20 Ordering Information and Mechanical Specifications 20.1 Introduction This section provides ordering information for the MC68HC9 08MR16 and MC68HC908MR32 along with the dimensions for: • 64-lead plastic quad flat pack (QFP) • 56-pin shrink dual in-line [...]
-
Page 276
Ordering Information and Mechanical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 276 Freescale Semiconductor 20.3 64-Pin Plastic Quad Flat Pack (QFP)[...]
-
Page 277
56-Pin Shrink Du al In-Line Pac kage (SDIP) MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 277 20.4 56-Pin Shrink Dual In-Line Package (SDIP)[...]
-
Page 278
Ordering Information and Mechanical Specifications MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 278 Freescale Semiconductor[...]
-
Page 279
MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 Freescale Semiconductor 279 Appendix A MC68HC908MR16 The information contained in this d ocument pertains to the MC68HC908MR16 with the exception of that shown in Figure A-1 .[...]
-
Page 280
MC68HC908MR16 MC68HC908MR32 • MC68 HC908MR16 Data Sheet, Rev . 6.1 280 Freescale Semiconductor $0000 ↓ $005F I/O REGISTERS — 96 BYTES $0060 ↓ $035F RAM — 768 BYTES $0360 ↓ $7FFF UNIMPLEMENTED — 31,904 BYTES $8000 ↓ $BEFF FLASH — 16,128 BYTES $BF00 ↓ $FDFF UNIMPLEMENTED — 16,128 BYTES $FE00 SIM BREAK STATUS REGISTER (SBSR) $FE0[...]
-
Page 281
[...]
-
Page 282
How t o Reach Us: Home P age: www .freescale.com E-mail: suppor t@freescale.com USA/Eur ope or Locatio ns Not Listed: F reescale Semiconductor T echnical Information Center, CH370 1300 N. Alma School Road Chandler , Arizona 85224 +1-800-521-6274 or +1-480-768-2130 suppor t@freescale.com Europe, Middle East, and Africa: F reescale Halbleiter Deutsch[...]