Page 1
MC9S08QE128 MC9S08QE96 MC9S08QE64 Reference Manual Related Documentation: HCS08 Microcontrollers • MC9S08QE128 (Data Sheet) Contains pin assignments and diagrams, all electrical specifications, and mechanical drawing outlines. Find the most current versions of all documents at: http://www.freescale.com MC9S08QE128RM Rev. 2 6/2007 freescale.com...
Page 3
MC9S08QE128 Series Features 8-Bit HCS08 Central Processor Unit (CPU) Development Support • Up to 50.33-MHz HCS08 CPU from 3.6 V to 2.1 V, and • Single-wire background debug interface 20-MHz CPU at 2.1 V to 1.8 V across temperature range •...
Revision History 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.
Page 7
Serial Communications Interface (S08SCIV4)......247 Chapter 15 Serial Peripheral Interface (S08SPIV3) ........267 Chapter 16 Timer/Pulse-Width Modulator (S08TPMV3) ......... 283 Chapter 17 Development Support ..............307 Chapter 18 Debug Module (DBG) (128K)............321 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
5.8.8 System Power Management Status and Control 2 Register (SPMSC2) ......105 5.8.9 System Power Management Status and Control 3 Register (SPMSC3) ......106 5.8.10 System Clock Gating Control 1 Register (SCGC1) ............107 5.8.11 System Clock Gating Control 2 Register (SCGC2) ............108 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 1 Device Overview The MC9S08QE128, MC9S08QE96, and MC9S08QE64 are members of the low-cost, low-power, high-performance HCS08 Family of 8-bit microcontroller units (MCUs). All MCUs in the family use the enhanced HCS08 core and are available with a variety of modules, memory sizes, memory types, and package types.
Chapter 1 Device Overview MCU Block Diagram The block diagram in Figure 1-1 shows the structure of the MC9S08QE128 Series MCU. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
V in 48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 1-1. MC9S08QE128 Series Block Diagram MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
TPMxCLK — TPMxCLKs are optional external clock sources for the TPM modules. The TPMxCLK must be limited to 1/4th the frequency of the bus clock for synchronization. See the External TPM Clock Sources section in Chapter 16, “Timer/Pulse-Width Modulator (S08TPMV3) for more details. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
EXTAL XTAL of the bus clock frequency. See the ADC chapter and erase operation. See and data sheet for the data sheet for details. details. Figure 1-2. System Clock Distribution Diagram MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This section describes signals that connect to package pins. It includes pinout diagrams, recommended system connections, and detailed discussions of signals. Device Pin Assignment This section shows the pin assignments for MC9S08QE128 Series devices in the available packages. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 2 Pins and Connections Recommended System Connections Figure 2-6 shows pin connections that are common to MC9S08QE128 Series application systems. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
PTG5/ADP21 PTH5 recommended for PTG6/ADP22 PTH6/SCL2 noisy environments. 4. C , and R PTG7/ADP23 PTH7/SDA2 are not required when low range low power oscillator is selected. Figure 2-6. Basic System Connections MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0.1-μF ceramic bypass capacitor located as near to the MCU power pins as practical to suppress high-frequency noise. Actual decoupling capacitor values and number will vary according to layout and application. The MC9S08QE128 Series has two V pins except on the 32-pin package.
BDC clock could be as fast as the bus clock rate, so there should never be any significant capacitance connected to the BKGD/MS pin that could interfere with background serial communications. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
2.2.6 General-Purpose I/O and Peripheral Ports The MC9S08QE128 Series of MCUs support up to 70 general-purpose I/O pins 1 input-only pin, and 1 output-only pin, which are shared with on-chip peripheral functions (timers, serial I/O, ADC, ACMP, etc.). When a port pin is configured as a general-purpose output or a peripheral uses the port pin as an output, software can select one of two drive strengths and enable or disable slew rate control.
Page 37
SPI1 pins (SS1, MISO1, MOSI1, and SPSCK1) can be repositioned using SPI1PS in SOPT2. Default locations are PTB5, PTB4, PTB3, and PTB2. If ADC and ACMP1 are enabled, both modules will have access to the pin. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
— Stop2 — Partial power down of internal circuits, RAM content is retained; I/O states are held Run Mode This is the normal operating mode for the MC9S08QE128 Series. In this mode, the CPU executes code from internal memory with execution beginning at the address fetched from memory at 0xFFFE–0xFFFF after reset.
If a device is in low power wait mode, a falling edge on an active BKGD/MS pin exits low power wait mode, clears the LPR and LPRS bits, and returns the device to normal run mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 40
The active background mode is used to program a bootloader or user application program into the flash program memory before the MCU is operated in run mode for the first time. When the MC9S08QE128 Series is shipped from the Freescale Semiconductor factory, the flash program memory is erased by default unless specifically noted, so there is no program that could be executed in run mode until the flash memory...
In stop2 the regulator is in partial powerdown. The ICS module can be configured to leave the reference clocks running. See Chapter 11, “Internal Clock Source (S08ICSV3)” for more information. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
MCU is in stop2. The pullup on this pin is not automatically enabled in stop2. To enable the internal pullup, set the PTAPE5 bit in the port A pull enable register (PTAPE). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 43
Stop3 mode is entered by executing a STOP instruction under the conditions as shown in Table 3-1. The states of all of the internal registers and logic, RAM contents, and I/O pin states are maintained. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Mode Selection Several control signals are used to determine the current operating mode of the device. Table 3-2 shows the conditions for each of the device’s operating modes. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Table 3-2. Power Mode Selections BDCSCR SPMSC1 SPMSC2 Effects on Sub-System Mode of Operation CPU & Periph CLKs Voltage ENBDM LVDE LVDSE PPDC BDM Clock Regulator RUN mode on. ICS in any mode. LPRUN mode low freq required. ICS in standby FBELP mode only.
Page 46
Standby STOP2 Partial power off WAIT LPWAIT Figure 3-1. Allowable Power Mode Transitions for the MC9S08QE128 Series Figure 3-1 illustrates mode state transitions allowed between the legal states shown in Table 3-1. PTA5/IRQ/TPM1CLK/RESET must be asserted low (or an RTC interrupt must occur) in order to exit stop2.
Page 47
Standby Optionally On Optionally On Wake Up Optionally On Optionally On Optionally On KBIx Optionally On Optionally On Optionally On LVD/LVW Optionally On Optionally On Optionally On Optionally On Optionally On MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If LVDSE is set when entering LPRun or LPWait, the MCU will actually enter run or wait mode, respectively. Requires the LVD to be enabled, else in standby. See Section 3.6.4, “LVD Enabled in Stop Mode”. ERCLKEN and EREFSTEN set in ICSC2, else in standby. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 49
Chapter 3 Modes of Operation MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
4-1, Figure 4-2, and Figure 4-3, on-chip memory in the MC9S08QE128 Series of MCUs consists of RAM, flash program memory for nonvolatile data storage, and I/O and control/status registers. The registers are divided into three groups: • Direct-page registers (0x0000 through 0x007F) •...
4-1, Figure 4-2, and Figure 4-3, on-chip memory in the MC9S08QE128 Series of MCUs consists of RAM, flash program memory for nonvolatile data storage, and I/O and control/status registers. The registers are divided into three groups: • Direct-page registers (0x0000 through 0x007F) •...
Page 52
Paging Window - PPAGE=0 Extended addresses formed FLASH with PPAGE and 16384 BYTES A13:A0 of CPU address 0xBFFF 0x0BFFF 0xC000 0x0C000 PPAGE=3 FLASH 16384 BYTES 0xFFFF 0x0FFFF Figure 4-2. MC9S08QE96 Memory Map MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Reset and Interrupt Vector Assignments Table 4-1 shows address assignments for reset and interrupt vectors. The vector names shown in this table are the labels used in the Freescale Semiconductor provided equate file for the MC9S08QE128 Series. Table 4-1. Reset and Interrupt Vectors Address...
Page 54
KBI1 and KBI2 share this vector, if both modules are enabled user should poll each flag to determine pending interrupt. IIC1 and IIC2 share this vector, if both modules are enabled user should poll each flag to determine pending interrupt. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 4 Memory Register Addresses and Bit Assignments The registers in the MC9S08QE128 Series are divided into these groups: • Direct-page registers are located in the first 128 locations in the memory map; these are accessible with efficient direct addressing mode instructions.
Page 62
1. IFR — Nonvolatile information memory that can be only accessed during production test. During production test, system initialization, configuration and test information is stored in the IFR. This information cannot be read or modified in normal user or background debug modes. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
— supports word accesses to any address specified by the linear address pointer when using LDHX, STHX instructions 4.4.2 Register Definition from 64 basic, to 128K in MC9S08QE128 4.4.2.1 Program Page Register (PPAGE) The HCS08 Core architecture limits the CPU addressable space available to 64K bytes. The address space can be extended to 128K bytes using a paging window scheme.
Page 64
When LWP is accessed the contents of LAP2:LAP0 make up the extended address of the flash memory location to be addressed. When accessing data using LWP, the contents of LAP2:LAP0 will increment after the read or write is complete. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 65
LAP2:LAP0. Writes to this register will first write the data value to the memory location specified by the linear address pointer and then will increment LAP2:LAP0. Writes to this register are most commonly used when writing to the flash block(s) during programming. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(PPAGE) allows for integrating up to 4M byte of flash into the system by selecting one of the 16K byte blocks to be accessed through the paging window located at 0x8000-0xBFFF. The MMU module also provides a linear address pointer that allows extension of data access up to 4M bytes. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 67
Resumes execution at the return address This sequence is not interruptible; there is no need to inhibit interrupts during RTC execution. An RTC can be executed from any address in memory. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 68
MMU to add that value to the existing value in LAP2:LAP0. 4.4.3.1.4 PPAGE and Linear Address Pointer to Extended Address Figure 4-1, on how the program PPAGE memory pages and the Linear Address Pointer are mapped to extended address space. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
For compatibility with M68HC05 MCUs, the HCS08 resets the stack pointer to 0x00FF. In the MC9S08QE128 Series, it is usually best to reinitialize the stack pointer to the top of the RAM so the direct page RAM can be used for frequently accessed RAM variables and bit-addressable program variables.
Features of the flash memory include: • Flash size — MC9S08QE128: 131,072 bytes (256 pages of 512 bytes each) — MC9S08QE96: 98,304 bytes (192 pages of 512 bytes each) — MC9S08QE64: 65,536 bytes (128 pages of 512 bytes each) •...
Page 71
Flash Options Register (FOPT and NVOPT) The FOPT register holds all bits associated with the security of the MCU and flash module. KEYEN Reset = Unimplemented or Reserved Figure 4-11. Flash Options Register (FOPT) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 72
Security”. 4.6.2.3 Flash Configuration Register (FCNFG) The FCNFG register enables the flash interrupts and gates the security backdoor writes. KEYACC Reset = Unimplemented or Reserved Figure 4-12. Flash Configuration Register (FCNFG) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 73
Flash Protection Size — With FPOPEN set, the FPS bits determine the size of the protected flash address FPS[6:0] range as shown in Table 4-18. Flash Protection Open FPOPEN 0 Flash array fully protected. 1 Flash array protected address range determined by FPS bits. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 75
FPVIOL flag has no effect on FPVIOL. The FPVIOL flag is cleared by writing a 1 to FPVIOL. While FPVIOL is set, it is not possible to launch a command or start a command write sequence. 0 No protection violation detected. 1 Protection violation has occurred. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 76
FACCERR flag in the FSTAT register. Table 4-21. Valid Flash Command List FCMD[6:0] NVM Command 0x05 Erase Verify 0x20 Program 0x25 Burst Program 0x40 Sector Erase 0x41 Mass Erase MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
FCLK < 150 kHz can destroy the flash memory due to overstress. Setting FCDIV to a value such that FCLK > 200 kHz can result in incomplete programming or erasure of the flash memory cells. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 78
A flash block address must be in the erased state before being programmed. Cumulative programming of bits within a flash block address is not allowed except for status field updates required in EEPROM emulation applications. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 79
FBLANK flag in the FSTAT register will be set if all addresses in the flash array memory are verified to be erased. If any address in the flash array memory is not erased, the erase verify operation will terminate and the FBLANK flag in the FSTAT register will remain clear. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 80
1. Write to a flash block address to start the command write sequence for the program command. The data written will be programmed to the address written. 2. Write the program command, 0x20, to the FCMD register. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 81
first burst programming command is still in progress. This pipelined operation allows a time MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 82
FCBEF flag in the FSTAT register has been set, greater than 50% faster programming time for the entire flash array can be effectively achieved when compared to using the basic program command. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 83
Figure 4-18. Example Burst Program Command Flow 4.6.3.2.4 Sector Erase Command The sector erase operation will erase all addresses in a 1 Kbyte sector of flash memory using an embedded algorithm. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 85
flash array. If the FPVIOL flag is set in the FSTAT register, the user must clear the FPVIOL flag before starting another command write sequence (see Section 4.6.2.5, “Flash Status Register (FSTAT)”). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
4.6.5 Flash Module Security The MC9S08QE128 Series includes circuitry to prevent unauthorized access to the contents of flash and RAM memory. When security is engaged, flash and RAM are considered secure resources. Direct-page registers, high-page registers, and the background debug controller are considered unsecured resources.
Page 87
The stored backdoor keys are unaffected by the backdoor key access sequence. After the next reset of the MCU, the security state of the flash module is determined by the flash security byte. The MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If a reset occurs while any flash command is in progress, that command will be immediately aborted. The state of the flash array address being programmed or the sector/block being erased is not guaranteed. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This section discusses basic reset and interrupt mechanisms and the various sources of reset and interrupt in the MC9S08QE128 Series. Some interrupt sources from peripheral modules are discussed in greater detail within other sections of this reference manual. This section gathers basic information about all reset and interrupt sources in one place for easy reference.
When the bus clock source is selected, the COP counter does not increment while the system is in stop mode. The COP counter resumes as soon as the MCU exits stop mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
It is good programming practice to push H onto the stack at the start of the interrupt service routine (ISR) and restore it immediately before the RTI that is used to return from the ISR. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
When the MCU is in stop mode and system clocks are shut down, a separate asynchronous path is used so the IRQ pin (if enabled) can wake the MCU. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Higher-priority sources are located toward the bottom of the table. The high-order byte of the address for the interrupt service routine is located at the MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 94
CCR) is 0, the CPU will finish the current instruction; stack the PCL, PCH, X, A, and CCR CPU registers; set the I bit; and then fetch the interrupt vector for the highest priority pending interrupt. Processing then continues in the interrupt service routine. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 95
KBI1 and KBI2 share this vector, if both modules are enabled user should poll each flag to determine pending interrupt. IIC1 and IIC2 share this vector, if both modules are enabled user should poll each flag to determine pending interrupt. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
LVWV in SPMSC3. Peripheral Clock Gating The MC9S08QE128 Series includes a clock gating system to manage the bus clock sources to the individual peripherals. Using this system, the user can enable or disable the bus clock to each of the peripherals at the clock source, eliminating unnecessary clocks to peripherals which are not in use and thereby reducing the overall run and wait mode currents.
Page 97
When clocks are re-enabled to a peripheral, the peripheral registers need to be re-initialized by user software. In stop modes, the bus clock is disabled for all gated peripherals, regardless of the settings in SCGC1 and SCGC2. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 IRQ pin function is disabled. 1 IRQ pin function is enabled. IRQ Flag — This read-only status bit indicates when an interrupt request event has occurred. IRQF 0 No IRQ request. 1 IRQ event detected. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Any of these reset sources that are active at the time of reset entry will cause the corresponding bit(s) to be set; bits corresponding to sources that are not active at the time of reset entry will be cleared. Figure 5-3. System Reset Status (SRS) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Reads always return 0x00. BDFR Reset: = Unimplemented or Reserved BDFR is writable only through serial background debug commands, not from user programs. Figure 5-4. System Background Debug Force Reset Register (SBDFR) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
When clear, the pin functions as one of its alternative functions. This pin defaults to its I/O port function following an MCU POR. 0 PTC4/TPM3CH4/RSTO pin functions as PTC4 or TPM3CH4. 1 PTC4/TPM3CH4/RSTO pin functions as RSTO. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 PTA5/IRQ/TCLK/RESET pin functions as PTA5, IRQ or TCLK. 1 PTA5/IRQ/TCLK/RESET pin functions as RESET. 5.8.5 System Options Register 2 (SOPT2) This high page register contains bits to configure MCU specific features on the MC9S08QE128 Series devices. COPCLKS SPI1PS ACIC2...
Bits 7:4 are reserved. Reading these bits will result in an indeterminate value; writes have no effect. Reserved Part Identification Number — Each derivative in the HCS08 Family has a unique identification number. The ID[11:8] MC9S08QE128 is hard coded to the value 0x015. See also ID bits in Table 5-9. Reset: = Unimplemented or Reserved Figure 5-8.
Field Description Part Identification Number — Each derivative in the HCS08 Family has a unique identification number. The ID[7:0] MC9S08QE128 is hard coded to the value 0x015. See also ID bits in Table 5-8. 5.8.7 System Power Management Status and Control 1 Register...
Low Power Wake Up on Interrupt — This bit controls whether or not the voltage regulator exits standby when LPWUI any active MCU interrupt occurs. 0 The voltage regulator will remain in standby on an interrupt. 1 The voltage regulator will exit standby on an interrupt. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Low-Voltage Warning Acknowledge — The LVWF bit indicates the low voltage warning status. Writing a 1 to LVWACK LVWACK clears LVWF to a 0 if a low voltage warning is not present. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
When clocks are re-enabled to a peripheral, the peripheral registers need to be re-initialized by user software. TPM3 TPM2 TPM1 IIC2 IIC1 SCI2 SCI1 Reset: Figure 5-12. System Clock Gating Control 1 Register (SCGC1) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
When clocks are re-enabled to a peripheral, the peripheral registers need to be re-initialized by user software. ACMP SPI2 SPI1 Reset: = Unimplemented or Reserved Figure 5-13. System Clock Gating Control 2 Register (SCGC2) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 109
SPI1 Clock Gate Control — This bit controls the clock gate to the SPI1 module. SPI1 0 Bus clock to the SPI1 module is disabled. 1 Bus clock to the SPI1 module is enabled. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 110
Chapter 5 Resets, Interrupts, and General System Control MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Parallel Input/Output Control This section explains software controls related to parallel input/output (I/O) and pin control. The MC9S08QE128 has nine parallel I/O ports which include a total of 70 I/O pins and one output-only pin. Chapter 2, “Pins and Connections,” for more information about pin assignments and external hardware considerations of these pins.
An output pin can be selected to have high output drive strength by setting the corresponding bit in the drive strength select register (PTxDSn). When high drive is selected, a pin is capable of sourcing and MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Output Enable SET_Enable CLR_Enable TOGGLE_Enable PTxDn Module_Enable Output Data DATA Port Read Data Synchronizer Input Data BUSCLK Figure 6-2. Parallel I/O Block Diagram Equipped with SET/CLR Functionality: Ports C & E MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This section refers to registers and control bits only by their names. A Freescale Semiconductor-provided equate or header file normally is used to translate these names into the appropriate absolute addresses. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
PTADD[7:0] PTAD reads. 0 Input (output driver disabled) and reads return the pin value. 1 Output driver enabled for port A bit n and PTAD reads return the contents of PTADn. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 116
PTA pin. For port A pins that are configured as inputs, these bits have no effect. 0 Output slew rate control disabled for port A bit n. 1 Output slew rate control enabled for port A bit n. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port A bit n. 1 High output drive strength selected for port A bit n. 6.5.2 Port B Registers Port B is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 118
KBI. PTBPE7 PTBPE6 PTBPE5 PTBPE4 PTBPE3 PTBPE2 PTBPE1 PTBPE0 Reset: Figure 6-10. Internal Pull Enable for Port B Register (PTBPE) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port B bit n. 1 High output drive strength selected for port B bit n. 6.5.3 Port C Registers Port C is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 120
1 Output driver enabled for port C bit n and PTCD reads return the contents of PTCDn. 6.5.3.3 Port C Data Set Register (PTCSET) PTCSET7 PTCSET6 PTCSET5 PTCSET4 PTCSET3 PTCSET2 PTCSET1 PTCSET0 Reset: Figure 6-15. Port C Data Set Register (PTCSET) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 121
Toggle for Port C Bits — Writing any bit to one in this location will toggle the corresponding bit in the data PTCTOGn register. Writing a zero to any bit in this register has no effect. 0 Corresponding PTCDn maintains current value. 1 Corresponding PTCDn is inverted. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 122
PTC pin. For port C pins that are configured as inputs, these bits have no effect. 0 Output slew rate control disabled for port C bit n. 1 Output slew rate control enabled for port C bit n. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port C bit n. 1 High output drive strength selected for port C bit n. 6.5.4 Port D Registers Port D is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 124
KBI. PTDPE7 PTDPE6 PTDPE5 PTDPE4 PTDPE3 PTDPE2 PTDPE1 PTDPE0 Reset: Figure 6-23. Internal Pull Enable for Port D Register (PTDPE) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port D bit n. 1 High output drive strength selected for port D bit n. 6.5.5 Port E Registers Port E is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 126
1 Output driver enabled for port E bit n and PTED reads return the contents of PTEDn. 6.5.5.3 Port E Data Set Register (PTESET) PTESET7 PTESET6 PTESET5 PTESET4 PTESET3 PTESET2 PTESET1 PTESET0 Reset: Figure 6-28. Port E Data Set Register (PTESET) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 127
The port E enable register (PTEPE) enables pull-ups on the corresponding PTE pin. In some cases, a pull-down device will be enabled if pull-downs are supported by an alternative pin function, such as KBI. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 128
PTE pin. For port E pins that are configured as inputs, these bits have no effect. 0 Output slew rate control disabled for port E bit n. 1 Output slew rate control enabled for port E bit n. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port E bit n. 1 High output drive strength selected for port E bit n. 6.5.6 Port F Registers Port F is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 130
KBI. PTFPE7 PTFPE6 PTFPE5 PTFPE4 PTFPE3 PTFPE2 PTFPE1 PTFPE0 Reset: Figure 6-36. Internal Pull Enable for Port F Register (PTFPE) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port F bit n. 1 High output drive strength selected for port F bit n. 6.5.7 Port G Registers Port G is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 132
KBI. PTGPE7 PTGPE6 PTGPE5 PTGPE4 PTGPE3 PTGPE2 PTGPE1 PTGPE0 Reset: Figure 6-41. Internal Pull Enable for Port G Register (PTGPE) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port G bit n. 1 High output drive strength selected for port G bit n. 6.5.8 Port H Registers Port H is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 134
KBI. PTHPE7 PTHPE6 PTHPE5 PTHPE4 PTHPE3 PTHPE2 PTHPE1 PTHPE0 Reset: Figure 6-46. Internal Pull Enable for Port H Register (PTHPE) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Low output drive strength selected for port H bit n. 1 High output drive strength selected for port H bit n. 6.5.9 Port J Registers Port J is controlled by the registers listed below. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 137
PTJ pin. For port J pins that are configured as inputs, these bits have no effect. 0 Low output drive strength selected for port J bit n. 1 High output drive strength selected for port J bit n. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 138
Chapter 6 Parallel Input/Output Control MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Keyboard Interrupt (S08KBIV2) Introduction The keyboard interrupt (KBI) module provides up to eight independently enabled external interrupt sources. MC9S08QE128 Series devices contain two KBI modules, called KBI1 and KBI2. Each KBI module has up to eight interrupt sources. 7.1.1 KBI Clock Gating The bus clock to the KBI can be gated on and off using the KBI bit in SCGC2.
A falling edge is detected when an enabled port input signal is seen as a logic 1 (the deasserted level) during one bus cycle and then a logic 0 (the asserted level) during the next cycle. A rising MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
4. Enable the interrupt pins by setting the appropriate KBIPEn bits in KBIxPE. 5. Write to KBACK in KBIxSC to clear any false interrupts. 6. Set KBIE in KBIxSC to enable interrupts. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(BCD) operations • Efficient bit manipulation instructions • Fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions • STOP and WAIT instructions to invoke low-power operating modes MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
A or transferred to A where arithmetic and logical operations can then be performed. For compatibility with the earlier M68HC05 Family, H is forced to 0x00 during reset. Reset has no effect on the contents of X. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
For a more detailed explanation of how each instruction sets the CCR bits, refer to the HCS08 Family Reference Manual, volume 1, Freescale Semiconductor document order number HCS08RMv1. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 148
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. 0 No carry out of bit 7 1 Carry out of bit 7 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Intel is LITTLE ENDIAN BIG ENDIAN located in the next memory location after that. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This variation of indexed addressing uses the 16-bit value in the H:X index register pair plus a 16-bit offset included in the instruction as the address of the operand needed to complete the instruction. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
2. Set the I bit in the CCR. 3. Fetch the high-order half of the interrupt vector. 4. Fetch the low-order half of the interrupt vector. 5. Delay for one free bus cycle. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
CPU is in stop mode, CPU clocks will resume and the CPU will enter active background mode where other serial background commands can be processed. This ensures that a host development system can still gain access to a target MCU even if it is in stop mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1. The return value of the 8-bit PPAGE register is pulled from the stack. 2. The 16-bit return address is pulled from the stack and loaded into the PC. 3. The return PPAGE value is written to the PPAGE register. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 154
RTC. In this case, since RTC unstacks the PPAGE value as well as the return address, all accesses to the subroutine, even those made from the same page, must use CALL instructions. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Half carry, bit 4 Interrupt mask, bit 3 Negative indicator, bit 2 Zero indicator, bit 1 Carry/borrow, bit 0 (carry out of bit 7) CCR activity notation – Bit not affected MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 156
The assembler will calculate the 8-bit signed offset and include it in the object code for this instruction. Address modes Inherent (no operands) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 157
Arithmetic Shift Right – – ASR oprx8,X ASR ,X ASR oprx8,SP 9E67 BCC rel Branch if Carry Bit Clear Branch if (C) = 0 – – – – – – REL 24 rr MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 158
– – – – – – BPL rel Branch if Plus Branch if (N) = 0 2A rr – – – – – – BRA rel Branch Always No Test 20 rr MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 159
(A) – (M) CMP oprx16,X Compare Accumulator ee ff – – (CCR Updated But Operands Not CMP oprx8,X with Memory Changed) CMP ,X CMP oprx16,SP 9ED1 ee ff CMP oprx8,SP 9EE1 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 162
Store X (Low 8 Bits of ee ff M ← (X) 0 – – – STX oprx8,X Index Register) STX ,X in Memory STX oprx16,SP 9EDF ee ff STX oprx8,SP 9EEF MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 163
Transfer Index Reg. to SP Enable Interrupts; Wait I bit ← 0; Halt CPU – – 0 – – – WAIT for Interrupt Bus clock frequency is one-half of the CPU clock frequency. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 164
DIR to DIR IMM to DIR IX1+ Indexed, 1-Byte Offset with IX+D IX+ to DIR DIX+ DIR to IX+ Post Increment Opcode in HCS08 Cycles Hexadecimal Instruction Mnemonic Addressing Mode Number of Bytes MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 165
Post Increment Note: All Sheet 2 Opcodes are Preceded by the Page 2 Prebyte (9E) Prebyte (9E) and Opcode in 9E60 HCS08 Cycles Hexadecimal Instruction Mnemonic Addressing Mode Number of Bytes MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 166
Chapter 8 Central Processor Unit (S08CPUV4) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 9 Analog Comparator 3V (ACMPVLPV1) Introduction MC9S08QE128 Series MCUs have two independent analog comparators (ACMPs), named ACMP1 and ACMP2. The analog comparator module (ACMP) provides a circuit for comparing two analog input voltages or for comparing one analog input voltage to an internal reference voltage. The comparator circuit is designed to operate across the full range of the supply voltage (rail-to-rail operation).
ACMP1 and ACMP2 share a single interrupt vector. When interrupts are enabled for both ACMPs, the ACF bit in ACMP1SC and ACMP2SC must be polled to determine which ACMP caused the interrupt. See Section 4.2, “Reset and Interrupt Vector Assignments,” for the ACMP interrupt vector assignment. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 169
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 9-1. MC9S08QE128 Series Block Diagram Highlighting ACMP Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
ACMP in Active Background Mode When the microcontroller is in active background mode, the ACMP will continue to operate normally. 9.1.7 Block Diagram The block diagram for the Analog Comparator module is shown Figure 9-2. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Inverting analog input to the ACMP. (Minus input) ACMPx+ Non-inverting analog input to the ACMP. (Positive input) ACMPxO Digital output of the ACMP. Register Definition The ACMP includes one register: • An 8-bit status and control register MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
ACF can be set on a rising edge of the comparator output, a falling edge of the comparator output, or either a rising or a falling edge (toggle). The comparator output can be read directly through ACO. The comparator output can be driven onto the ACMPxO pin using ACOPE. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 174
Analog Comparator (S08ACMPV3) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The 12-bit analog-to-digital converter (ADC) is a successive approximation ADC designed for operation within an integrated microcontroller system-on-chip. Figure 10-1 shows the MC9S08QE128 Series with the ADC module and pins highlighted. NOTE Ignore any references to stop1 low-power mode in this chapter, because the MC9S08QE128 device does not support it.
Page 176
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 10-1. MC9S08QE128 Series Block Diagram Highlighting ADC Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 10 Analog-to-Digital Converter (S08ADC12V1) 10.1.2 Module Configurations This section provides device-specific information for configuring the ADC on the MC9S08QE128 Series. 10.1.2.1 Channel Assignments The ADC channel assignments for the MC9S08QE128 Series devices are shown in Table 10-1. Reserved channels convert to an unknown value.
Page 178
V the cold slope value is applied in Equation 10-1. If V TEMP25 TEMP TEMP25 TEMP less than V the hot slope value is applied in Equation 10-1. TEMP25 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Selectable asynchronous hardware conversion trigger. • Automatic compare with interrupt for less-than, or greater-than or equal-to, programmable value. 10.1.4 Block Diagram Figure 10-2 provides a block diagram of the ADC module MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The ADC module supports up to 28 separate analog inputs. It also requires four supply/reference/ground connections. Table 10-2. Signal Properties Name Function AD27–AD0 Analog Channel inputs High reference voltage REFH Low reference voltage REFL Analog power supply DDAD Analog ground SSAD MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This section describes the function of the ADC status and control register (ADCSC1). Writing ADCSC1 aborts the current conversion and initiates a new conversion (if the ADCH bits are equal to a value other than all 1s). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
ADCSC1. When hardware trigger is selected, a conversion is initiated following the assertion of the ADHWT input. 0 Software trigger selected 1 Hardware trigger selected MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If ADCRL is not read until the after next conversion is completed, then the intermediate conversion results will be lost. In 8-bit mode, there is no interlocking with ADCRH. In the case that the MODE bits are changed, any data in ADCRL becomes invalid. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Figure 10-9. Compare Value Low Register(ADCCVL) 10.3.7 Configuration Register (ADCCFG) ADCCFG is used to select the mode of operation, clock source, clock divide, and configure for low power or long sample time. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1 AD3 pin I/O control disabled ADC Pin Control 2 — ADPC2 is used to control the pin associated with channel AD2. ADPC2 0 AD2 pin I/O control enabled 1 AD2 pin I/O control disabled MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1 AD11 pin I/O control disabled ADC Pin Control 10 — ADPC10 is used to control the pin associated with channel AD10. ADPC10 0 AD10 pin I/O control enabled 1 AD10 pin I/O control disabled MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1 AD19 pin I/O control disabled ADC Pin Control 18 — ADPC18 is used to control the pin associated with channel AD18. ADPC18 0 AD18 pin I/O control enabled 1 AD18 pin I/O control disabled MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Whichever clock is selected, its frequency must fall within the specified frequency range for ADCK. If the available clocks are too slow, the ADC will not perform according to specifications. If the available clocks MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
In software triggered operation, continuous conversions begin after ADCSC1 is written and continue until aborted. In hardware triggered operation, continuous conversions begin after a hardware trigger event and continue until aborted. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 192
(3.5 ADCK cycles) and long (23.5 ADCK cycles) sample times.When sampling is complete, the converter is isolated from the input channel and a successive approximation algorithm is performed to determine the MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 193
Number of bus cycles = 3.5 μs x 8 MHz = 28 cycles NOTE The ADCK frequency must be between f minimum and f ADCK ADCK maximum to meet ADC specifications. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
ADC in its idle state. The contents of ADCRH and ADCRL are unaffected by stop3 mode. After exiting from stop3 mode, a software or hardware trigger is required to resume conversions. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1. Update the configuration register (ADCCFG) to select the input clock source and the divide ratio used to generate the internal clock, ADCK. This register is also used for selecting sample time and low-power configuration. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 196
Holds compare value when compare function enabled APCTL1=0x02 AD1 pin I/O control disabled. All other AD pins remain general purpose I/O pins APCTL2=0x00 All other AD pins remain general purpose I/O pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
SSAD as their corresponding MCU digital supply (V and V ) and must be routed carefully for maximum noise immunity and bypass capacitors placed as near as possible to the package. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 198
The input is sampled for 3.5 cycles of the ADCK source when ADLSMP is low, or 23.5 cycles when ADLSMP is high. For minimal loss of accuracy due to current injection, pins adjacent to the analog input pins should not be transitioning during conversions. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Place a 0.01 μF capacitor (C • ) on the selected input channel to V or V (this will REFL SSAD improve noise issues but will affect sample rate based on the external analog source resistance). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 200
• Total unadjusted error (TUE) — This error is defined as the difference between the actual transfer function and the ideal straight-line transfer function, and therefore includes all forms of error. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 201
Missing codes are those values which are never converted for any input value. In 8-bit or 10-bit mode, the ADC is guaranteed to be monotonic and to have no missing codes. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
EREFSTEN. To disable the oscillator in stop2, switch the ICS into FBI or FEI mode before executing the STOP instruction. Figure 11-1 shows the MC9S08QE128 Series block diagram with the ICS highlighted. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 204
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 11-1. MC9S08QE128 Series Block Diagram Highlighting ICS Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Three selectable digitally controlled oscillators (DCO) optimized for different frequency ranges. • Option to maximize output frequency for a 32768 Hz external reference clock source. 11.1.4 Block Diagram Figure 11-2 is the ICS block diagram. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
In FLL bypassed internal mode, the FLL is enabled and controlled by the internal reference clock, but is bypassed. The ICS supplies a clock derived from the internal reference clock. The BDC clock is supplied from the FLL. MC9S08QE128 MCU Series Reference Manual, Rev. 1.11 Freescale Semiconductor...
Reset: Note: TRIM is loaded during reset from a factory programmed location when not in BDM mode. If in a BDM mode, a default value of 0x80 is loaded. Figure 11-5. ICS Trim Register (ICSTRM) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
IREFS bit due to internal synchronization between clock domains. 0 Source of reference clock is external clock. 1 Source of reference clock is internal clock. MC9S08QE128 MCU Series Reference Manual, Rev. 1.11 Freescale Semiconductor...
Page 211
31.25 - 39.0625 kHz 1536 48 - 60 Mhz 32.768 kHz 1824 59.77 Mhz Reserved The resulting bus clock frequency should not exceed the maximum specified bus clock frequency of the device. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The FLL loop will lock the frequency to the FLL factor times the internal reference frequency. The ICSLCLK is available for BDC communications, and the internal reference clock is enabled. MC9S08QE128 MCU Series Reference Manual, Rev. 1.11 Freescale Semiconductor...
Page 213
RDIV bits are written to divide external reference clock to be within the range of 31.25 kHz to 39.0625 kHz. • BDM mode is active or LP bit is written to 0. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
DCO the FLL remains unlocked for several reference cycles. Once the selected DCO startup time is over, the FLL is locked. The completion of the switch is shown by the DRST bits. MC9S08QE128 MCU Series Reference Manual, Rev. 1.11 Freescale Semiconductor...
ICSTRM register and ICS FTRIM register during any reset initialization. For finer precision, the user can trim the internal oscillator in the application and set the FTRIM bit accordingly. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The ICS presents the low range DCO output clock divided by two as ICSLCLK for use as a clock source for BDC communications. ICSLCLK is not available in FLL bypassed internal low power (FBILP) and FLL bypassed external low power (FBELP) modes. MC9S08QE128 MCU Series Reference Manual, Rev. 1.11 Freescale Semiconductor...
12.1.2 Interrupt Vectors For MC9S08QE128 Series MCUs with two IICs, both IICs share a single interrupt vector. When interrupts are enabled for both IICs, the IICF bit must be polled in the IIC1S and IIC2S registers to determine which IIC caused the interrupt. See Section 4.2, “Reset and Interrupt Vector...
Page 218
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 12-1. MC9S08QE128 Series Block Diagram Highlighting the IIC Modules MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
• Stop mode — The IIC is inactive in stop3 mode for reduced power consumption. The STOP instruction does not affect IIC register states. Stop2 will reset the register contents. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
SCL — Serial Clock Line The bidirectional SCL is the serial clock line of the IIC system. 12.2.2 SDA — Serial Data Line The bidirectional SDA is the serial data line of the IIC system. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Slave Address — The AD[7:1] field contains the slave address to be used by the IIC module. This field is used AD[7:1] on the 7-bit address scheme and the lower seven bits of the 10-bit address scheme. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Repeat START — Writing a 1 to this bit will generate a repeated START condition provided it is the current RSTA master. This bit will always be read as a low. Attempting a repeat at the wrong time will result in loss of arbitration. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If the RXAK bit is high it means that no acknowledge signal is detected. 0 Acknowledge received. 1 No acknowledge received. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
In master transmit mode, the first byte of data written to IICxD following assertion of MST is used for the address transfer and should comprise of the calling address (in bit 7 to bit 1) concatenated with the required R/W bit (in position bit 0). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Slave Address — The AD[10:8] field contains the upper three bits of the slave address in the 10-bit address AD[10:8] scheme. This field is only valid when the ADEXT bit is set. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
AD7 AD6 AD5 AD4 AD3 AD2 AD1 R/W AD7 AD6 AD5 AD4 AD3 AD2 AD1 R/W START CALLING ADDRESS READ/ REPEATED NEW CALLING ADDRESS STOP READ/ SIGNAL START SIGNAL WRITE WRITE SIGNAL Figure 12-9. IIC Bus Transmission Signals MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 229
In either case, the data transfer is aborted and the master does one of two things: • Relinquishes the bus by generating a STOP signal. • Commences a new calling by generating a repeated START signal. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 230
There is then no difference between the device clocks and the state of the SCL line and all the devices start counting their high periods. The first device to complete its high period pulls the SCL line low again. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 231
SCL low the slave can drive SCL low for the required period and then release it. If the slave SCL low period is greater than the master SCL low period then the resulting SCL bus signal low period is stretched. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
After the master-receiver has sent the first byte of the 10-bit address, the slave-transmitter will see an IIC interrupt. User software must ensure that for this interrupt, the contents of IICD are ignored and not treated as valid data. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The IIC module asserts this interrupt when it loses the data arbitration process and the ARBL bit in the status register is set. Arbitration is lost in the following circumstances: MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 234
A repeated START cycle is requested in slave mode. • A STOP condition is detected when the master did not request it. This bit must be cleared by software by writing a 1 to it. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
RXAK IICS Module status flags DATA IICD Data register; Write to transmit IIC data read to read IIC data IICC2 GCAEN ADEXT AD10 Address configuration Figure 12-11. IIC Module Quick Start MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 236
2. When 10-bit addressing is used to address a slave, the slave will see an interrupt following the first byte of the extended address. User software must ensure that for this interrupt, the contents of IICD are ignored and not treated as a valid data transfer Figure 12-12. Typical IIC Interrupt Routine MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
13.1.3.1 RTC Status after Stop2 Wakeup The registers associated with the RTC are unaffected after a stop2 wakeup. 13.1.3.2 Clocks in Stop Modes In the MC9S08QE128 Series, LPO and OSCOUT can be used in stop2 and stop3. IRCLK is available only in stop3. 13.1.4 RTC Clock Gating The bus clock to the RTC can be gated on and off with SCGC2[RTC].
Chapter 13 Real-Time Counter (S08RTCV1) 13.1.5 Interrupt Vector Section 4.2, “Reset and Interrupt Vector Assignments,” for the RTC interrupt vector assignment. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 239
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 13-1. MC9S08QE128 Block Diagram Highlighting RTC Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The RTC suspends all counting during active background mode until the microcontroller returns to normal user operating mode. Counting resumes from the suspended value as long as the RTCMOD register is not written and the RTCPS and RTCLKS bits are not altered. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
RTC registers.This section refers to registers and control bits only by their names and relative address offsets. Table 13-1 is a summary of RTC registers. Table 13-1. RTC Register Summary Name RTCSC RTIF RTCLKS RTIE RTCPS Clock Source Select RTCCNT RTCCNT RTCMOD RTCMOD MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
RTIF status bit. A value of 0x00 sets the RTIF bit on each rising edge of the prescaler output. Writing to RTCMOD resets the prescaler and the RTCCNT counters to 0x00. Reset sets the modulo to 0x00. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
20 ms 0.5 ms 0.625 s 1101 0.1 s 50 ms 3.125 ms 1.5625 s 1110 0.5 s 0.1 s 15.625 ms 3.125 s 1111 0.2 s 31.25 ms 6.25 s MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
For accuracy without adjustments at the expense of additional power consumption, the external clock (ERCLK) or the internal clock (IRCLK) can be selected with appropriate prescaler and modulo values. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 246
/* 60 minutes in an hour */ if (Minutes > 59){ Hours++; Minutes = 0; /* 24 hours in a day */ if (Hours > 23){ Days ++; Hours = 0; MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 14 Serial Communications Interface (S08SCIV4) 14.1 Introduction Figure 14-1 shows the MC9S08QE128 Series block diagram with the SCI highlighted. NOTE Ignore any references to stop1 low-power mode in this chapter, because the MC9S08QE128 device does not support it. 14.1.1 SCI Clock Gating The bus clock to SCI1 and SCI2 can be gated on and off using the SCGC1[SCI1,SCI2] bits, respectively.
Page 248
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 14-1. MC9S08QE128 Series Block Diagram Highlighting SCI Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 249
Rx/Tx pin Tx data path direction in polarity single-wire mode R7/T7 R6/T6 R5/T5 R4/T4 R3/T3 R2/T2 R1/T1 R0/T0 SCIxD Read: Rx data; write: Tx data Figure 14-2. SCI Module Quick Start MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
SCI baud rate generator. When BR = 0, the SCI baud rate generator is disabled to reduce supply current. When BR = 1 to 8191, the SCI baud rate = BUSCLK/(16×BR). See also BR bits in Table 14-2. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Normal — start + 8 data bits (LSB first) + stop. 1 Receiver and transmitter use 9-bit data characters start + 8 data bits (LSB first) + 9th data bit + stop. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This register has eight read-only status flags. Writes have no effect. Special software sequences (which do not involve writing to this register) are used to clear these status flags. TDRE RDRF IDLE Reset = Unimplemented or Reserved Figure 14-9. SCI Status Register 1 (SCIxS1) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 257
flag NF will be set at the same time as the flag RDRF gets set for the character. To clear NF, read SCIxS1 and then read the SCI data register (SCIxD). 0 No noise detected. 1 Noise detected in the received character in SCIxD. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Break character is transmitted with length of 10 bit times (11 if M = 1) 1 Break character is transmitted with length of 13 bit times (14 if M = 1) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(LOOPS = RSRC = 1), this bit determines the direction of data at the TxD pin. 0 TxD pin is an input in single-wire mode. 1 TxD pin is an output in single-wire mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The following describes each of the blocks of the SCI. 14.3.1 Baud Rate Generation As shown in Figure 14-13, the clock source for the SCI baud rate generator is the bus-rate clock. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If no new character is waiting in the transmit data buffer after a stop bit is shifted out the TxD pin, the transmitter sets the transmit complete flag and enters an idle mode, with TxD high, waiting for more characters to transmit. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
After receiving the stop bit into the receive shifter, and provided the receive data register is not already full, the data character is transferred to the receive data register and the receive data register full (RDRF) status MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 263
flags associated with the receiver (with the exception of the idle bit, IDLE, when RWUID bit is set) are inhibited from setting, thus eliminating the software overhead for handling the unimportant MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If the transmit complete interrupt enable (TCIE) bit is set, a hardware interrupt will be requested whenever TC = 1. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Or it is used with address-mark wakeup so the ninth data bit can serve as the wakeup bit. In custom protocols, the ninth bit can also serve as a software-controlled marker. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 266
In single-wire mode, the internal loop back connection from the transmitter to the receiver causes the receiver to receive characters that are sent out by the transmitter. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Chapter 15 Serial Peripheral Interface (S08SPIV3) 15.1 Introduction Figure 15-1 shows the MC9S08QE128 Series block diagram with the SPI highlighted. NOTE Ignore any references to stop1 low-power mode in this chapter, because the MC9S08QE128 device does not support it. 15.1.1...
Page 268
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 15-1. MC9S08QE128 Block Diagram Highlighting SPI Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(SS pin). In this system, the master device has configured its SS pin as an optional slave select output. MASTER SLAVE MOSI MOSI SPI SHIFTER SPI SHIFTER MISO MISO SPSCK SPSCK CLOCK GENERATOR Figure 15-2. SPI System Connections MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 270
In the external SPI system, simply connect all SPSCK pins to each other, all MISO pins together, and all MOSI pins together. Peripheral devices often use slightly different names for these pins. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(SPPR2:SPPR1:SPPR0) choose a prescale divisor of 1, 2, 3, 4, 5, 6, 7, or 8. The three rate select bits (SPR2:SPR1:SPR0) divide the output of the prescaler stage by 2, 4, 8, 16, 32, 64, 128, or 256 to get the internal SPI master mode bit-rate clock. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
I/O pin. When the SPI is enabled as a master and MODFEN = 1, the slave select output enable bit determines whether this pin acts as the mode fault input (SSOE = 0) or as the slave select output (SSOE = 1). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
SPI Transmit Interrupt Enable — This is the interrupt enable bit for SPI transmit buffer empty (SPTEF). SPTIE 0 Interrupts from SPTEF inhibited (use polling) 1 When SPTEF is 1, hardware interrupt requested MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This read/write register is used to control optional features of the SPI system. Bits 7, 6, 5, and 2 are not implemented and always read 0. MODFEN BIDIROE SPISWAI SPC0 Reset = Unimplemented or Reserved Figure 15-6. SPI Control Register 2 (SPIxC2) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Table 15-6. The input to this divider comes from the SPI baud rate prescaler (see Figure 15-4). The output of this divider is the SPI bit rate clock for master mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
This register has three read-only status bits. Bits 6, 3, 2, 1, and 0 are not implemented and always read 0. Writes have no meaning or effect. SPRF SPTEF MODF Reset = Unimplemented or Reserved Figure 15-8. SPI Status Register (SPIxS) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Data may be read from SPIxD any time after SPRF is set and before another transfer is finished. Failure to read the data out of the receive data buffer before a new transfer ends causes a receive overrun condition and the data from the new transfer is lost. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
CPOL. The SAMPLE IN waveform applies to the MOSI input of a slave or the MISO input of a master. The MOSI waveform applies to the MOSI output MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 279
1 starting as the slave is selected (SS IN goes low), and bit 8 ends at the last SPSCK edge. The MSB first and LSB first lines show the order of SPI data bits depending on the setting MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 280
MOSI and MISO outputs of the master and slave, respectively. When CPHA = 0, the slave’s SS input must go to its inactive high level between transfers. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
MODF is cleared by reading it while it is set, then writing to the SPI control register 1 (SPIxC1). User software should verify the error condition has been corrected before changing the SPI back to master mode. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 282
Serial Peripheral Interface (S08SPIV3) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Timer/Pulse-Width Modulator (S08TPMV3) 16.1 Introduction Figure 16-1 shows the MC9S08QE128 Series block diagram with the TPM highlighted. 16.1.1 ACMP/TPM Configuration Information The ACMP modules can be configured to connect the output of the analog comparator to a TPM input capture channel 0 by setting the corresponding SOPT2[ACICx] bit. With ACICx set, the TPMxCH0 pin is not available externally regardless of the configuration of the TPMx module.
Page 284
48-pin and 32-pin packages PTG1 REFH REFL PTH0 and V pins are each internally connected to two pads in 32-pin package PTG0 Figure 16-1. MC9S08QE128 Series Block Diagram Highlighting TPM Block and Pins MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
MCU pin. The output compare action may be selected to force the pin to zero, force the pin to one, toggle the pin, or ignore the pin (used for software timing functions). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Software can read the counter value at any time without affecting the counting sequence. Any write to either half of the TPMxCNT counter resets the counter, regardless of the data value written. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
TPM, refer to full-chip documentation for a specific derivative for more details about the interaction of TPM pin functions and general purpose I/O controls including port data, data direction, and pullup controls. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 289
16-bit channel value register matches the timer counter. When the output compare toggle mode is initially selected, the previous value on the pin is driven out until the next output compare event—then the pin is toggled. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 290
CHnF BIT TOF BIT Figure 16-3. High-True Pulse of an Edge-Aligned PWM TPMxMODH:TPMxMODL = 0x0008 TPMxMODH:TPMxMODL = 0x0005 TPMxCNTH:TPMxCNTL TPMxCHn CHnF BIT TOF BIT Figure 16-4. Low-True Pulse of an Edge-Aligned PWM MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 291
CHnF BIT TOF BIT Figure 16-5. High-True Pulse of a Center-Aligned PWM TPMxMODH:TPMxMODL = 0x0008 TPMxMODH:TPMxMODL = 0x0005 TPMxCNTH:TPMxCNTL TPMxCHn CHnF BIT TOF BIT Figure 16-6. Low-True Pulse of a Center-Aligned PWM MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
TPM system. The new prescale factor will affect the clock source on the next system clock cycle after the new value is updated into the register bits. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
TPM counter (TPMxCNTH:TPMxCNTL) and resets the coherency mechanism, regardless of the data involved in the write. Bit 15 Bit 8 Any write to TPMxCNTH clears the 16-bit counter Reset Figure 16-8. TPM Counter Register High (TPMxCNTH) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
BDM is active. Any write to the modulo registers bypasses the buffer latches and directly writes to the modulo register while BDM is active. Bit 15 Bit 8 Reset Figure 16-10. TPM Counter Modulo Register High (TPMxMODH) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Mode select B for TPM channel n. When CPWMS=0, MSnB=1 configures TPM channel n for edge-aligned PWM MSnB mode. Refer to the summary of channel mode and setup controls in Table 16-6. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
These read/write registers contain the captured TPM counter value of the input capture function or the output compare value for the output compare or PWM functions. The channel registers are cleared by reset. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 297
BDM is active. The values written to the channel register while BDM is active are used for PWM & output compare operation once normal execution resumes. Writes to the channel MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
(writing 00 to the CLKSB:CLKSA field) does not affect the values in the counter or other timer registers. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 299
This corresponds to the end of a PWM period (the 0x0000 count value corresponds to the center of a period). MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
With the output-compare function, the TPM can generate timed pulses with programmable position, polarity, duration, and frequency. When the counter reaches the value in the channel-value registers of an output-compare channel, the TPM can set, clear, or toggle the channel pin. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 301
If (CLKSB:CLKSA = 0:0), the registers are updated when the second byte is written • If (CLKSB:CLKSA not = 0:0), the registers are updated after the both bytes were written, and the TPM counter changes from (TPMxMODH:TPMxMODL - 1) to (TPMxMODH:TPMxMODL). If MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 302
Center-aligned PWM outputs typically produce less noise than edge-aligned PWMs because fewer I/O pin transitions are lined up at the same system clock edge. This type of PWM is also required for some types of motor drives. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
If the channel is configured for output compare or PWM modes, the interrupt flag is set each time the main timer counter matches the value in the 16-bit channel value register. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
PWM (CPWMS=0), TOF gets set when the timer counter changes from the terminal count (the value in the modulo register) to 0x0000. This case corresponds to the normal meaning of counter overflow. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 305
flag is set at the start and at the end of the active duty cycle period which are the times when the timer counter matches the channel value register. The flag is cleared by the two-step sequence described Section 16.6.2, “Description of Interrupt Operation.” MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The method for forcing active background mode depends on the specific HCS08 derivative. For the MC9S08QE128 Series, you can force active background after a power-on reset by holding the BKGD pin low as the device exits the reset condition. You can also force active background by driving BKGD low immediately after a serial background command that writes a one to the BDFR bit in the SBDFR register.
However, if the pod is powered separately, it can be connected to a running target system without forcing a target system reset or otherwise disturbing the running application program. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
MSB first at 16 BDC clock cycles per bit (nominal speed). The interface times out if 512 BDC clock cycles occur between falling edges from the host. Any BDC command that was in progress MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 310
HOST TRANSMIT 1 HOST TRANSMIT 0 10 CYCLES EARLIEST START OF NEXT BIT SYNCHRONIZATION TARGET SENSES BIT LEVEL UNCERTAINTY PERCEIVED START OF BIT TIME Figure 17-2. BDC Host-to-Target Serial Bit Timing MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 311
PERCEIVED START OF BIT TIME R-C RISE BKGD PIN 10 CYCLES EARLIEST START OF NEXT BIT 10 CYCLES HOST SAMPLES BKGD PIN Figure 17-3. BDC Target-to-Host Serial Bit Timing (Logic 1) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 312
SPEED-UP PULSE PERCEIVED START OF BIT TIME BKGD PIN 10 CYCLES EARLIEST START OF NEXT BIT 10 CYCLES HOST SAMPLES BKGD PIN Figure 17-4. BDM Target-to-Host Serial Bit Timing (Logic 0) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
8 bits of write data for BDCSCR in the host-to-target direction (CONTROL) RBKP 16 bits of read data in the target-to-host direction (from BDCBKPT breakpoint register) WBKP 16 bits of write data in the host-to-target direction (for BDCBKPT breakpoint register) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 314
Increment H:X by one, then write memory byte WRITE_NEXT_WS Active BDM 51/WD/d/SS located at H:X. Also report status. The SYNC command is a special operation that does not have a command code. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The force/tag select (FTS) control bit in BDCSCR is used to select forced (FTS = 1) or tagged (FTS = 0) type breakpoints. 17.3 Register Definition This section contains the descriptions of the BDC registers and control bits. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
WSF, and DVF) are read-only status indicators and can never be written by the WRITE_CONTROL serial BDC command. The clock switch (CLKSW) control bit may be read or written at any time. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 317
1 Breakpoint match forces active background mode at next instruction boundary (address need not be an opcode) Select Source for BDC Communications Clock — CLKSW defaults to 0, which selects the alternate BDC CLKSW clock source. 0 Alternate BDC clock source 1 MCU bus clock MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
0 Memory access did not conflict with a wait or stop instruction 1 Memory access command failed because the CPU entered wait or stop mode Data Valid Failure Status — This status bit is not used in the MC9S08QE128 Series because it does not have any slow access memory.
Page 319
Background Debug Force Reset — A serial active background mode command such as WRITE_BYTE allows BDFR an external debug host to force a target system reset. Writing 1 to this bit forces an MCU reset. This bit cannot be written from a user program. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 320
Development Support MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
— Source address of conditional branches taken — Destination address of indirect JMP and JSR instruction — Destination address of interrupts, RTI, RTC, and RTS instruction — Data associated with Event B trigger modes MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
1. In 64K versions of this module there are only 16 address lines [15:0], there are no core_cpu_aob_14_t2, core_cpu_aob_15_t2, core_ppage_t2[2:0], and ppage_sel signals. Figure 18-1. DBG Block Diagram 18.2 Signal Description The DBG module contains no external signals. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Figure 18-3. Debug Comparator A Low Register (DBGCAL) In the case of an end-trace to reset where DBGEN=1 and BEGIN=0, the bits in this register do not change after reset. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 326
Module Base + 0x0003 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 or non- end-run Reset end-run Figure 18-5. Debug Comparator B Low Register (DBGCBL) MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 327
[15:8] to a logic 1 or logic 0. 0 Compare corresponding address bit to a logic 0 1 Compare corresponding address bit to a logic 1 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 328
= Unimplemented or Reserved Figure 18-8. Debug FIFO High Register (DBGFH) In the case of an end-trace to reset where DBGEN=1 and BEGIN=0, the bits in this register do not change after reset. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 329
FIFO pointers to advance to the next FIFO location. In event-only modes, there is no useful information in DBGFX and DBGFH so it is not necessary to read them before reading DBGFL. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 330
Comparator A will compare the core address bus bit 16 to a logic 1 or logic 0. 0 Compare corresponding address bit to a logic 0 1 Compare corresponding address bit to a logic 1 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 331
Comparator B will compare the core address bus bit 16 to a logic 1 or logic 0. This bit is not used in full modes where comparator B is used to match the data value. 0 Compare corresponding address bit to a logic 0 1 Compare corresponding address bit to a logic 1 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 332
Comparator C will compare the core address bus bit 16 to a logic 1 or logic 0. 0 Compare corresponding address bit to a logic 0 1 Compare corresponding address bit to a logic 1 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 333
1 The information in the corresponding FIFO word is a 17-bit flash address with PPAGE[2:0] in the three most significant bits and CPU address[13:0] in the 14 least significant bits Extended Address Bit 16 — This bit is the most significant bit of the 17-bit core address. Bit 16 MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 334
COF address with the address in comparator C. If these addresses match, override the FIFO capture and do not increment the FIFO count. If the address does not match comparator C, capture the COF address, including the PPACC indicator, into the FIFO and into comparator C. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 335
A Then B 0011 Event Only B 0100 A Then Event Only B 0101 A And B (Full Mode) 0110 A And Not B (Full mode) 0111 Inside Range 1000 Outside Range MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 336
While DBGEN = 1, this status bit is a read-only image of the ARM bit in DBGC. See Section 18.4.4.2, “Arming the DBG Module” for more information. 0 Debugger not armed 1 Debugger armed MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 337
1 word valid 0010 2 words valid 0011 3 words valid 0100 4 words valid 0101 5 words valid 0110 6 words valid 0111 7 words valid 1000 8 words valid MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
FIFO. This bit indicates whether the COF address was a paged 17-bit program address using the PPAGE mechanism (PPACC=1) or a 17-bit CPU address that resulted from an unpaged CPU access. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
With the TRGSEL bit cleared a comparator match is all that is necessary for a trigger condition to be met. NOTE If the TRGSEL is set, the address stored in the comparator match address registers must be an opcode address for the trigger to occur. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
FIFO is filled in begin-trigger mode. In the case of an end-trace where DBGEN=1 and BEGIN=0, ARM and ARMF are cleared by any reset to MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 341
For Breakpoint tagging operation with an end-trigger type trace, only matches from Comparator A will be used to determine if the Breakpoint conditions are met and Comparator B matches will be ignored. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
Page 342
Start FIFO at trigger address, force CPU breakpoint when FIFO full Do not use Start FIFO at trigger opcode (No CPU breakpoint - keep running) Start FIFO at trigger opcode, force CPU breakpoint when FIFO full Do not use MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
The data stored in the FIFO can be read using BDM commands provided the DBG module is enabled and not armed (DBGEN=1 and ARM=0). The FIFO data is read out first-in-first-out. By reading the CNT bits MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
POR, the DBG module controls are initialized to start a begin trace run starting from when the reset vector is fetched. The conditions for the default begin trace run are: MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...
DBGT=0x40 to select a force-type trigger, a BEGIN trigger, and A-only trigger mode 18.6 Interrupts The DBG contains no interrupt source. 18.7 Electrical Specifications The DBG module contain no electrical specifications. MC9S08QE128 MCU Series Reference Manual, Rev. 2 Freescale Semiconductor...