Page 2
Additional information of this manual may be served by ABOV Semiconductor offices in Korea or Distributors. ABOV Semiconductor reserves the right to make changes to any information here in at any time without notice. The information, diagrams and other data in this manual are correct and reliable; however, ABOV Semiconductor is in no way responsible for any violations of patents or other rights of the third party generated by the use of this manual.
Page 6
MC97F2664 Figure 10.5 Effective Timing of Interrupt Flag Register ................97 Figure 10.6 Effective Timing of Interrupt ....................98 Figure 10.7 Interrupt Response Timing Diagram ..................99 Figure 10.8 Correspondence between Vector Table Address and the Entry Address of ISP ....99 Figure 10.9 Saving/Restore Process Diagram and Sample Source ............
Page 7
MC97F2664 Figure 11.44 Asynchronous Start Bit Sampling (USIn, where n = 0 and 1) .......... 188 Figure 11.45 Asynchronous Sampling of Data and Parity Bit (USIn, where n = 0 and 1) ..... 188 Figure 11.46 Stop Bit Sampling and Next Start Bit Sampling (USIn, where n = 0 and 1) ..... 189 Figure 11.47 USI0/1 SPI Clock Formats when CPHAn=0 (where n = 0 and 1) ........
Page 8
MC97F2664 List of Tables Table 1-1 Ordering Information of MC97F2664 ..................12 Table 5-1 Normal Pin Description ......................24 Table 7-1 Absolute Maximum Ratings ....................31 Table 7-2 Recommended Operating Conditions ..................31 Table 7-3 A/D Converter Characteristics ....................32 Table 7-4 Power-on Reset Characteristics .....................
Page 9
MC97F2664 Table 11-18 CPOLn Functionality (where n = 0 and 1) ................. 190 Table 11-19 USI0/1 Register Map (where n = 0 and 1) ................ 207 Table 11-20 Examples of USI0BD and USI1BD Settings for Commonly Used Oscillator Frequencies 216 Table 11-21 ADC Register Map ......................
1. Overview 1.1 Description The MC97F2664 is advanced CMOS 8-bit microcontroller with 64k bytes of FLASH. This is powerful microcontroller which provides a highly flexible and cost effective solution to many embedded control applications. This provides the following features : 64k bytes of FLASH, 256 bytes of IRAM, 4,096 bytes of XRAM , general...
1.4.1 Compiler We do not provide the compiler. Please contact the third parties. The core of MC97F2664 is Mentor 8051. And, device ROM size is smaller than 64k bytes. Developer can use all kinds of third party’s standard 8051 compiler.
MC97F2664 5. Pin Description Table 5-1 Normal Pin Description Function @RESET Shared with Name Port 0 is a bit-programmable I/O port which can Input AVERF be configured as an input, a push-pull output, or an open-drain output. A pull-up resistor can be specified in 1-bit unit.
Page 25
MC97F2664 Table 5-1 Normal Pin Description (Continued) Function @RESET Shared with Name EINT10/T0O/PWM0O Port 5 is a bit-programmable I/O port which Input can be configured as a schmitt-trigger input, EINT11/T1O/PWM1O a push-pull output, or an open-drain output. EINT12/T2O/PWM2O A pull-up resistor can be specified in 1-bit unit.
Page 26
MC97F2664 Table 5-1 Normal Pin Description (Continued) Function @RESET Shared with Name P53/T3O/PWM3O EINT13 External interrupt and Timer 3 capture input Input P30/T4O/PWM4O EINT14 External interrupt and Timer 4 capture input Input P31/T5O/PWM5O EINT15 External interrupt and Timer 5 capture input...
Page 27
MC97F2664 Table 5-1 Normal Pin Description (Continued) Function @RESET Shared with Name SCK3 Serial 3 clock input/output Input P72/EC4 MOSI0 SPI 0 master output, slave input Input P63/TXD0/SDA0/DSDA MOSI1 SPI 1 master output, slave input Input P40/TXD1/SDA1 MOSI2 SPI 2 master output, slave input...
Page 28
MC97F2664 Table 5-1 Normal Pin Description (Continued) PIN Name Function @RESET Shared with A/D converter analog input channels Input RESETB System reset pin with a pull-up resistor when it Input P57/EC3 is selected as the RESETB by CONFIGURE OPTION (NOTE3)
MC97F2664 6. Port Structures 6.1 General Purpose I/O Port Level Shift (1.8V to ExtVDD) Level Shift (ExtVDD to 1.8V) PULL-UP REGISTER OPEN DRAIN REGISTER DATA REGISTER SUB-FUNC DATA OUTPUT SUB-FUNC ENABLE SUB-FUNC DIRECTION DIRECTION REGISTER CMOS or Schmitt Level Input...
MC97F2664 6.2 External Interrupt I/O Port Level Shift (1.8V to ExtVDD) Level Shift (ExtVDD to 1.8V) PULL-UP REGISTER OPEN DRAIN REGISTER DATA REGISTER SUB-FUNC DATA OUTPUT SUB-FUNC ENABLE SUB-FUNC DIRECTION DIRECTION REGISTER EXTERNAL INTERRUPT POLARITY REG. INTERRUPT ENABLE FLAG CMOS or...
MC97F2664 7. Electrical Characteristics 7.1 Absolute Maximum Ratings Table 7-1 Absolute Maximum Ratings Parameter Symbol Rating Unit Note – Supply Voltage -0.3 ~ +6.5 -0.3 ~ VDD+0.3 Voltage on any pin with respect to VSS -0.3 ~ VDD+0.3 Maximum current output sourced by (I...
MC97F2664 7.11 UART Characteristics Table 7-11 UART Characteristics = -40°C ~ +85°C, VDD= 1.8V ~ 5.5V, f =11.1MHz) Parameter Symbol Unit Serial port clock cycle time 1250 x 16 1650 – Output data setup to clock rising edge x 13 –...
MC97F2664 7.13 Data Retention Voltage in Stop Mode Table 7-13 Data Retention Voltage in Stop Mode = -40°C ~ +85°C, VDD= 1.8V ~ 5.5V) Parameter Symbol Conditions Unit – – Data retention supply voltage DDDR – – μA Data retention supply current VDDR= 1.8V,...
MC97F2664 7.18 Main Oscillation Stabilization Characteristics Table 7-18 Main Oscillation Stabilization Characteristics = -40°C ~ +85°C, VDD= 1.8V ~ 5.5V) Oscillator Parameter Unit fx > 1MHz – – Crystal Oscillation stabilization occurs when VDD is equal to the minimum oscillator voltage –...
MC97F2664 7.20 Operating Voltage Range =0.4 to 16MHz) =32 to 38KHz) 16.0MHz 32.768KHz 12.0MHz 4.2MHz 0.4MHz Supply voltage (V) Supply voltage (V) Figure 7.16 Operating Voltage Range April 11, 2014 Ver. 1.4...
MC97F2664 7.21 Recommended Circuit and Layout This 0.1uF capacitor should be within 1cm from the VDD pin of MCU on the VDD VCC PCB layout. DC Power 0.1uF 0.1uF The MCU power line (VDD and VSS) should be separated from the high-...
MC97F2664 7.22 Recommended Circuit and Layout with SMPS Power SMPS Side MCU Side SMPS MC97F2664 1. The C1 capacitor is to flatten out the voltage of the SMPS power, VCC. √ Recommended C1: 470uF/25V more. 2. The R1 and C2 are the RC filter for VDD and suppress the ripple of VCC.
MC97F2664 7.23 Typical Characteristics These graphs and tables provided in this section are only for design guidance and are not tested or guaranteed. In graphs or tables some data are out of specified operating range (e.g. out of specified VDD range). This is only for information and devices are guaranteed to operate properly only within the specified range.
DPTR register. MC97F2664 provides on-chip 64k bytes of the ISP type flash program memory, which can be read and written to. Internal data memory (IRAM) is 256 bytes and it includes the stack area. External data memory (XRAM) is 4,096 bytes and it can be used as the extended stack area 8.1 Program Memory...
MC97F2664 8.2 Data Memory Figure 8-2 shows the internal data memory space available. Upper 128 Bytes Special Function Registers Internal RAM 128 Bytes (Indirect Addressing) (Direct Addressing) Lower 128 Bytes Internal RAM (Direct or Indirect Addressing) Figure 8.2 Data Memory Map The internal data memory space is divided into three blocks, which are generally referred to as the lower 128 bytes, upper 128 bytes, and SFR space.
MC97F2664 8.3 XRAM Memory MC97F2664 has 4,096 bytes XRAM. This area has no relation with RAM/FLASH. It can be read and written to through SFR with 8-bit unit. 107FH Extended Special Function Registers 128 Bytes (Indirect Addressing) 1000H 0FFFH External RAM...
MC97F2664 8.4.2 SFR Map Table 8-3 SFR Map @Reset Address Function Symbol P0 Data Register Stack Pointer Data Pointer Register Low Data Pointer Register High Data Pointer Register Low 1 DPL1 Data Pointer Register High 1 DPH1 – – Low Voltage Indicator Control Register LVICR –...
Page 60
MC97F2664 Table 8-3 SFR Map (Continued) @Reset Address Function Symbol P4 Data Register P1 Direction Register P1IO – – – – Extended Operation Register External Interrupt Flag 0 Register EIFLAG0 External Interrupt Flag 1 Register EIFLAG1 – – – External Interrupt Flag 2 Register...
Page 61
MC97F2664 Table 8-3 SFR Map (Continued) @Reset Address Function Symbol – Timer 3 Control Register T3CR Timer 3 Counter Register T3CNT Timer 3 Data Register T3DR Timer 3 Capture Data Register T3CDR – – – P7 Data Register P4 Direction Register...
Page 62
MC97F2664 Table 8-3 SFR Map (Continued) @Reset Address Function Symbol Accumulator Register P1 Debounce Enable Register P1DB – – Timer 7 Control Low Register T7CRL – – – Timer 7 Control High Register T7CRH Timer 7 A Data Low Register...
Page 64
MC97F2664 Table 8-4 Extended SFR Map (Continued) @Reset Address Function Symbol 1020H USI0 Status Register 1 USI0ST1 1021H USI0 Status Register 2 USI0ST2 1022H USI0 Baud Rate Generation Register USI0BD 1023H USI0 SDA Hold Time Register USI0SDHR 1024H USI0 Data Register...
Page 65
MC97F2664 Table 8-4 Extended SFR Map (Continued) @Reset Address Function Symbol – – – 1040H UART3 Control Register 1 UART3CR1 1041H UART3 Control Register 2 UART3CR2 – – – – 1042H UART3 Control Register 3 UART3CR3 1043H UART3 Status Register...
Page 66
MC97F2664 8.4.3 Compiler Compatible SFR ACC (Accumulator Register) : E0H Initial value : 00H Accumulator B (B Register) : F0H Initial value : 00H B Register SP (Stack Pointer) : 81H Initial value : 07H Stack Pointer XSP (Extend Stack Pointer) : 91H...
Page 67
MC97F2664 DPL (Data Pointer Register Low) : 82H Initial value : 00H Data Pointer Low DPH (Data Pointer Register High) : 83H Initial value : 00H Data Pointer High DPL1 (Data Pointer Register Low 1) : 84H DPL1 Initial value : 00H...
Page 68
MC97F2664 EO (Extended Operation Register) : A2H – – – – TRAP_EN DPSEL2 DPSEL1 DPSEL0 – – – – Initial value : 00H Select the Instruction (Keep always ‘0’). TRAP_EN Select MOVC @(DPTR++), A Select Software TRAP Instruction DPSEL[2:0] Select Banked Data Pointer Register...
Page 69
MC97F2664 SINTCR(System Interrupt Control Register) : F7H – – – – – – SPOVIE SPOVIFR – – – – – – Initial value : 00H SPOVIE Enable or Disable Stack Pointer Overflow Interrupt Disable Enable When SPOVF Interrupt occurs, this bit becomes ‘1’. The flag is SPOVIFR cleared only by writing a ‘0’...
9.1 I/O Ports The MC97F2664 has eight groups of I/O ports (P0 ~ P7). Each port can be easily configured by software as I/O pin, internal pull up and open-drain pin to meet various system configurations and design requirements. Also P1, P2, P3, and P5 include function that can generate interrupt according to change of state of the pin.
MC97F2664 9.3 P0 Port 9.3.1 P0 Port Description P0 is 8-bit I/O port. P0 control registers consist of P0 data register (P0), P0 direction register (P0IO), P0 pull-up resistor selection register (P0PU), and P0 open-drain selection register (P0OD). Refer to the port function selection registers for the P0 function selection.
Page 74
MC97F2664 P0FSR (Port 0 Function Selection Register) : 1010H (XSFR) P0FSR7 P0FSR6 P0FSR5 P0FSR4 P0FSR3 P0FSR2 P0FSR1 P0FSR0 Initial value : 00H P0FSR7 P07 Function select I/O Port AN14 Function P0FSR6 P06 Function select I/O Port AN13 Function P0FSR5 P05 Function select...
MC97F2664 9.4 P1 Port 9.4.1 P1 Port Description P1 is 8-bit I/O port. P1 control registers consist of P1 data register (P1), P1 direction register (P1IO), debounce enable register (P1DB), P1 pull-up resistor selection register (P1PU), and P1 open-drain selection register (P1OD) .
Page 76
MC97F2664 P1DB (P1 Debounce Enable Register) : E1H P17DB P16DB P15DB P14DB P13DB P12DB P11DB P10DB Initial value : 00H P17DB Configure Debounce of P17 Port Disable Enable P16DB Configure Debounce of P16 Port Disable Enable P15DB Configure Debounce of P15 Port...
Page 77
MC97F2664 P1FSR (Port 1 Function Selection Register) : 1011H (XSFR) P1FSR7 P1FSR6 P1FSR5 P1FSR4 P1FSR3 P1FSR2 P1FSR1 P1FSR0 Initial value : 00H P1FSR7 P17 Function select I/O Port (EINT7 function possible when input) AN7 Function P1FSR6 P16 Function select I/O Port (EINT6 function possible when input)
MC97F2664 9.5 P2 Port 9.5.1 P2 Port Description P2 is 8-bit I/O port. P2 control registers consist of P2 data register (P2), P2 direction register (P2IO), debounce enable register (P2DB), P2 pull-up resistor selection register (P2PU) and P2 open-drain selection register (P2OD).
Page 79
MC97F2664 P2DB (P2 Debounce Enable Register) : E9H DBCLK1 DBCLK0 P27DB P26DB P25DB P22DB P21DB P20DB Initial value : 00H DBCLK[1:0] Configure Debounce Clock of Port DBCLK1 DBCLK0 description fx/1 fx/4 fx/4096 Reserved P27DB Configure Debounce of P27 Port Disable...
Page 80
MC97F2664 P2FSR (Port 2 Function Selection Register) : 1012H (XSFR) – – – – P2FSR3 P2FSR2 P2FSR1 P2FSR0 – – – – Initial value : 00H P2FSR3 P23 Function select I/O Port TXD4 Function P2FSR2 P22 Function select I/O Port (EINT19 function possible when input)
MC97F2664 9.6 P3 Port 9.6.1 P3 Port Description P3 is 8-bit I/O port. P3 control registers consist of P3 data register (P3), P3 direction register (P3IO), debounce enable register (P35DB),P3 pull-up resistor selection register (P3PU) and P3 open-drain selection register (P3OD).
Page 82
MC97F2664 P35DB (P35 Debounce Enable Register) : F1H – P53DB P52DB P51DB P50DB P32DB P31DB P30DB – Initial value : 00H P53DB Configure Debounce of P53 Port Disable Enable P52DB Configure Debounce of P52 Port Disable Enable P51DB Configure Debounce of P51 Port...
Page 83
MC97F2664 P3FSR (Port 3 Function Selection Register) : 1013H (XSFR) P3FSR7 P3FSR6 P3FSR5 P3FSR4 P3FSR3 P3FSR2 P3FSR1 P3FSR0 Initial value : 00H P3FSR7 P36 Function select I/O Port (EC8 function possible when input) SCK2 Function P3FSR6 P35 Function select I/O Port (EC7 function possible when input)
MC97F2664 9.7 P4 Port 9.7.1 P4 Port Description P4 is 8-bit I/O port. P4 control registers consist of P4 data register (P4), P4 direction register (P4IO), P4 pull-up resistor selection register (P4PU) and P4 open-drain selection register (P4OD). Refer to the port function selection registers for the P4 function selection.
Page 85
MC97F2664 P4FSR (Port 4 Function Selection Register) : 1014H (XSFR) – – – P4FSR4 P4FSR3 P4FSR2 P4FSR1 P4FSR0 – – – Initial value : 00H P4FSR4 P46 Function select I/O Port TXD3 Function P4FSR3 P44 Function Select I/O Port TXD2 Function...
MC97F2664 9.8 P5 Port 9.8.1 P5 Port Description P5 is 8-bit I/O port. P5 control registers consist of P5 data register (P5), P5 direction register (P5IO), P5 pull-up resistor selection register (P5PU) and P5 open-drain selection register (P5OD). Refer to the port function selection registers for the P5 function selection.
Page 87
MC97F2664 P5FSR (Port 5 Function Selection Register) : 1015H (XSFR) – – – – P5FSR3 P5FSR2 P5FSR1 P5FSR0 – – – – Initial value : 00H P5FSR3 P53 Function Select I/O Port (EINT13 function possible when input) T3O/PWM3O Function P5FSR2...
MC97F2664 9.9 P6 Port 9.9.1 P6 Port Description P6 is 8-bit I/O port. P6 control registers consist of P6 data register (P6), P6 direction register (P6IO), P6 pull-up resistor selection register (P6PU) and P6 open-drain selection register (P6OD). Refer to the port function selection registers for the P6 function selection.
Page 89
MC97F2664 P6FSR (Port 6 Function Selection Register) : 1016H (XSFR) – P6FSR6 P6FSR5 P6FSR4 P6FSR3 P6FSR2 P6FSR1 P6FSR0 – Initial value : 00H P6FSR6 P67 Function select I/O Port SXOUT Function P6FSR5 P66 Function select I/O Port SXIN Function P6FSR4...
MC97F2664 9.10 P7 Port 9.10.1 P7 Port Description P7 is 5-bit I/O port. P7 control registers consist of P7 data register (P7), P7 direction register (P7IO), P7 pull-up resistor selection register (P7PU) and P7 open-drain selection register (P7OD). Refer to the port function selection registers for the P7 function selection.
Page 91
MC97F2664 P7FSR (Port 7 Function Selection Register) : 1017H (XSFR) – – – – P7FSR3 P7FSR2 P7FSR1 P7FSR0 – – – – Initial value : 00H P7FSR3 P73 Function Select I/O Port EC6 Function P7FSR2 P72 Function select I/O Port (EC4 function possible when input)
10. Interrupt Controller 10.1 Overview The MC97F2664 supports up to 24 interrupt sources. The interrupts have separate enable register bits associated with them, allowing software control. They can also have four levels of priority assigned to them. The non-maskable interrupt source is always enabled with a higher priority than any other interrupt source, and is not controllable by software.
MC97F2664 10.2 External Interrupt The external interrupt on EINT0~A and EINT10~19 pins receive various interrupt request depending on the external interrupt polarity 0 high/low register (EIPOL0H/L), external interrupt polarity 1 high/low register (EIPOL1H/L), and external interrupt polarity 2 high/low register (EIPOL2H/L), as shown in Figure 10.1. Also each external interrupt source has enable/disable bits.
MC97F2664 10.4 Interrupt Vector Table The interrupt controller supports 24 interrupt sources as shown in the Table 10-2. When interrupt is served, long call instruction (LCALL) is executed and program counter jumps to the vector address. All interrupt requests have their own priority order.
MC97F2664 10.5 Interrupt Sequence An interrupt request is held until the interrupt is accepted or the interrupt latch is cleared to ‘0’ by a reset or an instruction. Interrupt acceptance always generates at last cycle of the instruction. So instead of fetching the current instruction, CPU executes internally LCALL instruction and saves the PC at stack.
MC97F2664 10.6 Effective Timing after Controlling Interrupt Bit Case a) Control Interrupt Enable Register (IE, IE1, IE2, IE3) Interrupt Enable Register command After executing IE set/clear, enable register is effective. Next Instruction Next Instruction Figure 10.4 Effective Timing of Interrupt Enable Register...
MC97F2664 10.7 Multi Interrupt If two requests of different priority levels are received simultaneously, the request of higher priority level is served first. If more than one interrupt request are received, the interrupt polling sequence determines which request is served first by hardware. However, for special features, multi-interrupt processing can be executed by software.
MC97F2664 10.11 Interrupt Timing Interrupt sampled here CLP2 CLP1 CLP2 C1P1 C1P2 C2P1 C2P2 SCLK INT_SRC INTR_ACK LAST_CYC INTR_LCALL 8-Bit interrupt Vector INT_VEC {8’h00, INT_VEC} PROGA Figure 10.10 Timing Chart of Interrupt Acceptance and Interrupt Return Instruction Interrupt sources are sampled at the last cycle of a command. If an interrupt source is detected the lower 8-bit of interrupt vector (INT_VEC) is decided.
Page 101
MC97F2664 10.12.3 External Interrupt Flag Register (EIFLAG0, EIFLAG1, EIFLAG2) The external interrupt flag 0 register (EIFLAG0), external interrupt flag 1 register (EIFLAG1) and external interrupt flag 2 register (EIFLAG2) are set to ‘1’ when the external interrupt generating condition is satisfied. The flag is cleared when the interrupt service routine is executed.
Page 109
MC97F2664 EIFLAG0 (External Interrupt Flag 0 Register) : A3H FLAG7 FLAG6 FLAG5 FLAG4 FLAG3 FLAG2 FLAG1 FLAG0 Initial value : 00H When an External Interrupt 0 ~ 7 is occurred, the flag becomes ‘1’. EIFLAG0[6:5] The flag is cleared by writing ‘0’ to the bit. Writing “1” has no effect.
Page 110
MC97F2664 EIFLAG1 (External Interrupt Flag 1 Register) : A4H FLAG17 FLAG16 FLAG15 FLAG14 FLAG13 FLAG12 FLAG11 FLAG10 Initial value : 00H EIFLAG1[7:0] When an External Interrupt 10 ~ 17 is occurred, the flag becomes ‘1’. The flag is cleared by writing ‘0’ to the bit. So, the flag should be cleared by software.
Page 111
MC97F2664 EIFLAG2(External Interrupt Flag 2 Register) : A5H – – – FLAG19 FLAG18 FLAGA FLAG9 FLAG8 – – – Initial value : 00H EIFLAG2[4:0] When an External Interrupt 8 ~ A/18 ~ 19 is occurred, the flag becomes ‘1’. The flag is cleared by writing ‘0’ to the bit. So, the flag should be cleared by software.
MC97F2664 11. Peripheral Hardware 11.1 Clock Generator 11.1.1 Overview As shown in Figure 11.1, the clock generator produces the basic clock pulses which provide the system clock to be supplied to the CPU and the peripheral hardware. It contains main/sub-frequency clock oscillator. The main/sub clock operation can be easily obtained by attaching a crystal between the XIN/SXIN and XOUT/SXOUT pin, respectively.
MC97F2664 11.1.3 Register Map Table 11-1 Clock Generator Register Map Name Address Default Description SCCR System and Clock Control Register OSCCR Oscillator Control Register 11.1.4 Clock Generator Register Description The clock generator register uses clock control for system operation. The clock generation consists of System and clock control register and oscillator control register.
11.2 Basic Interval Timer 11.2.1 Overview The MC97F2664 has one 8-bit basic interval timer that is free-run and can’t stop. Block diagram is shown in Figure 11.2. In addition, the basic interval timer generates the time base for watchdog timer counting. It also provides a basic interval timer interrupt (BITIFR).
MC97F2664 11.2.3 Register Map Table 11-2 Basic Interval Timer Register Map Name Address Default Description BITCNT Basic Interval Timer Counter Register BITCR Basic Interval Timer Control Register 11.2.4 Basic Interval Timer Register Description The basic interval timer register consists of basic interval timer counter register (BITCNT) and basic interval timer control register (BITCR).
Page 117
MC97F2664 BITCR (Basic Interval Timer Control Register) : 8BH – BITIFR BITCK1 BITCK0 BCLR BCK2 BCK1 BCK0 – Initial value : 01H When BIT Interrupt occurs, this bit becomes ‘1’. For clearing bit, write ‘0’ BITIFR to this bit or auto clear by INT_ACK signal. Writing “1” has no effect.
MC97F2664 11.3 Watch Dog Timer 11.3.1 Overview The watchdog timer rapidly detects the CPU malfunction such as endless looping caused by noise or something like that, and resumes the CPU to the normal state. The watchdog timer signal for malfunction detection can be used as either a CPU reset or an interrupt request.
MC97F2664 11.4 Watch Timer 11.4.1 Overview The watch timer has the function for RTC (Real Time Clock) operation. It is generally used for RTC design. The internal structure of the watch timer consists of the clock source select circuit, timer counter circuit, output select circuit, and watch timer control register.
MC97F2664 11.5 Timer 0/1/2/3 11.5.1 Overview The 8-bit timer 0/1/2/3 consists of multiplexer, timer 0/1/2/3 counter register, timer 0/1/2/3 data register, timer 0/1/2/3 capture data register, and timer 0/1/2/3 control register (TnCNT, TnDR, TnCDR, TnCR). It has three operating modes:...
MC97F2664 11.5.2 8-Bit Timer/Counter Mode The 8-bit timer/counter mode is selected by control register as shown in Figure 11.6. The 8-bit timer have counter and data register. The counter register is increased by internal or external clock input. Timer 0/1/2/3 can use the input clock with one of 2, 4, 8, 32, 128, 512 and 2048 prescaler division rates (TnCK[2:0]).
MC97F2664 11.5.3 8-Bit PWM Mode The timer 0/1/2/3 has a high speed PWM (Pulse Width Modulation) function. In PWM mode, TnO/PWMnO pin outputs up to 8-bit resolution PWM output. This pin should be configured as a PWM output by setting the T0O/PWM0O, T1O/PWM1O,T2O/PWM2O and T3O/PWM3O function by P5FSR0, P5FSR1, P5FSR2, and P5FSR3 bit.
MC97F2664 11.5.4 8-Bit Capture Mode The timer 0/1/2/3 capture mode is set by TnMS[1:0] as ‘1x’. The clock source can use the internal/external clock. Basically, it has the same function as the 8-bit timer/counter mode and the interrupt occurs when TnCNT is equal to TnDR.
MC97F2664 11.5.6 Register Map Table 11-6 Timer 0/1/2/3 Register Map Name Address Default Description TnCNT B3H/B6H/BBH/BEH R Timer n Counter Register TnDR B4H/B7H/BCH/BFH R/W Timer n Data Register TnCDR B4H/B7H/BCH/BFH R Timer n Capture Data Register TnCR B2H/B5H/BAH/BDH R/W Timer n Control Register...
Page 132
MC97F2664 TnCR (Timer n Control Register) : B2H/B5H/BAH/BDH, n=0, 1, 2, and 3 – TnEN TnMS1 TnMS0 TnCK2 TnCK1 TnCK0 TnCC – Initial value : 00H TnEN Control Timer n Timer n disable Timer n enable TnMS[1:0] Control Timer n Operation Mode...
Page 133
MC97F2664 TINTCR(Timer Interrupt Control Register) : 95H T3MIE T2MIE T1MIE T0MIE T3OVIE T2OVIE T1OVIE T0OVIE Initial value : 00H T3MIE Enable or Disable Timer 3Match Interrupt Disable Enable T2MIE Enable or Disable Timer 2 Match Interrupt Disable Enable T1MIE Enable or Disable Timer 1 Match Interrupt...
Page 134
MC97F2664 TIFLAG0(Timer Interrupt Flag Register) : 96H T3OVIFR T3IFR T2OVIFR T2IFR T1OVIFR T1IFR T0OVIFR T0IFR Initial value : 00H When T3 overflow interrupt occurs, this bit becomes ‘1’. The flag T3OVIFR is cleared only by writing a ‘0’ to the bit. So, the flag should be cleared by software.
MC97F2664 11.6 Timer 4/5 11.6.1.1 Overview The 16-bit timer 4/5 consists of multiplexer, timer 4/5 A data register high/low, timer 4/5 B data register high/low and timer 4/5 control register high/low (TnADRH, TnADRL, TnBDRH, TnBDRL, TnCRH, TnCRL). It has four operating modes:...
MC97F2664 11.6.3 16-Bit Capture Mode The 16-bit timer 4/5 capture mode is set by TnMS[1:0] as ‘01’. The clock source can use the internal/external clock. Basically, it has the same function as the 16-bit timer/counter mode and the interrupt occurs when TnCNTH/TnCNTL is equal to TnADRH/TnADRL.
MC97F2664 11.6.4 16-Bit PPG Mode The timer 4/5 has a PPG (Programmable Pulse Generation) function. In PPG mode, TnO/PWMnO pin outputs up to 16-bit resolution PWM output. This pin should be configured as a PWM output by setting P3FSR0,P3FSR1 to ‘1’. The period of the PWM output is determined by the TnADRH/TnADRL. And the duty of the PWM output is determined by the TnBDRH/TnBDRL.
MC97F2664 Repeat Mode(TnMS = 11b) and "Start High"(TnPOL = 0b). Clear and Start Set TnEN Timer n clock Counter TnADRH/L Tn Interrupt 1. TnBDRH/L(5) < TnADRH/L PWMnO B Match A Match 2. TnBDRH/L >= TnADRH/L PWMnO A Match 3. TnBDRH/L = "0000H"...
MC97F2664 11.6.5 Block Diagram 16-bit A Data Register TnADRH/TnADRL A Match Reload TnCC TnEN TnECE TnCK[2:0] INT_ACK Buffer Register A To other block Clear Edge Detector A Match To interrupt TnIFR fx/1 block TnEN Comparator fx/2 A Match Clear fx/4...
Page 142
MC97F2664 11.6.6.1 Timer/Counter 4/5 Register Description The timer/counter 4/5 register consists of timer 4/5 A data high register (TnADRH), timer 4/5 A data low register (TnADRL), timer 4/5 B data high register (TnBDRH), timer 4/5 B data low register (TnBDRL), timer 4/5 control high register (TnCRH) and timer 4/5 control low register (TnCRL).
Page 143
MC97F2664 TnCRH (Timer n Control High Register) : CBH/D3H, n= 4 and 5 – – – – TnEN TnMS1 TnMS0 TnCC – – – – Initial value : 00H TnEN Control Timer n Timer n disable Timer n enable (Counter clear and start)
Page 144
MC97F2664 TnCRL (Timer n Control Low Register) : CAH/D2H, n= 4 and 5 – TnCK2 TnCK1 TnCK0 TnIFR TnPOL TnECE TnCNTR – Initial value : 00H TnCK[2:0] Select Timer n clock source. fx is main system clock frequency TnCK2 TnCK1 TnCK0 Description...
MC97F2664 11.7 Timer 6/7/8/9 11.7.1.1 Overview The 16-bit timer 6/7/8/9 consists of multiplexer, timer 6/7/8/9 A data register high/low, timer 6/7/8/9 B data register high/low and timer 6/7/8/9 control register high/low (TnADRH, TnADRL, TnBDRH, TnBDRL, TnCRH, TnCRL). It has four operating modes:...
MC97F2664 11.7.3 16-Bit Capture Mode The 16-bit timer 6/7/8/9 capture mode is set by TnMS[1:0] as ‘01’. The clock source can use the internal/external clock. Basically, it has the same function as the 16-bit timer/counter mode and the interrupt occurs when TnCNTH/TnCNTL is equal to TnADRH/TnADRL. The TnCNTH, TnCNTL values are automatically cleared by match signal.
MC97F2664 11.7.4 16-Bit PPG Mode The timer 6/7/8/9 has a PPG (Programmable Pulse Generation) function. In PPG mode, TnO/PWMnO pin outputs up to 16-bit resolution PWM output. This pin should be configured as a PWM output by setting P3FSR2,P2FSR0,P2FSR1,P2FSR2 to ‘1’. The period of the PWM output is determined by the TnADRH/TnADRL.
MC97F2664 Repeat Mode(TnMS = 11b) and "Start High"(TnPOL = 0b). Clear and Start Set TnEN Timer n clock Counter TnADRH/L Tn Interrupt 1. TnBDRH/L(5) < TnADRH/L PWMnO B Match A Match 2. TnBDRH/L >= TnADRH/L PWMnO A Match 3. TnBDRH/L = "0000H"...
MC97F2664 11.7.5 Block Diagram 16-bit A Data Register TnADRH/TnADRL A Match Reload TnCC TnEN TnECE TnCK[2:0] TnMIE Buffer Register A To other block Clear Edge To interrupt Detector A Match block TnIFR fx/1 TnEN Comparator fx/2 A Match Clear fx/4...
Page 152
MC97F2664 11.7.6.1 Timer/Counter 6/7/8/9 Register Description The timer/counter 6/7/8/9 register consists of timer 6/7/8/9 A data high register (TnADRH), timer 6/7/8/9 A data low register (TnADRL), timer 6/7/8/9 B data high register (TnBDRH), timer 6/7/8/9 B data low register (TnBDRL), timer 6/7/8/9 control high register (TnCRH), timer 6/7/8/9 control low register (TnCRL), and timer interrupt flag register(TIFLAG1).
Page 153
MC97F2664 TnCRH (Timer n Control High Register) : DBH/E3H/EBH/1059H (SFR/SFR/SFR/XSFR), n= 6, 7, 8, and 9 – – – TnEN TnMIE TnMS1 TnMS0 TnCC – – – Initial value : 00H TnEN Control Timer n Timer n disable Timer n enable (Counter clear and start)
Page 154
MC97F2664 TnCRL (Timer n Control Low Register) : DAH/E2H/EAH/1058H (SFR/SFR/SFR/XSFR), n= 6, 7, 8, and 9 – – TnCK2 TnCK1 TnCK0 TnPOL TnECE TnCNTR – – Initial value : 00H TnCK[2:0] Select Timer n clock source. fx is main system clock frequency...
Page 155
MC97F2664 TIFLAG1(Timer Interrupt Flag 1 Register) : 97H – – – – T9IFR T8IFR T7IFR T6IFR – – – – Initial value : 00H When T9 interrupt occurs, this bit becomes ‘1’ The flag is cleared T9IFR only by writing a ‘0’ to the bit. So, the flag should be cleared by software.
MC97F2664 11.8 Buzzer Driver 11.8.1 Overview The Buzzer consists of 6 bit counter, buzzer data register (BUZDR), and buzzer control register (BUZCR). The Square Wave (244.140Hz~125.0 kHz @f = 2MHz) is outputted through P33/BUZO pin. In buzzer data register (BUZDR),BUZDR[5:0] controls the buzzer frequency (look at the following expression) and BUZDIV[1:0] selects divided by DIV block .
11.9 SPI 2/3 11.9.1 Overview There is serial peripheral interface (SPI 2/3) one channel in MC97F2664. The SPI 2/3 allows synchronous serial data transfer between the external serial devices. It can do Full-duplex communication by 4-wire (MOSI2/3, MISO2/3, SCK2/3, SS2/3), support master/slave mode, can select serial clock (SCK2/3) polarity, phase and whether LSB first data transfer or MSB first data transfer.
Page 160
MC97F2664 11.9.3 Data Transmit / Receive Operation User can use SPI 2/3 for serial data communication by following step 1. Select SPI 2/3 operation mode(master/slave, polarity, phase) by control register SPInCR. 2. When the SPI 2/3 is configured as a Master, it selects a Slave by SS2/3 signal (active low).
MC97F2664 11.9.6 Register Map Table 11-13 SPI 2/3 Register Map Name Address Default Description SPInSR C4H/C7H SPI n Status Register SPInDR C3H/C6H SPI n Data Register SPInCR C2H/C5H SPI n Control Register 11.9.7 SPI 2/3 Register Description The SPI 2/3 register consists of SPI 2/3 control register (SPInCR), SPI 2/3 status register (SPInSR) and SPI 2/3 data register (SPInDR) 11.9.8 Register Description for SPI 2/3...
Page 163
MC97F2664 SPInSR (SPI 2/3 Status Register) : C4H/C7H, n= 2, 3 – – – SPIInFR WCOLn SS_HIGHn FXCHn SPInSSEN – – – Initial value : 00H When SPI 2/3 Interrupt occurs, this bit becomes ‘1’. If SPI 2/3 interrupt is SPIIFRn enable, this bit is auto cleared by INT_ACK signal.
Page 164
MC97F2664 SPInCR (SPI 2/3 Control Register) : C2H/C5H, n= 2, 3 SPInEN FLSBn SPInMS CPOLn CPHAn SPInDSCR SPInSCR1 SPInSCR0 Initial value : 00H SPInEN This bit controls the SPI 2/3 operation Disable SPI 2/3 operation Enable SPI 2/3 operation FLSBn...
MC97F2664 11.10 UART2/3/4 11.10.1 Overview The universal asynchronous serial receiver and transmitter (UART2/3/4) is a highly flexible serial communication device. The main features are listed below. - Full Duplex Operation (Independent Serial Receive and Transmit Registers) - Baud Rate Generator...
MC97F2664 11.10.3 Clock Generation UARTnBD U2Xn SCLK (UARTnBD+1) Baud Rate SCLK Generator txclk rxclk Figure 11.35 Clock Generation Block Diagram (where n = 2,3, and 4) The clock generation logic generates the base clock for the transmitter and receiver. Following table shows equations for calculating the baud rate (in bps).
MC97F2664 11.10.4 Data format A serial frame is defined to be one character of data bits with synchronization bits (start and stop bits), and optionally a parity bit for error detection. The UART2/3/4 supports all 30 combinations of the following as valid frame formats.
Page 169
MC97F2664 11.10.6 UART2/3/4 Transmitter The UART2/3/4 transmitter is enabled by setting the TXEn bit in UARTnCR2 register. When the Transmitter is enabled, the TXDn pin should be set to TXDn function for the serial output pin of UART2/3/4 by the P4FSR3/ P4FSR4/P2FSR3.
Page 170
MC97F2664 11.10.6.3 Parity Generator The parity generator calculates the parity bit for the serial frame data to be sent. When parity bit is enabled (UnPM[1]=1), the transmitter control logic inserts the parity bit between the MSB and the first stop bit of the frame to be sent.
Page 171
MC97F2664 11.10.7.2 Receiver Flag and Interrupt The UART2/3/4 receiver has one flag that indicates the receiver state. The receive complete (RXCn) flag indicates whether there are unread data in the receive buffer. This flag is set when there are unread data in the receive buffer and cleared when the receive buffer is empty. If the receiver is disabled (RXEn=0), the receiver buffer is flushed and the RXCn flag is cleared.
MC97F2664 11.10.7.5 Asynchronous Data Reception To receive asynchronous data frame, the UART includes a clock and data recovery unit. The clock recovery logic is used for synchronizing the internally generated baud-rate clock to the incoming asynchronous serial frame on the RXDn pin.
MC97F2664 The process for detecting stop bit is like clock and data recovery process. That is, if 2 or more samples of 3 center values have high level, correct stop bit is detected, else a frame error (FEn) flag is set. After deciding whether the first stop bit is valid or not, the Receiver goes to idle state and monitors the RXD line to check a valid high to low transition is detected (start bit detection).
Page 174
MC97F2664 UARTnDR (UARTn Data Register) : 103DH/1045H/104DH (XSFR), Where n = 2, 3, and 4 UARTnDR7 UARTnDR6 UARTnDR5 UARTnDR4 UARTnDR3 UARTnDR2 UARTnDR1 UARTnDR0 Initial value : 00H UARTnDR [7:0] The UARTn Transmit Buffer and Receive Buffer share the same I/O address with this DATA register.
Page 175
MC97F2664 UARTnCR2 (UARTn Control Register 2) : 1039H/1041H/1049H (XSFR), Where n = 2, 3, and 4 UDRIEn TXCIEn RXCIEn WAKEIEn TXEn RXEn UARTnEN U2Xn Initial value : 00H UDRIEn Interrupt enable bit for UARTn Data Register Empty Interrupt from UDREn is inhibited (use polling)
Page 176
MC97F2664 UARTnCR3 (UARTn Control Register 3) : 103AH/1042H/104AH (XSFR), Where n = 2, 3, and 4 LOOPSn USBSn UnTX8 UnRX8 Initial value : 00H LOOPSn Controls the Loop Back Mode of UARTn, for test mode Normal operation Loop Back mode USBSn Selects the length of stop bit.
Page 177
MC97F2664 UARTnST (UARTn Status Register) : 103BH/1043H/104BH (XSFR), Where n = 2, 3, and 4 UDREn TXCn RXCn WAKEn SOFTRSTn DORn Initial value : 80H UDREn The UDREn flag indicates if the transmit buffer (UARTnDR) is ready to receive new data. If UDREn is ‘1’, the buffer is empty and ready to be written.
MC97F2664 11.11 USI0/1 (UART + SPI + I2C) 11.11.1 Overview The USI0/1 consists of USI0/1 control register1/2/3/4, USI0/1 status register 1/2, USI0/1 baud-rate generation register, USI0/1 data register, USI0/1 SDA hold time register, USI0/1 SCL high period register, USI0/1 SCL low period register, and USI0/1 slave address register (USInCR1, USInCR2, USInCR3, USInCR4, USInST1, USInST2, USInBD, USInDR, USInSDHR, USInSCHR, USInSCLR, USInSAR).
Page 180
MC97F2664 11.11.2 USI0/1 UART Mode The universal synchronous and asynchronous serial receiver and transmitter (UART) is a highly flexible serial communication device. The main features are listed below. - Full Duplex Operation (Independent Serial Receive and Transmit Registers) - Asynchronous or Synchronous Operation...
MC97F2664 11.11.4 USI0/1 Clock Generation USInBD DBLSn SCLK (USInBD+1) Prescaling Up-Counter txclk SCLK MASTERn Edge Sync Register USInMS[1:0] Detector CPOLn SCKn rxclk Figure 11.41 Clock Generation Block Diagram (USIn, where n = 0 and 1) The clock generation logic generates the base clock for the transmitter and receiver. The USI0/1 supports four modes of clock operation and those are normal asynchronous, double speed asynchronous, master synchronous and slave synchronous mode.
MC97F2664 11.11.5 USI0/1 External Clock (SCKn) External clocking is used in the synchronous mode of operation. External clock input from the SCKn pin is sampled by a synchronization logic to remove meta-stability. The output from the synchronization logic must be passed through an edge detector before it is used by the transmitter and receiver.
MC97F2664 11.11.7 USI0/1 UART Data format A serial frame is defined to be one character of data bits with synchronization bits (start and stop bits), and optionally a parity bit for error detection. The UART supports all 30 combinations of the following as valid frame formats.
Page 185
MC97F2664 11.11.9 USI0/1 UART Transmitter The UART transmitter is enabled by setting the TXEn bit in USInCR2 register. When the Transmitter is enabled, the TXDn pin should be set to TXDn function for the serial output pin of UART by the P6FSR2/P4FSR0. The baud-rate, operation mode and frame format must be setup once before doing any transmission.
Page 186
MC97F2664 11.11.9.3 USI0/1 UART Parity Generator The parity generator calculates the parity bit for the serial frame data to be sent. When parity bit is enabled (USInPM1=1), the transmitter control logic inserts the parity bit between the MSB and the first stop bit of the frame to be sent.
Page 187
MC97F2664 11.11.10.2 USI0/1 UART Receiver Flag and Interrupt The UART receiver has one flag that indicates the receiver state. The receive complete (RXCn) flag indicates whether there are unread data in the receive buffer. This flag is set when there are unread data in the receive buffer and cleared when the receive buffer is empty. If the receiver is disabled (RXEn=0), the receiver buffer is flushed and the RXCn flag is cleared.
MC97F2664 11.11.10.5 USI0/1 Asynchronous Data Reception To receive asynchronous data frame, the UART includes a clock and data recovery unit. The clock recovery logic is used for synchronizing the internally generated baud-rate clock to the incoming asynchronous serial frame on the RXDn pin.
MC97F2664 The process for detecting stop bit is like clock and data recovery process. That is, if 2 or more samples of 3 center values have high level, correct stop bit is detected, else a frame error (FEn) flag is set. After deciding whether the first stop bit is valid or not, the Receiver goes to idle state and monitors the RXDn line to check a valid high to low transition is detected (start bit detection).
MC97F2664 11.11.11 USI0/1 SPI Mode The USI0/1 can be set to operate in industrial standard SPI compliant mode. The SPI mode has the following features. - Full Duplex, Three-wire synchronous data transfer - Mater and Slave Operation - Supports all four SPI0 modes of operation (mode 0, 1, 2, and 3)
MC97F2664 SCKn (CPOLn=0) SCKn (CPOLn=1) SAMPLE MOSIn MSB First … BIT7 BIT6 BIT2 BIT1 BIT0 LSB First … BIT0 BIT1 BIT5 BIT6 BIT7 MISOn /SSn OUT (MASTER) /SSn IN (SLAVE) Figure 11.47 USI0/1 SPI Clock Formats when CPHAn=0 (where n = 0 and 1) When CPHAn=0, the slave begins to drive its MISOn output with the first data bit value when SSn goes to active low.
MC97F2664 SCKn (CPOLn=0) SCKn (CPOLn=1) SAMPLE MOSIn … MSB First BIT7 BIT6 BIT2 BIT1 BIT0 … LSB First BIT0 BIT1 BIT5 BIT6 BIT7 MISOn /SSn OUT (MASTER) /SSn IN (SLAVE) Figure 11.48 USI0/1 SPI Clock Formats when CPHAn=1 (where n = 0 and 1) When CPHAn=1, the slave begins to drive its MISOn output when SSn goes active low, but the data is not defined until the first SCKn edge.
MC97F2664 11.11.14 USI0/1 I2C Mode The USI0/1 can be set to operate in industrial standard serial communication protocols mode. The I2C mode uses 2 bus lines serial data line (SDAn) and serial clock line (SCLn) to exchange data. Because both SDAn and SCLn lines are open-drain output, each line needs pull-up resistor.
MC97F2664 11.11.16 USI0/1 I2C Start / Repeated Start / Stop One master can issue a START (S) condition to notice other devices connected to the SCLn, SDAn lines that it will use the bus. A STOP (P) condition is generated by the master to release the bus lines so that other devices can use it.
MC97F2664 11.11.18 USI0/1 I2C Acknowledge The acknowledge related clock pulse is generated by the master. The transmitter releases the SDAn line (HIGH) during the acknowledge clock pulse. The receiver must pull down the SDAn line during the acknowledge clock pulse so that it remains stable LOW during the HIGH period of this clock pulse. When a slave is addressed by a master (Address Packet), and if it is unable to receive or transmit because it’s performing some real time...
MC97F2664 Wait High Start High Counting Counting Fast Device SCLOUT High Counter Reset Slow Device SCLOUT SCLn Figure 11.54 Clock Synchronization during Arbitration Procedure (USIn, where n = 0 and 1) Arbitration Process Device 1 loses Device1 outputs not adapted...
Page 198
MC97F2664 11.11.20.1 USI0/1 I2C Master Transmitter To operate I2C in master transmitter, follow the recommended steps below. Enable I2C by setting USInMS[1:0] bits in USInCR1 and USInEN bit in USInCR2. This provides main clock to the peripheral. Load SLAn+W into the USInDR where SLAn is address of slave device and W is transfer direction from the viewpoint of the master.
MC97F2664 The next figure depicts above process for master transmitter operation of I2C. Master S or Sr SLA+R Receiver SLA+W 0x86 0x22 STOP 0x0E 0x87 LOST DATA STOP LOST LOST& Slave Receiver (0x1D) 0x0F 0x1D 0x1F or Transmitter (0x1F) 0x46...
Page 200
MC97F2664 11.11.20.2 USI0/1 I2C Master Receiver To operate I2C in master receiver, follow the recommended steps below. Enable I2C by setting USInMS[1:0] bits in USInCR1 and USInEN bit in USInCR2. This provides main clock to the peripheral. Load SLAn+R into the USInDR where SLA is address of slave device and R is transfer direction from the viewpoint of the master.
MC97F2664 This is the final step for master receiver function of I2C, handling STOP interrupt. The STOP bit indicates that data transfer between master and slave is over. To clear USInST2, write any value to USInST2. After this, I2C enters idle state.
Page 202
MC97F2664 11.11.20.3 USI0/1 I2C Slave Transmitter To operate I2C in slave transmitter, follow the recommended steps below. If the main operating clock (SCLK) of the system is slower than that of SCLn, load value 0x00 into USInSDHR to make SDAn change within one system clock period from the falling edge of SCLn. Note that the hold time of SDAn is calculated by SDAH x period of SCLK where SDAH is multiple of number of SCLK coming from USInSDHR.
MC97F2664 The next figure shows flow chart for handling slave transmitter function of I2C. IDLE S or Sr SLA+R GCALL 0x97 0x1F LOST& 0x17 DATA 0x22 STOP 0x47 0x46 IDLE From master to slave / Interrupt, SCLn line is held low...
Page 204
MC97F2664 11.11.20.4 USI0/1 I2C Slave Receiver To operate I2C in slave receiver, follow the recommended steps below. 1. If the main operating clock (SCLK) of the system is slower than that of SCLn, load value 0x00 into USInSDHR to make SDAn change within one system clock period from the falling edge of SCLn. Note that the hold time of SDAn is calculated by SDAH x period of SCLK where SDAH is multiple of number of SCLK coming from USInSDHR.
MC97F2664 The process can be depicted as following figure when I2C operates in slave receiver mode. IDLE S or Sr SLA+W GCALL 0x95 0x1D LOST& 0x15 DATA 0x20 STOP 0x44 0x45 IDLE From master to slave / Interrupt, SCLn line is held low...
MC97F2664 11.11.22 Register Map Table 11-19 USI0/1 Register Map (where n = 0 and 1) Name Address Default Description USInBD 1022H/1032H (XSFR) USIn Baud Rate Generation Register USInDR 1024H/1034H (XSFR) USIn Data Register USInSDHR 1023H/1033H (XSFR) USIn SDA Hold Time Register...
Page 208
MC97F2664 USInDR (USI0/1 Data Register: For UART, SPI, and I2C mode) : 1024H/1034H (XSFR), n = 0, 1 USInDR7 USInDR 6 USInDR 5 USInDR 4 USInDR 3 USInDR 2 USInDR 1 USInDR 0 Initial value : 00H USInDR[7:0] The USIn transmit buffer and receive buffer share the same I/O address with this DATA register.
Page 209
MC97F2664 USInSCLR (USI0/1 SCL Low Period Register: For I2C mode) : 1025H/1035H (XSFR), n = 0, 1 USInSCLR7 USInSCLR6 USInSCLR5 USInSCLR 4 USInSCLR 3 USInSCLR 2 USInSCLR 1 USInSCLR 0 Initial value : 3FH USInSCLR[7:0] This register defines the high period of SCL when it operates in I2C master mode.
Page 210
MC97F2664 USInCR1 (USI0/1 Control Register 1: For UART, SPI, and I2C mode) : 1018H/1028H (XSFR), n = 0, 1 USInS1 USInS0 USInMS1 USInMS0 USInPM1 USInPM0 USInS2 CPOLn ORDn CPHAn Initial value : 00H USInMS[1:0] Selects operation mode of USIn USInMS1...
Page 211
MC97F2664 USInCR2 (USI0/1 Control Register 2: For UART, SPI, and I2C mode) : 1019H/1029H (XSFR), n = 0, 1 DRIEn TXCIEn RXCIEn WAKEIEn TXEn RXEn USInEN DBLSn Initial value : 00H DRIEn Interrupt enable bit for data register empty (only UART and SPI mode).
Page 212
MC97F2664 USInCR3 (USI0/1 Control Register 3: For UART, SPI, and I2C mode) : 101AH/102AH (ESFR), n = 0, 1 MASTERn LOOPSn DISSCKn USInSSEN FXCHn USInSB USInTX8 USInRX8 Initial value : 00H MASTERn Selects master or slave in SPI and synchronous mode operation and controls the direction of SCKn pin Slave mode operation (External clock for SCK).
Page 213
MC97F2664 USInCR4 (USI0/1 Control Register 4: For I2C mode) : 101BH/102BH (XSFR), n = 0, 1 – IICnIFR TXDLYENBn IICnIE ACKnEN IMASTERn STOPCn STARTCn – Initial value : 00H IICnIFR This is an interrupt flag bit for I2C mode. When an interrupt occurs, this bit becomes ‘1’.
Page 214
MC97F2664 USInST1 (USI0/1 Status Register 1: For UART and SPI mode) : 1020H/1030H (XSFR), n = 0, 1 DREn TXCn RXCn WAKEn USInRST DORn Initial value : 80H DREn The DREn flag indicates if the transmit buffer (USInDR) is ready to receive new data.
Page 215
MC97F2664 USInST2 (USI0/1 Status Register 2: For I2C mode) : 1021H/1031H (XSFR), n = 0, 1 GCALLn TENDn STOPDn SSELn MLOSTn BUSYn TMODEn RXACKn Initial value : 00H (NOTE) GCALLn This bit has different meaning depending on whether I2C is master or slave.
MC97F2664 11.13 12-Bit A/D Converter 11.13.1 Overview The analog-to-digital converter (A/D) allows conversion of an analog input signal to corresponding 12-bit digital value. The A/D module has fifteen analog inputs. The output of the multiplexer is the input into the converter which generates the result through successive approximation.
MC97F2664 11.13.3 Block Diagram TRIG[2:0] ADST T4 match signal T5 match signal Start T6 match signal T7 match signal ADSEL[3:0] CKSEL[1:0] T8 match signal (Select one input pin T9 match signal of the assigned pins) fx/1 fx/2 Clear fx/4 fx/8...
MC97F2664 SET ADCCRH Select ADC Clock and Data Align Bit. SET ADCCRL ADC enable & Select AN Input Channel. Converting START Start ADC Conversion. If Conversion is completed, AFLAG is set “1” and ADC AFLAG = 1? interrupt is occurred.
Page 221
MC97F2664 11.13.7 Register Description for ADC ADCDRH (A/D Converter Data High Register) : 1053H (XSFR) ADDM11 ADDM10 ADDM9 ADDM8 ADDM7 ADDM6 ADDM5 ADDM4 ADDL11 ADDL10 ADDL9 ADDL8 Initial value : xxH ADDM[11:4] MSB align, A/D Converter High Data (8-bit) ADDL[11:8]...
Page 222
MC97F2664 ADCCRH (A/D Converter High Register) : 1051H (XSFR) – ADCIFR TRIG2 TRIG1 TRIG0 ALIGN CKSEL1 CKSEL0 – Initial value : 00H When ADC interrupt occurs, this bit becomes ‘1’. For clearing bit, ADCIFR write ‘0’ to this bit or auto clear by INT_ACK signal. Writing “1” has no effect.
Page 223
MC97F2664 ADCCRL (A/D Converter Counter Low Register) : 1050H (XSFR) STBY ADST REFSEL AFLAG ADSEL3 ADSEL2 ADSEL1 ADSEL0 Initial value : 00H STBY Control Operation of A/D (The ADC module is automatically disabled at stop mode) ADC module disable ADC module enable ADST Control A/D Conversion start.
12. Power Down Operation 12.1 Overview The MC97F2664 has two power-down modes to minimize the power consumption of the device. In power down mode, power consumption is reduced considerably. The device provides three kinds of power saving functions, Main-IDLE, Sub-IDLE and STOP mode. In three modes, program is stopped.
MC97F2664 12.3 IDLE Mode The power control register is set to ‘01h’ to enter the IDLE Mode. In this mode, the internal oscillation circuits remain active. Oscillation continues and peripherals are operated normally but CPU stops. It is released by reset or interrupt.
MC97F2664 12.4 STOP Mode The power control register is set to ‘03H’ to enter the STOP Mode. In the stop mode, the selected oscillator, system clock and peripheral clock is stopped, but watch timer can be continued to operate with sub clock. With the clock frozen, all functions are stopped, but the on-chip RAM and control registers are held.
MC97F2664 12.5 Release Operation of STOP Mode After STOP mode is released, the operation begins according to content of related interrupt register just before STOP mode start (Figure 12.3). If the global interrupt Enable Flag (IE.EA) is set to `1`, the STOP mode is released by the interrupt which each interrupt enable flag = `1` and the CPU jumps to the relevant interrupt service routine.
MC97F2664 12.5.1 Register Map Table 12-2 Power Down Operation Register Map Name Address Default Description PCON Power Control Register 12.5.2 Power Down Operation Register Description The power down operation register consists of the power control register (PCON). 12.5.3 Register Description for Power Down Operation PCON (Power Control Register) : 87H –...
Control Register Refer to the Peripheral Registers 13.2 Reset Source The MC97F2664 has five types of reset sources. The following is the reset sources. - External RESETB - Power ON RESET (POR) - WDT Overflow Reset (In the case of WDTEN = `1`)
MC97F2664 13.4 RESET Noise Canceller The Figure 13.2 is the noise canceller diagram for noise cancellation of RESET. It has the noise cancellation value of about 2us (@V =5V) to the low input of system reset. t < T t < T t >...
MC97F2664 Counting for config read start after POR is released Internal nPOR PAD RESETB “H” LVR_RESETB .. 27 28 BIT (for Config) 00 01 02 03 BIT (for Reset) 1us X 256 X 28h = about 10ms Config Read 1us X 4096 X 4h = about 16ms...
MC97F2664 Table 13-2 Boot Process Description Process Description Remarks ① -No Operation ② -1st POR level Detection -about 1.4V - (INT-OSC 16MHz/16)x256x28h Delay section (=10ms) ③ -Slew Rate 0.15V/ms -VDD input voltage must rise over than flash operating voltage for Config read -about 1.5V ~ 1.6V...
MC97F2664 13.6 External RESETB Input The External RESETB is the input to a Schmitt trigger. If RESETB pin is held with low for at least 10us over within the operating voltage range and stable oscillation, it is applied and the internal state is initialized. After reset state becomes ‘1’, it needs the stabilization time with 16ms and after the stable state, the internal RESET...
13.7 Brown Out Detector Processor The MC97F2664 has an On-chip brown-out detection circuit (BOD) for monitoring the VDD level during operation by comparing it to a fixed trigger level. The trigger level for the BOD can be selected by LVRVS[3:0] bit to be 1.60V/ 2.00V/ 2.10V/ 2.20V/2.32V/ 2.44V/ 2.59V/ 2.75V/ 2.93V/ 3.14V/ 3.38V/ 3.67V/ 4.00V/ 4.40V.
MC97F2664 “H” “H” Internal nPOR “H” PAD RESETB LVR_RESETB ..27 28 BIT (for Config) 00 01 02 BIT (for Reset) 1us X 256 X 28h = about 10ms Config Read 1us X 4096 X 4h = about 16ms...
MC97F2664 13.8.1 Register Map Table 13-3 Reset Operation Register Map Name Address Default Description RSTFR Reset Flag Register LVRCR Low Voltage Reset Control Register LVICR Low Voltage Indicator Control Register 13.8.2 Reset Operation Register Description The reset control register consists of the reset flag register (RSTFR), low voltage reset control register (LVRCR), and low voltage indicator control register (LVICR).
Page 237
MC97F2664 LVRCR (Low Voltage Reset Control Register) : D8H – – LVRST LVRVS3 LVRVS2 LVRVS1 LVRVS0 LVREN – – Initial value : 00H LVRST LVR Enable when Stop Release Not effect at stop release LVR enable at stop release NOTES) When this bit is ‘1’, the LVREN bit is cleared to ‘0’...
Page 238
MC97F2664 LVICR (Low Voltage Indicator Control Register) : 86H – – LVIF LVIEN LVILS3 LVILS2 LVILS1 LVILS0 – – Initial value : 00H LVIF Low Voltage Indicator Flag Bit No detection Detection LVIEN LVI Enable/Disable Disable Enable LVILS[3:0] LVI Level Select...
14.1 Overview 14.1.1 Description On-chip debug system (OCD2) of MC97F2664 can be used for programming the non-volatile memories and on- chip debugging. Detail descriptions for programming via the OCD2 interface can be found in the following chapter. Figure 14.1 shows a block diagram of the OCD2 interface and the On-chip Debug system.
MC97F2664 14.2 Two-Pin External Interface 14.2.1 Basic Transmission Packet • 10-bit packet transmission using two-pin interface. • 1-packet consists of 8-bit data, 1-bit parity and 1-bit acknowledge. • Parity is even of ‘1’ for 8-bit data in transmitter. • Receiver generates acknowledge bit as ‘0’ when transmission for 8-bit data and its parity has no error.
MC97F2664 14.2.2 Packet Transmission Timing 14.2.2.1 Data Transfer DSDA acknowledgement acknowledgement signal from receiver signal from receiver DSCL START STOP Figure 14.3 Data Transfer on the Twin Bus 14.2.2.2 Bit Transfer DSDA DSCL data line change stable: of data data valid...
MC97F2664 14.2.2.3 Start and Stop Condition DSDA DSDA DSCL DSCL START condition STOP condition Figure 14.5 Start and Stop Condition 14.2.2.4 Acknowledge Bit Data output by transmitter no acknowledge Data output By receiver acknowledge DSCL from master clock pulse for acknowledgement Figure 14.6 Acknowledge on the Serial Bus...
MC97F2664 Acknowledge bit Acknowledge bit transmission transmission Minimum wait HIGH start HIGH 500ns Host PC DSCL OUT Start wait Target Device DSCL OUT minimum 1 T SCLK for next byte Maximum 5 T SCLK transmission DSCL Internal Operation Figure 14.7 Clock Synchronization during Wait Procedure...
MC97F2664 14.2.3 Connection of Transmission Two-pin interface connection uses open-drain (wire-AND bidirectional I/O). pull resistors DSDA(Debugger Serial Data Line) DSCL(Debugger Serial Clock Line) RUNFLAG RUNFLAG DSCL DSDA RUNFLAG DSCL DSDA DSDA DSDA RUNFLAG DSCL RUNFLAG DSCL Target Device(Slave) Host Machine(Master) Current source for DSCL to fast 0 to 1 transition in high speed mode Figure 14.8 Connection of Transmission...
15.1 Overview 15.1.1 Description MC97F2664 incorporates flash memory to which a program can be written, erased, and overwritten while mounted on the board. The flash memory can be read by ‘MOVC’ instruction and it can be programmed in OCD2, serial ISP mode or user program mode.
Page 249
MC97F2664 FMCR (Flash Mode Control Register) : FEH – – – – FMBUSY FMCR2 FMCR1 FMCR0 – – – – Initial value : 00H FMBUSY Flash Mode Busy Bit. This bit will be used for only debugger. No effect when “1” is written...
Page 250
15.1.7 Protection Area (User program mode) MC97F2664 can program its own flash memory (protection area). The protection area can not be erased or programmed. The protection areas are available only when the PAEN bit is cleared to ‘0’, that is, enable protection area at the configure option 2 if it is needed.
Page 251
MC97F2664 15.1.8 Erase Mode The sector erase program procedure in user program mode 1. Page buffer clear (FMCR=0x01) 2. Write ‘0’ to page buffer 3. Set flash sector address register (FSADRH/FSADRM/FSADRL). 4. Set flash identification register (FIDR). 5. Set flash mode control register (FMCR).
Page 252
MC97F2664 The Byte erase program procedure in user program mode 1. Page buffer clear (FMCR=0x01) 2. Write ‘0’ to page buffer 3. Set flash sector address register (FSADRH/FSADRM/FSADRL). 4. Set flash identification register (FIDR). 5. Set flash mode control register (FMCR).
Page 253
MC97F2664 15.1.9 Write Mode The sector Write program procedure in user program mode 1. Page buffer clear (FMCR=0x01) 2. Write data to page buffer 3. Set flash sector address register (FSADRH/FSADRM/FSADRL). 4. Set flash identification register (FIDR). 5. Set flash mode control register (FMCR).
Page 254
MC97F2664 The Byte Write program procedure in user program mode 1. Page buffer clear (FMCR=0x01) 2. Write data to page buffer 3. Set flash sector address register (FSADRH/FSADRM/FSADRL). 4. Set flash identification register (FIDR). 5. Set flash mode control register (FMCR).
Page 255
MC97F2664 15.1.10 Read Mode The Reading program procedure in user program mode 1. Load receive data from flash memory on MOVC instruction by indirectly addressing mode. Program Tip – reading A,#0 DPH,#0x7F DPL,#0x40 ;flash memory address MOVC A,@A+DPTR ;read data from flash memory 15.1.11 Hard Lock Mode...
MC97F2664 16. Configure Option 16.1 Configure Option Control The data for configure option should be written in the configure option area (003EH – 003FH) by programmer (Writer tools). CONFIGURE OPTION 1 : ROM Address 003FH – – – – VAPEN...
MC97F2664 17. APPENDIX A. Instruction Table Instructions are either 1, 2 or 3 bytes long as listed in the ‘Bytes’ column below. Each instruction takes either 1, 2 or 4 machine cycles to execute as listed in the following table. 1 machine cycle comprises 2 system clock cycles.
Page 258
MC97F2664 XRL A, @Ri Exclusive-OR indirect memory to A 66-67 XRL A,#data Exclusive-OR immediate to A XRL dir,A Exclusive-OR A to direct byte XRL dir,#data Exclusive-OR immediate to direct byte CLR A Clear A CPL A Complement A SWAP A...
Page 259
MC97F2664 ANL C,bit AND direct bit to carry ANL C,/bit AND direct bit inverse to carry ORL C,bit OR direct bit to carry ORL C,/bit OR direct bit inverse to carry MOV C,bit Move direct bit to carry MOV bit,C...
Need help?
Do you have a question about the MC97F2664 and is the answer not in the manual?
Questions and answers