MC68HC908LJ12 Technical Data M68HC08 Microcontrollers Rev. 2.1 MC68HC908LJ12/D August 2, 2005 freescale.
MC68HC908LJ12 Technical Data Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages.
Technical Data To provide the most up-to-date information, the revision of our documents on the World Wide Web will be the most current. Your printed copy may be an earlier revision. To verify you have the latest information available, refer to: http://freescale.com The following revision history table summarizes changes contained in this document. For your convenience, the page number designators have been linked to the appropriate location.
Technical Data — MC68HC908LJ12 List of Sections Section 1. General Description . . . . . . . . . . . . . . . . . . . . 33 Section 2. Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Section 3. Random-Access Memory (RAM) . . . . . . . . . . 59 Section 4. FLASH Memory (FLASH) . . . . . . . . . . . . . . . . 61 Section 5. Configuration Registers (CONFIG) . . . . . . . . 71 Section 6. Central Processor Unit (CPU) . . . . . . . . . . . . 77 Section 7. Oscillator (OSC) . . . . . . . . . . . . .
List of Sections Section 20. Computer Operating Properly (COP) . . . . 371 Section 21. Low-Voltage Inhibit (LVI) . . . . . . . . . . . . . . 377 Section 22. Break Module (BRK) . . . . . . . . . . . . . . . . . . 383 Section 23. Electrical Specifications. . . . . . . . . . . . . . . 391 Section 24. Mechanical Specifications . . . . . . . . . . . . . 407 Section 25. Ordering Information . . . . . . . . . . . . . . . . . 411 Technical Data 6 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Table of Contents Section 1. General Description 1.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.4 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 1.5 Pin Assignments . . . . . .
Table of Contents 2.4 Reserved Memory Locations . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.5 Input/Output (I/O) Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Section 3. Random-Access Memory (RAM) 3.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 3.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Section 6. Central Processor Unit (CPU) 6.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 6.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.4 CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.4.1 Accumulator . . . . . . . . . . . . . . . . . .
Table of Contents 7.6 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 7.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 7.7 Oscillator During Break Mode. . . . . . . . . . . . . . . . . . . . . . . . . . 99 Section 8. Clock Generator Module (CGM) 8.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents 8.7 Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 8.8 Special Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.8.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 8.8.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126 8.8.3 CGM During Break Interrupts. . . . . . . . . . . . . . . . . . . . . . . 126 8.
Table of Contents 9.6.1.3 9.6.1.4 9.6.1.5 9.6.1.6 9.6.2 9.6.3 9.6.4 Interrupt Status Registers . . . . . . . . . . . . . . . . . . . . . . .145 Interrupt Status Register 1 . . . . . . . . . . . . . . . . . . . . . . . 145 Interrupt Status Register 2 . . . . . . . . . . . . . . . . . . . . . . . 147 Interrupt Status Register 3 . . . . . . . . . . . . . . . . . . . . . . . 147 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Break Interrupts . . . . . . . . . . . .
Table of Contents Section 11. Timer Interface Module (TIM) 11.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 11.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 11.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 11.4 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 11.5 Functional Description . . . . . . . . . . . . . .
Table of Contents 12.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 12.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 12.4.1 Time Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.4.2 Calendar Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.4.3 Alarm Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 12.4.
Table of Contents 13.6.2 Infrared Receive Decoder . . . . . . . . . . . . . . . . . . . . . . . . . 233 13.7 SCI Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.7.1 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 13.7.2 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 13.7.2.1 Character Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 13.7.2.2 Character Transmission .
Table of Contents Section 14. Serial Peripheral Interface Module (SPI) 14.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 14.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 14.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 14.4 Pin Name Conventions and I/O Register Addresses . . . . . . . 271 14.5 Functional Description . . . . . . . . . . . . . . . . . .
Table of Contents 14.14.2 SPI Status and Control Register . . . . . . . . . . . . . . . . . . . . 296 14.14.3 SPI Data Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Section 15. Analog-to-Digital Converter (ADC) 15.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301 15.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 15.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents 16.4 Pin Name Conventions and I/O Register Addresses . . . . . . . 318 16.5 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320 16.5.1 LCD Duty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 16.5.2 LCD Voltages (VLCD, VLCD1, VLCD2, VLCD3) . . . . . . . . . . . 323 16.5.3 LCD Cycle Frame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 16.5.4 Fast Charge and Low Current . . . . . . . . . . . . . . . . . .
Table of Contents 17.6 Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 17.6.1 Port D Data Register (PTD) . . . . . . . . . . . . . . . . . . . . . . . . 354 17.6.2 Data Direction Register D (DDRD). . . . . . . . . . . . . . . . . . . 355 Section 18. External Interrupt (IRQ) 18.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357 18.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Section 20. Computer Operating Properly (COP) 20.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371 20.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 20.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372 20.4 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 20.4.1 ICLK . . . . . . . . . . . . . . . . . . . . .
Table of Contents 21.6 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 21.6.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382 21.6.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382 Section 22. Break Module (BRK) 22.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383 22.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents 23.9 3.3V Control Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 23.10 5.0V Oscillator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . 398 23.11 3.3V Oscillator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . 398 23.12 5.0V ADC Electrical Characteristics . . . . . . . . . . . . . . . . . . . .399 23.13 3.3V ADC Electrical Characteristics . . . . . . . . . . . . . . . . . . . .400 23.14 Timer Interface Module Characteristics . .
Technical Data — MC68HC908LJ12 List of Figures Figure Title 1-1 1-2 1-3 1-4 MC68HC908LJ12 Block Diagram. . . . . . . . . . . . . . . . . . . . . . . 37 64-Pin QFP and 64-Pin LQFP Pin Assignment . . . . . . . . . . . . 38 52-Pin LQFP Pin Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Power Supply Bypassing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2-1 2-2 Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List of Figures Figure Title 8-4 8-5 8-6 8-7 8-8 8-9 8-10 PLL Control Register (PCTL) . . . . . . . . . . . . . . . . . . . . . . . . . 118 PLL Bandwidth Control Register (PBWCR) . . . . . . . . . . . . . . 121 PLL Multiplier Select Register High (PMSH) . . . . . . . . . . . . . 122 PLL Multiplier Select Register Low (PMSL) . . . . . . . . . . . . . . 122 PLL VCO Range Select Register (PMRS) . . . . . . . . . . . . . . . 123 PLL Reference Divider Select Register (PMDS) . . . . . . . . . .
List of Figures Figure Title 10-6 10-7 10-8 10-9 10-10 Write Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Stack Pointer at Monitor Mode Entry . . . . . . . . . . . . . . . . . . . 168 Monitor Mode Entry Timing. . . . . . . . . . . . . . . . . . . . . . . . . . .169 Data Block Format for ROM-Resident Routines. . . . . . . . . . . 172 EE_WRITE FLASH Memory Usage . . . . . . . . . . . . . . . . . . . .
List of Figures Figure Title 13-1 13-2 13-3 13-4 13-5 13-6 13-7 13-8 13-9 13-10 13-11 13-12 13-13 13-14 13-15 13-16 13-17 13-18 13-19 13-20 IRSCI I/O Registers Summary . . . . . . . . . . . . . . . . . . . . . . . . 230 IRSCI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Infrared Sub-Module Diagram . . . . . . . . . . . . . . . . . . . . . . . . 232 Infrared SCI Data Example. . . . . . . . . . . . . . . . . . . . . . . . . . .233 SCI Module Block Diagram. . . . . . . . .
List of Figures Figure Title 15-1 15-2 15-3 15-4 15-5 15-6 15-7 15-8 15-9 ADC I/O Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 303 ADC Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 8-Bit Truncation Mode Error . . . . . . . . . . . . . . . . . . . . . . . . . . 307 ADC Status and Control Register (ADSCR) . . . . . . . . . . . . . . 310 ADRH and ADRL in 8-Bit Truncated Mode. . . . . . . . . . . . . . . 312 ADRH and ADRL in Right Justified Mode. .
List of Figures Figure 17-8 17-9 17-10 17-11 17-12 17-13 17-14 Title Page Port B LED Control Register (LEDB) . . . . . . . . . . . . . . . . . . . 350 Port C Data Register (PTC) . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Data Direction Register B (DDRB) . . . . . . . . . . . . . . . . . . . . . 352 Port C I/O Circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Port D Data Register (PTD) . . . . . . . . . . . . . . . . . . . . . . . . . .
Technical Data — MC68HC908LJ12 List of Tables Table Title 2-1 Vector Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58 5-1 LVI Trip Point Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6-1 6-2 Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 8-1 8-3 8-2 Numeric Examples . . . . . . . . . . . . . . . . . . . . . .
List of Tables Table Title Page 10-16 ICP_LDRNGE Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 10-17 EE_WRITE Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 10-18 EE_READ Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 11-1 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 11-2 Prescaler Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List of Tables Table 17-1 17-2 17-3 17-4 17-5 Title Page Port Control Register Bits Summary. . . . . . . . . . . . . . . . . . . .343 Port A Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Port B Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 Port C Pin Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Port D Pin Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List of Tables Technical Data 32 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 1. General Description 1.1 Contents 1.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.4 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 1.5 Pin Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 1.6 Pin Functions . . . . . . . . . . . .
General Description 1.2 Introduction The MC68HC908LJ12 is a member of the low-cost, high-performance M68HC08 Family of 8-bit microcontroller units (MCUs). The M68HC08 Family is based on the customer-specified integrated circuit (CSIC) design strategy. All MCUs in the family use the enhanced M68HC08 central processor unit (CPU08) and are available with a variety of modules, memory sizes and types, and package types. 1.
General Description • Serial peripheral interface module (SPI) • IRQ external interrupt pin with integrated pullup • 8-bit keyboard wakeup port with programmable pullup • 32 general-purpose input/output (I/O) pins: – High current 8-mA sink capability on PTB2–PTB5 – High current 20-mA sink capability on PTB0–PTB1 • 4/3 backplanes and static with maximum 27 frontplanes liquid crystal display (LCD) driver • 6-channel, 10-bit successive approximation analog-to-digital converter (ADC) • Resident ro
General Description Features of the CPU08 include the following: • Enhanced HC05 programming model • Extensive loop control functions • 16 addressing modes (eight more than the HC05) • 16-bit Index register and stack pointer • Memory-to-memory data transfers • Fast 8 × 8 multiply instruction • Fast 16/8 divide instruction • Binary-coded decimal (BCD) instructions • Optimization for controller applications • Efficient C language support 1.
General Description INTERNAL BUS USER FLASH — 12,288 BYTES USER RAM — 512 BYTES 32.
General Description BP1 BP0 PTB5/T2CH1 PTB4/T2CH0 PTB3/T1CH1 PTB2/T1CH0 PTB1/RxD PTB0/TxD CGMXFC OSC2 OSC1 VSS VDD 62 61 60 59 58 57 56 55 54 53 52 51 50 FP0/BP3 1 49 VDDA BP2 63 64 PTD4/KBI4 1.
BP0 PTB3/T1CH1 PTB2/T1CH0 PTB1/RxD PTB0/TxD CGMXFC OSC2 OSC1 VSS VDD 50 49 48 47 46 45 44 43 42 41 FP0/BP3 1 40 VDDA BP1 51 52 BP2 General Description 39 VREFL 33 PTA3/KBI3 FP7 8 32 PTA2/KBI2 FP8 9 31 PTA1/KBI1 FP9 10 30 PTA0/KBI0 FP10 11 29 PTC7/FP26 FP11 12 28 PTC6/FP25 FP13 PTC5/FP24 26 27 RST 13 14 FP12 25 7 IRQ FP6 24 PTA4/ADC0 PTC4/FP23 34 23 6 PTC3/FP22 FP5 22 PTA5/ADC1 PTC2/FP21 35 21 5 PTC1/FP20 FP4 20 PTA6/ADC2 PTC0/F
General Description 1.6 Pin Functions Description of pin functions are provided here. 1.6.1 Power Supply Pins (VDD and VSS) VDD and VSS are the power supply and ground pins. The MCU operates from a single power supply. Fast signal transitions on MCU pins place high, short-duration current demands on the power supply. To prevent noise problems, take special care to provide power supply bypassing at the MCU as Figure 1-4 shows. Place the C1 bypass capacitor as close to the MCU as possible.
General Description 1.6.3 Oscillator Pins (OSC1 and OSC2) The OSC1 and OSC2 pins are the connections for the on-chip oscillator circuit. The OSC1 pin contains a schmitt-trigger and a spike filter for improved EMC performance. See Section 7. Oscillator (OSC). 1.6.4 External Reset Pin (RST) A logic 0 on the RST pin forces the MCU to a known start-up state. RST is bidirectional, allowing a reset of the entire system. It is driven low when any internal reset source is asserted.
General Description 1.6.9 Port A Input/Output (I/O) Pins (PTA7–PTA0) PTA7–PTA0 are special function, bidirectional port pins (Section 17.). PTA7/ADC3–PTA4/ADC0 are shared with the ADC (Section 15.), and PTA3/KBI3–PTA0/KBI0 are shared with the KBI module (Section 19.). 1.6.10 Port B I/O Pins (PTB7–PTB0) PTB7–PTB0 are special function, bidirectional port pins (Section 17.). PTB0/TxD–PTB1/RxD are shared with the SCI module (Section 13.), PTB5/T2CH1–PTB4/T2CH0 are shared with the TIM2 (Section 11.
Technical Data — MC68HC908LJ12 Section 2. Memory Map 2.1 Contents 2.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.3 Unimplemented Memory Locations . . . . . . . . . . . . . . . . . . . . . 43 2.4 Reserved Memory Locations . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.5 Input/Output (I/O) Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.2 Introduction The CPU08 can address 64k-bytes of memory space.
Memory Map 2.4 Reserved Memory Locations Accessing a reserved location can have unpredictable effects on MCU operation. In the Figure 2-1 and in register figures in this document, reserved locations are marked with the word Reserved or with the letter R. 2.5 Input/Output (I/O) Section Most of the control, status, and data registers are in the zero page area of $0000–$005F.
Memory Map $0000 ↓ $005F I/O Registers 96 Bytes $0060 ↓ $025F RAM 512 Bytes $0260 ↓ $BFFF Unimplemented 48,544 Bytes $C000 ↓ $EFFF FLASH Memory 12,288 Bytes $F000 ↓ $FBFF Unimplemented 3,072 Bytes $FC00 ↓ $FDFF Monitor ROM 1 512 Bytes $FE00 SIM Break Status Register (SBSR) $FE01 SIM Reset Status Register (SRSR) $FE02 Reserved $FE03 SIM Break Flag Control Register (SBFCR) $FE04 Interrupt Status Register 1 (INT1) $FE05 Interrupt Status Register 2 (INT2) $FE06 Interrupt Status Registe
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr. $001E $001F Register Name Read: IRQ Status and Control Register Write: (INTSCR) Reset: Bit 7 6 5 4 3 2 1 Bit 0 0 0 0 0 IRQF 0 IMASK MODE 0 0 0 SSREC STOP COPD 0 0 0 PS2 PS1 PS0 ACK 0 Read: COPRS Configuration Register 1 Write: † (CONFIG1) Reset: 0 0 0 0 LVISTOP LVIRSTD LVIPWRD 0 0 TOIE TSTOP 0 0 1 0 0 0 † One-time writable register after each reset. †† Reset by POR only.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map Addr.
Memory Map . Table 2-1.
Technical Data — MC68HC908LJ12 Section 3. Random-Access Memory (RAM) 3.1 Contents 3.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 3.2 Introduction This section describes the 512 bytes of RAM (random-access memory). 3.3 Functional Description Addresses $0060 through $025F are RAM locations. The location of the stack RAM is programmable.
Random-Access Memory (RAM) During a subroutine call, the CPU uses two bytes of the stack to store the return address. The stack pointer decrements during pushes and increments during pulls. NOTE: Be careful when using nested subroutines. The CPU may overwrite data in the RAM during a subroutine or during the interrupt stacking operation. Technical Data 60 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 4. FLASH Memory (FLASH) 4.1 Contents 4.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.4 FLASH Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.5 FLASH Page Erase Operation . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.6 FLASH Mass Erase Operation . . . . . . . . . . . . . . .
FLASH Memory (FLASH) Addr. $FE08 $FE09 Register Name Bit 7 6 5 4 0 0 0 0 0 0 0 BPR7 BPR6 0 0 Read: FLASH Control Register Write: (FLCR) Reset: Read: FLASH Block Protect Register Write: (FLBPR) Reset: 3 2 1 Bit 0 HVEN MASS ERASE PGM 0 0 0 0 0 BPR5 BPR4 BPR3 BPR2 BPR1 BPR0 0 0 0 0 0 0 = Unimplemented Figure 4-1. FLASH I/O Register Summary 4.
FLASH Memory (FLASH) 4.4 FLASH Control Register The FLASH control register (FLCR) controls FLASH program and erase operations. Address: Read: $FE08 Bit 7 6 5 4 0 0 0 0 0 0 0 0 Write: Reset: 3 2 1 Bit 0 HVEN MASS ERASE PGM 0 0 0 0 Figure 4-2. FLASH Control Register (FLCR) HVEN — High Voltage Enable Bit This read/write bit enables the charge pump to drive high voltages for program and erase operations in the array.
FLASH Memory (FLASH) 4.5 FLASH Page Erase Operation Use the following procedure to erase a page of FLASH memory. A page consists of 128 consecutive bytes starting from addresses $xx00 or $xx80. The 48-byte user interrupt vectors area also forms a page. The 48-byte user interrupt vectors cannot be erased by the page erase operation because of security reasons. Mass erase is required to erase this page. 1. Set the ERASE bit and clear the MASS bit in the FLASH control register. 2.
FLASH Memory (FLASH) 4.6 FLASH Mass Erase Operation Use the following procedure to erase the entire FLASH memory to read as logic 1: 1. Set both the ERASE bit and the MASS bit in the FLASH control register. 2. Write any data to any FLASH address within the FLASH memory address range. 3. Wait for a time, tnvs (10µs). 4. Set the HVEN bit. 5. Wait for a time tmerase (4ms). 6. Clear the ERASE bit. 7. Wait for a time, tnvhl (100µs). 8. Clear the HVEN bit. 9.
FLASH Memory (FLASH) 4.7 FLASH Program Operation Programming of the FLASH memory is done on a row basis. A row consists of 64 consecutive bytes starting from addresses $xx00, $xx40, $xx80, or $xxC0. The procedure for programming a row of the FLASH memory is outlined below: 1. Set the PGM bit. This configures the memory for program operation and enables the latching of address and data for programming. 2. Write any data to any FLASH address within the row address range desired. 3.
FLASH Memory (FLASH) 1 Set PGM bit Algorithm for programming a row (64 bytes) of FLASH memory 2 Write any data to any FLASH address within the row address range desired 3 Wait for a time, tnvs 4 Set HVEN bit 5 Wait for a time, tpgs 6 7 Write data to the FLASH address to be programmed Wait for a time, tprog Completed programming this row? Y N NOTE: The time between each FLASH address change (step 6 to step 6), or the time between the last FLASH address programmed to clearing PGM bit (step 6
FLASH Memory (FLASH) 4.8 FLASH Protection Due to the ability of the on-board charge pump to erase and program the FLASH memory in the target application, provision is made to protect pages of memory from unintentional erase or program operations due to system malfunction. This protection is done by use of a FLASH block protect register (FLBPR). The FLBPR determines the range of the FLASH memory which is to be protected.
FLASH Memory (FLASH) BPR0 is used only for BPR[7:0] = $FF, for no block protection. The resultant 16-bit address is used for specifying the start address of the FLASH memory for block protection. The FLASH is protected from this start address to the end of FLASH memory, at $FFFF. With this mechanism, the protect start address can be XX00 or XX80 (at page boundaries — 128 bytes) within the FLASH memory.
FLASH Memory (FLASH) Technical Data 70 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 5. Configuration Registers (CONFIG) 5.1 Contents 5.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.4 Configuration Register 1 (CONFIG1) . . . . . . . . . . . . . . . . . . . . 73 5.5 Configuration Register 2 (CONFIG2) . . . . . . . . . . . . . . . . . . . . 75 5.
Configuration Registers (CONFIG) Addr. $001D $001F Register Name Bit 7 6 0 STOP_ IRCDIS 0 0 Read: Configuration Register 2 Write: (CONFIG2)† Reset: Read: COPRS Configuration Register 1 † Write: (CONFIG1) Reset: 0 5 4 STOP_ DIV2CLK XCLKEN 0 0 LVISTOP LVIRSTD LVIPWRD 0 0 1 3 2 1 Bit 0 PCEH PCEL LVISEL1 LVISEL0 0 0 0†† 0†† SSREC STOP COPD 0 0 0 0 0 † One-time writable register after each reset. †† Reset by POR only. = Unimplemented Figure 5-1.
Configuration Registers (CONFIG) 5.4 Configuration Register 1 (CONFIG1) Address: $001F Bit 7 Read: Write: Reset: COPRS 0 6 5 4 LVISTOP LVIRSTD LVIPWRD 0 0 1 3 0 0 2 1 Bit 0 SSREC STOP COPD 0 0 0 = Unimplemented Figure 5-2. Configuration Register 1 (CONFIG1) COPRS — COP Rate Select COPRS selects the COP time-out period. Reset clears COPRS. (See Section 20. Computer Operating Properly (COP).
Configuration Registers (CONFIG) SSREC — Short Stop Recovery SSREC enables the CPU to exit stop mode with a delay of 32 ICLK cycles instead of a 4096 ICLK cycle delay. 1 = Stop mode recovery after 32 ICLK cycles 0 = Stop mode recovery after 4096 ICLK cycles NOTE: Exiting stop mode by pulling reset will result in the long stop recovery. If using an external crystal oscillator, do not set the SSREC bit.
Configuration Registers (CONFIG) 5.5 Configuration Register 2 (CONFIG2) Address: Read: $001D Bit 7 6 0 STOP_ IRCDIS 0 0 Write: Reset: 5 4 STOP_ DIV2CLK XCLKEN 0 0 = Unimplemented 3 2 1 Bit 0 PCEH PCEL LVISEL1 LVISEL0 0 0 0†† 0†† †† Reset by POR only. Figure 5-3. Configuration Register 2 (CONFIG2) STOP_IRCDIS — Internal RC Oscillator Stop Mode Disable Setting STOP_IRCDIS disables the internal RC oscillator during stop mode.
Configuration Registers (CONFIG) PCEH — Port C Enable High Nibble Setting PCEH configures the PTC4/FP23–PTC7/FP26 pins for LCD frontplane driver use. Reset clears this bit. 1 = PTC4/FP23–PTC7/FP26 pins configured as LCD frontplane driver pins: FP23–FP26 0 = PTC4/FP23–PTC7/FP26 pins configured as standard I/O pins: PTC4–PTC7 PCEL — Port C Enable Low Nibble Setting PCEL configures the PTC0/FP19–PTC3/FP22 pins for LCD frontplane driver use. Reset clears this bit.
Technical Data — MC68HC908LJ12 Section 6. Central Processor Unit (CPU) 6.1 Contents 6.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.4 CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.4.1 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.4.2 Index Register . . . . . .
Central Processor Unit (CPU) 6.2 Introduction The M68HC08 CPU (central processor unit) is an enhanced and fully object-code-compatible version of the M68HC05 CPU. The CPU08 Reference Manual (Freescale document order number CPU08RM/AD) contains a description of the CPU instruction set, addressing modes, and architecture. 6.
Central Processor Unit (CPU) 6.4 CPU Registers Figure 6-1 shows the five CPU registers. CPU registers are not part of the memory map. 0 7 ACCUMULATOR (A) 0 15 H X INDEX REGISTER (H:X) 15 0 STACK POINTER (SP) 15 0 PROGRAM COUNTER (PC) 7 0 V 1 1 H I N Z C CONDITION CODE REGISTER (CCR) CARRY/BORROW FLAG ZERO FLAG NEGATIVE FLAG INTERRUPT MASK HALF-CARRY FLAG TWO’S COMPLEMENT OVERFLOW FLAG Figure 6-1. CPU Registers 6.4.1 Accumulator The accumulator is a general-purpose 8-bit register.
Central Processor Unit (CPU) 6.4.2 Index Register The 16-bit index register allows indexed addressing of a 64K-byte memory space. H is the upper byte of the index register, and X is the lower byte. H:X is the concatenated 16-bit index register. In the indexed addressing modes, the CPU uses the contents of the index register to determine the conditional address of the operand. The index register can serve also as a temporary data storage location.
Central Processor Unit (CPU) NOTE: The location of the stack is arbitrary and may be relocated anywhere in RAM. Moving the SP out of page 0 ($0000 to $00FF) frees direct address (page 0) space. For correct operation, the stack pointer must point only to RAM locations. 6.4.4 Program Counter The program counter is a 16-bit register that contains the address of the next instruction or operand to be fetched.
Central Processor Unit (CPU) 6.4.5 Condition Code Register The 8-bit condition code register contains the interrupt mask and five flags that indicate the results of the instruction just executed. Bits 6 and 5 are set permanently to logic 1. The following paragraphs describe the functions of the condition code register. Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 V 1 1 H I N Z C X 1 1 X 1 X X X X = Indeterminate Figure 6-6.
Central Processor Unit (CPU) I — Interrupt Mask When the interrupt mask is set, all maskable CPU interrupts are disabled. CPU interrupts are enabled when the interrupt mask is cleared. When a CPU interrupt occurs, the interrupt mask is set automatically after the CPU registers are saved on the stack, but before the interrupt vector is fetched. 1 = Interrupts disabled 0 = Interrupts enabled NOTE: To maintain M6805 Family compatibility, the upper byte of the index register (H) is not stacked automatically.
Central Processor Unit (CPU) C — Carry/Borrow Flag The CPU sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. Some instructions — such as bit test and branch, shift, and rotate — also clear or set the carry/borrow flag. 1 = Carry out of bit 7 0 = No carry out of bit 7 6.5 Arithmetic/Logic Unit (ALU) The ALU performs the arithmetic and logic operations defined by the instruction set.
Central Processor Unit (CPU) 6.6.2 Stop Mode The STOP instruction: • Clears the interrupt mask (I bit) in the condition code register, enabling external interrupts. After exit from stop mode by external interrupt, the I bit remains clear. After exit by reset, the I bit is set. • Disables the CPU clock. After exiting stop mode, the CPU clock begins running after the oscillator stabilization delay. 6.
Central Processor Unit (CPU) V H I N Z C ADC #opr ADC opr ADC opr ADC opr,X ADC opr,X ADC ,X ADC opr,SP ADC opr,SP A ← (A) + (M) + (C) Add with Carry ↕ ↕ IMM DIR EXT IX2 – ↕ ↕ ↕ IX1 IX SP1 SP2 A9 B9 C9 D9 E9 F9 9EE9 9ED9 ii dd hh ll ee ff ff IMM DIR EXT IX2 – ↕ ↕ ↕ IX1 IX SP1 SP2 AB BB CB DB EB FB 9EEB 9EDB ii dd hh ll ee ff ff ADD #opr ADD opr ADD opr ADD opr,X ADD opr,X ADD ,X ADD opr,SP ADD opr,SP Add without Carry AIS #opr Add Immediate Value (Signed) to SP SP ← (SP) + (16 « M) – – – – –
Central Processor Unit (CPU) Effect on CCR V H I N Z C Cycles Description Operand Operation Opcode Source Form Address Mode Table 6-1.
Central Processor Unit (CPU) Table 6-1.
Central Processor Unit (CPU) V H I N Z C CMP #opr CMP opr CMP opr CMP opr,X CMP opr,X CMP ,X CMP opr,SP CMP opr,SP Compare A with M (A) – (M) COM opr COMA COMX COM opr,X COM ,X COM opr,SP Complement (One’s Complement) CPHX #opr CPHX opr Compare H:X with M CPX #opr CPX opr CPX opr CPX ,X CPX opr,X CPX opr,X CPX opr,SP CPX opr,SP Compare X with M DAA Decimal Adjust A M ← (M) = $FF – (M) A ← (A) = $FF – (M) X ← (X) = $FF – (M) M ← (M) = $FF – (M) M ← (M) = $FF – (M) M ← (M) = $FF – (M) (H:X) – (M:M
Central Processor Unit (CPU) V H I N Z C INC opr INCA INCX INC opr,X INC ,X INC opr,SP JMP opr JMP opr JMP opr,X JMP opr,X JMP ,X JSR opr JSR opr JSR opr,X JSR opr,X JSR ,X Increment Jump to Subroutine Load A from M LDHX #opr LDHX opr Load H:X from M LSL opr LSLA LSLX LSL opr,X LSL ,X LSL opr,SP LSR opr LSRA LSRX LSR opr,X LSR ,X LSR opr,SP Logical Shift Right dd ff ff 4 1 1 4 3 5 PC ← Jump Address dd hh ll ee ff ff 2 3 4 3 2 PC ← (PC) + n (n = 1, 2, or 3) Push (PCL); SP ← (SP) – 1 Push (PCH)
Central Processor Unit (CPU) V H I N Z C MOV opr,opr MOV opr,X+ MOV #opr,opr MOV X+,opr Move MUL Unsigned multiply (M)Destination ← (M)Source 0 – – ↕ ↕ H:X ← (H:X) + 1 (IX+D, DIX+) X:A ← (X) × (A) DD DIX+ – IMD IX+D – 0 – – – 0 INH DIR INH INH – – ↕ ↕ ↕ IX1 IX SP1 Cycles Effect on CCR Description Operand Operation Opcode Source Form Address Mode Table 6-1.
Central Processor Unit (CPU) V H I N Z C RTI Return from Interrupt RTS Return from Subroutine Cycles Effect on CCR Description Operand Operation Opcode Source Form Address Mode Table 6-1.
Central Processor Unit (CPU) V H I N Z C Cycles Effect on CCR Description Operand Operation Opcode Source Form Address Mode Table 6-1.
MSB Branch REL DIR INH 3 4 1 2 3 4 5 6 7 8 9 A B C MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 7. Oscillator (OSC) 7.1 Contents 7.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 7.3 Internal Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.4 Crystal (X-tal) Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.5 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.5.1 Crystal Amplifier Input Pin (OSC1).
Oscillator (OSC) The reference clock for the CGM, real time clock module (RTC), and other MCU sub-systems is driven by the crystal oscillator. The COP module is always driven by internal RC oscillator. The RC internal oscillator runs continuously after a POR or reset and is always available in run and wait modes. In stop mode, it can be disabled by setting the STOP_IRCDIS bit in CONFIG2 register. Figure 7-1. shows the block diagram of the oscillator module.
Oscillator (OSC) 7.3 Internal Oscillator The internal RC oscillator clock (ICLK) is a free running 64kHz clock (at VDD = 5V) that requires no external components. It is the reference clock input to the computer operating properly (COP) module. The ICLK can be turned off in stop mode by setting the STOP_IRCDIS bit in CONFIG2. After reset, the bit is clear by default and ICLK is enabled during stop mode. 7.
Oscillator (OSC) 7.5.1 Crystal Amplifier Input Pin (OSC1) OSC1 pin is an input to the crystal oscillator amplifier. Schmitt trigger and glitch filter are implemented on this pin to improve EMC performance. See Section 23. Electrical Specifications for detail specification of the glitch filter. 7.5.2 Crystal Amplifier Output Pin (OSC2) OSC2 pin is the output of the crystal oscillator inverting amplifier. 7.5.
Oscillator (OSC) 7.6.1 Wait Mode The WAIT instruction has no effect on the oscillator module. CGMXCLK, CGMRCLK, and ICLK continues to drive the MCU modules. 7.6.2 Stop Mode The STOP instruction clears the SIMOSCEN signal, and hence the CGMXCLK (and CGMRCLK) clock stops running. For continuous CGMXCLK operation in stop mode, set the STOP_XCLKEN to logic 1 before entering stop mode. Continuous CGMXCLK operation in stop mode allows the RTC module to generate interrupts to wake up the CPU.
Oscillator (OSC) Technical Data 100 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 8. Clock Generator Module (CGM) 8.1 Contents 8.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 8.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 8.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 8.4.1 Oscillator Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 8.4.2 Phase-Locked Loop Circuit (PLL) . .
Clock Generator Module (CGM) 8.7 Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 8.8 Special Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.8.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 8.8.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126 8.8.3 CGM During Break Interrupts. . . . . . . . . . . . . . . . . . . . . . . 126 8.
Clock Generator Module (CGM) 8.
Clock Generator Module (CGM) OSCILLATOR (OSC) MODULE See Section 7. Oscillator (OSC).
Clock Generator Module (CGM) Addr.
Clock Generator Module (CGM) 8.4.1 Oscillator Module The oscillator module provides two clock outputs CGMXCLK and CGMRCLK to the CGM module. CGMXCLK or CGMXCLK divide-by-two can be selected to drive the SIM module to generate the system bus clocks. CGMRCLK is the reference clock for the phase-lock-loop, to generate a higher frequency clock. The oscillator module also provides the reference clock for the real time clock (RTC) module. See Section 7.
Clock Generator Module (CGM) The operating range of the VCO is programmable for a wide range of frequencies and for maximum immunity to external noise, including supply and CGMXFC noise. The VCO frequency is bound to a range from roughly one-half to twice the center-of-range frequency, fVRS. Modulating the voltage on the CGMXFC pin changes the frequency within this range. By design, fVRS is equal to the nominal center-of-range frequency, fNOM, (38.
Clock Generator Module (CGM) 8.4.4 Acquisition and Tracking Modes The PLL filter is manually or automatically configurable into one of two operating modes: • Acquisition mode — In acquisition mode, the filter can make large frequency corrections to the VCO. This mode is used at PLL start up or when the PLL has suffered a severe noise hit and the VCO frequency is far off the desired frequency. When in acquisition mode, the ACQ bit is clear in the PLL bandwidth control register. (See 8.6.
Clock Generator Module (CGM) The following conditions apply when the PLL is in automatic bandwidth control mode: • The ACQ bit (See 8.6.2 PLL Bandwidth Control Register.) is a read-only indicator of the mode of the filter. (See 8.4.4 Acquisition and Tracking Modes.) • The ACQ bit is set when the VCO frequency is within a certain tolerance and is cleared when the VCO frequency is out of a certain tolerance. (See 8.9 Acquisition/Lock Time Specifications for more information.
Clock Generator Module (CGM) The following conditions apply when in manual mode: • ACQ is a writable control bit that controls the mode of the filter. Before turning on the PLL in manual mode, the ACQ bit must be clear. • Before entering tracking mode (ACQ = 1), software must wait a given time, tACQ (See 8.9 Acquisition/Lock Time Specifications.), after turning on the PLL by setting PLLON in the PLL control register (PCTL).
Clock Generator Module (CGM) The relationship between the VCO frequency, fVCLK, and the reference frequency, fRCLK, is P 2 N f VCLK = ----------- ( f RCLK ) R where N is the integer range multiplier, between 1 and 4095. In cases where desired bus frequency has some tolerance, choose fRCLK to a value determined either by other module requirements (such as modules which are clocked by CGMXCLK), cost requirements, or ideally, as high as the specified range allows. See Section 23. Electrical Specifications.
Clock Generator Module (CGM) 6. Select the VCO’s power-of-two range multiplier E, according to this table: Frequency Range E 0 < fVCLK < 9,830,400 0 9,830,400 ≤ fVCLK < 19,660,800 1 19,660,800 ≤ fVCLK < 39,321,600 2 NOTE: Do not program E to a value of 3. 7. Select a VCO linear range multiplier, L, where fNOM = 38.4kHz f VCLK L = round -------------------------- 2E × f NOM 8. Calculate and verify the adequacy of the VCO programmed center-of-range frequency, fVRS.
Clock Generator Module (CGM) 10. Program the PLL registers accordingly: a. In the PRE bits of the PLL control register (PCTL), program the binary equivalent of P. b. In the VPR bits of the PLL control register (PCTL), program the binary equivalent of E. c. In the PLL multiplier select register low (PMSL) and the PLL multiplier select register high (PMSH), program the binary equivalent of N. d. In the PLL VCO range select register (PMRS), program the binary coded equivalent of L. e.
Clock Generator Module (CGM) 8.4.7 Special Programming Exceptions The programming method described in 8.4.6 Programming the PLL does not account for three possible exceptions. A value of 0 for R, N, or L is meaningless when used in the equations given. To account for these exceptions: • A 0 value for R or N is interpreted exactly the same as a value of 1. • A 0 value for L disables the PLL and prevents its selection as the source for the base clock. (See 8.4.8 Base Clock Selector Circuit.) 8.4.
Clock Generator Module (CGM) 8.4.9 CGM External Connections In its typical configuration, the CGM requires up to four external components. Figure 8-3 shows the external components for the PLL: • Bypass capacitor, CBYP • Filter network Care should be taken with PCB routing in order to minimize signal cross talk and noise. (See 8.9 Acquisition/Lock Time Specifications for routing information, filter network and its effects on PLL performance.) MCU VSSA CGMXFC VDDA VDD 10 kΩ 0.01 µF CBYP 0.1 µF 0.
Clock Generator Module (CGM) 8.5.1 External Filter Capacitor Pin (CGMXFC) The CGMXFC pin is required by the loop filter to filter out phase corrections. An external filter network is connected to this pin. (See Figure 8-3.) NOTE: To prevent noise problems, the filter network should be placed as close to the CGMXFC pin as possible, with minimum routing distances and no routing of other signals across the network. 8.5.2 PLL Analog Power Pin (VDDA) VDDA is a power pin used by the analog portions of the PLL.
Clock Generator Module (CGM) 8.5.6 CGM VCO Clock Output (CGMVCLK) CGMVCLK is the clock output from the VCO. 8.5.7 CGM Base Clock Output (CGMOUT) CGMOUT is the clock output of the CGM. This signal goes to the SIM, which generates the MCU clocks. CGMOUT is a 50 percent duty cycle clock running at twice the bus frequency. CGMOUT is software programmable to be equal to CGMXCLK, CGMXCLK divided by two, or CGMPCLK divided by two. 8.5.
Clock Generator Module (CGM) 8.6.1 PLL Control Register The PLL control register (PCTL) contains the interrupt enable and flag bits, the on/off switch, the base clock selector bit, the prescaler bits, and the VCO power-of-two range selector bits. Address: $0036 Bit 7 Read: Write: Reset: PLLIE 0 6 PLLF 0 5 4 3 2 1 Bit 0 PLLON BCS PRE1 PRE0 VPR1 VPR0 1 0 0 0 0 0 = Unimplemented Figure 8-4.
Clock Generator Module (CGM) PLLON — PLL On Bit This read/write bit activates the PLL and enables the VCO clock, CGMVCLK. PLLON cannot be cleared if the VCO clock is driving the base clock, CGMOUT (BCS = 1). (See 8.4.8 Base Clock Selector Circuit.) Reset sets this bit so that the loop can stabilize as the MCU is powering up.
Clock Generator Module (CGM) Table 8-2. PRE 1 and PRE0 Programming PRE1 and PRE0 P Prescaler Multiplier 00 0 1 01 1 2 10 2 4 11 3 8 VPR1 and VPR0 — VCO Power-of-Two Range Select Bits These read/write bits control the VCO’s hardware power-of-two range multiplier E that, in conjunction with L (See 8.4.3 PLL Circuits, 8.4.6 Programming the PLL, and 8.6.4 PLL VCO Range Select Register.) controls the hardware center-of-range frequency, fVRS. VPR1:VPR0 cannot be written when the PLLON bit is set.
Clock Generator Module (CGM) Address: $0037 Bit 7 Read: Write: Reset: AUTO 0 6 LOCK 0 5 ACQ 0 4 3 2 1 0 0 0 0 0 0 0 0 = Unimplemented R Bit 0 R 0 = Reserved Figure 8-5. PLL Bandwidth Control Register (PBWCR) AUTO — Automatic Bandwidth Control Bit This read/write bit selects automatic or manual bandwidth control. When initializing the PLL for manual operation (AUTO = 0), clear the ACQ bit before turning on the PLL. Reset clears the AUTO bit.
Clock Generator Module (CGM) 8.6.3 PLL Multiplier Select Registers The PLL multiplier select registers (PMSH and PMSL) contain the programming information for the modulo feedback divider. Address: Read: $0038 Bit 7 6 5 4 0 0 0 0 0 0 0 0 Write: Reset: 3 2 1 Bit 0 MUL11 MUL10 MUL9 MUL8 0 0 0 0 = Unimplemented Figure 8-6.
Clock Generator Module (CGM) 8.6.4 PLL VCO Range Select Register The PLL VCO range select register (PMRS) contains the programming information required for the hardware configuration of the VCO. Address: Read: Write: Reset: $003A Bit 7 6 5 4 3 2 1 Bit 0 VRS7 VRS6 VRS5 VRS4 VRS3 VRS2 VRS1 VRS0 0 1 0 0 0 0 0 0 Figure 8-8.
Clock Generator Module (CGM) 8.6.5 PLL Reference Divider Select Register The PLL reference divider select register (PMDS) contains the programming information for the modulo reference divider. Address: Read: $003B Bit 7 6 5 4 0 0 0 0 0 0 0 0 Write: Reset: 3 2 1 Bit 0 RDS3 RDS2 RDS1 RDS0 0 0 0 1 = Unimplemented Figure 8-9.
Clock Generator Module (CGM) 8.7 Interrupts When the AUTO bit is set in the PLL bandwidth control register (PBWC), the PLL can generate a CPU interrupt request every time the LOCK bit changes state. The PLLIE bit in the PLL control register (PCTL) enables CPU interrupts from the PLL. PLLF, the interrupt flag in the PCTL, becomes set whether interrupts are enabled or not. When the AUTO bit is clear, CPU interrupts from the PLL are disabled and PLLF reads as logic 0.
Clock Generator Module (CGM) 8.8.2 Stop Mode If the oscillator stop mode enable bit (STOP_XCLKEN in CONFIG2 register) is configured to disabled the oscillator in stop mode, then the STOP instruction disables the CGM (oscillator and phase locked loop) and holds low all CGM outputs (CGMOUT, CGMVCLK, CGMPCLK, and CGMINT).
Clock Generator Module (CGM) 8.9 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/lock times. 8.9.1 Acquisition/Lock Time Definitions Typical control systems refer to the acquisition time or lock time as the reaction time, within specified tolerances, of the system to a step input.
Clock Generator Module (CGM) The most critical parameter which affects the reaction times of the PLL is the reference frequency, fRDV. This frequency is the input to the phase detector and controls how often the PLL makes corrections. For stability, the corrections must be small compared to the desired frequency, so several corrections are required to reduce the frequency error. Therefore, the slower the reference the longer it takes to make these corrections.
Clock Generator Module (CGM) 8.9.3 Choosing a Filter As described in 8.9.2 Parametric Influences on Reaction Time, the external filter network is critical to the stability and reaction time of the PLL. The PLL is also dependent on reference frequency and supply voltage. Either of the filter networks in Figure 8-10 is recommended when using a 32.768kHz reference clock (CGMRCLK). Figure 8-10 (a) is used for applications requiring better stability.
Clock Generator Module (CGM) Technical Data 130 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 9. System Integration Module (SIM) 9.1 Contents 9.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 9.3 SIM Bus Clock Control and Generation . . . . . . . . . . . . . . . . . 134 9.3.1 Bus Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 9.3.2 Clock Start-up from POR or LVI Reset. . . . . . . . . . . . . . . . 135 9.3.3 Clocks in Stop Mode and Wait Mode . . . . . . . . . . . . . . .
System Integration Module (SIM) 9.6.4 Status Flag Protection in Break Mode . . . . . . . . . . . . . . . . 148 9.7 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 9.7.1 Wait Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149 9.7.2 Stop Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150 9.8 SIM Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 9.8.
System Integration Module (SIM) MODULE STOP MODULE WAIT CPU STOP (FROM CPU) CPU WAIT (FROM CPU) STOP/WAIT CONTROL SIMOSCEN (TO CGM, OSC) SIM COUNTER COP CLOCK ICLK (FROM OSC) CGMOUT (FROM CGM) ÷2 CLOCK CONTROL VDD CLOCK GENERATORS INTERNAL CLOCKS INTERNAL PULLUP DEVICE RESET PIN LOGIC LVI (FROM LVI MODULE) POR CONTROL MASTER RESET CONTROL RESET PIN CONTROL SIM RESET STATUS REGISTER ILLEGAL OPCODE (FROM CPU) ILLEGAL ADDRESS (FROM ADDRESS MAP DECODERS) COP (FROM COP MODULE) RESET INTERRUPT SOU
System Integration Module (SIM) Addr. Register Name Read: SIM Break Status Register $FE00 Write: (SBSR) Reset: Bit 7 6 5 4 3 2 R R R R R R 1 SBSW Note Bit 0 R 0 Note: Writing a logic 0 clears SBSW.
System Integration Module (SIM) OSC2 OSCILLATOR (OSC) MODULE CGMXCLK OSC1 ICLK STOP MODE CLOCK ENABLE SIGNALS FROM CONFIG2 TO RTC, ADC SIM COUNTER SIMOSCEN SYSTEM INTEGRATION MODULE CGMRCLK CGMOUT ÷2 PHASE-LOCKED LOOP (PLL) SIMDIV2 IT12 TO REST OF MCU BUS CLOCK GENERATORS IT23 TO REST OF MCU PTC1 MONITOR MODE USER MODE Figure 9-3. CGM Clock Signals 9.3.
System Integration Module (SIM) 9.3.3 Clocks in Stop Mode and Wait Mode Upon exit from stop mode by an interrupt, break, or reset, the SIM allows ICLK to clock the SIM counter. The CPU and peripheral clocks do not become active until after the stop delay timeout. This timeout is selectable as 4096 or 32 ICLK cycles. (See 9.7.2 Stop Mode.) In wait mode, the CPU clocks are inactive. The SIM also produces two sets of clocks for other modules.
System Integration Module (SIM) 9.4.1 External Pin Reset The RST pin circuit includes an internal pull-up device. Pulling the asynchronous RST pin low halts all processing. The PIN bit of the SIM reset status register (SRSR) is set as long as RST is held low for a minimum of 67 ICLK cycles, assuming that neither the POR nor the LVI was the source of the reset. See Table 9-2 for details. Figure 9-4 shows the relative timing. Table 9-2.
System Integration Module (SIM) IRST RST RST PULLED LOW BY MCU 32 CYCLES 32 CYCLES ICLK IAB VECTOR HIGH Figure 9-5. Internal Reset Timing The COP reset is asynchronous to the bus clock. ILLEGAL ADDRESS RST ILLEGAL OPCODE RST COPRST LVI POR INTERNAL RESET Figure 9-6. Sources of Internal Reset The active reset feature allows the part to issue a reset to peripherals and other chips within a system built around the MCU. 9.4.2.
System Integration Module (SIM) OSC1 PORRST 4096 CYCLES 32 CYCLES 32 CYCLES ICLK CGMOUT RST IRST $FFFE IAB $FFFF Figure 9-7. POR Recovery 9.4.2.2 Computer Operating Properly (COP) Reset An input to the SIM is reserved for the COP reset signal. The overflow of the COP counter causes an internal reset and sets the COP bit in the SIM reset status register (SRSR). The SIM actively pulls down the RST pin for all internal reset sources.
System Integration Module (SIM) 9.4.2.3 Illegal Opcode Reset The SIM decodes signals from the CPU to detect illegal instructions. An illegal instruction sets the ILOP bit in the SIM reset status register (SRSR) and causes a reset. If the stop enable bit, STOP, in the mask option register is logic 0, the SIM treats the STOP instruction as an illegal opcode and causes an illegal opcode reset. The SIM actively pulls down the RST pin for all internal reset sources. 9.4.2.
System Integration Module (SIM) 9.5 SIM Counter The SIM counter is used by the power-on reset module (POR) and in stop mode recovery to allow the oscillator time to stabilize before enabling the internal bus (IBUS) clocks. The SIM counter also serves as a prescaler for the computer operating properly module (COP). The SIM counter overflow supplies the clock for the COP module. The SIM counter is 12 bits long and is clocked by the falling edge of ICLK. 9.5.
System Integration Module (SIM) 9.6 Exception Control Normal, sequential program execution can be changed in three different ways: • Interrupts: – Maskable hardware CPU interrupts – Non-maskable software interrupt instruction (SWI) • Reset • Break interrupts 9.6.1 Interrupts At the beginning of an interrupt, the CPU saves the CPU register contents on the stack and sets the interrupt mask (I bit) to prevent additional interrupts.
System Integration Module (SIM) Interrupts are latched, and arbitration is performed in the SIM at the start of interrupt processing. The arbitration result is a constant that the CPU uses to determine which vector to fetch. Once an interrupt is latched by the SIM, no other interrupt can take precedence, regardless of priority, until the latched interrupt is serviced (or the I bit is cleared). (See Figure 9-10.
System Integration Module (SIM) 9.6.1.1 Hardware Interrupts A hardware interrupt does not stop the current instruction. Processing of a hardware interrupt begins after completion of the current instruction. When the current instruction is complete, the SIM checks all pending hardware interrupts.
System Integration Module (SIM) 9.6.1.2 SWI Instruction The SWI instruction is a non-maskable instruction that causes an interrupt regardless of the state of the interrupt mask (I bit) in the condition code register. NOTE: A software interrupt pushes PC onto the stack. A software interrupt does not push PC – 1, as a hardware interrupt does. 9.6.1.3 Interrupt Status Registers The flags in the interrupt status registers identify maskable interrupt sources.
System Integration Module (SIM) Table 9-3.
System Integration Module (SIM) 9.6.1.5 Interrupt Status Register 2 Address: $FE05 Bit 7 6 5 4 3 2 1 Bit 0 Read: IF14 IF13 IF12 IF11 IF10 IF9 IF8 IF7 Write: R R R R R R R R Reset: 0 0 0 0 0 0 0 0 R = Reserved Figure 9-13. Interrupt Status Register 2 (INT2) IF14–IF7 — Interrupt Flags 14–7 These flags indicate the presence of interrupt requests from the sources shown in Table 9-3. 1 = Interrupt request present 0 = No interrupt request present 9.6.1.
System Integration Module (SIM) 9.6.2 Reset All reset sources always have equal and highest priority and cannot be arbitrated. 9.6.3 Break Interrupts The break module can stop normal program flow at a softwareprogrammable break point by asserting its break interrupt output. (See Section 22. Break Module (BRK).) The SIM puts the CPU into the break state by forcing it to the SWI vector location. Refer to the break interrupt subsection of each module to see how each module is affected by the break state. 9.
System Integration Module (SIM) 9.7 Low-Power Modes Executing the WAIT or STOP instruction puts the MCU in a low powerconsumption mode for standby situations. The SIM holds the CPU in a non-clocked state. The operation of each of these modes is described in the following subsections. Both STOP and WAIT clear the interrupt mask (I) in the condition code register, allowing interrupts to occur. 9.7.1 Wait Mode In wait mode, the CPU clocks are inactive while the peripheral clocks continue to run.
System Integration Module (SIM) IAB $6E0B IDB $A6 $6E0C $A6 $A6 $00FF $01 $0B $00FE $00FD $00FC $6E EXITSTOPWAIT NOTE: EXITSTOPWAIT = RST pin OR CPU interrupt OR break interrupt Figure 9-16. Wait Recovery from Interrupt or Break 32 CYCLES IAB IDB 32 CYCLES $6E0B $A6 $A6 RST VCT H RST VCT L $A6 RST ICLK Figure 9-17. Wait Recovery from Internal Reset 9.7.2 Stop Mode In stop mode, the SIM counter is reset and the system clocks are disabled.
System Integration Module (SIM) A break interrupt during stop mode sets the SIM break stop/wait bit (SBSW) in the SIM break status register (SBSR). The SIM counter is held in reset from the execution of the STOP instruction until the beginning of stop recovery. It is then used to time the recovery period. Figure 9-18 shows stop mode entry timing. NOTE: To minimize stop current, all pins configured as inputs should be driven to a logic 1 or logic 0.
System Integration Module (SIM) 9.8.1 SIM Break Status Register The SIM break status register (SBSR) contains a flag to indicate that a break caused an exit from stop mode or wait mode. Address: Read: Write: $FE00 Bit 7 6 5 4 3 2 R R R R R R Reset: 1 SBSW Note Bit 0 R 0 Note: Writing a logic 0 clears SBSW. R = Reserved Figure 9-20. SIM Break Status Register (SBSR) SBSW — Break Wait Bit This status bit is set when a break interrupt causes an exit from wait mode or stop mode.
System Integration Module (SIM) 9.8.2 SIM Reset Status Register This register contains six flags that show the source of the last reset provided all previous reset status bits have been cleared. Clear the SIM reset status register by reading it. A power-on reset sets the POR bit and clears all other bits in the register. Address: Read: $FE01 Bit 7 6 5 4 3 2 1 Bit 0 POR PIN COP ILOP ILAD 0 LVI 0 1 0 0 0 0 0 0 0 Write: Reset: = Unimplemented Figure 9-21.
System Integration Module (SIM) 9.8.3 SIM Break Flag Control Register The SIM break control register contains a bit that enables software to clear status bits while the MCU is in a break state. Address: Read: Write: Reset: $FE03 Bit 7 6 5 4 3 2 1 Bit 0 BCFE R R R R R R R 0 R = Reserved Figure 9-22.
Technical Data — MC68HC908LJ12 Section 10. Monitor ROM (MON) 10.1 Contents 10.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 10.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 10.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 10.4.1 Entering Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 10.4.2 Data Format . . . . . . . . . . . . . . . .
Monitor ROM (MON) 10.2 Introduction This section describes the monitor ROM (MON) and the monitor mode entry methods. The monitor ROM allows complete testing of the MCU through a single-wire interface with a host computer. Monitor mode entry can be achieved without use of the higher test voltage, VTST, as long as vector addresses $FFFE and $FFFF are blank, thus reducing the hardware requirements for in-circuit programming.
Monitor ROM (MON) 10.4 Functional Description The monitor ROM receives and executes commands from a host computer. Figure 10-1 shows an example circuit used to enter monitor mode and communicate with a host computer via a standard RS-232 interface. Simple monitor commands can access any memory address. In monitor mode, the MCU can execute code downloaded into RAM by a host computer while most MCU pins retain normal operating mode functions.
Monitor ROM (MON) 68HC908LJ12 RST 0.1 µF VTST (SEE NOTE 3) RESET VECTORS $FFFE 10 kΩ (SEE NOTES 2 AND 3) C SW2 0.033 µF SW3 (SEE NOTE 2) C + 3 MC145407 + D 10 MΩ 10 µF 10 µF 18 C 32.768 kHz XTAL 4 10 µF 17 330 kΩ + + 2 19 DB-25 2 5 16 3 6 15 10 µF VDD 0.01 µF CGMXFC 10 kΩ 6–30 pF 20 IRQ D EXTERNAL OSCILLATOR MUST BE USED FOR MONITOR MODE ENTRY WHEN IRQ = VTST 1 $FFFF OSC1 OSC2 SW4 (SEE NOTE 2) VSS D 6–30 pF VREFL VDD VDD VDDA VREFH 0.
Monitor ROM (MON) 10.4.1 Entering Monitor Mode Table 10-1 shows the pin conditions for entering monitor mode. As specified in the table, monitor mode may be entered after a POR and will allow communication at 9600 baud provided one of the following sets of conditions is met: 1. If $FFFE and $FFFF do not contain $FF (programmed state): – The external clock is 4.9152 MHz with PTC1 low or 9.8304 MHz with PTC1 high – IRQ = VTST (PLL off) 2.
Monitor ROM (MON) MC68HC908LJ12 — Rev. 2.1 Freescale Semiconductor IRQ RST Address $FFFE/ $FFFF PTA2 PTA1 PTA0(1) PTC1 External Clock(2) Bus Frequency PLL COP Baud Rate X GND X X X X X X 0 X Disabled 0 No operation until reset goes high VTST(3) VDD or VTST X 0 1 1 0 4.9152 MHz 2.4576 MHz OFF Disabled 9600 PTA1 and PTA2 voltages only required if IRQ = VTST; PTC1 determines frequency divider VTST(3) VDD or VTST X 0 1 1 1 9.8304 MHz 2.
Monitor ROM (MON) NOTE: If the reset vector is blank and monitor mode is entered, the chip will see an additional reset cycle after the initial POR reset. Once the part has been programmed, the traditional method of applying a voltage, VTST, to IRQ must be used to enter monitor mode.
Monitor ROM (MON) POR RESET IS VECTOR BLANK? NO NORMAL USER MODE YES MONITOR MODE EXECUTE MONITOR CODE POR TRIGGERED? NO YES Figure 10-2. Low-Voltage Monitor Mode Entry Flowchart In monitor mode, the MCU uses different vectors for reset, SWI (software interrupt), and break interrupt than those for user mode. The alternate vectors are in the $FE page instead of the $FF page and allow code execution from the internal monitor firmware instead of user code.
Monitor ROM (MON) 10.4.2 Data Format Communication with the monitor ROM is in standard non-return-to-zero (NRZ) mark/space data format. Transmit and receive baud rates must be identical. START BIT BIT 0 BIT 1 BIT 2 BIT 3 BIT 4 BIT 5 BIT 6 NEXT START STOP BIT BIT BIT 7 Figure 10-3. Monitor Data Format 10.4.3 Break Signal A start bit (logic 0) followed by nine logic 0 bits is a break signal.
Monitor ROM (MON) Table 10-3 lists external frequencies required to achieve a standard baud rate of 9600 BPS. Other standard baud rates can be accomplished using proportionally higher or lower frequency generators. If using a crystal as the clock source, be aware of the upper frequency limit that the internal clock module can handle. See Section 23. Electrical Specifications for this limit. Table 10-3. Monitor Baud Rate Selection External Frequency IRQ PTC1 Internal Frequency Baud Rate (BPS) 4.
Monitor ROM (MON) FROM HOST 4 ADDRESS HIGH READ READ 4 1 ADDRESS HIGH 1 ADDRESS LOW 4 ADDRESS LOW DATA 1 3, 2 4 ECHO RETURN Notes: 1 = Echo delay, 2 bit times 2 = Data return delay, 2 bit times 3 = Cancel command delay, 11 bit times 4 = Wait 1 bit time before sending next byte. Figure 10-5.
Monitor ROM (MON) Table 10-5. WRITE (Write Memory) Command Description Write byte to memory Operand 2-byte address in high-byte:low-byte order; low byte followed by data byte Data Returned None Opcode $49 Command Sequence FROM HOST WRITE ADDRESS HIGH WRITE ADDRESS HIGH ADDRESS LOW ADDRESS LOW DATA DATA ECHO Table 10-6.
Monitor ROM (MON) Table 10-7. IWRITE (Indexed Write) Command Description Write to last address accessed + 1 Operand Single data byte Data Returned None Opcode $19 Command Sequence FROM HOST IWRITE IWRITE DATA DATA ECHO A sequence of IREAD or IWRITE commands can access a block of memory sequentially over the full 64k-byte memory map. Table 10-8.
Monitor ROM (MON) Table 10-9. RUN (Run User Program) Command Description Executes PULH and RTI instructions Operand None Data Returned None Opcode $28 Command Sequence FROM HOST RUN RUN ECHO The MCU executes the SWI and PSHH instructions when it enters monitor mode. The RUN command tells the MCU to execute the PULH and RTI instructions. Before sending the RUN command, the host can modify the stacked CPU registers to prepare to run the host program.
Monitor ROM (MON) 10.5 Security A security feature discourages unauthorized reading of FLASH locations while in monitor mode. The host can bypass the security feature at monitor mode entry by sending eight security bytes that match the bytes at locations $FFF6–$FFFD. Locations $FFF6–$FFFD contain userdefined data. NOTE: Do not leave locations $FFF6–$FFFD blank. For security reasons, program locations $FFF6–$FFFD even if they are not used for vectors.
Monitor ROM (MON) Upon power-on reset, if the received bytes of the security code do not match the data at locations $FFF6–$FFFD, the host fails to bypass the security feature. The MCU remains in monitor mode, but reading a FLASH location returns an invalid value and trying to execute code from FLASH causes an illegal address reset. After receiving the eight security bytes from the host, the MCU transmits a break character, signifying that it is ready to receive a command.
Monitor ROM (MON) 10.6 ROM-Resident Routines Eight routines stored in the monitor ROM area (thus ROM-resident) are provided for FLASH memory manipulation. Six of the eight routines are intended to simply FLASH program, erase, and load operations. The other two routines are intended to simply the use of the FLASH memory as EEPROM. Table 10-10 shows a summary of the ROM-resident routines. Table 10-10.
Monitor ROM (MON) R FILE_PTR $XXXX A M BUS SPEED (BUS_SPD) ADDRESS AS POINTER DATA SIZE (DATASIZE) START ADDRESS HIGH (ADDRH) START ADDRESS LOW (ADDRL) DATA 0 DATA BLOCK DATA 1 DATA ARRAY DATA N Figure 10-9. Data Block Format for ROM-Resident Routines The control and data bytes are described below. • Bus speed — This one byte indicates the operating bus speed of the MCU. The value of this byte should be equal to 4 times the bus speed. E.g., for a 4MHz bus, the value is 16 ($10).
Monitor ROM (MON) 10.6.1 PRGRNGE PRGRNGE is used to program a range of FLASH locations with data loaded into the data array. Table 10-11.
Monitor ROM (MON) ORG RAM : FILE_PTR: BUS_SPD DATASIZE START_ADDR DATAARRAY DS.B DS.B DS.W DS.B 1 1 1 64 PRGRNGE FLASH_START EQU EQU $FC06 $EF00 ; ; ; ; Indicates 4x bus frequency Data size to be programmed FLASH start address Reserved data array ORG FLASH INITIALISATION: MOV #20, BUS_SPD MOV #64, DATASIZE LDHX #FLASH_START STHX START_ADDR RTS MAIN: BSR INITIALISATION : : LDHX FILE_PTR JSR PRGRNGE Technical Data 174 MC68HC908LJ12 — Rev. 2.
Monitor ROM (MON) 10.6.2 ERARNGE ERARNGE is used to erase a range of locations in FLASH. Table 10-12. ERARNGE Routine Routine Name ERARNGE Routine Description Erase a page or the entire array Calling Address $FCBE Stack Used 9 bytes Data Block Format Bus speed (BUS_SPD) Data size (DATASIZE) Starting address (ADDRH) Starting address (ADDRL) There are two sizes of erase ranges: a page or the entire array.
Monitor ROM (MON) 10.6.3 LDRNGE LDRNGE is used to load the data array in RAM with data from a range of FLASH locations. Table 10-13.
Monitor ROM (MON) 10.6.4 MON_PRGRNGE In monitor mode, MON_PRGRNGE is used to program a range of FLASH locations with data loaded into the data array. Table 10-14. MON_PRGRNGE Routine Routine Name MON_PRGRNGE Routine Description Program a range of locations, in monitor mode Calling Address $FC28 Stack Used 16 bytes Data Block Format Bus speed Data size Starting address (high byte) Starting address (low byte) Data 1 : Data N The MON_PRGRNGE routine is designed to be used in monitor mode.
Monitor ROM (MON) 10.6.5 MON_ERARNGE In monitor mode, ERARNGE is used to erase a range of locations in FLASH. Table 10-15. MON_ERARNGE Routine Routine Name MON_ERARNGE Routine Description Erase a page or the entire array, in monitor mode Calling Address $FF2C Stack Used 11 bytes Data Block Format Bus speed Data size Starting address (high byte) Starting address (low byte) The MON_ERARNGE routine is designed to be used in monitor mode. It performs the same function as the ERARNGE routine (see 10.6.
Monitor ROM (MON) 10.6.6 MON_LDRNGE In monitor mode, LDRNGE is used to load the data array in RAM with data from a range of FLASH locations. Table 10-16. ICP_LDRNGE Routine Routine Name MON_LDRNGE Routine Description Loads data from a range of locations, in monitor mode Calling Address $FF24 Stack Used 11 bytes Data Block Format Bus speed Data size Starting address (high byte) Starting address (low byte) Data 1 : Data N The MON_LDRNGE routine is designed to be used in monitor mode.
Monitor ROM (MON) 10.6.7 EE_WRITE EE_WRITE is used to write a set of data from the data array to FLASH. Table 10-17. EE_WRITE Routine Routine Name EE_WRITE Routine Description Emulated EEPROM write. Data size ranges from 2 to 15 bytes at a time. Calling Address $FC00 Stack Used 17 bytes Data Block Format Bus speed (BUS_SPD) Data size (DATASIZE)(1) Starting address (ADDRH)(2) Starting address (ADDRL)(1) Data 1 : Data N Notes: 1. The minimum data size is 2 bytes. The maximum data size is 15 bytes.
Monitor ROM (MON) When the user dedicates a page of FLASH for data storage, and the size of the data array defined, each call of the EE_WRTIE routine will automatically transfer the data in the data array (in RAM) to the next blank block of locations in the FLASH page. Once a page is filled up, the EE_WRITE routine automatically erases the page, and starts reuse the page again. In the 128-byte page, an 8-byte control block is used by the routine to monitor the utilization of the page.
Monitor ROM (MON) ORG RAM : FILE_PTR: BUS_SPD DATASIZE START_ADDR DATAARRAY DS.B DS.B DS.W DS.
Monitor ROM (MON) 10.6.8 EE_READ EE_READ is used to load the data array in RAM with a set of data from FLASH. Table 10-18. EE_READ Routine Routine Name EE_READ Routine Description Emulated EEPROM read. Data size ranges from 2 to 15 bytes at a time. Calling Address $FC03 Stack Used 15 bytes Data Block Format Bus speed (BUS_SPD) Data size (DATASIZE) Starting address (ADDRH)(1) Starting address (ADDRL)(1) Data 1 : Data N Notes: 1. The start address must be a page boundary start address, e.g.
Monitor ROM (MON) NOTE: The EE_READ routine is unable to check for incorrect data blocks, such as the FLASH page boundary address and data size. It is the responsibility of the user to ensure the starting address indicated in the data block is at the FLASH page boundary and the data size is 2 to 15. If the FLASH page is programmed with a data array with a different size, the EE_READ call will be ignored. Technical Data 184 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 11. Timer Interface Module (TIM) 11.1 Contents 11.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 11.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 11.4 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 11.5 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 11.5.1 TIM Counter Prescaler . . . .
Timer Interface Module (TIM) 11.2 Introduction This section describes the timer interface (TIM) module. The TIM is a two-channel timer that provides a timing reference with input capture, output compare, and pulse-width-modulation functions. Figure 11-1 is a block diagram of the TIM. This particular MCU has two timer interface modules which are denoted as TIM1 and TIM2. 11.
Timer Interface Module (TIM) 11.4 Pin Name Conventions The text that follows describes both timers, TIM1 and TIM2. The TIM input/output (I/O) pin names are T[1,2]CH0 (timer channel 0) and T[1,2]CH1 (timer channel 1), where “1” is used to indicate TIM1 and “2” is used to indicate TIM2. The two TIMs share four I/O pins with four I/O port pins. The full names of the TIM I/O pins are listed in Table 11-1. The generic pin names appear in the text that follows. Table 11-1.
Timer Interface Module (TIM) PRESCALER SELECT INTERNAL BUS CLOCK PRESCALER TSTOP PS2 TRST PS1 PS0 16-BIT COUNTER TOF TOIE INTERRUPT LOGIC 16-BIT COMPARATOR TMODH:TMODL TOV0 ELS0B CHANNEL 0 ELS0A CH0MAX 16-BIT COMPARATOR TCH0H:TCH0L PORT LOGIC T[1,2]CH0 CH0F 16-BIT LATCH CH0IE MS0A INTERRUPT LOGIC MS0B INTERNAL BUS TOV1 ELS1B CHANNEL 1 ELS1A CH1MAX 16-BIT COMPARATOR TCH1H:TCH1L PORT LOGIC T[1,2]CH1 CH1F 16-BIT LATCH MS1A CH1IE INTERRUPT LOGIC Figure 11-1.
Timer Interface Module (TIM) Addr.
Timer Interface Module (TIM) Addr.
Timer Interface Module (TIM) Addr.
Timer Interface Module (TIM) 11.5.3 Output Compare With the output compare function, the TIM can generate a periodic pulse with a programmable polarity, duration, and frequency. When the counter reaches the value in the registers of an output compare channel, the TIM can set, clear, or toggle the channel pin. Output compares can generate TIM CPU interrupt requests. 11.5.3.1 Unbuffered Output Compare Any output compare channel can generate unbuffered output compare pulses as described in 11.5.
Timer Interface Module (TIM) 11.5.3.2 Buffered Output Compare Channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the TCH0 pin. The TIM channel registers of the linked pair alternately control the output. Setting the MS0B bit in TIM channel 0 status and control register (TSC0) links channel 0 and channel 1. The output compare value in the TIM channel 0 registers initially controls the output on the TCH0 pin.
Timer Interface Module (TIM) The value in the TIM counter modulo registers and the selected prescaler output determines the frequency of the PWM output. The frequency of an 8-bit PWM signal is variable in 256 increments. Writing $00FF (255) to the TIM counter modulo registers produces a PWM period of 256 times the internal bus clock period if the prescaler select value is $000. See 11.10.1 TIM Status and Control Register.
Timer Interface Module (TIM) Use the following methods to synchronize unbuffered changes in the PWM pulse width on channel x: NOTE: • When changing to a shorter pulse width, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. The output compare interrupt occurs at the end of the current pulse. The interrupt routine has until the end of the PWM period to write the new value.
Timer Interface Module (TIM) NOTE: In buffered PWM signal generation, do not write new pulse width values to the currently active channel registers. User software should track the currently active channel to prevent writing a new value to the active channel. Writing to the active channel registers is the same as generating unbuffered PWM signals. 11.5.4.3 PWM Initialization To ensure correct operation when generating unbuffered or buffered PWM signals, use the following initialization procedure: 1.
Timer Interface Module (TIM) Setting MS0B links channels 0 and 1 and configures them for buffered PWM operation. The TIM channel 0 registers (TCH0H:TCH0L) initially control the buffered PWM output. TIM status control register 0 (TSCR0) controls and monitors the PWM signal from the linked channels. Clearing the toggle-on-overflow bit, TOVx, inhibits output toggles on TIM overflows. Subsequent output compares try to force the output to a state it is already in and have no effect.
Timer Interface Module (TIM) 11.7.1 Wait Mode The TIM remains active after the execution of a WAIT instruction. In wait mode, the TIM registers are not accessible by the CPU. Any enabled CPU interrupt request from the TIM can bring the MCU out of wait mode. If TIM functions are not required during wait mode, reduce power consumption by stopping the TIM before executing the WAIT instruction. 11.7.2 Stop Mode The TIM is inactive after the execution of a STOP instruction.
Timer Interface Module (TIM) 11.9 I/O Signals Port B shares four of its pins with the TIM. The four TIM channel I/O pins are T1CH0, T1CH1, T2CH0, and T2CH1 as described in 11.4 Pin Name Conventions. Each channel I/O pin is programmable independently as an input capture pin or an output compare pin. T1CH0 and T2CH0 can be configured as buffered output compare or buffered PWM pins. 11.
Timer Interface Module (TIM) 11.10.1 TIM Status and Control Register The TIM status and control register (TSC): • Enables TIM overflow interrupts • Flags TIM overflows • Stops the TIM counter • Resets the TIM counter • Prescales the TIM counter clock Address: T1SC, $0020 and T2SC, $002B Bit 7 Read: TOF Write: 0 Reset: 0 6 5 TOIE TSTOP 0 1 4 3 0 0 TRST 0 0 2 1 Bit 0 PS2 PS1 PS0 0 0 0 = Unimplemented Figure 11-4.
Timer Interface Module (TIM) TSTOP — TIM Stop Bit This read/write bit stops the TIM counter. Counting resumes when TSTOP is cleared. Reset sets the TSTOP bit, stopping the TIM counter until software clears the TSTOP bit. 1 = TIM counter stopped 0 = TIM counter active NOTE: Do not set the TSTOP bit before entering wait mode if the TIM is required to exit wait mode. TRST — TIM Reset Bit Setting this write-only bit resets the TIM counter and the TIM prescaler.
Timer Interface Module (TIM) 11.10.2 TIM Counter Registers The two read-only TIM counter registers contain the high and low bytes of the value in the TIM counter. Reading the high byte (TCNTH) latches the contents of the low byte (TCNTL) into a buffer. Subsequent reads of TCNTH do not affect the latched TCNTL value until TCNTL is read. Reset clears the TIM counter registers. Setting the TIM reset bit (TRST) also clears the TIM counter registers.
Timer Interface Module (TIM) 11.10.3 TIM Counter Modulo Registers The read/write TIM modulo registers contain the modulo value for the TIM counter. When the TIM counter reaches the modulo value, the overflow flag (TOF) becomes set, and the TIM counter resumes counting from $0000 at the next timer clock. Writing to the high byte (TMODH) inhibits the TOF bit and overflow interrupts until the low byte (TMODL) is written. Reset sets the TIM counter modulo registers.
Timer Interface Module (TIM) 11.10.
Timer Interface Module (TIM) CHxF — Channel x Flag Bit When channel x is an input capture channel, this read/write bit is set when an active edge occurs on the channel x pin. When channel x is an output compare channel, CHxF is set when the value in the TIM counter registers matches the value in the TIM channel x registers. When TIM CPU interrupt requests are enabled (CHxIE = 1), clear CHxF by reading TIM channel x status and control register with CHxF set and then writing a logic 0 to CHxF.
Timer Interface Module (TIM) When ELSxB:ELSxA = 0:0, this read/write bit selects the initial output level of the TCHx pin. See Table 11-3. Reset clears the MSxA bit. 1 = Initial output level low 0 = Initial output level high NOTE: Before changing a channel function by writing to the MSxB or MSxA bit, set the TSTOP and TRST bits in the TIM status and control register (TSC).
Timer Interface Module (TIM) NOTE: Before enabling a TIM channel register for input capture operation, make sure that the TCHx pin is stable for at least two bus clocks. User software should also clear CHxF before setting CHxIE to avoid any false interrupts. TOVx — Toggle On Overflow Bit When channel x is an output compare channel, this read/write bit controls the behavior of the channel x output when the TIM counter overflows. When channel x is an input capture channel, TOVx has no effect.
Timer Interface Module (TIM) In input capture mode (MSxB:MSxA = 0:0), reading the high byte of the TIM channel x registers (TCHxH) inhibits input captures until the low byte (TCHxL) is read. In output compare mode (MSxB:MSxA ≠ 0:0), writing to the high byte of the TIM channel x registers (TCHxH) inhibits output compares until the low byte (TCHxL) is written.
Technical Data — MC68HC908LJ12 Section 12. Real Time Clock (RTC) 12.1 Contents 12.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 12.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 12.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 12.4.1 Time Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.4.2 Calendar Functions . . . . . . . . .
Real Time Clock (RTC) 12.2 Introduction This section describes the real time clock (RTC) module. The RTC provides real time clock and calendar functions with automatic leap year adjustments. Other functions include alarm interrupt, periodic interrupts, and a chronograph timer. 12.3 Features Features of the RTC module include: • Counter registers for: – Second – Minute – Hour – Day – Day-of-week – Month – Year Addr.
Real Time Clock (RTC) $0044 $0045 $0046 $0047 $0048 $0049 $004A $004B $004C $004D $004E Read: RTC Status Register Write: (RTCSR) Reset: ALMF CHRF DAYF HRF MINF SECF TB1F TB2F 0 0 0 0 0 0 0 0 Read: Alarm Minute Register Write: (ALMR) Reset: 0 0 AM5 AM4 AM3 AM2 AM1 AM0 0 0 0 0 0 0 0 0 Read: Alarm Hour Register Write: (ALHR) Reset: 0 0 0 AH4 AH3 AH2 AH1 AH0 0 0 0 0 0 0 0 0 Read: Second Register Write: (SECR) Reset: 0 0 SEC5 SEC4 SEC3 SEC2 SE
Real Time Clock (RTC) 12.4 Functional Description The RTC module provides clock indications in seconds, minutes, and hours; calendar indications in day-of-week, day-of-month, month, and year; with automatic adjustment for month and leap year. Reading the clock and calendar registers return the current time and date. Writing to these registers set the time and date, and the counters will continue to count from the new settings. The alarm interrupt is set for the hour and minute.
Real Time Clock (RTC) XTL[2:0] CGMXCLK ÷ 64 ÷ 256 ÷4 ÷ 320 ÷5 VALID CGMXCLK FREQUENCIES: ÷ 384 ÷6 XTL[2:0] = 000 => X = A XTL[2:0] = 000 => X = B 000 X ÷ 32 A ÷ 25 B SL 010 X 011 ÷2 38.400 kHz 64.000 kHz ÷2 76.800 kHz ÷ 640 ÷ 768 ÷2 2 Hz 32.768 kHz 32.
Real Time Clock (RTC) 12.4.1 Time Functions Real time clock functions are provided by the second, minute, and hour counter registers. All three clock counters are able to generate interrupts on every counter increment, providing periodic interrupts for the second (SECF), minute (MINF), and hour (HRF). A CPU interrupt request is generated if the corresponding enable bit (SECIE, MINIE, and HRIE) is also set. 12.4.
Real Time Clock (RTC) 12.4.5 Chronograph Functions A 100Hz resolution chronograph counter can be enabled by setting the CHRE bit. The chronograph counter will automatically roll over to zero when the counter reaches 99. If 32.768kHz CGMXCLK is used, the chronograph counter resolution becomes 128Hz. With either 100Hz or 128Hz resolution, the counter value is converted to 100Hz, before it is saved in the chronograph data register. Therefore, each chronograph data register increment represents 10ms. 12.
Real Time Clock (RTC) 12.6 RTC Registers The RTC module has thirteen memory-mapped registers: • RTC control register 1 (RTCCR1) • RTC control register 2 (RTCCR2) • RTC status register (RTCSR) • Alarm minute and hour registers (ALMR and ALHR) • Second register (SECR) • Minute register (MINR) • Hour register (HRR) • Day register (DAY) • Month register (MTHR) • Year register (YRR) • Day of the week register (DOWR) • Chronograph data register (CHRR) 12.6.
Real Time Clock (RTC) CHRIE — Chronograph Interrupt Enable This read/write bit enables the chronograph flag, CHRF, to generate CPU interrupt requests. Reset clears the CHRIE bit. 1 = CHRF enabled to generate CPU interrupt 0 = CHRF not enabled to generate CPU interrupt DAYIE — Day Interrupt Enable This read/write bit enables the day flag, DAYF, to generate CPU interrupt requests. Reset clears the DAYIE bit.
Real Time Clock (RTC) 12.6.2 RTC Control Register 2 (RTCCR2) The RTC control register 2 (RTCCR2) contains control and clock selection bits for RTC operation. Address: $0043 Read: 0 0 Write: R CHRCLR Reset: 0 0 CHRE RTCE 0 0 = Unimplemented 0 0 R XTL2 XTL1 XTL0 0 0 0 = Reserved Figure 12-4. RTC Control Register 2 (RTCCR2) CHRCLR — Chronograph counter clear Setting this write-only bit resets the chronograph counter. Setting CHRCLR has no effect on any other registers.
Real Time Clock (RTC) XTL[2:0] — Crystal Frequency Select Bits These three bits set the prescalers/dividers for proper operation of the RTC module for various crystal (CGMXCLK) input frequencies. The XTL[2:0] bits can only be written once after reset, subsequent writes to these bits will have no effect on its content. Table 12-1 shows the XTL[2:0] settings for various CGMXCLK frequencies. Reset clear the XTL[2:0] bits. Table 12-1. CGMXCLK Frequency for RTC Input Reference CGMXCLK(1) XTL2 XTL1 XTL0 32.
Real Time Clock (RTC) ALMF — Alarm Flag This clearable, read-only bit is set when the value in the RTC hour and minute counters matches the value in the alarm hour and alarm minute registers. When the ALMIE bit in RTCCR1 is set, ALMF generates a CPU interrupt request. In normal operation, clear the ALMF bit by reading RTCSR with ALMF set and then reading the alarm hour register (ALHR). Reset clears ALMF.
Real Time Clock (RTC) MINF — Minute Flag This clearable, read-only bit is set on every increment of the minute counter. When the MINIE bit in RTCCR1 is set, MINF generates a CPU interrupt request. In normal operation, clear the MINF bit by reading RTCSR with MINF set and then reading the minute register (MINR). Reset clears MINF. 1 = Minute counter incremented 0 = No minute counter incremented SECF — Second Flag This clearable, read-only bit is set on every increment of the second counter.
Real Time Clock (RTC) 12.6.4 Alarm Minute and Hour Registers (ALMR and ALHR) These read/write registers contain the alarm minute and hour values for the hour and minute alarm function. When the hour counter matches the value in the alarm hour register (ALHR) and the minute counter matches the value in the alarm minute register (ALMR), the alarm flag, ALMF, is set. When ALMF is set and the alarm interrupt enable bit, ALMIE, is also set, a CPU interrupt request is generated.
Real Time Clock (RTC) 12.6.5 Second Register (SECR) This read/write register contains the current value of the second counter. This register can be read at any time without affecting the counter count. Writing to this register loads the value to the second counter and the counter continues to count from this new value. The second counter rolls over to 0 ($00) after reaching 59 ($4B). Writing a value other than 0 to 59 to this register has no effect.
Real Time Clock (RTC) 12.6.7 Hour Register (HRR) This read/write register contains the current value of the hour counter. This register can be read at any time without affecting the counter count. Writing to this register loads the value to the hour counter and the counter continues to count from this new value. The hour counter rolls over to 0 ($00) after reaching 23 ($17). Writing a value other than 0 to 23 to this register has no effect.
Real Time Clock (RTC) 12.6.9 Month Register (MTHR) This read/write register contains the current value of the month counter. This register can be read at any time without affecting the counter count. Writing to this register loads the value to the month counter and the counter continues to count from this new value. The month counter rolls over to 1 ($01) after reaching 12 ($0B). Writing a value other than 1 to 12 to this register has no effect.
Real Time Clock (RTC) 12.6.11 Day-Of-Week Register (DOWR) This read/write register contains the current value of the day-of-week counter. This register can be read at any time without affecting the counter count. Writing to this register loads the value to the day-of-week counter and the counter continues to count from this new value. The day-of-week counter value rolls over to 0 ($00) after reaching 6 ($06). Writing a value other than 0 to 6 to this register has no effect.
Technical Data — MC68HC908LJ12 Section 13. Infrared Serial Communications Interface Module (IRSCI) 13.1 Contents 13.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 13.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 13.4 Pin Name Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 13.5 IRSCI Module Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 13.
Infrared Serial Communications 13.9 SCI During Break Module Interrupts. . . . . . . . . . . . . . . . . . . .249 13.10 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 13.10.1 PTB0/TxD (Transmit Data). . . . . . . . . . . . . . . . . . . . . . . . . 249 13.10.2 PTB1/RxD (Receive Data) . . . . . . . . . . . . . . . . . . . . . . . . . 249 13.11 I/O Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 13.11.
Infrared Serial Communications Interface Module (IRSCI) 13.
Infrared Serial Communications Addr.
Infrared Serial Communications Interface Module (IRSCI) 13.4 Pin Name Conventions The generic names of the IRSCI I/O pins are: • RxD (receive data) • TxD (transmit data) IRSCI I/O (input/output) lines are implemented by sharing parallel I/O port pins. The full name of an IRSCI input or output reflects the name of the shared port pin. Table 13-1 shows the full names and the generic names of the IRSCI I/O pins. The generic pin names appear in the text of this section. Table 13-1.
Infrared Serial Communications The infrared sub-module receives two clock sources from the SCI module: SCI_R16XCLK and SCI_R32XCLK. Both reference clocks are used to generate the narrow pulses during data transmission. The SCI_R16XCLK and SCI_R32XCLK are internal clocks with frequencies that are 16 and 32 times the baud rate respectively. Both SCI_R16XCLK and SCI_R32XCLK clocks are used for transmitting data. The SCI_R16XCLK clock is used only for receiving data.
Infrared Serial Communications Interface Module (IRSCI) The sub-module consists of two main blocks: the transmit encoder and the receive decoder. When transmitting data, the SCI data stream is encoded by the infrared sub-module. For every "0" bit, a narrow "low" pulse is transmitted; no pulse is transmitted for "1" bits. When receiving data, the infrared pulses should be detected using an infrared photo diode for conversion to CMOS voltage levels before connecting to the RxD pin for the infrared decoder.
Infrared Serial Communications 13.7 SCI Functional Description Figure 13-5 shows the structure of the SCI.
Infrared Serial Communications Interface Module (IRSCI) The SCI allows full-duplex, asynchronous, NRZ serial communication between the MCU and remote devices, including other MCUs. The transmitter and receiver of the SCI operate independently, although they use the same baud rate generator. During normal operation, the CPU monitors the status of the SCI, writes the data to be transmitted, and processes received data. NOTE: For SCI operations, the IR sub-module is transparent to the SCI module.
Infrared Serial Communications 13.7.2 Transmitter Figure 13-7 shows the structure of the SCI transmitter. The baud rate clock source for the SCI can be selected by the CKS bit, in the SCI baud rate register (see 13.11.7 SCI Baud Rate Register (SCBR)).
Infrared Serial Communications Interface Module (IRSCI) 13.7.2.1 Character Length The transmitter can accommodate 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 control register 3 (SCC3) is the ninth bit (bit 8). 13.7.2.2 Character Transmission During an SCI transmission, the transmit shift register shifts a character out to the TxD pin.
Infrared Serial Communications 13.7.2.3 Break Characters Writing a logic 1 to the send break bit, SBK, in SCC2 loads the transmit shift register with a break character. A break character contains all logic 0s and has no start, stop, or parity bit. Break character length depends on the M bit in SCC1. As long as SBK is at logic 1, transmitter logic continuously loads break characters into the transmit shift register.
Infrared Serial Communications Interface Module (IRSCI) NOTE: When queueing an idle character, return the TE bit to logic 1 before the stop bit of the current character shifts out to the TxD pin. Setting TE after the stop bit appears on TxD causes data previously written to the SCDR to be lost. Toggle the TE bit for a queued idle character when the SCTE bit becomes set and just before writing the next byte to the SCDR. 13.7.2.
Infrared Serial Communications INTERNAL BUS SCR1 SCR0 PRESCALER SL = 0 => X = A SL = 1 => X = B BAUD DIVIDER ÷ 16 DATA RECOVERY SCI_RxD BKF CPU INTERRUPT REQUEST 11-BIT RECEIVE SHIFT REGISTER H 8 7 6 5 M WAKE ILTY PEN PTY 4 3 2 1 0 L ALL 0s RPF ERROR CPU INTERRUPT REQUEST DMA SERVICE REQUEST SCI DATA REGISTER START SCP0 STOP A SL X B SCR2 ALL 1s CGMXCLK BUS CLOCK SCP1 MSB CKS SCRF WAKEUP LOGIC RWU IDLE R8 PARITY CHECKING IDLE ILIE DMARE ILIE SCRF SCRIE DMARE SCRIE SCR
Infrared Serial Communications Interface Module (IRSCI) 13.7.3.2 Character Reception During an SCI reception, the receive shift register shifts characters in from the RxD pin. The SCI data register (SCDR) is the read-only buffer between the internal data bus and the receive shift register. After a complete character shifts into the receive shift register, the data portion of the character transfers to the SCDR.
Infrared Serial Communications To locate the start bit, data recovery logic does an asynchronous search for a logic 0 preceded by three logic 1s. When the falling edge of a possible start bit occurs, the RT clock begins to count to 16. To verify the start bit and to detect noise, data recovery logic takes samples at RT3, RT5, and RT7. Table 13-2 summarizes the results of the start bit verification samples. Table 13-2.
Infrared Serial Communications Interface Module (IRSCI) NOTE: The RT8, RT9, and RT10 samples do not affect start bit verification. If any or all of the RT8, RT9, and RT10 start bit samples are logic 1s following a successful start bit verification, the noise flag (NF) is set and the receiver assumes that the bit is a start bit. To verify a stop bit and to detect noise, recovery logic takes samples at RT8, RT9, and RT10. Table 13-4 summarizes the results of the stop bit samples. Table 13-4.
Infrared Serial Communications As the receiver samples an incoming character, it resynchronizes the RT clock on any valid falling edge within the character. Resynchronization within characters corrects misalignments between transmitter bit times and receiver bit times. Slow Data Tolerance Figure 13-10 shows how much a slow received character can be misaligned without causing a noise error or a framing error.
Infrared Serial Communications Interface Module (IRSCI) The maximum percent difference between the receiver count and the transmitter count of a slow 9-bit character with no errors is 170 – 163 × 100 = 4.12% -------------------------170 Fast Data Tolerance Figure 13-11 shows how much a fast received character can be misaligned without causing a noise error or a framing error. The fast stop bit ends at RT10 instead of RT16 but is still there for the stop bit data samples at RT8, RT9, and RT10.
Infrared Serial Communications The maximum percent difference between the receiver count and the transmitter count of a fast 9-bit character with no errors is 170 – 176 × 100 = 3.53% -------------------------170 13.7.3.6 Receiver Wakeup So that the MCU can ignore transmissions intended only for other receivers in multiple-receiver systems, the receiver can be put into a standby state.
Infrared Serial Communications Interface Module (IRSCI) 13.7.3.7 Receiver Interrupts The following sources can generate CPU interrupt requests from the SCI receiver: • SCI receiver full (SCRF) — The SCRF bit in SCS1 indicates that the receive shift register has transferred a character to the SCDR. SCRF can generate a receiver interrupt request. Setting the SCI receive interrupt enable bit, SCRIE, in SCC2 enables the SCRF bit to generate receiver CPU interrupts.
Infrared Serial Communications 13.8 Low-Power Modes The WAIT and STOP instructions put the MCU in low powerconsumption standby modes. 13.8.1 Wait Mode The SCI module remains active after the execution of a WAIT instruction. In wait mode, the SCI module registers are not accessible by the CPU. Any enabled CPU interrupt request from the SCI module can bring the MCU out of wait mode.
Infrared Serial Communications Interface Module (IRSCI) 13.9 SCI During Break Module Interrupts The system integration module (SIM) controls whether status bits in other modules can be cleared during interrupts generated by the break module. The BCFE bit in the SIM break flag control register (SBFCR) enables software to clear status bits during the break state. To allow software to clear status bits during a break interrupt, write a logic 1 to the BCFE bit.
Infrared Serial Communications Table 13-5 shows a summary of I/O pin functions when the SCI is enabled. Table 13-5.
Infrared Serial Communications Interface Module (IRSCI) 13.11.1 SCI Control Register 1 SCI control register: • Enables loop mode operation • Enables the SCI • Controls output polarity • Controls character length • Controls SCI wakeup method • Controls idle character detection • Enables parity function • Controls parity type Address: Read: Write: Reset: $0013 Bit 7 6 LOOPS ENSCI 0 0 5 0 0 4 3 2 1 Bit 0 M WAKE ILTY PEN PTY 0 0 0 0 0 Figure 13-12.
Infrared Serial Communications M — Mode (Character Length) Bit This read/write bit determines whether SCI characters are eight or nine bits long. (See Table 13-6.) The ninth bit can serve as an extra stop bit, as a receiver wakeup signal, or as a parity bit. Reset clears the M bit.
Infrared Serial Communications Interface Module (IRSCI) PTY — Parity Bit This read/write bit determines whether the SCI generates and checks for odd parity or even parity. (See Table 13-6.) Reset clears the PTY bit. 1 = Odd parity 0 = Even parity NOTE: Changing the PTY bit in the middle of a transmission or reception can generate a parity error. Table 13-6.
Infrared Serial Communications Address: Read: Write: Reset: $0014 Bit 7 6 5 4 3 2 1 Bit 0 SCTIE TCIE SCRIE ILIE TE RE RWU SBK 0 0 0 0 0 0 0 0 Figure 13-13. SCI Control Register 2 (SCC2) SCTIE — SCI Transmit Interrupt Enable Bit This read/write bit enables the SCTE bit to generate SCI transmitter CPU interrupt requests. Reset clears the SCTIE bit.
Infrared Serial Communications Interface Module (IRSCI) (logic 1). Clearing and then setting TE during a transmission queues an idle character to be sent after the character currently being transmitted. Reset clears the TE bit. 1 = Transmitter enabled 0 = Transmitter disabled NOTE: Writing to the TE bit is not allowed when the enable SCI bit (ENSCI) is clear. ENSCI is in SCI control register 1. RE — Receiver Enable Bit Setting this read/write bit enables the receiver.
Infrared Serial Communications 13.11.3 SCI Control Register 3 SCI control register 3: • Stores the ninth SCI data bit received and the ninth SCI data bit to be transmitted • Enables the following interrupts: – Receiver overrun interrupts – Noise error interrupts – Framing error interrupts – Parity error interrupts Address: $0015 Bit 7 Read: R8 Write: Reset: U 6 5 4 3 2 1 Bit 0 T8 DMARE DMATE ORIE NEIE FEIE PEIE U 0 0 0 0 0 0 = Unimplemented U = Unaffected Figure 13-14.
Infrared Serial Communications Interface Module (IRSCI) DMARE — DMA Receive Enable Bit CAUTION: The DMA module is not included on this MCU. Writing a logic 1 to DMARE or DMATE may adversely affect MCU performance.
Infrared Serial Communications PEIE — Receiver Parity Error Interrupt Enable Bit This read/write bit enables SCI receiver CPU interrupt requests generated by the parity error bit, PE. (See 13.11.4 SCI Status Register 1.) Reset clears PEIE. 1 = SCI error CPU interrupt requests from PE bit enabled 0 = SCI error CPU interrupt requests from PE bit disabled 13.11.
Infrared Serial Communications Interface Module (IRSCI) operation, clear the SCTE bit by reading SCS1 with SCTE set and then writing to SCDR. Reset sets the SCTE bit. 1 = SCDR data transferred to transmit shift register 0 = SCDR data not transferred to transmit shift register TC — Transmission Complete Bit This read-only bit is set when the SCTE bit is set, and no data, preamble, or break character is being transmitted.
Infrared Serial Communications OR — Receiver Overrun Bit This clearable, read-only bit is set when software fails to read the SCDR before the receive shift register receives the next character. The OR bit generates an SCI error CPU interrupt request if the ORIE bit in SCC3 is also set. The data in the shift register is lost, but the data already in the SCDR is not affected. Clear the OR bit by reading SCS1 with OR set and then reading the SCDR. Reset clears the OR bit.
Infrared Serial Communications Interface Module (IRSCI) BYTE 1 BYTE 2 BYTE 3 SCRF = 0 SCRF = 1 SCRF = 0 SCRF = 1 SCRF = 0 SCRF = 1 NORMAL FLAG CLEARING SEQUENCE BYTE 4 READ SCS1 SCRF = 1 OR = 0 READ SCS1 SCRF = 1 OR = 0 READ SCS1 SCRF = 1 OR = 0 READ SCDR BYTE 1 READ SCDR BYTE 2 READ SCDR BYTE 3 BYTE 1 BYTE 2 BYTE 3 SCRF = 0 OR = 0 SCRF = 1 OR = 1 SCRF = 0 OR = 1 SCRF = 1 SCRF = 1 OR = 1 DELAYED FLAG CLEARING SEQUENCE BYTE 4 READ SCS1 SCRF = 1 OR = 0 READ SCS1 SCRF = 1 OR = 1 R
Infrared Serial Communications 13.11.5 SCI Status Register 2 (SCS2) SCI status register 2 contains flags to signal the following conditions: • Break character detected • Incoming data Address: $0017 Bit 7 6 5 4 3 2 Read: 1 Bit 0 BKF RPF 0 0 Write: Reset: 0 0 0 0 0 0 = Unimplemented Figure 13-17. SCI Status Register 2 (SCS2) BKF — Break Flag Bit This clearable, read-only bit is set when the SCI detects a break character on the RxD pin. In SCS1, the FE and SCRF bits are also set.
Infrared Serial Communications Interface Module (IRSCI) 13.11.6 SCI Data Register (SCDR) The SCI data register is the buffer between the internal data bus and the receive and transmit shift registers. Reset has no effect on data in the SCI data register. Address: $0018 Bit 7 6 5 4 3 2 1 Bit 0 Read: R7 R6 R5 R4 R3 R2 R1 R0 Write: T7 T6 T5 T4 T3 T2 T1 T0 Reset: Unaffected by reset Figure 13-18.
Infrared Serial Communications 13.11.7 SCI Baud Rate Register (SCBR) The baud rate register selects the baud rate for both the receiver and the transmitter. Address: $0019 Bit 7 Read: Write: Reset: CKS 0 6 0 5 4 3 2 1 Bit 0 SCP1 SCP0 R SCR2 SCR1 SCR0 0 0 0 0 0 0 R = Reserved 0 = Unimplemented Figure 13-19. SCI Baud Rate Register (SCBR) CKS — Baud Clock Input Select This read/write bit selects the source clock for the baud rate generator.
Infrared Serial Communications Interface Module (IRSCI) Table 13-8.
Infrared Serial Communications Table 13-9. SCI Baud Rate Selection Examples SCP1 and SCP0 Prescaler Divisor (PD) SCR2, SCR1, and SCR0 Baud Rate Divisor (BD) Baud Rate (fBUS = 4.
Infrared Serial Communications Interface Module (IRSCI) 13.11.8 SCI Infrared Control Register The infrared control register contains the control bits for the infrared submodule. • Enables the infrared sub-module • Selects the infrared transmitter narrow pulse width Address: $001A Bit 7 Read: Write: Reset: R 0 6 5 4 0 0 0 0 0 0 = Unimplemented 3 2 1 Bit 0 R TNP1 TNP0 IREN 0 0 0 0 R = Reserved Figure 13-20.
Infrared Serial Communications Technical Data 268 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 14. Serial Peripheral Interface Module (SPI) 14.1 Contents 14.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 14.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 14.4 Pin Name Conventions and I/O Register Addresses . . . . . . . 271 14.5 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 14.5.1 Master Mode . . . . . . . . . . . . .
Serial Peripheral Interface Module (SPI) 14.13.3 SPSCK (Serial Clock). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 14.13.4 SS (Slave Select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 14.13.5 CGND (Clock Ground) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 14.14 I/O Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 14.14.1 SPI Control Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 14.14.
Serial Peripheral Interface Module (SPI) 14.4 Pin Name Conventions and I/O Register Addresses The text that follows describes the SPI. The SPI I/O pin names are SS (slave select), SPSCK (SPI serial clock), CGND (clock ground), MOSI (master out slave in), and MISO (master in/slave out). The SPI shares four I/O pins with four parallel I/O ports. The full names of the SPI I/O pins are shown in Table 14-1. The generic pin names appear in the text that follows. Table 14-1.
Serial Peripheral Interface Module (SPI) INTERNAL BUS TRANSMIT DATA REGISTER CGMOUT ÷ 2 FROM SIM SHIFT REGISTER 7 6 5 4 3 2 1 MISO 0 ÷2 MOSI ÷8 CLOCK DIVIDER ÷ 32 RECEIVE DATA REGISTER PIN CONTROL LOGIC ÷ 128 SPMSTR SPE CLOCK SELECT SPR1 SPSCK M CLOCK LOGIC S SS SPR0 SPMSTR RESERVED MODFEN TRANSMITTER CPU INTERRUPT REQUEST RESERVED CPHA CPOL SPWOM ERRIE SPI CONTROL SPTIE SPRIE RECEIVER/ERROR CPU INTERRUPT REQUEST R SPE SPRF SPTE OVRF MODF Figure 14-2.
Serial Peripheral Interface Module (SPI) 14.5.1 Master Mode The SPI operates in master mode when the SPI master bit, SPMSTR, is set. NOTE: Configure the SPI modules as master or slave before enabling them. Enable the master SPI before enabling the slave SPI. Disable the slave SPI before disabling the master SPI. (See 14.14.1 SPI Control Register.) Only a master SPI module can initiate transmissions. Software begins the transmission from a master SPI module by writing to the transmit data register.
Serial Peripheral Interface Module (SPI) The SPR1 and SPR0 bits control the baud rate generator and determine the speed of the shift register. (See 14.14.2 SPI Status and Control Register.) Through the SPSCK pin, the baud rate generator of the master also controls the shift register of the slave peripheral. As the byte shifts out on the MOSI pin of the master, another byte shifts in from the slave on the master’s MISO pin. The transmission ends when the receiver full bit, SPRF, becomes set.
Serial Peripheral Interface Module (SPI) When the master SPI starts a transmission, the data in the slave shift register begins shifting out on the MISO pin. The slave can load its shift register with a new byte for the next transmission by writing to its transmit data register. The slave must write to its transmit data register at least one bus cycle before the master starts the next transmission. Otherwise, the byte already in the slave shift register shifts out on the MISO pin.
Serial Peripheral Interface Module (SPI) The clock phase (CPHA) control bit selects one of two fundamentally different transmission formats. The clock phase and polarity should be identical for the master SPI device and the communicating slave device. In some cases, the phase and polarity are changed between transmissions to allow a master device to communicate with peripheral slaves having different requirements.
Serial Peripheral Interface Module (SPI) SPSCK CYCLE # FOR REFERENCE 1 2 3 4 5 6 7 8 MSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB SPSCK; CPOL = 0 SPSCK; CPOL =1 MOSI FROM MASTER MISO FROM SLAVE MSB SS; TO SLAVE CAPTURE STROBE Figure 14-4. Transmission Format (CPHA = 0) MISO/MOSI BYTE 1 BYTE 2 BYTE 3 MASTER SS SLAVE SS CPHA = 0 SLAVE SS CPHA = 1 Figure 14-5.
Serial Peripheral Interface Module (SPI) 14.6.3 Transmission Format When CPHA = 1 Figure 14-6 shows an SPI transmission in which CPHA is logic 1. The figure should not be used as a replacement for data sheet parametric information. Two waveforms are shown for SPSCK: one for CPOL = 0 and another for CPOL = 1.
Serial Peripheral Interface Module (SPI) When CPHA = 1 for a slave, the first edge of the SPSCK indicates the beginning of the transmission. This causes the SPI to leave its idle state and begin driving the MISO pin with the MSB of its data. Once the transmission begins, no new data is allowed into the shift register from the transmit data register. Therefore, the SPI data register of the slave must be loaded with transmit data before the first edge of SPSCK.
Serial Peripheral Interface Module (SPI) WRITE TO SPDR INITIATION DELAY BUS CLOCK MOSI MSB BIT 6 1 2 BIT 5 SPSCK CPHA = 1 SPSCK CPHA = 0 SPSCK CYCLE NUMBER 3 INITIATION DELAY FROM WRITE SPDR TO TRANSFER BEGIN WRITE TO SPDR BUS CLOCK EARLIEST LATEST WRITE TO SPDR SPSCK = INTERNAL CLOCK ÷ 2; 2 POSSIBLE START POINTS BUS CLOCK EARLIEST WRITE TO SPDR SPSCK = INTERNAL CLOCK ÷ 8; 8 POSSIBLE START POINTS LATEST SPSCK = INTERNAL CLOCK ÷ 32; 32 POSSIBLE START POINTS LATEST SPSC
Serial Peripheral Interface Module (SPI) 14.7 Queuing Transmission Data The double-buffered transmit data register allows a data byte to be queued and transmitted. For an SPI configured as a master, a queued data byte is transmitted immediately after the previous transmission has completed. The SPI transmitter empty flag (SPTE) indicates when the transmit data buffer is ready to accept new data. Write to the transmit data register only when the SPTE bit is high.
Serial Peripheral Interface Module (SPI) For an idle master or idle slave that has no data loaded into its transmit buffer, the SPTE is set again no more than two bus cycles after the transmit buffer empties into the shift register. This allows the user to queue up a 16-bit value to send. For an already active slave, the load of the shift register cannot occur until the transmission is completed. This implies that a back-to-back write to the transmit data register is not possible.
Serial Peripheral Interface Module (SPI) interrupts share the same CPU interrupt vector. (See Figure 14-11.) It is not possible to enable MODF or OVRF individually to generate a receiver/error CPU interrupt request. However, leaving MODFEN low prevents MODF from being set. If the CPU SPRF interrupt is enabled and the OVRF interrupt is not, watch for an overflow condition. Figure 14-9 shows how it is possible to miss an overflow.
Serial Peripheral Interface Module (SPI) BYTE 1 SPI RECEIVE COMPLETE BYTE 2 5 1 BYTE 3 7 BYTE 4 11 SPRF OVRF READ SPSCR 2 READ SPDR 4 6 3 1 BYTE 1 SETS SPRF BIT. 2 CPU READS SPSCR WITH SPRF BIT SET AND OVRF BIT CLEAR. CPU READS BYTE 1 IN SPDR, CLEARING SPRF BIT. 3 9 8 12 10 14 13 8 CPU READS BYTE 2 IN SPDR, CLEARING SPRF BIT. 9 CPU READS SPSCR AGAIN TO CHECK OVRF BIT. 10 CPU READS BYTE 2 SPDR, CLEARING OVRF BIT. 4 CPU READS SPSCR AGAIN TO CHECK OVRF BIT. 11 BYTE 4 SETS SPRF BIT.
Serial Peripheral Interface Module (SPI) MODF generates a receiver/error CPU interrupt request if the error interrupt enable bit (ERRIE) is also set. The SPRF, MODF, and OVRF interrupts share the same CPU interrupt vector. (See Figure 14-11.) It is not possible to enable MODF or OVRF individually to generate a receiver/error CPU interrupt request. However, leaving MODFEN low prevents MODF from being set.
Serial Peripheral Interface Module (SPI) slave. This happens because SS at logic 0 indicates the start of the transmission (MISO driven out with the value of MSB) for CPHA = 0. When CPHA = 1, a slave can be selected and then later unselected with no transmission occurring. Therefore, MODF does not occur since a transmission was never begun. In a slave SPI (MSTR = 0), the MODF bit generates an SPI receiver/error CPU interrupt request if the ERRIE bit is set.
Serial Peripheral Interface Module (SPI) Reading the SPI status and control register with SPRF set and then reading the receive data register clears SPRF. The clearing mechanism for the SPTE flag is always just a write to the transmit data register. The SPI transmitter interrupt enable bit (SPTIE) enables the SPTE flag to generate transmitter CPU interrupt requests, provided that the SPI is enabled (SPE = 1).
Serial Peripheral Interface Module (SPI) The following sources in the SPI status and control register can generate CPU interrupt requests: • SPI receiver full bit (SPRF) — The SPRF bit becomes set every time a byte transfers from the shift register to the receive data register. If the SPI receiver interrupt enable bit, SPRIE, is also set, SPRF generates an SPI receiver/error CPU interrupt request.
Serial Peripheral Interface Module (SPI) By not resetting the SPRF, OVRF, and MODF flags, the user can still service these interrupts after the SPI has been disabled. The user can disable the SPI by writing 0 to the SPE bit. The SPI can also be disabled by a mode fault occurring in an SPI that was configured as a master with the MODFEN bit set. 14.11 Low-Power Modes The WAIT and STOP instructions put the MCU in low powerconsumption standby modes. 14.11.
Serial Peripheral Interface Module (SPI) 14.12 SPI During Break Interrupts The system integration module (SIM) controls whether status bits in other modules can be cleared during the break state. The BCFE bit in the SIM break flag control register (SBFCR) enables software to clear status bits during the break state. (See Section 9. System Integration Module (SIM).) To allow software to clear status bits during a break interrupt, write a logic 1 to the BCFE bit.
Serial Peripheral Interface Module (SPI) The SPI has limited inter-integrated circuit (I2C) capability (requiring software support) as a master in a single-master environment. To communicate with I2C peripherals, MOSI becomes an open-drain output when the SPWOM bit in the SPI control register is set. In I2C communication, the MOSI and MISO pins are connected to a bidirectional pin from the I2C peripheral and through a pullup resistor to VDD. 14.13.
Serial Peripheral Interface Module (SPI) 14.13.3 SPSCK (Serial Clock) The serial clock synchronizes data transmission between master and slave devices. In a master MCU, the SPSCK pin is the clock output. In a slave MCU, the SPSCK pin is the clock input. In full-duplex operation, the master and slave MCUs exchange a byte of data in eight serial clock cycles. When enabled, the SPI controls data direction of the SPSCK pin regardless of the state of the data direction register of the shared I/O port. 14.13.
Serial Peripheral Interface Module (SPI) When an SPI is configured as a master, the SS input can be used in conjunction with the MODF flag to prevent multiple masters from driving MOSI and SPSCK. (See 14.8.2 Mode Fault Error.) For the state of the SS pin to set the MODF flag, the MODFEN bit in the SPSCK register must be set. If the MODFEN bit is low for an SPI master, the SS pin can be used as a general-purpose I/O under the control of the data direction register of the shared I/O port.
Serial Peripheral Interface Module (SPI) 14.14 I/O Registers Three registers control and monitor SPI operation: • SPI control register (SPCR) • SPI status and control register (SPSCR) • SPI data register (SPDR) 14.14.
Serial Peripheral Interface Module (SPI) SPMSTR — SPI Master Bit This read/write bit selects master mode operation or slave mode operation. Reset sets the SPMSTR bit. 1 = Master mode 0 = Slave mode CPOL — Clock Polarity Bit This read/write bit determines the logic state of the SPSCK pin between transmissions. (See Figure 14-4 and Figure 14-6.) To transmit data between SPI modules, the SPI modules must have identical CPOL values. Reset clears the CPOL bit.
Serial Peripheral Interface Module (SPI) 14.14.
Serial Peripheral Interface Module (SPI) ERRIE — Error Interrupt Enable Bit This read/write bit enables the MODF and OVRF bits to generate CPU interrupt requests. Reset clears the ERRIE bit. 1 = MODF and OVRF can generate CPU interrupt requests 0 = MODF and OVRF cannot generate CPU interrupt requests 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 register.
Serial Peripheral Interface Module (SPI) MODFEN — Mode Fault Enable Bit This read/write bit, when set to 1, allows the MODF flag to be set. If the MODF flag is set, clearing the MODFEN does not clear the MODF flag. If the SPI is enabled as a master and the MODFEN bit is low, then the SS pin is available as a general-purpose I/O. If the MODFEN bit is set, then this pin is not available as a generalpurpose I/O.
Serial Peripheral Interface Module (SPI) 14.14.3 SPI Data Register The SPI data register consists of the read-only receive data register and the write-only transmit data register. Writing to the SPI data register writes data into the transmit data register. Reading the SPI data register reads data from the receive data register. The transmit data and receive data registers are separate registers that can contain different values. (See Figure 14-2.
Serial Peripheral Interface Module (SPI) Technical Data 300 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 15. Analog-to-Digital Converter (ADC) 15.1 Contents 15.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 15.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 15.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 15.4.1 ADC Port I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 15.4.2 Voltage Conversion . . . .
Analog-to-Digital Converter (ADC) 15.2 Introduction This section describes the analog-to-digital convert (ADC). The ADC is a 6-channel 10-bit linear successive approximation ADC. 15.
Analog-to-Digital Converter (ADC) Addr.
Analog-to-Digital Converter (ADC) logic and can be used as general-purpose I/O pins. Writes to the port data register or data direction register will not have any affect on the port pin that is selected by the ADC. Read of a port pin which is in use by the ADC will return the pin condition if the corresponding DDR bit is at logic 0. If the DDR bit is at logic 1, the value in the port data latch is read.
Analog-to-Digital Converter (ADC) 15.4.2 Voltage Conversion When the input voltage to the ADC equals VREFH, the ADC converts the signal to $3FF (full scale). If the input voltage equals VREFL, the ADC converts it to $000. Input voltages between VREFH and VREFL are straight-line linear conversions. All other input voltages will result in $3FF if greater than VREFH and $000 if less than VREFL. NOTE: Input voltage should not exceed the analog supply voltages. 15.4.
Analog-to-Digital Converter (ADC) 15.4.4 Continuous Conversion In the continuous conversion mode, the ADC continuously converts the selected channel, filling the ADC data register (ADRH:ADRL) with new data after each conversion. Data from the previous conversion will be overwritten whether that data has been read or not. Conversions will continue until the ADCO bit is cleared.
Analog-to-Digital Converter (ADC) Finally, 8-bit truncation mode will place the eight MSBs in ADC data register low (ADRL). The two LSBs are dropped. This mode of operation is used when compatibility with 8-bit ADC designs are required. No interlocking between ADRH and ADRL is present. NOTE: Quantization error is affected when only the most significant eight bits are used as a result. See Figure 15-3.
Analog-to-Digital Converter (ADC) 15.5 Interrupts When the AIEN bit is set, the ADC module is capable of generating a CPU interrupt after each ADC conversion. A CPU interrupt is generated if the COCO bit is at logic 0. The COCO bit is not used as a conversion complete flag when interrupts are enabled. The interrupt vector is defined in Table 2-1 . Vector Addresses. 15.6 Low-Power Modes The STOP and WAIT instructions put the MCU in low powerconsumption standby modes. 15.6.
Analog-to-Digital Converter (ADC) 15.7.1 ADC Voltage In (VADIN) VADIN is the input voltage signal from one of the nine channels to the ADC module. 15.7.2 ADC Analog Power Pin (VDDA) The ADC analog portion uses VDDA as its power pin. Connect the VDDA pin to the same voltage potential as VDD. External filtering may be necessary to ensure clean VDDA for good results. NOTE: Route VDDA carefully for maximum noise immunity and place bypass capacitors as close as possible to the package. 15.7.
Analog-to-Digital Converter (ADC) 15.8 I/O Registers These I/O registers control and monitor operation of the ADC: • ADC status and control register, ADSCR • ADC data register, ADRH:ADRL • ADC clock register, ADCLK 15.8.1 ADC Status and Control Register This section describes the function of the ADC status and control register (ADSCR). Writing ADSCR aborts the current conversion and initiates a new conversion.
Analog-to-Digital Converter (ADC) ADCO — ADC Continuous Conversion Bit When set, the ADC will convert samples continuously and update the ADC data register at the end of each conversion. Only one conversion is allowed when this bit is cleared. Reset clears the ADCO bit. 1 = Continuous ADC conversion 0 = One ADC conversion ADCH[4:0] — ADC Channel Select Bits ADCH[4:0] form a 5-bit field which is used to select one of the ADC channels when not in auto-scan mode.
Analog-to-Digital Converter (ADC) 15.8.2 ADC Data Register The ADC data register consist of a pair of 8-bit registers: high byte (ADRH), and low byte (ADRL). This pair form a 16-bit register to store the 10-bit ADC result for the selected ADC result justification mode. In 8-bit truncated mode, the ADRL holds the eight most significant bits (MSBs) of the 10-bit result. The ADRL is updated each time an ADC conversion completes. In 8-bit truncated mode, ADRL contains no interlocking with ADRH.
Analog-to-Digital Converter (ADC) In left justified mode the ADRH holds the eight most significant bits (MSBs), and the ADRL holds the two least significant bits (LSBs), of the 10-bit result. The ADRH and ADRL are updated each time a single channel ADC conversion completes. Reading ADRH latches the contents of ADRL. Until ADRL is read all subsequent ADC results will be lost. (See Figure 15-7 . ADRH and ADRL in Left Justified Mode.) Addr.
Analog-to-Digital Converter (ADC) 15.8.3 ADC Clock Control Register The ADC clock control register (ADCLK) selects the clock frequency for the ADC. Address: Read: Write: Reset: $003F ADIV2 ADIV1 ADIV0 ADICLK MODE1 MODE0 0 0 0 0 0 1 = Unimplemented R 0 0 R 0 0 = Reserved Figure 15-9. ADC Clock Control Register (ADICLK) ADIV[2:0] — ADC Clock Prescaler Bits ADIV2, ADIV1, and ADIV0 form a 3-bit field which selects the divide ratio used by the ADC to generate the internal ADC clock.
Analog-to-Digital Converter (ADC) If the external clock (CGMXCLK) is equal to or greater than 1MHz, CGMXCLK can be used as the clock source for the ADC. If CGMXCLK is less than 1MHz, use the PLL-generated bus clock as the clock source. As long as the internal ADC clock is at fADIC, correct operation can be guaranteed.
Analog-to-Digital Converter (ADC) Technical Data 316 MC68HC908LJ12 — Rev. 2.
Technical Data — MC68HC908LJ12 Section 16. Liquid Crystal Display Driver (LCD) 16.1 Contents 16.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 16.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 16.4 Pin Name Conventions and I/O Register Addresses . . . . . . . 318 16.5 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320 16.5.1 LCD Duty . . . . . . . . . . . . . . . . .
Liquid Crystal Display Driver (LCD) 16.2 Introduction This section describes the liquid crystal display (LCD) driver module. The LCD driver module can drive a maximum of 27 frontplanes and 4 backplanes, depending on the LCD duty selected. 16.
Liquid Crystal Display Driver (LCD) Addr.
Liquid Crystal Display Driver (LCD) $005A $005B $005C $005D $005E $005F Read: LCD Data Register 9 Write: (LDAT9) Reset: Read: LCD Data Register 10 Write: (LDAT10) Reset: Read: LCD Data Register 11 Write: (LDAT11) Reset: Read: LCD Data Register 12 Write: (LDAT12) Reset: Read: LCD Data Register 13 Write: (LDAT13) Reset: Read: LCD Data Register 14 Write: (LDAT14) Reset: F17B3 F17B2 F17B1 F17B0 F16B3 F16B2 F16B1 F16B0 U U U U U U U U F19B3 F19B2 F19B1 F19B0 F18B3 F18B2 F18B1 F18B0
Liquid Crystal Display Driver (LCD) FP18 FP17 FP16 FP15 FP14 FP13 FP12 FP11 FP10 FP9 FP8 FP7 FP6 FP5 When the LCD driver module is disabled (LCDE = 0), the LCD display will be OFF, all backplane and frontplane drivers have the same potential as VDD. The resistor ladder is disconnected from VDD to reduce power consumption.
FP0 Liquid Crystal Display Driver (LCD) RFP FP1 RFP FP24 RFP BP0 RBP BP1 RBP VLCD (from VDD) VLCD RLCD RLCD RLCD VLCD1 VLCD2 VLCD3 Vbias Freescale Semiconductor MC68HC908LJ12 — Rev. 2.1 VR BIAS CONTROL LCCON[3:0] Figure 16-3.
Liquid Crystal Display Driver (LCD) 16.5.2 LCD Voltages (VLCD, VLCD1, VLCD2, VLCD3) The voltage VLCD is connected directly to VDD. VLCD1, VLCD2, and VLCD3 are internal bias voltages for the LCD driver waveforms. They are derived from VLCD using a resistor ladder (see Figure 16-3).
Liquid Crystal Display Driver (LCD) 16.5.4 Fast Charge and Low Current The default value for each of the bias resistors (see Figure 16-3), RLCD, in the resistor ladder is approximately 37kΩ at VLCD = 3V. The relatively high current drain through the 37kΩ resistor ladder may not be suitable for some LCD panel connections. Lowering this current is possible by setting the LC bit in the LCD control register, switching the RLCD value to 146kΩ.
Liquid Crystal Display Driver (LCD) 16.5.5 Contrast Control The contrast of the connected LCD panel can be adjusted by configuring the LCCON[3:0] bits in the LCD control register. The LCCON[3:0] bits provide a 16-step contrast control, which adjusts the bias voltage in the resistor ladder for LCD voltage VLCD3. The relative voltages, VLCD1 and VLCD2, are altered according. For example, setting LCCON[3:0] = $F, the relative panel potential voltage (VLCD – VLCD3) is reduced from maximum 3.
Liquid Crystal Display Driver (LCD) 16.7 I/O Signals The LCD driver module has thirty (30) output pins and shares eight of them with port C I/O pins. • FP0/BP3 (multiplexed; selected as FP0 or BP3 by DUTY[1:0]) • BP0–BP2 • FP1–FP26 (FP19–FP26 shared with port C) 16.7.1 BP0–BP3 (Backplane Drivers) BP0–BP3 are the backplane driver output pins. These are connected to the backplane of the LCD panel.
Liquid Crystal Display Driver (LCD) DUTY = STATIC 1FRAME VLCD VLCD1 VLCD2 BP0 VLCD3 NOTES: 1. BP1, BP2, and BP3 are not used. 2. At static duty, 1FRAME is equal to the cycle of LCD waveform base clock. Figure 16-6. Static LCD Backplane Driver Waveform DUTY = 1/4 1FRAME VLCD VLCD1 VLCD2 BP0 VLCD3 BP1 VLCD VLCD1 VLCD2 VLCD3 BP2 VLCD VLCD1 VLCD2 VLCD3 BP3 VLCD VLCD1 VLCD2 VLCD3 Figure 16-7. 1/4 Duty LCD Backplane Driver Waveforms MC68HC908LJ12 — Rev. 2.
Liquid Crystal Display Driver (LCD) 16.7.2 FP0–FP26 (Frontplane Drivers) FP0–FP26 are the frontplane driver output pins. These are connected to the frontplane of the LCD panel. Depending on LCD duty selected and the contents in the LCD data registers, the voltage waveforms in Figure 16-8, Figure 16-9, and Figure 16-10 appear on the frontplane pins. FP19–FP26 are shared with port C I/O pins. These pins are configured for standard I/O or LCD use by the PCEL and PCEH bits in CONFIG2 register.
Liquid Crystal Display Driver (LCD) DUTY = 1/3 DATA LATCH: 1 = ON, 0 = OFF — FxB2 FxB1 FxB0 0 0 0 FPx OUTPUT 1FRAME VLCD VLCD1 VLCD2 VLCD3 — — — — — — — FxB2 FxB1 FxB0 0 0 1 FxB2 FxB1 FxB0 0 1 0 FxB2 FxB1 FxB0 1 0 0 FxB2 FxB1 FxB0 0 1 1 FxB2 FxB1 FxB0 1 1 0 FxB2 FxB1 FxB0 1 0 1 FxB2 FxB1 FxB0 1 1 1 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD2 VLCD3 VLCD VLCD1 VLCD
Liquid Crystal Display Driver (LCD) DUTY = 1/4 DATA LATCH: 1 = ON, 0 = OFF 1FRAME FxB3 FxB2 FxB1 FxB0 0 0 0 0 FPx OUTPUT VLCD VLCD1 VLCD2 VLCD3 FxB3 FxB2 FxB1 FxB0 0 0 0 1 FxB3 FxB2 FxB1 FxB0 0 0 1 0 FxB3 FxB2 FxB1 FxB0 0 0 1 1 FxB3 FxB2 FxB1 FxB0 0 1 0 0 FxB3 FxB2 FxB1 FxB0 0 1 0 1 FxB3 FxB2 FxB1 FxB0 0 1 1 0 FxB3 FxB2 FxB1 FxB0 0 1 1 1 Figure 16-10. 1/4 Duty LCD Frontplane Driver Waveforms Technical Data 330 MC68HC908LJ12 — Rev. 2.
Liquid Crystal Display Driver (LCD) DUTY = 1/4 DATA LATCH: 1 = ON, 0 = OFF 1FRAME FxB3 FxB2 FxB1 FxB0 1 0 0 0 FPx OUTPUT VLCD VLCD1 VLCD2 VLCD3 FxB3 FxB2 FxB1 FxB0 1 0 0 1 FxB3 FxB2 FxB1 FxB0 1 0 1 0 FxB3 FxB2 FxB1 FxB0 1 0 1 1 FxB3 FxB2 FxB1 FxB0 1 1 0 0 FxB3 FxB2 FxB1 FxB0 1 1 0 1 FxB3 FxB2 FxB1 FxB0 1 1 1 0 FxB3 FxB2 FxB1 FxB0 1 1 1 1 Figure 16-11. 1/4 Duty LCD Frontplane Driver Waveforms (continued) MC68HC908LJ12 — Rev. 2.
Liquid Crystal Display Driver (LCD) 16.8 Seven Segment Display Connection The following shows an example for connecting a 7-segment LCD display to the LCD driver. The example uses 1/3 duty cycle, with pins BP0, BP1, BP2, FP0, FP1, and FP2 connected as shown in Figure 16-12. The output waveforms are shown in Figure 16-13.
Liquid Crystal Display Driver (LCD) DUTY = 1/3 1FRAME VLCD VLCD1 VLCD2 BP0 VLCD3 — — — F0B2 F0B1 F0B0 0 1 0 F1B2 F1B1 F1B0 0 1 0 F2B2 F2B1 F2B0 0 1 1 BP1 VLCD VLCD1 VLCD2 VLCD3 BP2 VLCD VLCD1 VLCD2 VLCD3 FP0 VLCD VLCD1 VLCD2 VLCD3 FP1 VLCD VLCD1 VLCD2 VLCD3 FP2 VLCD VLCD1 VLCD2 VLCD3 Figure 16-13. BP0–BP2 and FP0–FP2 Output Waveforms for 7-Segment Display Example MC68HC908LJ12 — Rev. 2.
Liquid Crystal Display Driver (LCD) The voltage waveform across the "f" segment of the LCD (between BP1 and FP0) is illustrated in Figure 16-14. As shown in the waveform, the voltage peaks reach the LCD-ON voltage, VLCD, therefore, the segment will be ON. +VLCD +VLCD1 +VLCD2 BP1–FP0 0 –VLCD2 –VLCD1 –VLCD Figure 16-14. "f" Segment Voltage Waveform The voltage waveform across the "e" segment of the LCD (between BP2 and FP0) is illustrated in Figure 16-15.
Liquid Crystal Display Driver (LCD) 16.9 I/O Registers Sixteen (16) registers control LCD driver module operation: • LCD control register (LCDCR) • LCD clock register (LCDCLK) • LCD data registers (LDAT1–LDAT14) 16.9.
Liquid Crystal Display Driver (LCD) Table 16-2. Resistor Ladder Selection FC LC Action X 0 Each resistor is approximately 37 kΩ (default) 0 1 Each resistor is approximately 146 kΩ 1 1 Fast charge mode LCCON[3:0] — LCD Contrast Control These read/write bits select the bias voltage, Vbias. This voltage controls the contrast of the LCD. Maximum contrast is set when LCCON[3:0] = 0000; minimum contrast is when LCCON[3:0] = 1111. Table 16-3.
Liquid Crystal Display Driver (LCD) 16.9.2 LCD Clock Register (LCDCLK) The LCD clock register (LCDCLK): • Selects the fast charge duty cycle • Selects LCD driver duty cycle • Selects LCD waveform base clock Address: $004F Bit 7 Read: 0 Write: Reset: 6 5 4 3 2 1 Bit 0 FCCTL1 FCCTL0 DUTY1 DUTY0 LCLK2 LCLK1 LCLK0 0 0 0 0 0 0 0 0 = Unimplemented Figure 16-17.
Liquid Crystal Display Driver (LCD) DUTY[1:0] — Duty Cycle Select These read/write bits select the duty cycle of the LCD driver output waveforms. The multiplexed FP0/BP3 pin is controlled by the duty cycle selected. Reset clears these bits. Table 16-5. LCD Duty Cycle Selection DUTY1:DUTY0 Description 00 Static selected; FP0/BP3 pin function as FP0. 01 1/3 duty cycle selected; FP0/BP3 pin functions as FP0. 10 1/4 duty cycle selected; FP0/BP3 pin functions as BP3.
Liquid Crystal Display Driver (LCD) 16.9.3 LCD Data Registers (LDAT1–LDAT14) The fourteen (14) LCD data registers enable and disable the drive to the corresponding LCD segments. Addr.
Liquid Crystal Display Driver (LCD) $005B $005C $005D $005E $005F Read: LCD Data Register 10 Write: (LDAT10) Reset: Read: LCD Data Register 11 Write: (LDAT11) Reset: Read: LCD Data Register 12 Write: (LDAT12) Reset: Read: LCD Data Register 13 Write: (LDAT13) Reset: Read: LCD Data Register 14 Write: (LDAT14) Reset: F19B3 F19B2 F19B1 F19B0 F18B3 F18B2 F18B1 F18B0 U U U U U U U U F21B3 F21B2 F21B1 F21B0 F20B3 F20B2 F20B1 F20B0 U U U U U U U U F23B3 F23B2 F23B1 F23B0 F
Technical Data — MC68HC908LJ12 Section 17. Input/Output (I/O) Ports 17.1 Contents 17.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 17.3 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 17.3.1 Port A Data Register (PTA) . . . . . . . . . . . . . . . . . . . . . . . . 344 17.3.2 Data Direction Register A (DDRA) . . . . . . . . . . . . . . . . . . . 345 17.4 Port B . . . . . . . . . . . . . . . . . . . . . .
Input/Output (I/O) Ports Addr.
Input/Output (I/O) Ports Table 17-1.
Input/Output (I/O) Ports 17.3 Port A Port A is an 8-bit special function port that shares four of its port pins with the analog-to-digital converter (ADC) module and four of its port pins with the keyboard interrupt module (KBI). 17.3.1 Port A Data Register (PTA) The port A data register contains a data latch for each of the eight port A pins.
Input/Output (I/O) Ports ADC[3:0] — ADC channels 3 to 0 ADC[3:0] are pins used for the input channels to the analog-to-digital converter module. The channel select bits, ADCH[4:0], in the ADC status and control register define which port pin will be used as an ADC input and overrides any control from the port I/O logic. See Section 15. Analog-to-Digital Converter (ADC). NOTE: Care must be taken when reading port A while applying analog voltages to ADC[3:0] pins.
Input/Output (I/O) Ports READ DDRA ($0004) INTERNAL DATA BUS WRITE DDRA ($0004) RESET DDRAx WRITE PTA ($0000) PTAx PTAx READ PTA ($0000) Figure 17-4. Port A I/O Circuit When DDRAx is a logic 1, reading address $0000 reads the PTAx data latch. When DDRAx is a logic 0, reading address $0000 reads the voltage level on the pin. The data latch can always be written, regardless of the state of its data direction bit. Table 17-2 summarizes the operation of the port A pins. Table 17-2.
Input/Output (I/O) Ports 17.4 Port B Port B is a 8-bit special function port that shares two of its port pins with the infrared serial communication interface (IRSCI) module, two of its port pins with the timer interface module 1 (TIM1) module, two of its port pins with the timer interface module 2 (TIM2), and two of its port pins with the ADC module. Port pins PTB0–PTB5 can be configured for direct LED drive. 17.4.
Input/Output (I/O) Ports T1CH[1:0] — Timer 1 Channel I/O Bits The T1CH1 and T1CH0 pins are the TIM1 input capture/output compare pins. The edge/level select bits, ELSxB:ELSxA, determine whether the PTB2/T1CH0 and PTB3/T1CH1 pins are timer channel I/O pins or general-purpose I/O pins. See Section 11. Timer Interface Module (TIM). T2CH[1:0] — Timer 2 Channel I/O Bits The T2CH1 and T2CH0 pins are the TIM1 input capture/output compare pins.
Input/Output (I/O) Ports NOTE: For those devices packaged in a 52-pin LQFP, PTB4–PTB7 are not connected. DDRB4–DDRB7 should be set to a 1 to configure PTB4–PTB7 as outputs. Address: Read: Write: Reset: $0005 Bit 7 6 5 4 3 2 1 Bit 0 DDRB7 DDRB6 DDRB5 DDRB4 DDRB3 DDRB2 DDRB1 DDRB0 0 0 0 0 0 0 0 0 Figure 17-6. Data Direction Register B (DDRB) DDRB[7:0] — Data Direction Register B Bits These read/write bits control port B data direction.
Input/Output (I/O) Ports Table 17-3 summarizes the operation of the port B pins. Table 17-3. Port B Pin Functions Accesses to DDRB DDRB Bit PTB Bit 0 X(1) 1 X Accesses to PTB I/O Pin Mode Read/Write Read Write Input, Hi-Z(2) DDRB[7:0] Pin PTB[7:0](3) Output DDRB[7:0] PTB[7:0] PTB[7:0] Notes: 1. X = don’t care. 2. Hi-Z = high impedance. 3. Writing affects data register, but does not affect input. 17.4.
Input/Output (I/O) Ports 17.5 Port C Port C is an 8-bit special function port that shares all of its port pins with the liquid crystal display (LCD) driver module. 17.5.1 Port C Data Register (PTC) The port C data register contains a data latch for each of the eight port C pins. Address: Read: Write: $0002 Bit 7 6 5 4 3 2 1 Bit 0 PTC7 PTC6 PTC5 PTC4 PTC3 PTC2 PTC1 PTC0 FP21 FP20 FP19 Reset: Alternative Function: Unaffected by reset FP26 FP25 FP24 FP23 FP22 Figure 17-9.
Input/Output (I/O) Ports 17.5.2 Data Direction Register C (DDRC) Data direction register C determines whether each port C pin is an input or an output. Writing a logic 1 to a DDRC bit enables the output buffer for the corresponding port C pin; a logic 0 disables the output buffer. Address: Read: Write: Reset: $0006 Bit 7 6 5 4 3 2 1 Bit 0 DDRC7 DDRC6 DDRC5 DDRC4 DDRC3 DDRC2 DDRC1 DDRC0 0 0 0 0 0 0 0 0 Figure 17-10.
Input/Output (I/O) Ports When DDRCx is a logic 1, reading address $0002 reads the PTCx data latch. When DDRCx is a logic 0, reading address $0002 reads the voltage level on the pin. The data latch can always be written, regardless of the state of its data direction bit. Table 17-4 summarizes the operation of the port C pins. Table 17-4.
Input/Output (I/O) Ports 17.6 Port D Port D is an 8-bit special function port that shares four of its pins with serial peripheral interface (SPI) module and four of its pins with the keyboard interrupt module (KBI). NOTE: Port D is not available in a 52-pin LQFP. 17.6.1 Port D Data Register (PTD) The port D data register contains a data latch for each of the eight port D pins. NOTE: Bit 0–bit 7 of PTD are not available in a 52-pin LQFP.
Input/Output (I/O) Ports KBI[7:4] — Keyboard Interrupt Pins KBI[7:4] are input pins to the keyboard interrupt module. The corresponding control bits, KBIE[7:4], in the keyboard interrupt enable register, KBIER, select which port pins will be used as a keyboard interrupt input and overrides any control from the port I/O logic. See Section 19. Keyboard Interrupt Module (KBI) 17.6.2 Data Direction Register D (DDRD) Data direction register D determines whether each port D pin is an input or an output.
Input/Output (I/O) Ports READ DDRD ($0007) INTERNAL DATA BUS WRITE DDRD ($0007) DDRDx RESET WRITE PTD ($0003) PTDx PTDx READ PTD ($0003) Figure 17-14. Port D I/O Circuit When DDRDx is a logic 1, reading address $0003 reads the PTDx data latch. When DDRDx is a logic 0, reading address $0003 reads the voltage level on the pin. The data latch can always be written, regardless of the state of its data direction bit. Table 17-5 summarizes the operation of the port D pins. Table 17-5.
Technical Data — MC68HC908LJ12 Section 18. External Interrupt (IRQ) 18.1 Contents 18.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 18.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 18.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358 18.4.1 IRQ Pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 18.
External Interrupt (IRQ) 18.4 Functional Description A logic 0 applied to the external interrupt pin can latch a CPU interrupt request. Figure 18-1 shows the structure of the IRQ module. Interrupt signals on the IRQ pin are latched into the IRQ latch. An interrupt latch remains set until one of the following actions occurs: • Vector fetch — A vector fetch automatically generates an interrupt acknowledge signal that clears the IRQ latch.
External Interrupt (IRQ) RESET ACK TO CPU FOR BIL/BIH INSTRUCTIONS INTERNAL ADDRESS BUS VECTOR FETCH DECODER VDD VDD INTERNAL PULLUP DEVICE IRQF D CLR Q IRQ IRQ INTERRUPT REQUEST SYNCHRONIZER CK IMASK MODE TO MODE SELECT LOGIC HIGH VOLTAGE DETECT Figure 18-1. IRQ Module Block Diagram Addr.
External Interrupt (IRQ) 18.4.1 IRQ Pin 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 MODE bit is set, the IRQ pin is both falling-edge-sensitive and lowlevel-sensitive. With MODE set, both of the following actions must occur to clear IRQ: • Vector fetch or software clear — A vector fetch generates an interrupt acknowledge signal to clear the latch.
External Interrupt (IRQ) 18.5 IRQ Module During Break Interrupts The system integration module (SIM) controls whether the IRQ latch can be cleared during the break state. The BCFE bit in the break flag control register (BFCR) enables software to clear the latches during the break state. (See Section 22. Break Module (BRK).) To allow software to clear the IRQ latch during a break interrupt, write a logic 1 to the BCFE bit.
External Interrupt (IRQ) Address: Read: $001E Bit 7 6 5 4 3 2 0 0 0 0 IRQF 0 Write: Reset: ACK 0 0 0 0 0 0 1 Bit 0 IMASK MODE 0 0 = Unimplemented Figure 18-2. IRQ Status and Control Register (INTSCR) IRQF — IRQ Flag Bit This read-only status bit is high when the IRQ interrupt is pending. 1 = IRQ interrupt pending 0 = IRQ interrupt not pending ACK — IRQ Interrupt Request Acknowledge Bit Writing a logic 1 to this write-only bit clears the IRQ latch. ACK always reads as logic 0.
Technical Data — MC68HC908LJ12 Section 19. Keyboard Interrupt Module (KBI) 19.1 Contents 19.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 19.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 19.4 I/O Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 19.5 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365 19.5.
Keyboard Interrupt Module (KBI) 19.3 Features Features of the keyboard interrupt module include the following: • Eight keyboard interrupt pins with pullup devices • Separate keyboard interrupt enable bits and one keyboard interrupt mask • Programmable edge-only or edge- and level- interrupt sensitivity • Exit from low-lower modes Addr.
Keyboard Interrupt Module (KBI) 19.5 Functional Description INTERNAL BUS KBI0 ACKK VDD . KBIE0 TO PULLUP ENABLE D . CLR VECTOR FETCH DECODER KEYF RESET Q SYNCHRONIZER CK . KEYBOARD INTERRUPT FF KBI7 KEYBOARD INTERRUPT REQUEST IMASKK MODEK KBIE7 TO PULLUP ENABLE Figure 19-2. Keyboard Interrupt Block Diagram Writing to the KBIE7–KBIE0 bits in the keyboard interrupt enable register independently enables or disables a port A or port D pin as a keyboard interrupt pin.
Keyboard Interrupt Module (KBI) • Vector fetch or software clear — A vector fetch generates an interrupt acknowledge signal to clear the interrupt request. Software may generate the interrupt acknowledge signal by writing a logic 1 to the ACKK bit in the keyboard status and control register KBSCR. The ACKK bit is useful in applications that poll the keyboard interrupt pins and require software to clear the keyboard interrupt request.
Keyboard Interrupt Module (KBI) 19.5.1 Keyboard Initialization When a keyboard interrupt pin is enabled, it takes time for the internal pull-up to reach a logic 1. Therefore a false interrupt can occur as soon as the pin is enabled. To prevent a false interrupt on keyboard initialization: 1. Mask keyboard interrupts by setting the IMASKK bit in the keyboard status and control register. 2. Enable the KBI pins by setting the appropriate KBIEx bits in the keyboard interrupt enable register. 3.
Keyboard Interrupt Module (KBI) 19.6.1 Keyboard Status and Control Register • Flags keyboard interrupt requests • Acknowledges keyboard interrupt requests • Masks keyboard interrupt requests • Controls keyboard interrupt triggering sensitivity Address: Read: $001B Bit 7 6 5 4 3 2 0 0 0 0 KEYF 0 Write: Reset: ACKK 0 0 0 0 0 0 1 Bit 0 IMASKK MODEK 0 0 = Unimplemented Figure 19-3.
Keyboard Interrupt Module (KBI) 19.6.2 Keyboard Interrupt Enable Register The keyboard interrupt enable register individually enables or disables the PTA0/KBI0–PTA3/KBI3 and PTD4/KBI4–PTD7/KBI7 pins to operate as a keyboard interrupt pin. Address: Read: Write: Reset: $001C Bit 7 6 5 4 3 2 1 Bit 0 KBIE7 KBIE6 KBIE5 KBIE4 KBIE3 KBIE2 KBIE1 KBIE0 0 0 0 0 0 0 0 0 Figure 19-4.
Keyboard Interrupt Module (KBI) 19.9 Stop Mode The keyboard interrupt module remains active in stop mode. Clearing the IMASKK bit in the keyboard status and control register enables keyboard interrupt requests to bring the MCU out of stop mode. 19.10 Keyboard Module During Break Interrupts The system integration module (SIM) controls whether the keyboard interrupt latch can be cleared during the break state.
Technical Data — MC68HC908LJ12 Section 20. Computer Operating Properly (COP) 20.1 Contents 20.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 20.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372 20.4 I/O Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 20.4.1 ICLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 20.4.2 STOP Instruction .
Computer Operating Properly (COP) 20.3 Functional Description Figure 20-1 shows the structure of the COP module. RESET STATUS REGISTER COP TIMEOUT CLEAR STAGES 5–12 STOP INSTRUCTION INTERNAL RESET SOURCES RESET VECTOR FETCH RESET CIRCUIT 12-BIT COP PRESCALER CLEAR ALL STAGES ICLK COPCTL WRITE COP CLOCK 6-BIT COP COUNTER COPEN (FROM SIM) COP DISABLE (COPD FROM CONFIG1) RESET COPCTL WRITE CLEAR COP COUNTER COP RATE SEL (COPRS FROM CONFIG1) Figure 20-1.
Computer Operating Properly (COP) A COP reset pulls the RST pin low for 32 ICLK cycles and sets the COP bit in the SIM reset status register (SRSR). In monitor mode, the COP is disabled if the RST pin or the IRQ1 is held at VTST. During the break state, VTST on the RST pin disables the COP. NOTE: Place COP clearing instructions in the main program and not in an interrupt subroutine.
Computer Operating Properly (COP) 20.4.5 Internal Reset An internal reset clears the COP prescaler and the COP counter. 20.4.6 Reset Vector Fetch A reset vector fetch occurs when the vector address appears on the data bus. A reset vector fetch clears the COP prescaler. 20.4.7 COPD (COP Disable) The COPD signal reflects the state of the COP disable bit (COPD) in the CONFIG1 register. (See Figure 20-2 and Section 5. Configuration Registers (CONFIG).) 20.4.
Computer Operating Properly (COP) 20.5 COP Control Register The COP control register is located at address $FFFF and overlaps the reset vector. Writing any value to $FFFF clears the COP counter and starts a new timeout period. Reading location $FFFF returns the low byte of the reset vector. Address: $FFFF Bit 7 6 5 4 3 Read: Low byte of reset vector Write: Clear COP counter Reset: Unaffected by reset 2 1 Bit 0 Figure 20-3. COP Control Register (COPCTL) 20.
Computer Operating Properly (COP) 20.8.1 Wait Mode The COP remains active during wait mode. To prevent a COP reset during wait mode, periodically clear the COP counter in a CPU interrupt routine. 20.8.2 Stop Mode Stop mode turns off the ICLK input to the COP and clears the COP prescaler. Service the COP immediately before entering or after exiting stop mode to ensure a full COP timeout period after entering or exiting stop mode.
Technical Data — MC68HC908LJ12 Section 21. Low-Voltage Inhibit (LVI) 21.1 Contents 21.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 21.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 21.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .378 21.4.1 Interrupt LVI Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 21.4.2 Forced Reset Operation . . . . . .
Low-Voltage Inhibit (LVI) Addr. Register Name Bit 7 6 Read: LVIOUT Low-Voltage Inhibit Status $FE0F Register Write: (LVISR) Reset: 0 LVIIE 5 4 3 2 1 Bit 0 LVIIF 0 0 0 0 0 0 0 0 0 LVIIAK 0 0 0 = Unimplemented Figure 21-1. LVI I/O Register Summary 21.4 Functional Description Figure 21-2 shows the structure of the LVI module.
Low-Voltage Inhibit (LVI) The LVI trip point selection bits, LVISEL[1:0], select the trip point voltage, VTRIPF, to be configured for 5V or 3.3V operation. The actual trip points are shown in Section 23. Electrical Specifications. Setting LVI interrupt enable bit, LVIIE, enables LVI interrupts whenever the LVIOUT bit toggles (from logic 0 to logic 1, or from logic 1 to logic 0). NOTE: After a power-on reset (POR) the user must configure the LVISEL[1:0} bits for 3.
Low-Voltage Inhibit (LVI) 21.4.1 Interrupt LVI Operation In applications that can operate at VDD levels below the VTRIPF level, software can monitor VDD by polling the LVIOUT bit, or by setting the LVI interrupt enable bit, LVIIE, to enable interrupt requests. In the configuration register 1 (CONFIG1), the LVIPWRD bit must be at logic 0 to enable the LVI module, and the LVIRSTD bit must be at logic 1 to disable LVI resets.
Low-Voltage Inhibit (LVI) 21.4.4 LVI Trip Selection The trip point selection bits, LVISEL[1:0], in the CONFIG2 register select whether the LVI is configured for 5V or 3.3 V operation. (See Section 5. Configuration Registers (CONFIG).) NOTE: The MCU is guaranteed to operate at a minimum supply voltage. The trip point (VTRIPF [5 V] or VTRIPF [3.3 V]) may be lower than this. (See Section 23. Electrical Specifications for the actual trip point voltages.) 21.
Low-Voltage Inhibit (LVI) LVIIE — LVI Interrupt Enable Bit This read/write bit enables the LVIIF bit to generate CPU interrupt requests. Reset clears the LVIIE bit. 1 = LVIIF can generate CPU interrupt requests 0 = LVIIF cannot generate CPU interrupt requests LVIIF — LVI Interrupt Flag This clearable, read-only flag is set whenever the LVIOUT bit toggles. Reset clears the LVIIF bit.
Technical Data — MC68HC908LJ12 Section 22. Break Module (BRK) 22.1 Contents 22.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 22.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 22.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384 22.4.1 Flag Protection During Break Interrupts . . . . . . . . . . . . . . . 386 22.4.2 CPU During Break Interrupts . . . . . . . . . . . .
Break Module (BRK) 22.3 Features Features of the break module include: • Accessible input/output (I/O) registers during the break interrupt • CPU-generated break interrupts • Software-generated break interrupts • COP disabling during break interrupts 22.4 Functional Description When the internal address bus matches the value written in the break address registers, the break module issues a breakpoint signal to the CPU.
Break Module (BRK) IAB15–IAB8 BREAK ADDRESS REGISTER HIGH 8-BIT COMPARATOR IAB15–IAB0 BREAK CONTROL 8-BIT COMPARATOR BREAK ADDRESS REGISTER LOW IAB7–IAB0 Figure 22-1. Break Module Block Diagram Addr.
Break Module (BRK) 22.4.1 Flag Protection During Break Interrupts The BCFE bit in the SIM break flag control register (SBFCR) enables software to clear status bits during the break state. 22.4.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 begins after completion of the CPU instruction in progress.
Break Module (BRK) 22.5.2 Stop Mode A break interrupt causes exit from stop mode and sets the SBSW bit in the break status register. 22.6 Break Module Registers These registers control and monitor operation of the break module: • Break status and control register (BRKSCR) • Break address register high (BRKH) • Break address register low (BRKL) • SIM break status register (SBSR) • SIM break flag control register (SBFCR) 22.6.
Break Module (BRK) BRKA — Break Active Bit This read/write status and control bit is set when a break address match occurs. Writing a logic 1 to BRKA generates a break interrupt. Clear BRKA by writing a logic 0 to it before exiting the break routine. Reset clears the BRKA bit. 1 = (When read) Break address match 0 = (When read) No break address match 22.6.2 Break Address Registers The break address registers (BRKH and BRKL) contain the high and low bytes of the desired breakpoint address.
Break Module (BRK) Address: Read: Write: $FE00 Bit 7 6 5 4 3 2 R R R R R R Reset: 1 SBSW Note Bit 0 R 0 Note: Writing a logic 0 clears SBSW. R = Reserved Figure 22-6. SIM Break Status Register (SBSR) SBSW — Break Wait Bit This status bit is set when a break interrupt causes an exit from wait mode or stop mode. Clear SBSW by writing a logic 0 to it. Reset clears SBSW.
Break Module (BRK) 22.6.4 SIM Break Flag Control Register The SIM break flag control register (SBFCR) contains a bit that enables software to clear status bits while the MCU is in a break state. Address: Read: Write: Reset: $FE03 Bit 7 6 5 4 3 2 1 Bit 0 BCFE R R R R R R R 0 R = Reserved Figure 22-7.
Technical Data — MC68HC908LJ12 Section 23. Electrical Specifications 23.1 Contents 23.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 23.3 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . 392 23.4 Functional Operating Range. . . . . . . . . . . . . . . . . . . . . . . . . . 393 23.5 Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 23.6 5.0V DC Electrical Characteristics . . . . . . .
Electrical Specifications 23.2 Introduction This section contains electrical and timing specifications. 23.3 Absolute Maximum Ratings Maximum ratings are the extreme limits to which the MCU can be exposed without permanently damaging it. NOTE: This device is not guaranteed to operate properly at the maximum ratings. Refer to 23.6 5.0V DC Electrical Characteristics for guaranteed operating conditions. Table 23-1. Absolute Maximum Ratings(1) Characteristic Symbol Value Unit Supply voltage VDD –0.
Electrical Specifications 23.4 Functional Operating Range Table 23-2. Operating Range Characteristic Operating temperature range Operating voltage range Symbol Value Unit TA – 40 to +85 °C VDD 3.3V ± 10% 5.0V ± 10% V 23.5 Thermal Characteristics Table 23-3.
Electrical Specifications 23.6 5.0V DC Electrical Characteristics Table 23-4. 5.0V DC Electrical Characteristics Characteristic(1) Symbol Min Typ(2) Max Unit Output high voltage (ILOAD = –2.0 mA) All ports VOH VDD –0.8 — — V Output low voltage (ILOAD = 1.6mA) All ports (ILOAD = 8.0 mA) PTB2–PTB5 (ILOAD = 15.0 mA) PTB0/TxD–PTB1 VOL — — 0.4 V Input high voltage All ports, RST, IRQ, OSC1 VIH 0.7 × VDD — VDD V Input low voltage All ports, RST, IRQ, OSC1 VIL VSS — 0.
Electrical Specifications Notes: 1. VDD = 4.5 to 5.5 Vdc, VSS = 0 Vdc, TA = TL to TH, unless otherwise noted. 2. Typical values reflect average measurements at midpoint of voltage range, 25 °C only. 3. Run (operating) IDD measured using external square wave clock source. All inputs 0.2 V from rail. No dc loads. Less than 100 pF on all outputs. CL = 20 pF on OSC2. All ports configured as inputs. OSC2 capacitance linearly affects run IDD. 4. Wait IDD measured using external square wave clock source.
Electrical Specifications 23.7 3.3V DC Electrical Characteristics Table 23-5. 3.3V DC Electrical Characteristics Characteristic(1) Symbol Min Typ(2) Max Unit Output high voltage (ILOAD = –1.0 mA) All ports VOH VDD –0.4 — — V Output low voltage (ILOAD = 0.8mA) All ports (ILOAD = 4.0 mA) PTB2–PTB5 (ILOAD = 10.0 mA) PTB0/TxD–PTB1 VOL — — 0.4 V Input high voltage All ports, RST, IRQ, OSC1 VIH 0.7 × VDD — VDD V Input low voltage All ports, RST, IRQ, OSC1 VIL VSS — 0.
Electrical Specifications Notes: 1. VDD = 3.0 to 3.6 Vdc, VSS = 0 Vdc, TA = TL to TH, unless otherwise noted. 2. Typical values reflect average measurements at midpoint of voltage range, 25 °C only. 3. Run (operating) IDD measured using external square wave clock source. All inputs 0.2 V from rail. No dc loads. Less than 100 pF on all outputs. CL = 20 pF on OSC2. All ports configured as inputs. OSC2 capacitance linearly affects run IDD. 4. Wait IDD measured using external square wave clock source.
Electrical Specifications 23.10 5.0V Oscillator Characteristics Table 23-8. 5.0V Oscillator Specifications Characteristic Symbol Min Typ Max Unit Internal oscillator clock frequency fICLK 46k 47k(1) 48k Hz External reference clock to OSC1(2) fOSC dc — 20M Hz Crystal reference frequency(3) fXCLK 32.768k 4.
Electrical Specifications 23.12 5.0V ADC Electrical Characteristics Table 23-10. ADC 5.0V Electrical Characteristics Characteristic Symbol Min Max Unit Supply voltage VDDA 4.5 5.5 V VDDA is an dedicated pin and should be tied to VDD on the PCB with proper decoupling. Input range VADIN 0 VDDA V VADIN ≤ VDDA Resolution BAD 10 10 bits Absolute accuracy AAD — ± 1.
Electrical Specifications 23.13 3.3V ADC Electrical Characteristics Table 23-11. ADC 3.3V Electrical Characteristics Characteristic Symbol Min Max Unit Supply voltage VDDA 3.0 3.6 V VDDA is an dedicated pin and should be tied to VDD on the PCB with proper decoupling. Input range VADIN 0 VDDA V VADIN ≤ VDDA Resolution BAD 10 10 bits Absolute accuracy AAD — ± 1.
Electrical Specifications 23.14 Timer Interface Module Characteristics Characteristic Input capture pulse width Symbol Min Max Unit tTIH, tTIL 1 — tCYC 23.15 CGM Electrical Specifications Characteristic Symbol Min Typ Max Unit Reference frequency fRDV 30 32.768 100 kHz Range nominal multiplies fNOM — 38.4 — kHz VCO center-of-range frequency fVRS 38.4k — 40.
Electrical Specifications 23.16 5.
Electrical Specifications 23.17 3.
Electrical Specifications SS INPUT SS PIN OF MASTER HELD HIGH 1 SPSCK OUTPUT CPOL = 0 NOTE SPSCK OUTPUT CPOL = 1 NOTE 5 4 5 4 6 MISO INPUT MSB IN BITS 6–1 11 MOSI OUTPUT MASTER MSB OUT 7 LSB IN 10 11 BITS 6–1 MASTER LSB OUT Note: This first clock edge is generated internally, but is not seen at the SPSCK pin.
Electrical Specifications SS INPUT 3 1 SPSCK INPUT CPOL = 0 5 4 2 SPSCK INPUT CPOL = 1 5 4 9 8 MISO INPUT SLAVE MSB OUT 6 MOSI OUTPUT BITS 6–1 7 NOTE 11 11 10 MSB IN SLAVE LSB OUT BITS 6–1 LSB IN Note: Not defined but normally MSB of character just received a) SPI Slave Timing (CPHA = 0) SS INPUT 1 SPSCK INPUT CPOL = 0 5 4 2 3 SPSCK INPUT CPOL = 1 8 MISO OUTPUT 5 4 10 NOTE MOSI INPUT 9 SLAVE MSB OUT 6 7 BITS 6–1 11 10 MSB IN SLAVE LSB OUT BITS 6–1 LSB IN Note: Not defin
Electrical Specifications 23.18 FLASH Memory Characteristics Table 23-12. FLASH Memory Electrical Characteristics Characteristic Data retention voltage Symbol Min. Max. Unit VRDR 1.
Technical Data — MC68HC908LJ12 Section 24. Mechanical Specifications 24.1 Contents 24.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 24.3 52-Pin Low-Profile Quad Flat Pack (LQFP) . . . . . . . . . . . . . . 408 24.4 64-Pin Low-Profile Quad Flat Pack (LQFP) . . . . . . . . . . . . . . 409 24.5 64-Pin Quad Flat Pack (QFP). . . . . . . . . . . . . . . . . . . . . . . . . 410 24.
Mechanical Specifications 24.3 52-Pin Low-Profile Quad Flat Pack (LQFP) 4X 4X 13 TIPS 0.20 (0.008) H L–M N 0.20 (0.008) T L–M N –X– X=L, M, N 52 40 1 CL 39 AB 3X G VIEW Y –L– –M– AB B B1 13 V VIEW Y BASE METAL F PLATING V1 27 14 J 26 U –N– A1 0.13 (0.005) M D T L–M S N S S1 SECTION AB–AB A ROTATED 90° CLOCKWISE S 4X C θ2 0.10 (0.004) T –H– –T– SEATING PLANE 4X θ3 VIEW AA 0.05 (0.002) S W θ1 C2 2X R θ R1 0.25 (0.010) GAGE PLANE K C1 E VIEW AA Z NOTES: 1.
Mechanical Specifications 24.4 64-Pin Low-Profile Quad Flat Pack (LQFP) 4X 4X 16 TIPS 0.2 H A–B D 0.2 C A–B D A2 0.05 S 49 64 (S) 1 48 θ1 A 0.25 B θ E E1 E1/2 VIEW Y 16 E/2 VIEW AA NOTES: 1. DIMENSIONS AND TOLERANCING PER ANSI Y14.5M, 1982. 2. CONTROLLING DIMENSION: MILLIMETER. 3. DATUM PLANE DATUM H IS LOCATED AT BOTTOM OF LEAD AND IS COINCIDENT WITH THE LEAD WHERE THE LEAD EXITS THE PLASTIC BODY AT THE BOTTOM OF THE PARTING LINE. 4.
Mechanical Specifications 24.5 64-Pin Quad Flat Pack (QFP) L 48 33 DETAIL A S D S H A–B V 0.20 (0.008) M B P B M L B 0.20 (0.008) –B– C A–B –A– 0.05 (0.002) A–B S D 32 S 49 –A–, –B–, –D– DETAIL A 64 17 F 1 16 –D– A 0.20 (0.008) C A–B S D S 0.05 (0.002) A–B S 0.20 (0.008) M H A–B S D S M J N E M C M H 0.02 (0.008) DATUM PLANE M C A–B S D S SECTION B–B 0.01 (0.
Technical Data — MC68HC908LJ12 Section 25. Ordering Information 25.1 Contents 25.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 25.3 MC Order Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 25.2 Introduction This section contains ordering numbers for the MC68HC908LJ12. 25.3 MC Order Numbers Table 25-1.
Ordering Information Technical Data 412 MC68HC908LJ12 — Rev. 2.
How to Reach Us: Home Page: www.freescale.com RoHS-compliant and/or Pb- free versions of Freescale products have the functionality and electrical characteristics of their non-RoHS-compliant and/or non-Pb- free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. E-mail: support@freescale.com For information on Freescale.s Environmental Products program, go to http://www.freescale.com/epp.