Part Number Hot Search : 
RLZ12B 86A125 28SCF BTA12C CFWM455D B4402 TA7758P MP11A
Product Description
Full Text Search
 

To Download HD64F2110BV Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  regarding the change of names mentioned in the document, such as hitachi electric and hitachi xx, to renesas technology corp. the semiconductor operations of mitsubishi electric and hitachi were transferred to renesas technology corporation on april 1st 2003. these operations include microcomputer, logic, analog and discrete devices, and memory chips other than drams (flash memory, srams etc.) accordingly, although hitachi, hitachi, ltd., hitachi semiconductors, and other hitachi brand names are mentioned in the document, these names have in fact all been changed to renesas technology corp. thank you for your understanding. except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. renesas technology home page: http://www.renesas.com renesas technology corp. customer support dept. april 1, 2003 to all our customers
cautions keep safety first in your circuit designs! 1. renesas technology corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. notes regarding these materials 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corporation product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corporation or a third party. 2. renesas technology corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corporation or an authorized renesas technology corporation product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corporation assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corporation by various means, including the renesas technology corporation semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corporation or an authorized renesas technology corporation product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corporation is n ecessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corporation for further details on these materials or the products contained therein.
hitachi 16-bit single-chip microcomputer h8s/2110b h8s/2110b f-ztat tm HD64F2110BV hardware manual ade-602-298 rev. 1.0 09/19/02 hitachi, ltd.
rev. 1.0, 09/02, page ii of xxx cautions 1. hitachi neither warrants nor grants licenses of any rights of hitachis or any third partys patent, copyright, trademark, or other intellectual property rights for information contained in this document. hitachi bears no responsibility for problems that may arise with third partys rights, including intellectual property rights, in connection with use of the information contained in this document. 2. products and product specifications may be subject to change without notice. confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. hitachi makes every attempt to ensure that its products are of high quality and reliability. however, contact hitachis sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. design your application so that the product is used within the ranges guaranteed by hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the hitachi product. 5. this product is not designed to be radiation resistant. 6. no one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from hitachi. 7. contact hitachis sales office for any questions regarding this document or hitachi semiconductor products.
rev. 1.0, 09/02, page iii of xxx general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the products state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pin. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the systems operation is not guaranteed if they are accessed.
rev. 1.0, 09/02, page iv of xxx configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents. for details, see the actual locations in this manual. 11. index
rev. 1.0, 09/02, page v of xxx preface the h8s/2110b is a microcomputer (mcu) made up of the h8s/2000 cpu employing hitachis original architecture as its core, and the peripheral functions required to configure a system. the h8s/2000 cpu has an internal 32-bit configuration, sixteen 16-bit general registers, and a simple and optimized instruction set for high-speed operation. the h8s/2000 cpu can handle a 16-mbyte linear address space. this lsi is equipped with rom, ram, a 14-bit pwm timer (pwmx), a 16-bit free-running timer (frt), an 8-bit timer (tmr), a watchdog timer (wdt), a serial communication interface (sci), a keyboard buffer controller, a host interface lpc interface (lpc), an i 2 c bus interface (iic), and i/o ports as on-chip peripheral modules, required for system configuration. a flash memory (f-ztat tm *) version is available for this lsi's rom. this provides flexibility as it can be reprogrammed in no time to cope with all situations from the early stages of mass production to full-scale mass production. this is particularly applicable to application devices with specifications that will most probably change. note: * f-ztat tm is a trademark of hitachi, ltd. target users: this manual was written for users who will be using the h8s/2110b in the design of application systems. target users are expected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the hardware functions and electrical characteristics of the h8s/2110b to the target users. refer to the h8s/2600 series, h8s/2000 series programming manual for a detailed description of the instruction set. notes on reading this manual: in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, peripheral functions and electrical characteristics. in order to understand the details of the cpu's functions read the h8s/2600 series, h8s/2000 series programming manual. in order to understand the details of a register when its name is known read the index that is the final part of the manual to find the page number of the entry on the register. the addresses, bits, and initial values of the registers are summarized in section 20, list of registers.
rev. 1.0, 09/02, page vi of xxx rules: register name: the following notation is used for cases when the same or a similar function, e.g. serial communication interface, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb is on the left and the lsb is on the right. number notation: binary is bxxxx, hexadecimal is hxxxx, decimal is xxxx. signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.hitachisemiconductor.com/ h8s/2110b manuals: manual title ade no. h8s/2110b hardware manual this manual h8s/2600 series, h8s/2000 series programming manual ade-602-083 user's manuals for development tools: manual title ade no. h8s, h8/300 series c/c++ compiler, assembler, optimizing linkage editor user's manual ade-702-247 h8s, h8/300 series simulator/debugger user's manual ade-702-282 h8s, h8/300 series hitachi embedded workshop, hitachi debugging interface tutorial ade-702-231 hitachi embedded workshop user's manual ade-702-201
rev. 1.0, 09/02, page vii of xxx contents section 1 overview........................................................................................... 1 1.1 features .................................................................................................................... .........1 1.2 block diagram ............................................................................................................... ...3 1.3 pin arrangement and functions........................................................................................4 1.3.1 pin arrangement ..................................................................................................4 1.3.2 pin functions in each operating mode ...............................................................5 1.3.3 pin functions .......................................................................................................10 section 2 cpu................................................................................................... 15 2.1 features .................................................................................................................... .........15 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu ..................................16 2.1.2 differences from h8/300 cpu.............................................................................16 2.1.3 differences from h8/300h cpu..........................................................................17 2.2 cpu operating modes ......................................................................................................18 2.2.1 normal mode.......................................................................................................18 2.2.2 advanced mode ...................................................................................................19 2.3 address space ............................................................................................................... ....21 2.4 register configuration ...................................................................................................... 22 2.4.1 general registers .................................................................................................23 2.4.2 program counter (pc) .........................................................................................24 2.4.3 extended control register (exr) .......................................................................24 2.4.4 condition-code register (ccr) ..........................................................................24 2.4.5 initial register values..........................................................................................26 2.5 data formats ................................................................................................................ .....26 2.5.1 general register data formats ............................................................................26 2.5.2 memory data formats .........................................................................................28 2.6 instruction set ............................................................................................................. ......29 2.6.1 instructions classified by function......................................................................30 2.6.2 basic instruction formats ....................................................................................39 2.7 addressing modes and effective address calculation .....................................................40 2.7.1 register directrn.............................................................................................41 2.7.2 register indirect@ern ....................................................................................41 2.7.3 register indirect with displacement@(d:16, ern) or @(d:32, ern)..............41 2.7.4 register indirect with post-increment or pre-decrement@ern+ or @-ern ..41 2.7.5 absolute address@aa:8, @aa:16, @aa:24, or @aa:32....................................41 2.7.6 immediate#xx:8, #xx:16, or #xx:32 .................................................................42 2.7.7 program-counter relative@(d:8, pc) or @(d:16, pc)....................................42 2.7.8 memory indirect@@aa:8 ................................................................................43 2.7.9 effective address calculation .............................................................................44
rev. 1.0, 09/02, page viii of xxx 2.8 processing states........................................................................................................... .... 46 2.9 usage notes ................................................................................................................. ..... 48 2.9.1 note on tas instruction usage ........................................................................... 48 2.9.2 note on stm/ldm instruction usage ................................................................ 48 2.9.3 bit manipulation instructions .............................................................................. 48 2.9.4 eepmov instruction........................................................................................... 50 section 3 mcu operating modes .....................................................................51 3.1 mcu operating mode selection ...................................................................................... 51 3.2 register descriptions ....................................................................................................... .51 3.2.1 mode control register (mdcr) ......................................................................... 52 3.2.2 system control register (syscr) ...................................................................... 53 3.2.3 serial timer control register (stcr) ................................................................ 55 3.3 operating mode descriptions ........................................................................................... 57 3.3.1 mode 2 ................................................................................................................. 57 3.3.2 mode 3 ................................................................................................................. 57 3.4 address map in each operating mode............................................................................. 58 section 4 exception handling ...........................................................................61 4.1 exception handling types and priority ............................................................................ 61 4.2 exception sources and exception vector table ............................................................... 62 4.3 reset ....................................................................................................................... .......... 63 4.3.1 reset exception handling.................................................................................... 63 4.3.2 interrupts after reset............................................................................................ 64 4.3.3 on-chip peripheral modules after reset is cancelled......................................... 64 4.4 interrupt exception handling............................................................................................ 64 4.5 trap instruction exception handling................................................................................ 64 4.6 stack status after exception handling.............................................................................. 65 4.7 usage note.................................................................................................................. ...... 66 section 5 interrupt controller............................................................................67 5.1 features.................................................................................................................... ......... 67 5.2 input/output pins ........................................................................................................... ... 69 5.3 register descriptions ....................................................................................................... .69 5.3.1 interrupt control registers a to c (icra to icrc) ........................................... 70 5.3.2 address break control register (abrkcr)....................................................... 71 5.3.3 break address registers a to c (bara to barc) ............................................ 71 5.3.4 irq sense control registers (iscrh, iscrl)................................................... 72 5.3.5 irq enable register (ier) .................................................................................. 73 5.3.6 irq status register (isr).................................................................................... 74 5.3.7 keyboard matrix interrupt mask registers (kmimra, kmimr) wake-up event interrupt mask register (wuemrb) ....................................... 74 5.4 interrupt sources........................................................................................................... .... 76
rev. 1.0, 09/02, page ix of xxx 5.4.1 external interrupts ...............................................................................................76 5.4.2 internal interrupts.................................................................................................78 5.5 interrupt exception handling vector table......................................................................78 5.6 interrupt control modes and interrupt operation .............................................................81 5.6.1 interrupt control mode 0 .....................................................................................81 5.6.2 interrupt control mode 1 .....................................................................................83 5.6.3 interrupt exception handling sequence ..............................................................85 5.6.4 interrupt response times ....................................................................................87 5.7 address break ............................................................................................................... ....87 5.7.1 features................................................................................................................87 5.7.2 block diagram .....................................................................................................88 5.7.3 operation .............................................................................................................88 5.7.4 usage notes .........................................................................................................89 5.8 usage notes ................................................................................................................. .....90 5.8.1 conflict between interrupt generation and disabling .........................................90 5.8.2 instructions that disable interrupts ......................................................................91 5.8.3 interrupts during execution of eepmov instruction..........................................91 5.8.4 irq status register (isr)....................................................................................92 section 6 bus controller (bsc)........................................................................ 93 6.1 register descriptions ....................................................................................................... .93 6.1.1 bus control register (bcr) ................................................................................93 6.1.2 wait state control register (wscr)...................................................................94 section 7 i/o ports ............................................................................................ 95 7.1 overview.................................................................................................................... .......95 7.2 port 1...................................................................................................................... ...........100 7.2.1 port 1 data direction register (p1ddr).............................................................100 7.2.2 port 1 data register (p1dr)................................................................................100 7.2.3 port 1 pull-up mos control register (p1pcr) ..................................................101 7.2.4 pin functions .......................................................................................................101 7.2.5 port 1 input pull-up mos ...................................................................................101 7.3 port 2...................................................................................................................... ...........102 7.3.1 port 2 data direction register (p2ddr).............................................................102 7.3.2 port 2 data register (p2dr)................................................................................102 7.3.3 port 2 pull-up mos control register (p2pcr) ..................................................103 7.3.4 pin functions .......................................................................................................103 7.3.5 port 2 input pull-up mos ...................................................................................103 7.4 port 3...................................................................................................................... ...........104 7.4.1 port 3 data direction register (p3ddr).............................................................104 7.4.2 port 3 data register (p3dr)................................................................................104 7.4.3 port 3 pull-up mos control register (p3pcr) ..................................................105 7.4.4 pin functions .......................................................................................................105
rev. 1.0, 09/02, page x of xxx 7.4.5 port 3 input pull-up mos ................................................................................... 105 7.5 port 4...................................................................................................................... ........... 106 7.5.1 port 4 data direction register (p4ddr)............................................................. 106 7.5.2 port 4 data register (p4dr)................................................................................ 107 7.5.3 pin functions ....................................................................................................... 107 7.6 port 5...................................................................................................................... ........... 109 7.6.1 port 5 data direction register (p5ddr)............................................................. 109 7.6.2 port 5 data register (p5dr)................................................................................ 110 7.6.3 pin functions ....................................................................................................... 110 7.7 port 6...................................................................................................................... ........... 111 7.7.1 port 6 data direction register (p6ddr)............................................................. 112 7.7.2 port 6 data register (p6dr)................................................................................ 112 7.7.3 port 6 pull-up mos control register (kmpcr)................................................ 113 7.7.4 system control register 2 (syscr2) ................................................................. 114 7.7.5 pin functions ....................................................................................................... 115 7.7.6 port 6 input pull-up mos ................................................................................... 117 7.8 port 7...................................................................................................................... ........... 117 7.8.1 port 7 input data register (p7pin) ..................................................................... 118 7.8.2 port 7 data direction register (p7ddr)............................................................. 118 7.8.3 port 7 output data register (p7odr)................................................................. 119 7.8.4 pin functions ....................................................................................................... 119 7.9 port 8...................................................................................................................... ........... 120 7.9.1 port 8 data direction register (p8ddr)............................................................. 120 7.9.2 port 8 data register (p8dr)................................................................................ 121 7.9.3 pin functions ....................................................................................................... 121 7.10 port 9..................................................................................................................... ............ 123 7.10.1 port 9 data direction register (p9ddr)............................................................. 124 7.10.2 port 9 data register (p9dr)................................................................................ 124 7.10.3 pin functions ....................................................................................................... 125 7.11 port a..................................................................................................................... ........... 126 7.11.1 port a data direction register (paddr) ........................................................... 127 7.11.2 port a output data register (paodr) ............................................................... 127 7.11.3 port a input data register (papin).................................................................... 128 7.11.4 pin functions ....................................................................................................... 128 7.11.5 port a input pull-up mos .................................................................................. 130 7.12 port b ..................................................................................................................... ........... 131 7.12.1 port b data direction register (pbddr) ........................................................... 131 7.12.2 port b output data register (pbodr) ............................................................... 132 7.12.3 port b input data register (pbpin) .................................................................... 132 7.12.4 pin functions ....................................................................................................... 133 7.12.5 port b input pull-up mos .................................................................................. 134 section 8 14-bit pwm timer (pwmx)............................................................135
rev. 1.0, 09/02, page xi of xxx 8.1 features .................................................................................................................... .........135 8.2 input/output pins ........................................................................................................... ...136 8.3 register descriptions ....................................................................................................... .136 8.3.1 pwm (d/a) counters h and l (dacnth, dacntl)......................................136 8.3.2 pwm (d/a) data registers a and b (dadra, dadrb) .................................138 8.3.3 pwm (d/a) control register (dacr) ...............................................................140 8.4 bus master interface ........................................................................................................ .142 8.5 operation................................................................................................................... ........143 8.6 usage note.................................................................................................................. ......151 8.6.1 module stop mode setting ..................................................................................151 section 9 16-bit free-running timer (frt) ................................................... 153 9.1 features .................................................................................................................... .........153 9.2 input/output pins ........................................................................................................... ...155 9.3 register descriptions ....................................................................................................... .155 9.3.1 free-running counter (frc) ..............................................................................156 9.3.2 output compare registers a and b (ocra, ocrb) .........................................156 9.3.3 input capture registers a to d (icra to icrd) ................................................156 9.3.4 output compare registers ar and af (ocrar, ocraf) ...............................157 9.3.5 output compare register dm (ocrdm) ...........................................................157 9.3.6 timer interrupt enable register (tier) ..............................................................158 9.3.7 timer control/status register (tcsr) ................................................................159 9.3.8 timer control register (tcr) .............................................................................162 9.3.9 timer output compare control register (tocr)...............................................163 9.4 operation................................................................................................................... ........165 9.4.1 pulse output.........................................................................................................165 9.5 operation timing............................................................................................................ ..165 9.5.1 frc increment timing ........................................................................................165 9.5.2 output compare output timing ..........................................................................166 9.5.3 frc clear timing................................................................................................167 9.5.4 input capture input timing .................................................................................167 9.5.5 buffered input capture input timing ..................................................................168 9.5.6 timing of input capture flag (icf) setting ........................................................169 9.5.7 timing of output compare flag (ocf) setting...................................................170 9.5.8 timing of frc overflow flag setting ................................................................170 9.5.9 automatic addition timing.................................................................................171 9.5.10 mask signal generation timing ..........................................................................171 9.6 interrupt sources ........................................................................................................... ....172 9.7 usage notes ................................................................................................................. .....173 9.7.1 conflict between frc write and clear ...............................................................173 9.7.2 conflict between frc write and increment........................................................174 9.7.3 conflict between ocr write and compare-match .............................................174 9.7.4 switching of internal clock and frc operation .................................................176
rev. 1.0, 09/02, page xii of xxx 9.7.5 module stop mode setting .................................................................................. 178 section 10 8-bit timer (tmr)..........................................................................179 10.1 features................................................................................................................... .......... 179 10.2 input/output pins .......................................................................................................... .... 182 10.3 register descriptions ...................................................................................................... .. 182 10.3.1 timer counter (tcnt)........................................................................................ 183 10.3.2 time constant register a (tcora)................................................................... 184 10.3.3 time constant register b (tcorb) ................................................................... 184 10.3.4 timer control register (tcr)............................................................................. 184 10.3.5 timer control/status register (tcsr)................................................................ 189 10.3.6 time constant register (tcorc)....................................................................... 194 10.3.7 input capture registers r and f (ticrr and ticrf)........................................ 194 10.3.8 timer input select register (tisr) ..................................................................... 194 10.3.9 timer connection register i (tconri) ............................................................. 195 10.3.10 timer connection register s (tconrs)............................................................ 195 10.3.11 timer xy control register (tcrxy) ................................................................ 196 10.4 operation .................................................................................................................. ........ 197 10.4.1 pulse output......................................................................................................... 197 10.5 operation timing........................................................................................................... ... 198 10.5.1 tcnt count timing ........................................................................................... 198 10.5.2 timing of cmfa and cmfb setting at compare-match ................................... 198 10.5.3 timing of timer output at compare-match........................................................ 199 10.5.4 timing of counter clear at compare-match ....................................................... 199 10.5.5 tcnt external reset timing .............................................................................. 200 10.5.6 timing of overflow flag (ovf) setting ............................................................. 200 10.6 tmr_0 and tmr_1 cascaded connection ...................................................................... 201 10.6.1 16-bit count mode .............................................................................................. 201 10.6.2 compare-match count mode .............................................................................. 201 10.7 tmr_y and tmr_x cascaded connection .................................................................... 202 10.7.1 16-bit count mode .............................................................................................. 202 10.7.2 compare-match count mode .............................................................................. 202 10.7.3 input capture operation ...................................................................................... 203 10.8 interrupt sources.......................................................................................................... ..... 204 10.9 usage notes ................................................................................................................ ...... 205 10.9.1 conflict between tcnt write and counter clear............................................... 205 10.9.2 conflict between tcnt write and count-up ..................................................... 206 10.9.3 conflict between tcor write and compare-match........................................... 206 10.9.4 conflict between compare-matches a and b ..................................................... 207 10.9.5 switching of internal clocks and tcnt operation............................................. 207 10.9.6 mode setting with cascaded connection ............................................................ 210 10.9.7 module stop mode setting .................................................................................. 210
rev. 1.0, 09/02, page xiii of xxx section 11 watchdog timer (wdt)................................................................. 211 11.1 features ................................................................................................................... ..........211 11.2 input/output pins .......................................................................................................... ....213 11.3 register descriptions ...................................................................................................... ..213 11.3.1 timer counter (tcnt)........................................................................................213 11.3.2 timer control/status register (tcsr) ................................................................214 11.4 operation.................................................................................................................. .........218 11.4.1 watchdog timer mode ........................................................................................218 11.4.2 interval timer mode ............................................................................................220 11.4.3 reso signal output timing ...............................................................................221 11.5 interrupt sources .......................................................................................................... .....221 11.6 usage notes ................................................................................................................ ......222 11.6.1 notes on register access.....................................................................................222 11.6.2 conflict between timer counter (tcnt) write and increment..........................223 11.6.3 changing values of cks2 to cks0 bits.............................................................223 11.6.4 switching between watchdog timer mode and interval timer mode................223 11.6.5 system reset by reso signal.............................................................................224 11.6.6 counter values during transitions between high-speed, sub-active, and watch modes ................................................................................................224 section 12 serial communication interface (sci) ........................................... 225 12.1 features ................................................................................................................... ..........225 12.2 input/output pins .......................................................................................................... ....227 12.3 register descriptions ...................................................................................................... ..227 12.3.1 receive shift register (rsr)...............................................................................228 12.3.2 receive data register (rdr) ..............................................................................228 12.3.3 transmit data register (tdr).............................................................................228 12.3.4 transmit shift register (tsr) .............................................................................228 12.3.5 serial mode register (smr)................................................................................229 12.3.6 serial control register (scr)..............................................................................231 12.3.7 serial status register (ssr).................................................................................233 12.3.8 serial interface mode register (scmr)..............................................................235 12.3.9 bit rate register (brr) ......................................................................................236 12.3.10 serial pin select register (spsr) ........................................................................241 12.4 operation in asynchronous mode ....................................................................................242 12.4.1 data transfer format...........................................................................................242 12.4.2 receive data sampling timing and reception margin in asynchronous mode ..........................................................244 12.4.3 clock.................................................................................................................... 245 12.4.4 sci initialization (asynchronous mode) .............................................................246 12.4.5 data transmission (asynchronous mode)...........................................................247 12.4.6 serial data reception (asynchronous mode)......................................................249 12.5 multiprocessor communication function.........................................................................253
rev. 1.0, 09/02, page xiv of xxx 12.5.1 multiprocessor serial data transmission ............................................................ 255 12.5.2 multiprocessor serial data reception ................................................................. 256 12.6 operation in clocked synchronous mode ........................................................................ 260 12.6.1 clock.................................................................................................................... 260 12.6.2 sci initialization (clocked synchronous mode)................................................. 261 12.6.3 serial data transmission (clocked synchronous mode) .................................... 262 12.6.4 serial data reception (clocked synchronous mode).......................................... 264 12.6.5 simultaneous serial data transmission and reception (clocked synchronous mode) ............................................................................. 266 12.7 interrupt sources.......................................................................................................... ..... 268 12.8 usage notes ................................................................................................................ ...... 269 12.8.1 module stop mode setting .................................................................................. 269 12.8.2 break detection and processing .......................................................................... 269 12.8.3 mark state and break detection .......................................................................... 269 12.8.4 receive error flags and transmit operations (clocked synchronous mode only) .................................................................... 269 12.8.5 relation between writing to tdr and tdre flag ............................................. 269 12.8.6 sci operations during mode transitions ............................................................ 270 12.8.7 switching from sck pins to port pins ................................................................ 273 section 13 i 2 c bus interface (iic).....................................................................275 13.1 features................................................................................................................... .......... 275 13.2 input/output pins .......................................................................................................... .... 278 13.3 register descriptions ...................................................................................................... .. 279 13.3.1 i 2 c bus data register (icdr) ............................................................................. 279 13.3.2 slave address register (sar)............................................................................. 280 13.3.3 second slave address register (sarx) ............................................................. 281 13.3.4 i 2 c bus mode register (icmr)........................................................................... 282 13.3.5 i 2 c bus control register (iccr)......................................................................... 285 13.3.6 i 2 c bus status register (icsr)............................................................................ 295 13.3.7 ddc switch register (ddcswr) ...................................................................... 299 13.3.8 i 2 c bus extended control register (icxr)......................................................... 300 13.4 operation .................................................................................................................. ........ 304 13.4.1 i 2 c bus data format ............................................................................................ 304 13.4.2 initialization ......................................................................................................... 30 6 13.4.3 master transmit operation .................................................................................. 306 13.4.4 master receive operation.................................................................................... 310 13.4.5 slave receive operation...................................................................................... 318 13.4.6 slave transmit operation .................................................................................... 325 13.4.7 iric setting timing and scl control ................................................................ 327 13.4.8 noise canceler..................................................................................................... 330 13.4.9 initialization of internal state .............................................................................. 331 13.5 interrupt sources.......................................................................................................... ..... 333
rev. 1.0, 09/02, page xv of xxx 13.6 usage notes ................................................................................................................ ......333 13.6.1 module stop mode setting ..................................................................................343 section 14 keyboard buffer controller............................................................ 345 14.1 features ................................................................................................................... ..........345 14.2 input/output pins .......................................................................................................... ....346 14.3 register descriptions ...................................................................................................... ..347 14.3.1 keyboard control register h (kbcrh) .............................................................347 14.3.2 keyboard control register l (kbcrl) ..............................................................349 14.3.3 keyboard data buffer register (kbbr) .............................................................350 14.4 operation.................................................................................................................. .........351 14.4.1 receive operation................................................................................................351 14.4.2 transmit operation ..............................................................................................352 14.4.3 receive abort ......................................................................................................355 14.4.4 kclki and kdi read timing.............................................................................357 14.4.5 kclko and kdo write timing.........................................................................357 14.4.6 kbf setting timing and kclk control .............................................................358 14.4.7 receive timing....................................................................................................359 14.4.8 kclk fall interrupt operation............................................................................360 14.5 usage notes ................................................................................................................ ......361 14.5.1 kbioe setting and kclk falling edge detection.............................................361 14.5.2 module stop mode setting ..................................................................................361 section 15 host interface lpc interface (lpc) ............................................... 363 15.1 features ................................................................................................................... ..........363 15.2 input/output pins .......................................................................................................... ....365 15.3 register descriptions ...................................................................................................... ..366 15.3.1 host interface control registers 0 and 1 (hicr0, hicr1).................................367 15.3.2 host interface control registers 2 and 3 (hicr2, hicr3).................................374 15.3.3 lpc channel 3 address register (ladr3) ........................................................377 15.3.4 input data registers 1 to 3 (idr1 to idr3) ........................................................378 15.3.5 output data registers 1 to 3 (odr1 to odr3)...................................................379 15.3.6 bidirectional data registers 0 to 15 (twr0 to twr15) ....................................379 15.3.7 status registers 1 to 3 (str1 to str3)...............................................................380 15.3.8 serirq control registers 0 and 1 (sirqcr0, sirqcr1) ...............................387 15.3.9 host interface select register (hisel) ...............................................................395 15.4 operation.................................................................................................................. .........396 15.4.1 host interface activation .....................................................................................396 15.4.2 lpc i/o cycles ....................................................................................................397 15.4.3 a20 gate ..............................................................................................................399 15.4.4 host interface shutdown function (lpcpd).......................................................402 15.4.5 host interface serialized interrupt operation (serirq) ....................................406 15.4.6 host interface clock start request (clkrun) ..................................................408
rev. 1.0, 09/02, page xvi of xxx 15.5 interrupt sources.......................................................................................................... ..... 408 15.5.1 ibfi1, ibfi2, ibfi3, and erri ........................................................................... 408 15.5.2 smi, hirq1, hirq6, hirq9, hirq10, hirq11, and hirq12 ....................... 409 15.6 usage notes ................................................................................................................ ...... 411 15.6.1 module stop mode setting .................................................................................. 411 15.6.2 notes on using host interface............................................................................. 411 section 16 ram ................................................................................................413 section 17 rom ................................................................................................415 17.1 features................................................................................................................... .......... 415 17.2 mode transitions ........................................................................................................... ... 417 17.3 block configuration........................................................................................................ .. 420 17.4 input/output pins .......................................................................................................... .... 421 17.5 register descriptions ...................................................................................................... .. 421 17.5.1 flash memory control register 1 (flmcr1)..................................................... 422 17.5.2 flash memory control register 2 (flmcr2)..................................................... 423 17.5.3 erase block registers 1 and 2 (ebr1, ebr2) .................................................... 424 17.6 operating modes............................................................................................................ ... 425 17.7 on-board programming modes........................................................................................ 425 17.7.1 boot mode ........................................................................................................... 426 17.7.2 user program mode............................................................................................. 430 17.8 flash memory programming/erasing ............................................................................... 431 17.8.1 program/program-verify ..................................................................................... 431 17.8.2 erase/erase-verify............................................................................................... 433 17.9 program/erase protection ................................................................................................. 43 5 17.9.1 hardware protection ............................................................................................ 435 17.9.2 software protection.............................................................................................. 435 17.9.3 error protection.................................................................................................... 435 17.10 interrupts during flash memory programming/erasing ................................................... 436 17.11 programmer mode ........................................................................................................... . 437 17.12 usage notes ............................................................................................................... ....... 438 section 18 clock pulse generator .....................................................................439 18.1 oscillator................................................................................................................. .......... 440 18.1.1 connecting crystal resonator ............................................................................. 440 18.1.2 external clock input method............................................................................... 441 18.2 duty correction circuit .................................................................................................... 443 18.3 medium-speed clock divider .......................................................................................... 443 18.4 bus master clock select circuit ....................................................................................... 444 18.5 subclock input circuit ..................................................................................................... . 444 18.6 waveform forming circuit............................................................................................... 444 18.7 clock select circuit ....................................................................................................... ... 445
rev. 1.0, 09/02, page xvii of xxx 18.8 usage notes ................................................................................................................ ......445 18.8.1 note on resonator................................................................................................445 18.8.2 notes on board design ........................................................................................445 section 19 power-down modes ....................................................................... 447 19.1 register descriptions ...................................................................................................... ..447 19.1.1 standby control register (sbycr) ....................................................................448 19.1.2 low-power control register (lpwrcr) ...........................................................450 19.1.3 module stop control registers h and l (mstpcrh, mstpcrl)....................451 19.2 mode transitions and lsi states ......................................................................................452 19.3 medium-speed mode........................................................................................................45 5 19.4 sleep mode ................................................................................................................. ......456 19.5 software standby mode....................................................................................................45 7 19.6 hardware standby mode ..................................................................................................458 19.7 watch mode................................................................................................................. .....459 19.8 subsleep mode.............................................................................................................. ....460 19.9 subactive mode ............................................................................................................. ...461 19.10 module stop mode.......................................................................................................... ..462 19.11 direct transitions........................................................................................................ ......462 19.12 usage notes ............................................................................................................... .......463 19.12.1 i/o port status......................................................................................................463 19.12.2 current consumption when waiting for oscillation stabilization ......................463 section 20 list of registers .............................................................................. 465 20.1 register addresses (address order) .................................................................................465 20.2 register bits.............................................................................................................. ........473 20.3 register states in each operating mode...........................................................................480 20.4 register select conditions ................................................................................................4 86 section 21 electrical characteristics ................................................................ 493 21.1 electrical characteristics................................................................................................. ..493 21.1.1 absolute maximum ratings ................................................................................493 21.1.2 dc characteristics ...............................................................................................494 21.1.3 ac characteristics ...............................................................................................500 21.1.4 flash memory characteristics..............................................................................506 21.1.5 usage note...........................................................................................................508 21.2 timing chart............................................................................................................... ......508 21.2.1 clock timing .......................................................................................................508 21.2.2 control signal timing .........................................................................................510 21.2.3 on-chip peripheral module timing ....................................................................511 appendix a i/o port states in each processing state...................................... 517
rev. 1.0, 09/02, page xviii of xxx appendix b product codes ...............................................................................518 appendix c package dimensions .....................................................................519 index .........................................................................................................521
rev. 2.0, 09/02, page xix of xxx figures section 1 overview figure 1.1 internal block diagram of h8s/2110b .........................................................................3 figure 1.2 pin arrangement of h8s/2110b....................................................................................4 section 2 cpu figure 2.1 exception vector table (normal mode) .....................................................................19 figure 2.2 stack structure in normal mode .................................................................................19 figure 2.3 exception vector table (advanced mode) .................................................................20 figure 2.4 stack structure in advanced mode .............................................................................21 figure 2.5 memory map ........................................................................................................ .......21 figure 2.6 cpu internal registers ............................................................................................ ....22 figure 2.7 usage of general registers ........................................................................................ .23 figure 2.8 stack ............................................................................................................. ...............24 figure 2.9 general register data formats (1) ..............................................................................26 figure 2.9 general register data formats (2) ..............................................................................27 figure 2.10 memory data formats.............................................................................................. .28 figure 2.11 instruction formats (examples) ................................................................................40 figure 2.12 branch address specification in memory indirect addressing mode ......................43 figure 2.13 state transitions ................................................................................................ ........47 section 3 mcu operating modes figure 3.1 address map for h8s/2110b (1).................................................................................58 figure 3.2 address map for h8s/2110b (2).................................................................................59 section 4 exception handling figure 4.1 reset sequence (mode 3) ........................................................................................... .63 figure 4.2 stack status after exception handling ........................................................................65 figure 4.3 operation when sp value is odd ................................................................................66 section 5 interrupt controller figure 5.1 block diagram of interrupt controller ........................................................................68 figure 5.2 relationship between interrupts irq7 and irq6, interrupts kin15 to kin0, interrupts wue7 to wue0, and registers kmimr, kmimra, and wuemrb......76 figure 5.3 block diagram of interrupts irq7 to irq0 ................................................................77 figure 5.4 flowchart of procedure up to interrupt acceptance in interrupt control mode 0.......82 figure 5.5 state transition in interrupt control mode 1 ..............................................................83 figure 5.6 flowchart of procedure up to interrupt acceptance in interrupt control mode 1.....85 figure 5.7 interrupt exception handling ...................................................................................... 86 figure 5.8 address break block diagram ....................................................................................88 figure 5.9 address break timing example..................................................................................90
rev. 2.0, 09/02, page xx of xxx figure 5.10 conflict between interrupt generation and disabling ............................................... 91 section 8 14-bit pwm timer (pwmx) figure 8.1 pwm (d/a) block diagram...................................................................................... 135 figure 8.2 pwm (d/a) operation .............................................................................................. 1 43 figure 8.3 output waveform (os = 0, dadr corresponds to t l ) ............................................ 145 figure 8.4 output waveform (os = 1, dadr corresponds to t h ) ............................................ 146 figure 8.5 d/a data register configuration when cfs = 1 ...................................................... 146 figure 8.6 output waveform when dadr = h0207 (os = 1)................................................. 147 section 9 16-bit free-running timer (frt) figure 9.1 block diagram of 16-bit free-running timer ......................................................... 154 figure 9.2 example of pulse output........................................................................................... 165 figure 9.3 increment timing with internal clock source .......................................................... 165 figure 9.4 increment timing with external clock source ......................................................... 166 figure 9.5 timing of output compare a output ....................................................................... 166 figure 9.6 clearing of frc by compare-match a signal ......................................................... 167 figure 9.7 input capture input signal timing (usual case) ...................................................... 167 figure 9.8 input capture input signal timing (when icra to icrd are read)....................... 168 figure 9.9 buffered input capture timing ................................................................................. 168 figure 9.10 buffered input capture timing (bufea = 1) ........................................................ 169 figure 9.11 timing of input capture flag (icfa, icfb, icfc, or icfd) setting .................... 169 figure 9.12 timing of output compare flag (ocfa or ocfb) setting ................................... 170 figure 9.13 timing of overflow flag (ovf) setting................................................................. 170 figure 9.14 ocra automatic addition timing ........................................................................ 171 figure 9.15 timing of input capture mask signal setting......................................................... 171 figure 9.16 timing of input capture mask signal clearing ...................................................... 172 figure 9.17 frc write-clear conflict ....................................................................................... 17 3 figure 9.18 frc write-increment conflict................................................................................ 174 figure 9.19 conflict between ocr write and compare-match (when automatic addition function is not used) ................................................. 175 figure 9.20 conflict between ocrar/ocraf write and compare-match (when automatic addition function is used) ........................................................ 176 section 10 8-bit timer (tmr) figure 10.1 block diagram of 8-bit timer (tmr_0 and tmr_1)............................................ 180 figure 10.2 block diagram of 8-bit timer (tmr_y and tmr_x) .......................................... 181 figure 10.3 pulse output example ............................................................................................. 197 figure 10.4 count timing for internal clock input.................................................................... 198 figure 10.5 count timing for external clock input (both edges) ............................................ 198 figure 10.6 timing of cmf setting at compare-match ............................................................ 199 figure 10.7 timing of toggled timer output by compare-match a signal ............................. 199 figure 10.8 timing of counter clear by compare-match.......................................................... 199
rev. 2.0, 09/02, page xxi of xxx figure 10.9 timing of counter clear by external reset input ...................................................200 figure 10.10 timing of ovf flag setting..................................................................................200 figure 10.11 timing of input capture operation .......................................................................203 figure 10.12 timing of input capture signal (input capture signal is input during ticrr and ticrf read) .............................204 figure 10.13 conflict between tcnt write and clear ..............................................................205 figure 10.14 conflict between tcnt write and count-up.......................................................206 figure 10.15 conflict between tcor write and compare-match ............................................207 section 11 watchdog timer (wdt) figure 11.1 block diagram of wdt ..........................................................................................212 figure 11.2 watchdog timer mode (rst/ nmi = 1) operation.................................................219 figure 11.3 interval timer mode operation...............................................................................220 figure 11.4 ovf flag set timing .............................................................................................. 220 figure 11.5 output timing of reso signal ...............................................................................221 figure 11.6 writing to tcnt and tcsr (wdt_0)...................................................................222 figure 11.7 conflict between tcnt write and increment.........................................................223 figure 11.8 sample circuit for resetting system by reso signal ...........................................224 section 12 serial communication interface (sci) figure 12.1 block diagram of sci ............................................................................................. 226 figure 12.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits) ..................................................242 figure 12.3 receive data sampling timing in asynchronous mode ........................................244 figure 12.4 relation between output clock and transmit data phase (asynchronous mode) .245 figure 12.5 sample sci initialization flowchart .......................................................................246 figure 12.6 example of sci transmit operation in asynchronous mode (example with 8-bit data, parity, one stop bit) ....................................................247 figure 12.7 sample serial transmission flowchart ...................................................................248 figure 12.8 example of sci receive operation in asynchronous mode (example with 8-bit data, parity, one stop bit) ....................................................249 figure 12.9 sample serial reception flowchart (1) ...................................................................251 figure 12.9 sample serial reception flowchart (2) ...................................................................252 figure 12.10 example of communication using multiprocessor format (transmission of data h'aa to receiving station a)...........................................254 figure 12.11 sample multiprocessor serial transmission flowchart ........................................255 figure 12.12 example of sci receive operation (example with 8-bit data, multiprocessor bit, one stop bit) ..............................257 figure 12.13 sample multiprocessor serial reception flowchart (1) ........................................258 figure 12.13 sample multiprocessor serial reception flowchart (2) ........................................259 figure 12.14 data format in clocked synchronous communication (lsb-first).....................260 figure 12.15 sample sci initialization flowchart......................................................................261 figure 12.16 example of sci transmit operation in clocked synchronous mode...................262
rev. 2.0, 09/02, page xxii of xxx figure 12.17 sample serial transmission flowchart ................................................................. 263 figure 12.18 example of sci receive operation in clocked synchronous mode .................... 264 figure 12.19 sample serial reception flowchart....................................................................... 265 figure 12.20 sample flowchart of simultaneous serial transmission and reception............... 267 figure 12.21 sample flowchart for mode transition during transmission ............................... 271 figure 12.22 pin states during transmission in asynchronous mode (internal clock)............. 271 figure 12.23 pin states during transmission in clocked synchronous mode (internal clock)...................................................................................................... 272 figure 12.24 sample flowchart for mode transition during reception .................................... 272 figure 12.25 switching from sck pins to port pins .................................................................. 273 figure 12.26 prevention of low pulse output at switching from sck pins to port pins.......... 273 section 13 i 2 c bus interface (iic) figure 13.1 block diagram of i 2 c bus interface........................................................................ 277 figure 13.2 i 2 c bus interface connections (example: this lsi as master) .............................. 278 figure 13.3 i 2 c bus data format (i 2 c bus format)................................................................... 304 figure 13.4 i 2 c bus data format (serial format) ...................................................................... 304 figure 13.5 i 2 c bus timing........................................................................................................ 305 figure 13.6 sample flowchart for iic initialization................................................................... 306 figure 13.7 sample flowchart for operations in master transmit mode .................................. 307 figure 13.8 example of operation timing in master transmit mode (mls = wait = 0)....... 309 figure 13.9 example of stop condition issuance operation timing in master transmit mode (mls = wait = 0) ................................................................................................. 310 figure 13.10 sample flowchart for operations in master receive mode (hnds = 1) ............. 311 figure 13.11 example of operation timing in master receive mode (mls = wait = 0, hnds = 1) ............................................................................ 313 figure 13.12 example of stop condition issuance operation timing in master receive mode (mls = wait = 0, hnds = 1) ............................................................................ 313 figure 13.13 sample flowchart for operations in master receive mode (receiving multiple bytes) (wait = 1).................................................................. 314 figure 13.14 sample flowchart for operations in master receive mode (receiving a single byte) (wait = 1) .................................................................... 315 figure 13.15 example of master receive mode operation timing (mls = ackb = 0, wait = 1)............................................................................ 317 figure 13.16 example of stop condition issuance timing in master receive mode (mls = ackb = 0, wait = 1)............................................................................ 318 figure 13.17 sample flowchart for operations in slave receive mode (hnds = 1) ............... 319 figure 13.18 example of slave receive mode operation timing (1) (mls = 0, hnds= 1) ... 321 figure 13.19 example of slave receive mode operation timing (2) (mls = 0, hnds= 1) ... 321 figure 13.20 sample flowchart for operations in slave receive mode (hnds = 0) ............... 322 figure 13.21 example of slave receive mode operation timing (1) (mls = ackb = 0, hnds = 0)............................................................................ 324 figure 13.22 example of slave receive mode operation timing (2)
rev. 2.0, 09/02, page xxiii of xxx (mls = ackb = 0, hnds = 0)............................................................................324 figure 13.23 sample flowchart for slave transmit mode.........................................................325 figure 13.24 example of slave transmit mode operation timing (mls = 0)..........................327 figure 13.25 iric setting timing and scl control (1) ............................................................328 figure 13.26 iric setting timing and scl control (2) ............................................................329 figure 13.27 iric setting timing and scl control (3) ............................................................330 figure 13.28 block diagram of noise canceler.........................................................................331 figure 13.29 notes on reading master receive data ................................................................337 figure 13.30 flowchart for start condition issuance instruction for retransmission and timing ............................................................................................................................... ...............339 figure 13.31 stop condition issuance timing ...........................................................................340 figure 13.32 iric flag clearing timing when wait = 1 ........................................................340 figure 13.33 icdr read and iccr access timing in slave transmit mode...........................341 figure 13.34 trs bit set timing in slave mode.......................................................................342 section 14 keyboard buffer controller figure 14.1 block diagram of keyboard buffer controller .......................................................345 figure 14.2 keyboard buffer controller connection .................................................................346 figure 14.3 sample receive processing flowchart ....................................................................351 figure 14.4 receive timing ................................................................................................... ....352 figure 14.5 (1) sample transmit processing flowchart.............................................................353 figure 14.5 (2) sample transmit processing flowchart.............................................................354 figure 14.6 transmit timing.................................................................................................. ....354 figure 14.7 (1) sample receive abort processing flowchart ....................................................355 figure 14.7 (2) sample receive abort processing flowchart ....................................................356 figure 14.8 receive abort and transmit start (transmission/reception switchover) timing ........................................................356 figure 14.9 kclki and kdi read timing ................................................................................357 figure 14.10 kclko and kdo write timing ..........................................................................357 figure 14.11 kbf setting and kclk automatic i/o inhibit generation timing......................358 figure 14.12 receive counter and kbbr data load timing....................................................359 figure 14.13 example of kclk input fall interrupt operation ................................................360 figure 14.14 kbioe setting and kclk falling edge detection timing..................................361 section 15 host interface lpc interface (lpc) figure 15.1 block diagram of lpc ............................................................................................3 64 figure 15.2 typical lframe timing .......................................................................................398 figure 15.3 abort mechanism .................................................................................................. ..398 figure 15.4 ga20 output ...................................................................................................... .....400 figure 15.5 power-down state termination timing..................................................................405 figure 15.6 serirq timing .................................................................................................... ..406 figure 15.7 clock start request timing ....................................................................................408 figure 15.8 hirq flowchart (example of channel 1)...............................................................411
rev. 2.0, 09/02, page xxiv of xxx section 17 rom figure 17.1 block diagram of flash memory............................................................................ 416 figure 17.2 flash memory state transitions.............................................................................. 417 figure 17.3 boot mode........................................................................................................ ....... 418 figure 17.4 user program mode (example)............................................................................... 419 figure 17.5 flash memory block configuration........................................................................ 420 figure 17.6 on-chip ram area in boot mode ......................................................................... 429 figure 17.7 id code area..................................................................................................... ...... 429 figure 17.8 programming/erasing flowchart example in user program mode ........................ 430 figure 17.9 program/program-verify flowchart........................................................................ 432 figure 17.10 erase/erase-verify flowchart ............................................................................... 434 figure 17.11 memory map in programmer mode...................................................................... 437 section 18 clock pulse generator figure 18.1 block diagram of clock pulse generator ............................................................... 439 figure 18.2 typical connection to crystal resonator................................................................ 440 figure 18.3 equivalent circuit of crystal resonator.................................................................. 440 figure 18.4 example of external clock input ............................................................................ 441 figure 18.5 external clock input timing................................................................................... 442 figure 18.6 timing of external clock output stabilization delay time ................................... 443 figure 18.7 subclock input timing ............................................................................................ 444 figure 18.8 note on board design of oscillator circuit section ............................................... 445 section 19 power-down modes figure 19.1 mode transition diagram ....................................................................................... 453 figure 19.2 medium-speed mode timing ................................................................................. 456 figure 19.3 application example in software standby mode ................................................... 458 figure 19.4 hardware standby mode timing ............................................................................ 459 section 21 electrical characteristics figure 21.1 darlington pair drive circuit (example) ................................................................ 499 figure 21.2 led drive circuit (example) ................................................................................. 499 figure 21.3 output load circuit.............................................................................................. ... 501 figure 21.4 connection of vcl capacitor................................................................................. 508 figure 21.5 system clock timing .............................................................................................. 508 figure 21.6 oscillation settling timing ..................................................................................... 5 09 figure 21.7 oscillation setting timing (exiting software standby mode)................................ 509 figure 21.8 reset input timing ............................................................................................... ... 510 figure 21.9 interrupt input timing........................................................................................... .. 510 figure 21.10 i/o port input/output timing................................................................................ 511 figure 21.11 frt input/output timing ..................................................................................... 511 figure 21.12 frt clock input timing ....................................................................................... 511 figure 21.13 8-bit timer output timing ................................................................................... 512
rev. 2.0, 09/02, page xxv of xxx figure 21.14 8-bit timer clock input timing............................................................................512 figure 21.15 8-bit timer reset input timing ............................................................................512 figure 21.16 pwmx output timing..........................................................................................512 figure 21.17 sck clock input timing.......................................................................................513 figure 21.18 sci input/output timing (synchronous mode) ....................................................513 figure 21.19 wdt output timing ( reso ) ...............................................................................513 figure 21.20 keyboard buffer controller timing ......................................................................514 figure 21.21 i 2 c bus interface input/output timing .................................................................515 figure 21.22 host interface (lpc) timing.................................................................................515 figure 21.23 tester measurement condition..............................................................................516 appendix c package dimensions figure c.1 package dimensions (fp-100b) ...............................................................................519 figure c.2 package dimensions (tfp-100b).............................................................................520
rev. 2.0, 09/02, page xxvi of xxx
rev. 2.0, 09/02, page xxvii of xxx tables section 1 overview table 1.1 pin functions in each operating mode ........................................................................5 table 1.2 pin functions ......................................................................................................... .....10 section 2 cpu table 2.1 instruction classification ............................................................................................ 29 table 2.2 operation notation.................................................................................................... ..30 table 2.3 data transfer instructions...........................................................................................3 1 table 2.4 arithmetic operations instructions (1) .......................................................................32 table 2.4 arithmetic operations instructions (2) .......................................................................33 table 2.5 logic operations instructions .....................................................................................34 table 2.6 shift instructions.................................................................................................... .....34 table 2.7 bit manipulation instructions (1)................................................................................35 table 2.7 bit manipulation instructions (2)................................................................................36 table 2.8 branch instructions ................................................................................................... ..37 table 2.9 system control instructions........................................................................................38 table 2.10 block data transfer instructions ............................................................................39 table 2.11 addressing modes ..................................................................................................40 table 2.12 absolute address access ranges ...........................................................................42 table 2.13 effective address calculation (1)...........................................................................44 table 2.13 effective address calculation (2)...........................................................................45 section 3 mcu operating modes table 3.1 mcu operating mode selection ................................................................................51 section 4 exception handling table 4.1 exception types and priority......................................................................................61 table 4.2 exception handling vector table...............................................................................62 table 4.3 status of ccr after trap instruction exception handling..........................................65 section 5 interrupt controller table 5.1 pin configuration..................................................................................................... ...69 table 5.2 correspondence between interrupt source and icr ...................................................70 table 5.3 interrupt sources, vector addresses, and interrupt priorities.....................................79 table 5.4 interrupt control modes..............................................................................................8 1 table 5.5 interrupt response times ...........................................................................................87 table 5.6 number of states in interrupt handling routine execution status.............................87 section 7 i/o ports table 7.1 port functions of h8s/2110b .....................................................................................96
rev. 2.0, 09/02, page xxviii of xxx table 7.2 input pull-up mos states (port 1)........................................................................... 101 table 7.3 input pull-up mos states (port 2)........................................................................... 103 table 7.4 input pull-up mos states (port 3)........................................................................... 106 table 7.5 input pull-up mos states (port 6)........................................................................... 117 table 7.6 input pull-up mos states (port a) .......................................................................... 131 table 7.7 input pull-up mos states (port b) .......................................................................... 134 section 8 14-bit pwm timer (pwmx) table 8.1 pin configuration..................................................................................................... . 136 table 8.2 read and write access methods for 16-bit registers.............................................. 142 table 8.3 settings and operation (examples when f = 10 mhz)............................................. 144 table 8.4 position of pulse to be added to basic pulse with 14-bit conversion accuracy (cfs = 1) .................................................................................................................. 148 table 8.5 position of pulse to be added to basic pulse with 12-bit conversion accuracy (cfs = 1) .................................................................................................................. 149 table 8.6 position of pulse to be added to basic pulse with 10-bit conversion accuracy (cfs = 1) .................................................................................................................. 150 section 9 16-bit free-running timer (frt) table 9.1 pin configuration..................................................................................................... . 155 table 9.2 frt interrupt sources............................................................................................... 17 2 table 9.3 switching of internal clock and frc operation ...................................................... 177 section 10 8-bit timer (tmr) table 10.1 pin configuration.................................................................................................. 18 2 table 10.2 clock input to tcnt and count condition (1) .................................................... 186 table 10.2 clock input to tcnt and count condition (2) .................................................... 187 table 10.3 registers accessible by tmr_x/tmr_y ........................................................... 196 table 10.4 input capture signal selection ............................................................................. 204 table 10.5 interrupt sources of 8-bit timers tmr_0, tmr_1, tmr_y, and tmr_x ....... 205 table 10.6 timer output priorities ......................................................................................... 207 table 10.7 switching of internal clocks and tcnt operation.............................................. 208 table 10.7 switching of internal clocks and tcnt operation (cont) ................................... 209 section 11 watchdog timer (wdt) table 11.1 pin configuration.................................................................................................. 21 3 table 11.2 wdt interrupt source .......................................................................................... 221 section 12 serial communication interface (sci) table 12.1 pin configuration.................................................................................................. 22 7 table 12.2 relationships between n setting in brr and bit rate b..................................... 236 table 12.3 brr settings for various bit rates (asynchronous mode) (1) ........................... 237 table 12.3 brr settings for various bit rates (asynchronous mode) (2) ........................... 238
rev. 2.0, 09/02, page xxix of xxx table 12.4 maximum bit rate for each frequency (asynchronous mode)...........................239 table 12.5 maximum bit rate with external clock input (asynchronous mode).................239 table 12.6 brr settings for various bit rates (clocked synchronous mode) .....................240 table 12.7 maximum bit rate with external clock input (clocked synchronous mode).....240 table 12.8 serial transfer formats (asynchronous mode)....................................................243 table 12.9 ssr status flags and receive data handling ......................................................250 table 12.10 sci interrupt sources............................................................................................268 section 13 i 2 c bus interface (iic) table 13.1 pin configuration..................................................................................................27 8 table 13.2 communication format ........................................................................................281 table 13.3 i 2 c transfer rate ..................................................................................................284 table 13.4 flags and transfer states (master mode) .............................................................290 table 13.4 flags and transfer states (master mode) (cont)...................................................291 table 13.5 flags and transfer states (slave mode) ...............................................................292 table 13.5 flags and transfer states (slave mode) (cont) .....................................................293 table 13.6 i 2 c bus data format symbols ..............................................................................304 table 13.7 iic interrupt sources.............................................................................................333 table 13.8 i 2 c bus timing (scl and sda outputs) .............................................................334 table 13.9 permissible scl rise time (t sr ) values................................................................335 table 13.10 i 2 c bus timing (with maximum influence of t sr /t sf )............................................336 section 14 keyboard buffer controller table 14.1 pin configuration..................................................................................................34 6 section 15 host interface lpc interface (lpc) table 15.1 pin configuration..................................................................................................36 5 table 15.2 register selection .................................................................................................37 8 table 15.3 ga20 (p81) set/clear timing ..............................................................................399 table 15.4 fast a20 gate output signals..............................................................................401 table 15.5 scope of host interface pin shutdown .................................................................403 table 15.6 scope of initialization in each host interface mode ............................................404 table 15.7 frame configuration of serial interrupt transfer cycle.......................................407 table 15.8 receive complete interrupts and error interrupt..................................................408 table 15.9 hirq setting and clearing conditions.................................................................410 table 15.10 host address example..........................................................................................412 section 17 rom table 17.1 differences between boot mode and user program mode...................................417 table 17.2 pin configuration..................................................................................................42 1 table 17.3 operating modes and rom ..................................................................................425 table 17.4 on-board programming mode settings................................................................425 table 17.5 boot mode operation ...........................................................................................428
rev. 2.0, 09/02, page xxx of xxx table 17.6 system clock frequencies for which automatic adjustment of lsi bit rate is possible ................................................................................................................. 429 section 18 clock pulse generator table 18.1 damping resistance values.................................................................................. 440 table 18.2 crystal resonator parameters ............................................................................... 441 table 18.3 external clock input conditions........................................................................... 442 table 18.4 external clock output stabilization delay time ................................................. 443 table 18.5 subclock input conditions.................................................................................... 444 section 19 power-down modes table 19.1 operating frequency and wait time.................................................................... 449 table 19.2 lsi internal states in each operating mode ........................................................ 454 section 21 electrical characteristics table 21.1 absolute maximum ratings ................................................................................. 493 table 21.2 dc characteristics (1)........................................................................................... 494 table 21.2 dc characteristics (2)........................................................................................... 497 table 21.2 dc characteristics (3) when lpc function is used ............................................ 498 table 21.3 permissible output currents ................................................................................. 498 table 21.4 bus drive characteristics...................................................................................... 500 table 21.5 clock timing ........................................................................................................ 5 01 table 21.6 control signal timing .......................................................................................... 502 table 21.7 timing of on-chip peripheral modules ............................................................... 503 table 21.8 keyboard buffer controller timing ..................................................................... 504 table 21.9 i 2 c bus timing ..................................................................................................... 505 table 21.10 lpc module timing ............................................................................................. 505 table 21.11 flash memory characteristics .............................................................................. 506 appendix a i/o port states in each processing state table a.1 i/o port states in each processing state............................................................... 517
rev. 1.0, 09/02, page 1 of 524 section 1 overview 1.1 features high-speed h8s/2000 central processing unit with an internal 16-bit architecture upward-compatible with h8/300 and h8/300h cpus on an object level sixteen 16-bit general registers 65 basic instructions various peripheral function 14-bit pwm timer (pwmx) 16-bit free-running timer (frt) 8-bit timer (tmr) watchdog timer (wdt) asynchronous or clocked synchronous serial communication interface (sci) i 2 c bus interface (iic) keyboard buffer controller host interface lpc interface (lpc) clock pulse generator
rev. 1.0, 09/02, page 2 of 524 on-chip memory rom model rom ram remarks f-ztat version HD64F2110BV 64 kbytes 2 kbytes general i/o ports i/o pins: 82 supports various power-down states compact package product package code body size pin pitch h8s/2110b qfp-100b tqfp-100b fp-100b tfp-100b 16.0 16.0 mm 0.5 mm
rev. 1.0, 09/02, page 3 of 524 1.2 block diagram h8s/2000 cpu interrup contoller wdt 2 channels keyboard buffer controller 3 channels rom (flash memory) ram 16-bit frt 8-bit timer 4 channels 14-bit pwm host interface (lpc) sci 1 channel iic 2 channles internal adderss bus p17 p16 p15 p14 p13 p12 p11 p10 p27 p26 p25 p24 p23 p22 p21 p20 pa7/ /ps2cd pa6/ /ps2cc pa5/ /ps2bd pa4/ /ps2bc pa3/ /ps2ad pa2/ /ps2ac pa1/ pa0/ p37/serirq p36/lclk p35/ p34/ p33/lad3 p32/lad2 p31/lad1 p30/lad0 pb7/ pb6/ pb5/ pb4/ pb3/ pb2/ pb1/ /lsci pb0/ / p97/sda0 p96/ /excl p95 p94 p93 p92/ p91/ p90/ p67/tmox/ / p66/ftob/ / p65/ftid/ p64/ftic/ p63/ftib/ p62/ftia/ /tmiy p61/ftoa/ p60/ftci/ /tmix p47/pwx1 p46/pwx0 p45/tmri1 p44/tmo1 p43/tmci1 p42/tmri0/sda1 p41/tmo0 p40/tmci0 p52/exsck1 * 1 /scl0 p51/exrxd1 * 1 p50/extxd1 * 1 p77 * 2 /extmox * 1 p76 * 2 /tmoy * 1 p75 * 2 p74 * 2 p73 * 2 p72 * 2 p71 * 2 p70 * 2 p86/ /sck1/scl1 p85/ /rxd1 p84/ /txd1 p83/ p82/ p81/ga20 p80/ vcc vcc vss xtal extal vccb md1 md0 nmi vcc vcl vss vss vss vss port 8 port 7 clock pulse generator internal data bus port a port 2 port 9 port 6 port 4 port 5 port 1 port 3 port b 1. the program development tool (emulator) does not support this function. 2. the program development tool (emulator) does not support the output. notes: bus controller figure 1.1 internal block diagram of h8s/2110b
rev. 1.0, 09/02, page 4 of 524 1.3 pin arrangement and functions 1.3.1 pin arrangement fp-100b tfp-100b (top view) 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 xtal extal vccb md1 md0 nmi vcl pa7/ /ps2cd pa6/ /ps2cc p52/exsck1 * 1 /scl0 p51/exrdxd1 * 1 p50/extxd1 * 1 vss p97/sda0 p96/ /excl p95 p94 pa5/ /ps2bd pa4/ /ps2bc p93 p92/ p91/ p90/ p14 p15 p16 p17 vss vss pb4/ pb5/ p20 p21 p22 p23 p24 p25 p26 p27 vcc pb6/ pb7/ p47/pwx1 p46/pwx0 p45/tmri1 p44/tmo1 p43/tmci1 p42/tmri0/sda1 p41/tmo0 p40/tmci0 pa0/ pa1/ vss p77 * 2 /extmox * 1 p76 * 2 /tmoy * 1 p75 * 2 p74 * 2 p73 * 2 p72 * 2 p71 * 2 p70 * 2 vcc vcc p67/tmox/ / p66/ftob/ / p65/ftid/ p64/ftic/ pa2/ /ps2ac pa3/ /ps2ad p63/ftib/ p62/ftia/ /tmiy p61/ftoa/ p60/ftci/ /tmix p13 p12 p11 p10 pb3/ pb2/ p30/lad0 p31/lad1 p32/lad2 p33/lad3 p34/ p35/ p36/lclk p37/serirq pb1/ /lsci pb0/ / vss p80/ p81/ga20 p82/ p83/ p84/ /txd1 p85/ /rxd1 p86/ /sck1/scl1 55 54 53 52 51 12345678910111213141516171819202122232425 1. the program development tool (emulator) does not support this function. 2. the program development tool (emulator) does not support the output. notes: figure 1.2 pin arrangement of h8s/2110b
rev. 1.0, 09/02, page 5 of 524 1.3.2 pin functions in each operating mode table 1.1 pin functions in each operating mode pin name pin no. single-chip modes fp-100b tfp-100b mode 2, mode 3 (expe = 0) flash memory programmer mode 1 res res 2 xtal xtal 3 extal extal 4 vccb vcc 5 md1 vss 6 md0 vss 7nmi fa9 8 stby vcc 9 vcl vcc 10 (b) pa7/ kin15 /ps2cd nc 11 (b) pa6/ kin14 /ps2cc nc 12 (n) p52/exsck1 * 1 /scl0 nc 13 p51/exrxd1 * 1 fa17 14 p50/extxd1 * 1 nc 15 vss vss 16 (n) p97/sda0 vcc 17 p96/ f /excl nc 18 p95 fa16 19 p94 fa15 20 (b) pa5/ kin13 /ps2bd nc 21 (b) pa4/ kin12 /ps2bc nc
rev. 1.0, 09/02, page 6 of 524 pin name pin no. single-chip modes fp-100b tfp-100b mode 2, mode 3 (expe = 0) flash memory programmer mode 22 p93 we 23 p92/ irq0 vss 24 p91/ irq1 vcc 25 p90/ irq2 vcc 26 p60/ftci/ kin0 /tmix nc 27 p61/ftoa/ kin1 nc 28 p62/ftia/ kin2 /tmiy nc 29 p63/ftib/ kin3 nc 30 (b) pa3/ kin11 /ps2ad nc 31 (b) pa2/ kin10 /ps2ac nc 32 p64/ftic/ kin4 nc 33 p65/ftid/ kin5 nc 34 p66/ftob/ kin6 / irq6 nc 35 p67/tmox/ kin7 / irq7 vss 36 vcc vcc 37 vcc vcc 38 p70 * 2 nc 39 p71 * 2 nc 40 p72 * 2 nc 41 p73 * 2 nc
rev. 1.0, 09/02, page 7 of 524 pin name pin no. single-chip modes fp-100b tfp-100b mode 2, mode 3 (expe = 0) flash memory programmer mode 42 p74 * 2 nc 43 p75 * 2 nc 44 p76 * 2 /tmoy * 1 nc 45 p77 * 2 /extmox * 1 nc 46 vss vss 47 (b) pa1/ kin9 nc 48 (b) pa0/ kin8 nc 49 p40/tmci0 nc 50 p41/tmo0 nc 51 (n) p42/tmri0/sda1 nc 52 p43/tmci1 nc 53 p44/tmo1 nc 54 p45/tmri1 nc 55 p46/pwx0 nc 56 p47/pwx1 nc 57 pb7/ wue7 nc 58 pb6/ wue6 nc 59 vcc vcc 60 p27 ce 61 p26 fa14 62 p25 fa13 63 p24 fa12 64 p23 fa11
rev. 1.0, 09/02, page 8 of 524 pin name pin no. single-chip modes fp-100b tfp-100b mode 2, mode 3 (expe = 0) flash memory programmer mode 65 p22 fa10 66 p21 oe 67 p20 fa8 68 pb5/ wue5 nc 69 pb4/ wue4 nc 70 vss vss 71 vss vss 72 p17 fa7 73 p16 fa6 74 p15 fa5 75 p14 fa4 76 p13 fa3 77 p12 fa2 78 p11 fa1 79 p10 fa0 80 pb3/ wue3 nc 81 pb2/ wue2 nc 82 p30/lad0 fo0 83 p31/lad1 fo1 84 p32/lad2 fo2 85 p33/lad3 fo3 86 p34/ lframe fo4 87 p35/ lreset fo5 88 p36/lclk fo6 89 p37/serirq fo7 90 pb1/ wue1 /lsci nc 91 pb0/ wue0 / lsmi nc
rev. 1.0, 09/02, page 9 of 524 pin name pin no. single-chip modes fp-100b tfp-100b mode 2, mode 3 (expe = 0) flash memory programmer mode 92 vss vss 93 p80/ pme nc 94 p81/ga20 nc 95 p82/ clkrun nc 96 p83/ lpcpd nc 97 p84/ irq3 /txd1 nc 98 p85/ irq4 /rxd1 nc 99 (n) p86/ irq5 /sck1/scl1 nc 100 reso nc notes: the (b) in pin no. means the vccb drive and the (n) in pin no. means the nmos push- pull/open-drain drive. * 1 the program development tool (emulator) does not support this function. * 2 the program development tool (emulator) does not support the output.
rev. 1.0, 09/02, page 10 of 524 1.3.3 pin functions table 1.2 pin functions pin no. type symbol fp-100b, tfp-100b i/o name and function vcc 36, 37, 59 input power supply pin. connect the pin to the system power supply. vcl 9 input power supply pin. connect the pin to vcc. vccb 4 input the power supply for the port a input/output buffer. power vss 15, 46, 70, 71, 92 input ground pin. connect to the system power supply (0 v). xtal 2 input extal 3 input pins for connection to crystal resonators. the extal pin can also input an external clock. see section 18, clock pulse generator, for typical connection diagrams. f 17 output supplies the system clock to external devices. clock excl 17 input input a 32.768 khz external subclock. operating mode control md1 md0 5 6 input these pins set the operating mode. these pins should not be changed while the mcu is operating. res 1 input reset pin. when this pin becomes low, the chip is reset. reso 100 output outputs a reset signal to external device. system control stby 8 input when this pin is driven low, a transition is made to hardware standby mode. nmi 7 input input pin for a nonmaskable interrupt request. interrupt signals irq0 to irq7 23 to 25, 97 to 99, 34, 35 input these pins request a maskable interrupt. ftci 26 input the counter clock input pin. ftoa 27 output the output compare a output pin. ftob 34 output the output compare b output pin. 16-bit free- running timer (frt) ftia 28 input the input capture a input pin.
rev. 1.0, 09/02, page 11 of 524 pin no. type symbol fp-100b, tfp-100b i/o name and function ftib 29 input the input capture b input pin. ftic 32 input the input capture c input pin. 16-bit free- running timer (frt) ftid 33 input the input capture d input pin. tmo0 tmo1 tmox extmox * 1 tmoy * 1 50 53 35 45 44 output the waveform output pins for the output compare function. tmci0 tmci1 49 52 input input pins for the external clock input to counters. 8-bit timer (tmr_0, tmr_1, tmr_x, tmr_y) tmri0 tmri1 51 54 input the counter reset input pins. 8-bit timer (tmr_x, tmr_y) tmix tmiy 26 28 input the counter event input and counter reset input pins. 14-bit pwm timer (pwmx) pwx0 pwx1 55 56 output pwm d/a pulse output pins. extxd1 * 1 txd1 14 97 output transmit data output pins. exrxd1 * 1 rxd1 13 98 input receive data input pins. serial communi- cation interface (sci_1) exsck1 * 1 sck1 12 99 input/ output clock input/output pins. the output type is nmos push-pull. ps2ac ps2bc ps2cc 31 21 11 input/ output keyboard buffer controller synchronization clock input/output pins. keyboard buffer controller ps2ad ps2bd ps2cd 30 20 10 input/ output keyboard buffer controller data input/output pins.
rev. 1.0, 09/02, page 12 of 524 pin no. type symbol fp-100b, tfp-100b i/o name and function lad3 to lad0 85 to 82 input/ output lpc command, address, and data input/output pins. lframe 86 input input pin that indicates the start of an lpc cycle or forced termination of an abnormal lpc cycle. lreset 87 input input pin that indicates an lpc reset. lclk 88 input the lpc clock input pin. serirq 89 input/ output input/output pin for lpc serialized host interrupts (hirq1, smi, hirq6, hirq9 to hirq12). lsci, lsmi , pme 90, 91, 93 input/ output lpc auxiliary output pins. functionally, they are general i/o ports. ga20 94 input/ output a20 gate control signal output pin. output state monitoring input is possible. clkrun 95 input/ output input/output pin that requests the start of lclk operation when lclk is stopped. host interface (lpc) lpcpd 96 input input pin that controls lpc module shutdown. kin0 to kin15 26 to 29, 32 to 35, 48, 47, 31, 30, 21, 20, 11, 10 input matrix keyboard input pins. kin0 to kin15 are used as key-scan inputs, and p10 to p17 and p20 to p27 are used as key-scan outputs. this allows a maximum 16- output 16-input, 256-key matrix to be configured. keyboard buffer controller wue0 to wue7 91, 90, 81, 80, 69, 68, 58, 57 input wakeup event input pins. these pins allow the same kind of wakeup as key-wakeup from various sources. scl0 scl1 12 99 input/ output i 2 c clock i/o pins. the output type is nmos open-drain output. i 2 c bus interface (iic) sda0 sda1 16 51 input/ output i 2 c data i/o pins. the output type is nmos open-drain output.
rev. 1.0, 09/02, page 13 of 524 pin no. type symbol fp-100b, tfp-100b i/o name and function i/o ports p17 to p10 72 to 79 input/ output eight input/output pins. p27 to p20 60 to 67 input/ output eight input/output pins. p37 to p30 89 to 82 input/ output eight input/output pins. p47 to p40 56 to 49 input/ output eight input/output pins. (the output type of p42 is nmos push-pull.) p52 to p50 12 to 14 input/ output three input/output pins. (the output type of p52 is nmos push-pull.) p67 to p60 35 to 32 29 to 26 input/ output eight input/output pins. p77 to p70 45 to 38 input/ output * 2 eight input/output pins. * 2 p86 to p80 99 to 93 input/ output seven input/output pins. (the output type of p86 is nmos push-pull.) p97 to p90 16 to 19 22 to 25 input/ output eight input/output pins. (the output type of p97 is nmos push-pull.) pa7 to pa0 10, 11, 20, 21, 30, 31, 47, 48 input/ output eight input/output pins. pb7 to pb0 57, 58, 68, 69, 80, 81, 90, 91 input/ output eight input/output pins. notes: 1. the program development tool (emulator) does not support this function. 2. the program development tool (emulator) does not support the output.
rev. 1.0, 09/02, page 14 of 524
rev. 1.0, 09/02, page 15 of 524 section 2 cpu the h8s/2000 cpu is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the h8/300 and h8/300h cpus. the h8s/2000 cpu has sixteen 16-bit general registers, can address a 16-mbyte linear address space, and is ideal for realtime control. this section describes the h8s/2000 cpu. the usable modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. 2.1 features upward-compatibility with h8/300 and h8/300h cpus can execute h8/300 cpu and h8/300h cpu object programs general-register architecture sixteen 16-bit general registers also usable as sixteen 8-bit registers or eight 32-bit registers sixty-five basic instructions 8/16/32-bit arithmetic and logic instructions multiply and divide instructions powerful bit-manipulation instructions eight addressing modes register direct [rn] register indirect [@ern] register indirect with displacement [@(d:16,ern) or @(d:32,ern)] register indirect with post-increment or pre-decrement [@ern+ or @Cern] absolute address [@aa:8, @aa:16, @aa:24, or @aa:32] immediate [#xx:8, #xx:16, or #xx:32] program-counter relative [@(d:8,pc) or @(d:16,pc)] memory indirect [@@aa:8] 16-mbyte address space program: 16 mbytes data: 16 mbytes high-speed operation all frequently-used instructions are executed in one or two states 8/16/32-bit register-register add/subtract: 1 state 8 8-bit register-register multiply: 12 states (mulxu.b), 13 states (mulxs.b) 16 ? 8-bit register-register divide: 12 states (divxu.b) 16 16-bit register-register multiply: 20 states (mulxu.w), 21 states (mulxs.w) 32 ? 16-bit register-register divide: 20 states (divxu.w) cpu210a_010020020800
rev. 1.0, 09/02, page 16 of 524 two cpu operating modes normal mode advanced mode power-down state transition to power-down state by sleep instruction selectable cpu clock speed 2.1.1 differences between h8s/2600 cpu and h8s/2000 cpu the differences between the h8s/2600 cpu and the h8s/2000 cpu are as shown below. register configuration the mac register is supported only by the h8s/2600 cpu. basic instructions the four instructions mac, clrmac, ldmac, and stmac are supported only by the h8s/2600 cpu. the number of execution states of the mulxu and mulxs instructions execution states instruction mnemonic h8s/2600 h8s/2000 mulxu.b rs, rd 3 12 mulxu mulxu.w rs, erd 4 20 mulxs.b rs, rd 4 13 mulxs mulxs.w rs, erd 5 21 in addition, there are differences in address space, ccr and exr register functions, power-down modes, etc., depending on the model. 2.1.2 differences from h8/300 cpu in comparison to the h8/300 cpu, the h8s/2000 cpu has the following enhancements. more general registers and control registers eight 16-bit extended registers and one 8-bit control register have been added. expanded address space normal mode supports the same 64-kbyte address space as the h8/300 cpu. advanced mode supports a maximum 16-mbyte address space.
rev. 1.0, 09/02, page 17 of 524 enhanced addressing the addressing modes have been enhanced to make effective use of the 16-mbyte address space. enhanced instructions addressing modes of bit-manipulation instructions have been enhanced. signed multiply and divide instructions have been added. two-bit shift and two-bit rotate instructions have been added. instructions for saving and restoring multiple registers have been added. a test and set instruction has been added. higher speed basic instructions are executed twice as fast. 2.1.3 differences from h8/300h cpu in comparison to the h8/300h cpu, the h8s/2000 cpu has the following enhancements. additional control register one 8-bit control register has been added. enhanced instructions addressing modes of bit-manipulation instructions have been enhanced. two-bit shift and two-bit rotate instructions have been added. instructions for saving and restoring multiple registers have been added. a test and set instruction has been added. higher speed basic instructions are executed twice as fast.
rev. 1.0, 09/02, page 18 of 524 2.2 cpu operating modes the h8s/2000 cpu has two operating modes: normal and advanced. normal mode supports a maximum 64-kbyte address space. advanced mode supports a maximum 16-mbyte address space. the mode is selected by the lsi's mode pins. 2.2.1 normal mode the exception vector table and stack have the same structure as in the h8/300 cpu in normal mode. address space linear access to a maximum address space of 64 kbytes is possible. extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers. when extended register en is used as a 16-bit register it can contain any value, even when the corresponding general register (rn) is used as an address register. (if general register rn is referenced in the register indirect addressing mode with pre-decrement (@Crn) or post- increment (@rn+) and a carry or borrow occurs, the value in the corresponding extended register (en) will be affected.) instruction set all instructions and addressing modes can be used. only the lower 16 bits of effective addresses (ea) are valid. exception vector table and memory indirect branch addresses in normal mode, the top area starting at h'0000 is allocated to the exception vector table. one branch address is stored per 16 bits. the exception vector table in normal mode is shown in figure 2.1. for details on the exception vector table, see section 4, exception handling. the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in normal mode, the operand is a 16-bit (word) operand, providing a 16-bit branch address. branch addresses can be stored in the top area from h'0000 to h'00ff. note that this area is also used for the exception vector table. stack structure in normal mode, when the program counter (pc) is pushed onto the stack in a subroutine call in normal mode, and the pc and condition-code register (ccr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.2. the extended control register (exr) is not pushed onto the stack. for details, see section 4, exception handling.
rev. 1.0, 09/02, page 19 of 524 h'0000 h'0001 h'0002 h'0003 h'0004 h'0005 h'0006 h'0007 h'0008 h'0009 h'000a h'000b reset exception vector (reserved for system use) exception vector 1 exception vector 2 exception vector table (reserved for system use) figure 2.1 exception vector table (normal mode) (a) subroutine branch (b) exception handling pc (16 bits) ccr ccr * pc (16 bits) sp note: * ignored when returning. sp figure 2.2 stack structure in normal mode 2.2.2 advanced mode address space linear access to a maximum address space of 16 mbytes is possible. extended registers (en) the extended registers (e0 to e7) can be used as 16-bit registers. they can also be used as the upper 16-bit segments of 32-bit registers or address registers. instruction set all instructions and addressing modes can be used.
rev. 1.0, 09/02, page 20 of 524 exception vector table and memory indirect branch addresses in advanced mode, the top area starting at h'00000000 is allocated to the exception vector table in 32-bit units. in each 32 bits, the upper 8 bits are ignored and a branch address is stored in the lower 24 bits (see figure 2.3). for details on the exception vector table, see section 4, exception handling. h'00000000 h'00000003 h'00000004 h'0000000b h'0000000c h'00000010 h'00000008 h'00000007 reserved reserved reserved reset exception vector (reserved for system use) exception vector table exception vector 1 (reserved for system use) figure 2.3 exception vector table (advanced mode) the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in advanced mode, the operand is a 32-bit longword operand, providing a 32-bit branch address. the upper 8 bits of these 32 bits are a reserved area that is regarded as h'00. branch addresses can be stored in the area from h'00000000 to h'000000ff. note that the top area of this range is also used for the exception vector table. stack structure in advanced mode, when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc and condition-code register (ccr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.4. the extended control register (exr) is not pushed onto the stack. for details, see section 4, exception handling.
rev. 1.0, 09/02, page 21 of 524 (a) subroutine branch (b) exception handling pc (24 bits) ccr pc (24 bits) sp sp reserved figure 2.4 stack structure in advanced mode 2.3 address space figure 2.5 shows a memory map of the h8s/2000 cpu. the h8s/2000 cpu provides linear access to a maximum 64-kbyte address space in normal mode, and a maximum 16-mbyte (architecturally 4-gbyte) address space in advanced mode. the usable modes and address spaces differ depending on the product. for details on each product, refer to section 3, mcu operating modes. h'0000 h'ffff h'00000000 h'ffffffff h'00ffffff 64 kbytes 16 mbytes program area data area (b) advanced mode (a) normal mode not available in this lsi figure 2.5 memory map
rev. 1.0, 09/02, page 22 of 524 2.4 register configuration the h8s/2000 cpu has the internal registers shown in figure 2.6. there are two types of registers: general registers and control registers. control registers are a 24-bit program counter (pc), an 8-bit extended control register (exr), and an 8-bit condition code register (ccr). t i2i1i0 exr * 76543210 pc 23 0 15 0 7 0 7 0 e0 e1 e2 e3 e4 e5 e6 e7 r0h r1h r2h r3h r4h r5h r6h r7h r0l r1l r2l r3l r4l r5l r6l r7l sp pc exr t i2 to i0 ccr i ui : stack pointer : program counter : extended control register : trace bit : interrupt mask bits : condition-code register : interrupt mask bit : user bit or interrupt mask bit : half-carry flag : user bit : negative flag : zero flag : overflow flag : carry flag er0 er1 er2 er3 er4 er5 er6 er7 (sp) iuihunzvc ccr 76543210 h u n z v c general registers (rn) and extended registers (en) control registers legend ---- note: * does not affect operation in this lsi. figure 2.6 cpu internal registers
rev. 1.0, 09/02, page 23 of 524 2.4.1 general registers the h8s/2000 cpu has eight 32-bit general registers. these general registers are all functionally alike and can be used as both address registers and data registers. when a general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8-bit register. figure 2.7 illustrates the usage of the general registers. when the general registers are used as 32-bit registers or address registers, they are designated by the letters er (er0 to er7). when the general registers are used as 16-bit registers, the er registers are divided into 16-bit general registers designated by the letters e (e0 to e7) and r (r0 to r7). these registers are functionally equivalent, providing a maximum sixteen 16-bit registers. the e registers (e0 to e7) are also referred to as extended registers. when the general registers are used as 8-bit registers, the r registers are divided into 8-bit general registers designated by the letters rh (r0h to r7h) and rl (r0l to r7l). these registers are functionally equivalent, providing a maximum sixteen 8-bit registers. the usage of each register can be selected independently. general register er7 has the function of the stack pointer (sp) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. figure 2.8 shows the stack. ? address registers ? 32-bit registers ? 16-bit registers ? 8-bit registers er registers (er0 to er7) e registers (extended registers) (e0 to e7) r registers (r0 to r7) rh registers (r0h to r7h) rl registers (r0l to r7l) figure 2.7 usage of general registers
rev. 1.0, 09/02, page 24 of 524 sp (er7) free area stack area figure 2.8 stack 2.4.2 program counter (pc) this 24-bit counter indicates the address of the next instruction the cpu will execute. the length of all cpu instructions is 2 bytes (one word), so the least significant pc bit is ignored. (when an instruction is fetched for read, the least significant pc bit is regarded as 0.) 2.4.3 extended control register (exr) exr does not affect operation in this lsi. bit bit name initial value r/w description 7 t 0 r/w trace bit does not affect operation in this lsi. 6 to 3 all 1 r reserved these bits are always read as 1. 2 to 0 i2 i1 i0 1 1 1 r/w r/w r/w interrupt mask bits 2 to 0 do not affect operation in this lsi. 2.4.4 condition-code register (ccr) this 8-bit register contains internal cpu status information, including an interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. operations can be performed on the ccr bits by the ldc, stc, andc, orc, and xorc instructions. the n, z, v, and c flags are used as branching conditions for conditional branch (bcc) instructions.
rev. 1.0, 09/02, page 25 of 524 bit bit name initial value r/w description 7 i 1 r/w interrupt mask bit masks interrupts other than nmi when set to 1. nmi is accepted regardless of the i bit setting. the i bit is set to 1 at the start of an exception-handling sequence. for details, refer to section 5, interrupt controller. 6 ui undefined r/w user bit or interrupt mask bit can be written to and read from by software using the ldc, stc, andc, orc, and xorc instructions. 5 h undefined r/w half-carry flag when the add.b, addx.b, sub.b, subx.b, cmp.b or neg.b instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. when the add.w, sub.w, cmp.w, or neg.w instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise. when the add.l, sub.l, cmp.l, or neg.l instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 27, and cleared to 0 otherwise. 4 u undefined r/w user bit can be written to and read from by software using the ldc, stc, andc, orc, and xorc instructions. 3 n undefined r/w negative flag stores the value of the most significant bit of data as a sign bit. 2 z undefined r/w zero flag set to 1 to indicate zero data, and cleared to 0 to indicate non-zero data. 1 v undefined r/w overflow flag set to 1 when an arithmetic overflow occurs, and cleared to 0 otherwise. 0 c undefined r/w carry flag set to 1 when a carry occurs, and cleared to 0 otherwise. used by add instructions, to indicate a carry subtract instructions, to indicate a borrow shift and rotate instructions, to indicate a carry the carry flag is also used as a bit accumulator by bit manipulation instructions.
rev. 1.0, 09/02, page 26 of 524 2.4.5 initial register values the program counter (pc) among cpu internal registers is initialized when reset exception handling loads a start address from a vector table. the trace (t) bit in exr is cleared to 0, and the interrupt mask (i) bits in ccr and exr are set to 1. the other ccr bits and the general registers are not initialized. note that the stack pointer (er7) is undefined. the stack pointer should therefore be initialized by an mov.l instruction executed immediately after a reset. 2.5 data formats the h8s/2000 cpu can process 1-bit, 4-bit bcd, 8-bit (byte), 16-bit (word), and 32-bit (longword) data. bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2, , 7) of byte operand data. the daa and das decimal-adjust instructions treat byte data as two digits of 4-bit bcd data. 2.5.1 general register data formats figure 2.9 shows the data formats of general registers. 70 70 msb lsb msb lsb 70 43 don't care don't care don't care 70 43 70 don't care 65432 710 70 don't care 65432 710 don't care rnh rnl rnh rnl rnh rnl data type register number data image byte data byte data 4-bit bcd data 4-bit bcd data 1-bit data 1-bit data upper lower upper lower figure 2.9 general register data formats (1)
rev. 1.0, 09/02, page 27 of 524 15 0 msb lsb 15 0 msb lsb 31 16 msb 15 0 lsb en rn ern en rn rnh rnl msb lsb : general register er : general register e : general register r : general register rh : general register rl : most significant bit : least significant bit data type data image register number word data word data rn en longword data legend ern figure 2.9 general register data formats (2)
rev. 1.0, 09/02, page 28 of 524 2.5.2 memory data formats figure 2.10 shows the data formats in memory. the h8s/2000 cpu can access word data and longword data in memory, but word or longword data must begin at an even address. if an attempt is made to access word or longword data at an odd address, no address error occurs but the least significant bit of the address is regarded as 0, so the access starts at the preceding address. this also applies to instruction fetches. when sp (er7) is used as an address register to access the stack, the operand size should be word size or longword size. 70 76 543210 msb lsb msb msb lsb lsb data type address 1-bit data byte data word data address l address l address 2m address 2m + 1 longword data address 2n address 2n + 1 address 2n + 2 address 2n + 3 data image figure 2.10 memory data formats
rev. 1.0, 09/02, page 29 of 524 2.6 instruction set the h8s/2000 cpu has 65 types of instructions. the instructions are classified by function as shown in table 2.1. table 2.1 instruction classification function instructions size types mov b/w/l pop * 1 , push * 1 w/l ldm * 5 , stm * 5 l data transfer movfpe * 3 , movtpe * 3 b 5 add, sub, cmp, neg b/w/l addx, subx, daa, das b inc, dec b/w/l adds, subs l mulxu, divxu, mulxs, divxs b/w extu, exts w/l arithmetic operations tas * 4 b 19 logic operations and, or, xor, not b/w/l 4 shift shal, shar, shll, shlr, rotl, rotr, rotxl, rotxr b/w/l 8 bit manipulation bset, bclr, bnot, btst, bld, bild, bst, bist, band, biand, bor, bior, bxor, bixor b14 branch b cc * 2 , jmp, bsr, jsr, rts 5 system control trapa, rte, sleep, ldc, stc, andc, orc, xorc, nop 9 block data transfer eepmov 1 total: 65 notes: b: byte size; w: word size; l: longword size. 1. pop.w rn and push.w rn are identical to mov.w @sp+, rn and mov.w rn, @- sp. pop.l ern and push.l ern are identical to mov.l @sp+, ern and mov.l ern, @-sp. 2. b cc is the general name for conditional branch instructions. 3. cannot be used in this lsi. 4. when using the tas instruction, use registers er0, er1, er4, and er5. 5. er7 is not used as the register that can be saved (stm)/restored (ldm) when using stm/ldm instruction, because er7 is the stack pointer.
rev. 1.0, 09/02, page 30 of 524 2.6.1 instructions classified by function tables 2.3 to 2.10 summarize the instructions in each functional category. the notation used in tables 2.3 to 2.10 is defined below. table 2.2 operation notation symbol description rd general register (destination) * rs general register (source) * rn general register * ern general register (32-bit register) (ead) destination operand (eas) source operand exr extended control register ccr condition-code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition C subtraction multiplication ? division logical and logical or ? logical exclusive or ? move ~ not (logical complement) :8/:16/:24/:32 8-, 16-, 24-, or 32-bit length note: * general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit registers (er0 to er7).
rev. 1.0, 09/02, page 31 of 524 table 2.3 data transfer instructions instruction size * 1 function mov b/w/l (eas) ? rd, rs ? (ead) moves data between two general registers or between a general register and memory, or moves immediate data to a general register. movfpe b cannot be used in this lsi. movtpe b cannot be used in this lsi. pop w/l @sp+ ? rn pops a general register from the stack. pop.w rn is identical to mov.w @sp+, rn. pop.l ern is identical to mov.l @sp+, ern push w/l rn ? @-sp pushes a general register onto the stack. push.w rn is identical to mov.w rn, @-sp. push.l ern is identical to mov.l ern, @-sp. ldm * 2 l @sp+ ? rn (register list) pops two or more general registers from the stack. stm * 2 l rn (register list) ? @-sp pushes two or more general registers onto the stack. notes: 1. size refers to the operand size. b: byte w: word l: longword 2. er7 is not used as the register that can be saved (stm)/restored (ldm) when using stm/ldm instruction, because er7 is the stack pointer.
rev. 1.0, 09/02, page 32 of 524 table 2.4 arithmetic operations instructions (1) instruction size * function add sub b/w/l rd rs ? rd, rd #imm ? rd performs addition or subtraction on data in two general registers, or on immediate data and data in a general register. (subtraction on immediate data and data in a general register cannot be performed in bytes. use the subx or add instruction.) addx subx brd rs c ? rd, rd #imm c ? rd performs addition or subtraction with carry on data in two general registers, or on immediate data and data in a general register. inc dec b/w/l rd 1 ? rd, rd 2 ? rd adds or subtracts the value 1 or 2 to or from data in a general register. (only the value 1 can be added to or subtracted from byte operands.) adds subs lrd 1 ? rd, rd 2 ? rd, rd 4 ? rd adds or subtracts the value 1, 2, or 4 to or from data in a 32-bit register. daa das b rd (decimal adjust) ? rd decimal-adjusts an addition or subtraction result in a general register by referring to ccr to produce 4-bit bcd data. mulxu b/w rd rs ? rd performs unsigned multiplication on data in two general registers: either 8 bits 8 bits ? 16 bits or 16 bits 16 bits ? 32 bits. mulxs b/w rd rs ? rd performs signed multiplication on data in two general registers: either 8 bits 8 bits ? 16 bits or 16 bits 16 bits ? 32 bits. divxu b/w rd ? rs ? rd performs unsigned division on data in two general registers: either 16 bits ? 8 bits ? 8-bit quotient and 8-bit remainder or 32 bits ? 16 bits ? 16-bit quotient and 16-bit remainder. note: * size refers to the operand size. b: byte w: word l: longword
rev. 1.0, 09/02, page 33 of 524 table 2.4 arithmetic operations instructions (2) instruction size * 1 function divxs b/w rd ? rs ? rd performs signed division on data in two general registers: either 16 bits ? 8 bits ? 8-bit quotient and 8-bit remainder or 32 bits ? 16 bits ? 16-bit quotient and 16-bit remainder. cmp b/w/l rd C rs, rd C #imm compares data in a general register with data in another general register or with immediate data, and sets the ccr bits according to the result. neg b/w/l 0 C rd ? rd takes the two's complement (arithmetic complement) of data in a general register. extu w/l rd (zero extension) ? rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by padding with zeros on the left. exts w/l rd (sign extension) ? rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by extending the sign bit. tas * 2 b @erd C 0, 1 ? ( of @erd) tests memory contents, and sets the most significant bit (bit 7) to 1. notes: 1. size refers to the operand size. b: byte w: word l: longword 2. when using the tas instruction, use registers er0, er1, er4 and er5.
rev. 1.0, 09/02, page 34 of 524 table 2.5 logic operations instructions instruction size * function and b/w/l rd rs ? rd, rd #imm ? rd performs a logical and operation on a general register and another general register or immediate data. or b/w/l rd rs ? rd, rd #imm ? rd performs a logical or operation on a general register and another general register or immediate data. xor b/w/l rd ? rs ? rd, rd ? #imm ? rd performs a logical exclusive or operation on a general register and another general register or immediate data. not b/w/l ~ rd ? rd takes the one's complement (logical complement) of data in a general register. note: * size refers to the operand size. b: byte w: word l: longword table 2.6 shift instructions instruction size * function shal shar b/w/l rd (shift) ? rd performs an arithmetic shift on data in a general register. 1-bit or 2 bit shift is possible. shll shlr b/w/l rd (shift) ? rd performs a logical shift on data in a general register. 1-bit or 2 bit shift is possible. rotl rotr b/w/l rd (rotate) ? rd rotates data in a general register. 1-bit or 2 bit rotation is possible. rotxl rotxr b/w/l rd (rotate) ? rd rotates data including the carry flag in a general register. 1-bit or 2 bit rotation is possible. note: * size refers to the operand size. b: byte w: word l: longword
rev. 1.0, 09/02, page 35 of 524 table 2.7 bit manipulation instructions (1) instruction size * function bset b 1 ? ( of ) sets a specified bit in a general register or memory operand to 1. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bclr b 0 ? ( of ) clears a specified bit in a general register or memory operand to 0. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bnot b ~ ( of ) ? ( of ) inverts a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. btst b ~ ( of ) ? z tests a specified bit in a general register or memory operand and sets or clears the z flag accordingly. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. band b c ( of ) ? c logically ands the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. biand b c ( of ) ? c logically ands the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bor b c ( of ) ? c logically ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. bior b c ( ~ of ) ? c logically ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. note: * size refers to the operand size. b: byte
rev. 1.0, 09/02, page 36 of 524 table 2.7 bit manipulation instructions (2) instruction size * function bxor b c ? ( of ) ? c logically exclusive-ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. bixor b c ? ~ ( of ) ? c logically exclusive-ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bld b ( of ) ? c transfers a specified bit in a general register or memory operand to the carry flag. bild b ~ ( of ) ? c transfers the inverse of a specified bit in a general register or memory operand to the carry flag. the bit number is specified by 3-bit immediate data. bst b c ? ( of ) transfers the carry flag value to a specified bit in a general register or memory operand. bist b ~ c ? (. of ) transfers the inverse of the carry flag value to a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data. note: * size refers to the operand size. b: byte
rev. 1.0, 09/02, page 37 of 524 table 2.8 branch instructions instruction size function branches to a specified address if a specified condition is true. the branching conditions are listed below. mnemonic description condition bra (bt) always (true) always brn (bf) never (false) never bhi high c z = 0 bls low or same c z = 1 bcc (bhs) carry clear (high or same) c = 0 bcs (blo) carry set (low) c = 1 bne not equal z = 0 beq equal z = 1 bvc overflow clear v = 0 bvs overflow set v = 1 bpl plus n = 0 bmi minus n = 1 bge greater or equal n ? v = 0 blt less than n ? v = 1 bgt greater than z (n ? v) = 0 ble less or equal z (n ? v) = 1 bcc jmp branches unconditionally to a specified address. bsr branches to a subroutine at a specified address jsr branches to a subroutine at a specified address rts returns from a subroutine
rev. 1.0, 09/02, page 38 of 524 table 2.9 system control instructions instruction size * function trapa starts trap-instruction exception handling. rte returns from an exception-handling routine. sleep causes a transition to a power-down state. ldc b/w (eas) ? ccr, (eas) ? exr moves the memory operand contents or immediate data to ccr or exr. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. stc b/w ccr ? (ead), exr ? (ead) transfers ccr or exr contents to a general register or memory operand. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. andc b ccr #imm ? ccr, exr #imm ? exr logically ands the ccr or exr contents with immediate data. orc b ccr #imm ? ccr, exr #imm ? exr logically ors the ccr or exr contents with immediate data. xorc b ccr ? #imm ? ccr, exr ? #imm ? exr logically exclusive-ors the ccr or exr contents with immediate data. nop pc + 2 ? pc only increments the program counter. note: * size refers to the operand size. b: byte w: word
rev. 1.0, 09/02, page 39 of 524 table 2.10 block data transfer instructions instruction size function eepmov.b if r4l 1 0 then repeat @er5 + ? @er6+ r4lC1 ? r4l until r4l = 0 else next; eepmov.w if r4 1 0 then repeat @er5 + ? @er6+ r4C1 ? r4 until r4 = 0 else next; transfers a data block. starting from the address set in er5, transfers data for the number of bytes set in r4l or r4 to the address location set in er6. execution of the next instruction begins as soon as the transfer is completed. 2.6.2 basic instruction formats the h8s/2000 cpu instructions consist of 2-byte (1-word) units. an instruction consists of an operation field (op), a register field (r), an effective address extension (ea), and a condition field (cc). figure 2.11 shows examples of instruction formats. operation field indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand. the operation field always includes the first four bits of the instruction. some instructions have two operation fields. register field specifies a general register. address registers are specified by 3 bits, and data registers by 3 bits or 4 bits. some instructions have two register fields, and some have no register field. effective address extension 8, 16, or 32 bits specifying immediate data, an absolute address, or a displacement. condition field specifies the branching condition of bcc instructions.
rev. 1.0, 09/02, page 40 of 524 op op rn rm nop, rts add.b rn, rm mov.b @(d:16, rn), rm rn rm op ea (disp) op cc ea (disp) bra d:16 (1) operation field only (2) operation field and register fields (3) operation field, register fields, and effective address extension (4) operation field, effective address extension, and condition field figure 2.11 instruction formats (examples) 2.7 addressing modes and effective address calculation the h8s/2000 cpu supports the eight addressing modes listed in table 2.11. each instruction uses a subset of these addressing modes. arithmetic and logic operations instructions can use the register direct and immediate addressing modes. data transfer instructions can use all addressing modes except program-counter relative and memory indirect. bit manipulation instructions can use register direct, register indirect, or absolute addressing mode to specify an operand, and register direct (bset, bclr, bnot, and btst instructions) or immediate (3-bit) addressing mode to specify a bit number in the operand. table 2.11 addressing modes no. addressing mode symbol 1 register direct rn 2 register indirect @ern 3 register indirect with displacement @(d:16,ern)/@(d:32,ern) 4 register indirect with post-increment register indirect with pre-decrement @ern+ @Cern 5 absolute address @aa:8/@aa:16/@aa:24/@aa:32 6 immediate #xx:8/#xx:16/#xx:32 7 program-counter relative @(d:8,pc)/@(d:16,pc) 8 memory indirect @@aa:8
rev. 1.0, 09/02, page 41 of 524 2.7.1 register directrn the register field of the instruction code specifies an 8-, 16-, or 32-bit general register which contains the operand. r0h to r7h and r0l to r7l can be specified as 8-bit registers. r0 to r7 and e0 to e7 can be specified as 16-bit registers. er0 to er7 can be specified as 32-bit registers. 2.7.2 register indirect@ern the register field of the instruction code specifies an address register (ern) which contains the address of a memory operand. if the address is a program instruction address, the lower 24 bits are valid and the upper 8 bits are all assumed to be 0 (h'00). 2.7.3 register indirect with displacement@(d:16, ern) or @(d:32, ern) a 16-bit or 32-bit displacement contained in the instruction code is added to an address register (ern) specified by the register field of the instruction, and the sum gives the address of a memory operand. a 16-bit displacement is sign-extended when added. 2.7.4 register indirect with post-increment or pre-decrement@ern+ or @-ern register indirect with post-increment@ern+: the register field of the instruction code specifies an address register (ern) which contains the address of a memory operand. after the operand is accessed, 1, 2, or 4 is added to the address register contents and the sum is stored in the address register. the value added is 1 for byte access, 2 for word access, and 4 for longword access. for word or longword transfer instructions, the register value should be even. register indirect with pre-decrement@-ern: the value 1, 2, or 4 is subtracted from an address register (ern) specified by the register field in the instruction code, and the result becomes the address of a memory operand. the result is also stored in the address register. the value subtracted is 1 for byte access, 2 for word access, and 4 for longword access. for word or longword transfer instructions, the register value should be even. 2.7.5 absolute address@aa:8, @aa:16, @aa:24, or @aa:32 the instruction code contains the absolute address of a memory operand. the absolute address may be 8 bits long (@aa:8), 16 bits long (@aa:16), 24 bits long (@aa:24), or 32 bits long (@aa:32). table 2.12 indicates the accessible absolute address ranges. to access data, the absolute address should be 8 bits (@aa:8), 16 bits (@aa:16), or 32 bits (@aa:32) long. for an 8-bit absolute address, the upper 16 bits are all assumed to be 1 (h'ffff). for a 16-bit absolute address, the upper 16 bits are a sign extension. for a 32-bit absolute address, the entire address space is accessed.
rev. 1.0, 09/02, page 42 of 524 a 24-bit absolute address (@aa:24) indicates the address of a program instruction. the upper 8 bits are all assumed to be 0 (h'00). table 2.12 absolute address access ranges absolute address normal mode advanced mode 8 bits (@aa:8) h'ff00 to h'ffff h'ffff00 to h'ffffff 16 bits (@aa:16) h'000000 to h'007fff, h'ff8000 to h'ffffff data address 32 bits (@aa:32) program instruction address 24 bits (@aa:24) h'0000 to h'ffff h'000000 to h'ffffff 2.7.6 immediate#xx:8, #xx:16, or #xx:32 the 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data contained in an instruction code can be used directly as an operand. the adds, subs, inc, and dec instructions implicitly contain immediate data in their instruction codes. some bit manipulation instructions contain 3-bit immediate data in the instruction code, specifying a bit number. the trapa instruction contains 2-bit immediate data in its instruction code, specifying a vector address. 2.7.7 program-counter relative@(d:8, pc) or @(d:16, pc) this mode can be used by the bcc and bsr instructions. an 8-bit or 16-bit displacement contained in the instruction code is sign-extended to 24 bits and added to the 24-bit address indicated by the pc value to generate a 24-bit branch address. only the lower 24 bits of this branch address are valid; the upper 8 bits are all assumed to be 0 (h'00). the pc value to which the displacement is added is the address of the first byte of the next instruction, so the possible branching range is C126 to +128 bytes (C63 to +64 words) or C32766 to +32768 bytes (C16383 to +16384 words) from the branch instruction. the resulting value should be an even number.
rev. 1.0, 09/02, page 43 of 524 2.7.8 memory indirect@@aa:8 this mode can be used by the jmp and jsr instructions. the instruction code contains an 8-bit absolute address specifying a memory operand which contains a branch address. the upper bits of the 8-bit absolute address are all assumed to be 0, so the address range is 0 to 255 (h'0000 to h'00ff in normal mode, h'000000 to h'0000ff in advanced mode). in normal mode, the memory operand is a word operand and the branch address is 16 bits long. in advanced mode, the memory operand is a longword operand, the first byte of which is assumed to be 0 (h'00). note that the top area of the address range in which the branch address is stored is also used for the exception vector area. for further details, refer to section 4, exception handling. if an odd address is specified in word or longword memory access, or as a branch address, the least significant bit is regarded as 0, causing data to be accessed or the instruction code to be fetched at the address preceding the specified address. (for further information, see section 2.5.2, memory data formats.) specified by @aa:8 specified by @aa:8 branch address branch address reserved (a) normal mode (b) advanced mode figure 2.12 branch address specification in memory indirect addressing mode
rev. 1.0, 09/02, page 44 of 524 2.7.9 effective address calculation table 2.13 indicates how effective addresses are calculated in each addressing mode. in normal mode, the upper 8 bits of the effective address are ignored in order to generate a 16-bit address. table 2.13 effective address calculation (1) no 1 offset 1 2 4 r op 31 0 31 23 2 3 register indirect with displacement @(d:16,ern) or @(d:32,ern) 4 r op disp r op rm op rn 31 0 31 0 r op don't care 31 23 31 0 don't care 31 0 disp 31 0 31 0 31 23 31 0 don't care 31 23 31 0 don't care 24 24 24 24 addressing mode and instruction format effective address calculation effective address (ea) register direct (rn) general register contents general register contents general register contents general register contents sign extension register indirect (@ern) register indirect with post-increment or pre-decrement ? register indirect with post-increment @ern+ ? register indirect with pre-decrement @-ern 1, 2, or 4 1, 2, or 4 operand size byte word longword operand is general register contents.
rev. 1.0, 09/02, page 45 of 524 table 2.13 effective address calculation (2) no 5 op 31 23 31 0 don't care abs @aa:8 7 h'ffff op 31 23 31 0 don't care @aa:16 op @aa:24 @aa:32 abs 15 16 31 23 31 0 don't care 31 23 31 0 don't care abs op abs 6 op imm #xx:8/#xx:16/#xx:32 8 24 24 24 24 addressing mode and instruction format absolute address immediate effective address calculation effective address (ea) sign extension operand is immediate data. 31 23 7 program-counter relative @(d:8,pc)/@(d:16,pc) memory indirect @@aa:8 ? ? 31 0 don't care 23 0 disp 0 31 23 31 0 don't care disp op 23 op 8 abs 31 0 abs h'000000 7 8 0 15 31 23 31 0 don't care 15 h'00 16 op abs 31 0 abs h'000000 7 8 0 31 24 24 24 pc contents sign extension memory contents memory contents
rev. 1.0, 09/02, page 46 of 524 2.8 processing states the h8s/2000 cpu has four main processing states: the reset state, exception handling state, program execution state, and program stop state. figure 2.13 indicates the state transitions. reset state in this state the cpu and on-chip peripheral modules are all initialized and stopped. when the res input goes low, all current processing stops and the cpu enters the reset state. all interrupts are masked in the reset state. reset exception handling starts when the res signal changes from low to high. for details, refer to section 4, exception handling. the reset state can also be entered by a watchdog timer overflow. exception-handling state the exception-handling state is a transient state that occurs when the cpu alters the normal processing flow due to an exception source, such as, a reset, trace, interrupt, or trap instruction. the cpu fetches a start address (vector) from the exception vector table and branches to that address. for further details, refer to section 4, exception handling. program execution state in this state the cpu executes program instructions in sequence. program stop state this is a power-down state in which the cpu stops operating. the program stop state occurs when a sleep instruction is executed or the cpu enters hardware standby mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 47 of 524 program execution state sleep mode exception-handling state software standby mode = high reset state = high, = low hardware standby mode * 2 power-down state * 3 * 1 notes: 1. 2. 3. from any state except hardware standby mode, a transition to the reset state occurs whenever goes low. a transition can also be made to the reset state when the watchdog timer overflows. from any state, a transition to hardware standby mode occurs when goes low. the power-down state also includes watch mode, subactive mode, subsleep mode, etc. for details, refer to section 19, power-down modes. sleep instruction with lson = 0, ssby = 0 interrupt request request for exception handling end of exception handling external interrupt request sleep instruction with lson = 0, pss = 0, ssby = 1 figure 2.13 state transitions
rev. 1.0, 09/02, page 48 of 524 2.9 usage notes 2.9.1 note on tas instruction usage when using the tas instruction, use registers er0, er1, er4 and er5. the tas instruction is not generated by the hitachi h8s and h8/300 series c/c++ compilers. when the tas instruction is used as a user-defined intrinsic function, use registers er0, er1, er4 and er5. 2.9.2 note on stm/ldm instruction usage er7 is not used as the register that can be saved (stm)/restored (ldm) when using stm/ldm instruction, because er7 is the stack pointer. two, three, or four registers can be saved/restored by one stm/ldm instruction. the following ranges can be specified in the register list. two registers: er0er1, er2er3, or er4er5 three registers: er0er2 or er4er6 four registers: er0er3 the stm/ldm instruction including er7 is not generated by the hitachi h8s and h8/300 series c/c++ compilers. 2.9.3 bit manipulation instructions the bset, bclr, bnot, bst, and bist instructions read data from the specified address in byte units, manipulate the data of the target bit, and write data to the same address again in byte units. special care is required when using these instructions in cases where a register containing a write-only bit is used or a bit is directly manipulated for a port, because this may rewrite data of a bit other than the bit to be manipulated. example: the bclr instruction is executed for ddr in port 4. p47 and p46 are input pins, with a low-level signal input at p47 and a high-level signal input at p46. p45 to p40 are output pins and output low-level signals. the following shows an example in which p40 is set to be an input pin with the bclr instruction.
rev. 1.0, 09/02, page 49 of 524 prior to executing bclr: p47 p46 p45 p44 p43 p42 p41 p40 input/output input input output output output output output output pin state low level high level low level low level low level low level low level low level ddr 00111111 dr 10000000 bclr instruction executed: bclr #0, @p4ddr the bclr instruction is executed for ddr in port 4. after executing bclr: p47 p46 p45 p44 p43 p42 p41 p40 input/output output output output output output output output input pin state low level high level low level low level low level low level low level high level ddr 1 111111 0 dr 1 0 00000 0 operation: 1. when the bclr instruction is executed, first the cpu reads p4ddr. since p4ddr is a write-only register, so the cpu reads hff. in this example p4ddr has a value of h'3f, but the value read by the cpu is h'ff. 2. the cpu clears bit 0 of the read data to 0, changing data to h'fe. 3. the cpu writes h'fe to ddr, completing execution of bclr. as a result of the bclr instruction, bit 0 in ddr is set to 0, and p40 becomes an input pin. however, bits 7 and 6 of ddr are modified to 1, therefore p47 and p46 become output pins.
rev. 1.0, 09/02, page 50 of 524 2.9.4 eepmov instruction 1. eepmov is a block-transfer instruction and transfers the byte size of data indicated by r4l, which starts from the address indicated by r5, to the address indicated by r6. r6 r6 + r4l r5 r5 + r4l 2. set r4l and r6 so that the end address of the destination address (value of r6 + r4l) does not exceed h'ffff (the value of r6 must not change from h'ffff to h'0000 during execution). invalid h'ffff r6 r6 + r4l r5 r5 + r4l
rev. 1.0, 09/02, page 51 of 524 section 3 mcu operating modes 3.1 mcu operating mode selection this lsi has two operating modes (modes 2 and 3). the operating mode is determined by the setting of the mode pins (md1 and md0). table 3.1 shows the mcu operating mode selection. table 3.1 lists the mcu operating modes. table 3.1 mcu operating mode selection mcu operating mode md1 md0 cpu operating mode description on-chip rom 2 0 advanced single-chip mode 3 1 1 normal single-chip mode enabled modes 2 and 3 set the operation in single-chip mode. modes 0 and 1 cannot be used in this lsi. thus, mode pins should be set to enable mode 2 or 3 in normal program execution state. mode pins should not be changed during operation. 3.2 register descriptions the following registers are related to the operating mode. mode control register (mdcr) system control register (syscr) serial timer control register (stcr)
rev. 1.0, 09/02, page 52 of 524 3.2.1 mode control register (mdcr) mdcr is used to monitor the current operating mode. bit bit name initial value r/w description 7 expe 0 r/w reserved the initial value should not be changed. 6 to 2 all 0 r reserved these bits are always read as 0. these bits cannot be modified. 1 0 mds1 mds0 * * r r mode select 1 and 0 these bits indicate the input levels at mode pins (md1 and md0) (the current operating mode). bits mds1 and mds0 correspond to md1 and md0, respectively. these bits are read-only bits and they cannot be written to. the mode pin (md1 and md0) input levels are latched into these bits when mdcr is read. these latches are canceled by a reset. note: * the initial values are determined by the settings of the md1 and md0 pins.
rev. 1.0, 09/02, page 53 of 524 3.2.2 system control register (syscr) syscr selects a system pin function, monitors a reset source, selects the interrupt control mode and the detection edge for nmi, pin location selection, enables or disables register access to the on-chip peripheral modules, and enables or disables on-chip ram address space. bit bit name initial value r/w description 7 and 6 all 0 r/w reserved the initial value should not be changed. 5 4 intm1 intm0 0 0 r r/w these bits select the control mode of the interrupt controller. for details on the interrupt control modes and interrupt control select modes 1 and 0, see section 5.6, interrupt control modes and interrupt operation. 00: interrupt control mode 0 01: interrupt control mode 1 10: setting prohibited 11: setting prohibited 3 xrst 1 r external reset this bit indicates the reset source. a reset is caused by an external reset input, or when the watchdog timer overflows. 0: a reset is caused when the watchdog timer overflows. 1: a reset is caused by an external reset.
rev. 1.0, 09/02, page 54 of 524 bit bit name initial value r/w description 2 nmieg 0 r/w nmi edge select selects the valid edge of the nmi interrupt input. 0: an interrupt is requested at the falling edge of nmi input 1: an interrupt is requested at the rising edge of nmi input 1 hie 0 r/w host interface enable controls cpu access to the keyboard matrix interrupt, input pull-up mos control registers (kmimr, kmpcr, and kmimra), and the 8-bit timer (tmr_x and tmr_y) registers (tcr_x/tcr_y, tcsr_x/tcsr_y, ticrr/tcora_y, ticrf/tcorb_y, tcnt_x/tcnt_y, tcorc/tisr, tcora_x, and tcorb_x, tconri, and tconrs). 0: in areas h'(ff)fff0 to h'(ff)fff7 and h'(ff)fffc to h'(ff)ffff, cpu access to 8-bit timer (tmr_x and tmr_y) is permitted. 1: in areas h'(ff)fff0 to h'(ff)fff7 and h'(ff)fffc to h'(ff)ffff, cpu access to keyboard matrix interrupt and input pull-up mos control registers is permitted. 0 rame 1 r/w ram enable enables or disables on-chip ram. the rame bit is initialized when the reset state is released. 0: on-chip ram is disabled 1: on-chip ram is enabled
rev. 1.0, 09/02, page 55 of 524 3.2.3 serial timer control register (stcr) stcr enables or disables register access, iic operating mode, and on-chip flash memory, and selects the input clock of the timer counter. bit bit name initial value r/w description 7 iics 0 r/w i 2 c extra buffer select specifies bits 7 to 4 of port a as output buffers similar to slc and sda. these pins are used to implement an i 2 c interface only by software. 0: pa7 to pa4 are normal input/output pins. 1: pa7 to pa4 are input/output pins enabling bus driving. 6 5 iicx1 iicx0 0 0 r/w r/w i 2 c transfer rate select 1 and 0 these bits control the iic operation. these bits select a transfer rate in master mode together with bits cks2 to cks0 in the i 2 c bus mode register (icmr). for details on the transfer rate, refer to table 13.3. 4 iice 0 r/w i 2 c master enable enables or disables cpu access for iic registers (iccr, icsr, icdr/sarx, icmr/sar), pwmx registers (dadrah/dacr, dadral, dadrbh/dacnth, dadrbl/dacntl), and sci registers (smr, brr, scmr). 0: sci_1 registers are accessed in an area from h(ff)ff88 to h(ff)ff89 and from h(ff)ff8e to h(ff)ff8f. 1: iic_1 registers are accessed in an area from h(ff)ff88 to h(ff)ff89 and from h(ff)ff8e to h(ff)ff8f. pwmx registers are accessed in an area from h(ff)ffa0 to h(ff)ffa1 and from h(ff)ffa6 to h(ff)ffa7. iic_0 registers are accessed in an area from h(ff)ffd8 to h(ff)ffd9 and from h(ff)ffde to h(ff)ffdf.
rev. 1.0, 09/02, page 56 of 524 bit bit name initial value r/w description 3 flshe 0 r/w flash memory control register enable enables or disables cpu access for flash memory registers (flmcr1, flmcr2, ebr1, ebr2), control registers in power-down state (sbycr, lpwrcr, mstpcrh, mstpcrl), and control registers of on- chip peripheral modules (pcsr, syscr2). 0: registers in power-down state and control registers of on-chip peripheral modules are accessed in an area from h(ff)ff80 to h(ff)ff87. 1: control registers of flash memory are accessed in an area from h(ff)ff80 to h(ff)ff87. 2 0 r/(w)reserved the initial value should not be changed. 1 0 icks1 icks0 0 0 r/w r/w internal clock source select 1, 0 these bits select a clock to be input to the timer counter (tcnt) and a count condition together with bits cks2 to cks0 in the timer control register (tcr). for details, refer to section 10.3.4, timer control register (tcr).
rev. 1.0, 09/02, page 57 of 524 3.3 operating mode descriptions 3.3.1 mode 2 the cpu can access a 16-mbyte address space in advanced single-chip mode. the on-chip rom is enabled. 3.3.2 mode 3 the cpu can access a 64-kbyte address space in normal single-chip mode. the on-chip rom is enabled. the cpu can access a 56-kbyte address space in mode 3.
rev. 1.0, 09/02, page 58 of 524 3.4 address map in each operating mode figures 3.1 and 3.2 show the address map in each operating mode. mode 2 ( expe = 0) advanced mode single-chip mode on-chip rom internal i/o registers 2 on-chip ram internal i/o registers 1 on-chip ram (128 bytes) internal i/o registers 3 reserved area reserved area h'01ffff h'000000 h'ffe080 h'ffe880 h'fffeff h'ffffff h'fffe50 h'ffff7f h'ffff80 h'ffff00 h'fff800 h'fffe4f h'ffefff h'00ffff figure 3.1 address map for h8s/2110b (1)
rev. 1.0, 09/02, page 59 of 524 mode 3 ( expe = 0) normal mode single-chip mode h'dfff h'0000 on-chip rom internal i/o registers 2 on-chip ram internal i/o registers 1 h'efff h'e080 h'e880 h'feff h'ffff h'fe50 h'ff7f h'ff80 h'ff00 on-chip ram (128 bytes) internal i/o registers 3 h'f800 h'fe4f reserved area figure 3.2 address map for h8s/2110b (2)
rev. 1.0, 09/02, page 60 of 524
rev. 1.0, 09/02, page 61 of 524 section 4 exception handling 4.1 exception handling types and priority as table 4.1 indicates, exception handling may be caused by a reset, interrupt, direct transition, or trap instruction. exception handling is prioritized as shown in table 4.1. if two or more exceptions occur simultaneously, they are accepted and processed in order of priority. table 4.1 exception types and priority priority exception type start of exception handling reset starts immediately after a low-to-high transition of the res pin, or when the watchdog timer overflows. interrupt starts when execution of the current instruction or exception handling ends, if an interrupt request has been issued. interrupt detection is not performed on completion of andc, orc, xorc, or ldc instruction execution, or on completion of reset exception handling. high direct transition starts when a direction transition occurs as the result of sleep instruction execution. low trap instruction started by execution of a trap (trapa) instruction. trap instruction exception handling requests are accepted at all times in program execution state.
rev. 1.0, 09/02, page 62 of 524 4.2 exception sources and exception vector table different vector addresses are assigned to different exception sources. table 4.2 lists the exception sources and their vector addresses. table 4.2 exception handling vector table vector address exception source vector number normal mode advanced mode reset 0 h'0000 to h'0001 h'000000 to h'000003 reserved for system use 1 ? 5 h'0002 to h'0003 | h'000a to h'000b h'000004 to h'000007 | h'000014 to h'000017 direct transition 6 h'000c to h'000d h'000018 to h'00001b external interrupt (nmi) 7 h'000e to h'000f h'00001c to h'00001f 8 h'0010 to h'0011 h'000020 to h'000023 9 h'0012 to h'0013 h'000024 to h'000027 10 h'0014 to h'0015 h'000028 to h'00002b trap instruction (four sources) 11 h'0016 to h'0017 h'00002c to h'00002f reserved for system use 12 ? 15 h'0018 to h'0019 | h'001e to h'001f h'000030 to h'000033 | h'00003c to h'00003f irq0 16 h'0020 to h'0021 h'000040 to h'000043 irq1 17 h'0022 to h'0023 h'000044 to h'000047 irq2 18 h'0024 to h'0025 h'000048 to h'00004b irq3 19 h'0026 to h'0027 h'00004c to h'00004f irq4 20 h'0028 to h'0029 h'000050 to h'000053 irq5 21 h'002a to h'002b h'000054 to h'000057 irq6 22 h'002c to h'002d h'000058 to h'00005b external interrupt irq7 23 h'002e to h'002f h'00005c to h'00005f internal interrupt * 24 ? 111 h'0030 to h'0031 ? h'00de to h'00df h'000060 to h'000063 ? h'0001bc to h'0001bf note: * for details on the internal interrupt vector table, see section 5.5, interrupt exception handling vector table.
rev. 1.0, 09/02, page 63 of 524 4.3 reset a reset has the highest exception priority. when the res pin goes low, all processing halts and this lsi enters the reset. to ensure that this lsi is reset, hold the res pin low for at least 20 ms at power-on. to reset the chip during operation, hold the res pin low for at least 20 states. a reset initializes the internal state of the cpu and the registers of on-chip peripheral modules. the chip can also be reset by overflow of the watchdog timer. for details, see section 11, watchdog timer (wdt). 4.3.1 reset exception handling when the res pin goes high after being held low for the necessary time, this lsi starts reset exception handling as follows: 1. the internal state of the cpu and the registers of the on-chip peripheral modules are initialized and the i bit is set to 1 in ccr. 2. the reset exception handling vector address is read and transferred to the pc, and program execution starts from the address indicated by the pc. figure 4.1 shows an example of the reset sequence. internal address bus internal read signal internal write signal internal data bus vector fetch (1) reset exception handling vector address ((1) = h'0000) (2) start address (contents of reset exception handling vector address) (3) start address ((3) = (2)) (4) first program instruction (1) (3) high internal processing prefetch of first program instruction (2) (4) figure 4.1 reset sequence (mode 3)
rev. 1.0, 09/02, page 64 of 524 4.3.2 interrupts after reset if an interrupt is accepted after a reset and before the stack pointer (sp) is initialized, the pc and ccr will not be saved correctly, leading to a program crash. to prevent this, all interrupt requests, including nmi, are disabled immediately after a reset. since the first instruction of a program is always executed immediately after the reset state ends, make sure that this instruction initializes the stack pointer (example: mov.l #xx: 32, sp). 4.3.3 on-chip peripheral modules after reset is cancelled after a reset is cancelled, the module stop control registers (mstpcr) are initialized, and all modules operate in module stop mode. therefore, the registers of on-chip peripheral modules cannot be read from or written to. to read from and write to these registers, clear module stop mode. 4.4 interrupt exception handling interrupts are controlled by the interrupt controller. the sources to start interrupt exception handling are external interrupt sources (nmi, irq7 to irq0, kin15 to kin0, and wue7 to wue0) and internal interrupt sources from the on-chip peripheral modules. nmi is an interrupt with the highest priority. for details, refer to section 5, interrupt controller. interrupt exception handling is conducted as follows: 1. the values in the program counter (pc) and condition code register (ccr) are saved to the stack. 2. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and program execution begins from that address. 4.5 trap instruction exception handling trap instruction exception handling starts when a trapa instruction is executed. trap instruction exception handling can be executed at all times in the program execution state. trap instruction exception handling is conducted as follows: 1. the values in the program counter (pc) and condition code register (ccr) are saved to the stack. 2. a vector address corresponding to the interrupt source is generated, the start address is loaded from the vector table to the pc, and program execution starts from that address. the trapa instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, as specified in the instruction code.
rev. 1.0, 09/02, page 65 of 524 table 4.3 shows the status of ccr after execution of trap instruction exception handling. table 4.3 status of ccr after trap instruction exception handling ccr interrupt control mode i ui 01 111 legend 1: set to 1 : retains value prior to execution 4.6 stack status after exception handling figure 4.2 shows the stack after completion of trap instruction exception handling and interrupt exception handling. ccr ccr * pc (16 bits) sp note: ignored on return. normal mode advanced mode ccr pc (24 bits) sp figure 4.2 stack status after exception handling
rev. 1.0, 09/02, page 66 of 524 4.7 usage note when accessing word data or longword data, this lsi assumes that the lowest address bit is 0. the stack should always be accessed in words or longwords, and the value of the stack pointer (sp: er7) should always be kept even. use the following instructions to save registers: push.w rn (or mov.w rn, @-sp) push.l ern (or mov.l ern, @-sp) use the following instructions to restore registers: pop.w rn (or mov.w @sp+, rn) pop.l ern (or mov.l @sp+, ern ) setting sp to an odd value may lead to a malfunction. figure 4.3 shows an example of what happens when the sp value is odd. sp ccr : pc : r1l : sp : condition code register program counter general register r1l stack pointer ccr sp sp r1l h'ffeffa h'ffeffb h'ffeffc h'ffeffd h'ffefff pc pc trapa instruction executed sp set to h'fffeff data saved above sp mov.b r1l, @-er7 executed contents of ccr lost address legend note: this diagram illustrates an example in which the interrupt control mode is 0 in advanced mode. figure 4.3 operation when sp value is odd
rev. 1.0, 09/02, page 67 of 524 section 5 interrupt controller 5.1 features two interrupt control modes any of two interrupt control modes can be set by means of the intm1 and intm0 bits in the system control register (syscr). priorities settable with icr an interrupt control register (icr) is provided for setting interrupt priorities. three priority levels can be set for each module for all interrupts except nmi and address break. independent vector addresses all interrupt sources are assigned independent vector addresses, making it unnecessary for the source to be identified in the interrupt handling routine. thirty-one external interrupts nmi is the highest-priority interrupt, and is accepted at all times. rising edge or falling edge detection can be selected for nmi. falling-edge, rising-edge, or both-edge detection, or level sensing, can be selected for irq7 to irq0 . the irq6 interrupt is shared by the interrupt from the irq6 pin and eight external interrupt inputs ( kin7 to kin0 ), and the irq7 interrupt is shared by the interrupt from the irq7 pin and sixteen external interrupt inputs ( kin15 to kin8 and wue7 to wue0 ). kin15 to kin0 and wue7 to wue0 can be masked individually by the user program.
rev. 1.0, 09/02, page 68 of 524 syscr nmi input irq input internal interrupt request wovi0 to ibfi3 nmieg intm1, intm0 nmi input irq input isr iscr ier icr interrupt controller priority check interrupt request vector number i, ui ccr cpu icr iscr ier isr kmimr wuemr syscr : interrupt control register : irq sense control register : irq enable register : irq status register : keyboard matrix interrupt mask register : wake-up event interrupt mask register : system control register legend: kin and wue input kmimr wuemr kin input wue input figure 5.1 block diagram of interrupt controller
rev. 1.0, 09/02, page 69 of 524 5.2 input/output pins table 5.1 summarizes the pins of the interrupt controller. table 5.1 pin configuration symbol i/o function nmi input nonmaskable external interrupt rising edge or falling edge can be selected irq7 to irq0 input maskable external interrupts rising edge, falling edge, both edges, or level sensing, can be selected individually for each pin. kin15 to kin0 input maskable external interrupts falling edge or level sensing can be selected. wue7 to wue0 input maskable external interrupts falling edge or level sensing can be selected. 5.3 register descriptions the interrupt controller has the following registers. for details on the system control register (syscr), refer to section 3.2.2, system control register (syscr). interrupt control registers a to c (icra to icrc) address break control register (abrkcr) break address registers a to c (bara to barc) irq sense control registers (iscrh, iscrl) irq enable register (ier) irq status register (isr) keyboard matrix interrupt mask registers (kmimra, kmimr) wake-up event interrupt mask register (wuemrb)
rev. 1.0, 09/02, page 70 of 524 5.3.1 interrupt control registers a to c (icra to icrc) the icr registers set interrupt control levels for interrupts other than nmi and address breaks. the correspondence between interrupt sources and icra to icrc settings is shown in table 5.2. bit bit name initial value r/w description 7 to 0 icrn7 to ircn0 all 0 r/w interrupt control level 0: corresponding interrupt source is interrupt control level 0 (no priority) 1: corresponding interrupt source is interrupt control level 1 (priority) n: a to c table 5.2 correspondence between interrupt source and icr register bit bit name icra icrb icrc 7 icrn7 irq0 6 icrn6 irq1 frt sci_1 5 icrn5 irq2, irq3 4 icrn4 irq4, irq5 iic_0 3 icrn3 irq6, irq7 tmr_0 iic_1 2 icrn2 tmr_1 1 icrn1 wdt_0 tmr_x , tmr_y lpc 0 icrn0 wdt_1 keyboard buffer controller n: a to c ? : reserved. the write value should always be 0.
rev. 1.0, 09/02, page 71 of 524 5.3.2 address break control register (abrkcr) abrkcr controls the address breaks. when both the cmf flag and bie flag are set to 1, an address break is requested. bit bit name initial value r/w description 7 cmf 0 r condition match flag address break source flag. indicates that an address specified by bara to barc is prefetched. [setting condition] when an address specified by bara to barc is prefetched while the bie flag is set to 1. [clearing condition] when an exception handling is executed for an address break interrupt. 6 to 1 all 0 r reserved these bits are always read as 0 and cannot be modified. 0 bie 0 r/w break interrupt enable enables or disables address break. 0: disabled 1: enabled 5.3.3 break address registers a to c (bara to barc) the bar registers specify an address that is to be a break address. an address in which the first byte of an instruction exists should be set as a break address. in normal mode, addresses a23 to a16 are not compared. bara bit bit name initial value r/w description 7 to 0 a23 to a16 all 0 r/w addresses 23 to 16 the a23 to a16 bits are compared with a23 to a16 in the internal address bus.
rev. 1.0, 09/02, page 72 of 524 barb bit bit name initial value r/w description 7 to 0 a15 to a8 all 0 r/w addresses 15 to 8 the a15 to a8 bits are compared with a15 to a8 in the internal address bus. barc bit bit name initial value r/w description 7 to 1 a7 to a1 all 0 r/w addresses 7 to 1 the a7 to a1 bits are compared with a7 to a1 in the internal address bus. 0 0 r reserved this bit is always read as 0 and cannot be modified. 5.3.4 irq sense control registers (iscrh, iscrl) the iscr registers select the source that generates an interrupt request at pins irq7 to irq0 . iscrh bit bit name initial value r/w description 7 6 irq7scb irq7sca 0 0 r/w r/w 5 4 irq6scb irq6sca 0 0 r/w r/w 3 2 irq5scb irq5sca 0 0 r/w r/w 1 0 irq4scb irq4sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn input 01: interrupt request generated at falling edge of irqn input 10: interrupt request generated at rising edge of irqn input 11: interrupt request generated at both falling and rising edges of irqn input (n = 7 to 4)
rev. 1.0, 09/02, page 73 of 524 iscrl bit bit name initial value r/w description 7 6 irq3scb irq3sca 0 0 r/w r/w 5 4 irq2scb irq2sca 0 0 r/w r/w 3 2 irq1scb irq1sca 0 0 r/w r/w 1 0 irq0scb irq0sca 0 0 r/w r/w irqn sense control b irqn sense control a 00: interrupt request generated at low level of irqn input 01: interrupt request generated at falling edge of irqn input 10: interrupt request generated at rising edge of irqn input 11: interrupt request generated at both falling and rising edges of irqn input (n = 3 to 0) 5.3.5 irq enable register (ier) ier controls the enabling and disabling of interrupt requests irq7 to irq0. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w irqn enable (n = 7 to 0) the irqn interrupt request is enabled when this bit is 1.
rev. 1.0, 09/02, page 74 of 524 5.3.6 irq status register (isr) the isr register is a flag register that indicates the status of irq7 to irq0 interrupt requests. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f 0 0 0 0 0 0 0 0 r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * [setting condition] when the interrupt source selected by the iscr registers occurs [clearing conditions] when reading irqnf flag when irqnf = 1, then writing 0 to irqnf flag when interrupt exception handling is executed when low-level detection is set and irqn input is high (n = 7 to 0) when irqn interrupt exception handling is executed when falling-edge, rising-edge, or both-edge detection is set note: * only 0 can be written, for flag clearing. 5.3.7 keyboard matrix interrupt mask registers (kmimra, kmimr) wake-up event interrupt mask register (wuemrb) the kmimra, kmimr, and wuemrb registers enable or disable key-sensing interrupt inputs ( kin15 to kin0 ), and wake-up event interrupt inputs ( wue7 to wue0 ). kmimra bit bit name initial value r/w description 7 6 5 4 3 2 1 0 kmimr15 kmimr14 kmimr13 kmimr12 kmimr11 kmimr10 kmimr9 kmimr8 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w keyboard matrix interrupt mask 15 to 8 these bits enable or disable a key-sensing input interrupt request (kin15 to kin8). 0: enables a key-sensing input interrupt request 1: disables a key-sensing input interrupt request
rev. 1.0, 09/02, page 75 of 524 kmimr bit bit name initial value r/w description 7 6 5 4 3 2 1 0 kmimr7 kmimr6 kmimr5 kmimr4 kmimr3 kmimr2 kmimr1 kmimr0 1 0 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w keyboard matrix interrupt mask 7 to 0 these bits enable or disable a key-sensing input interrupt request (kin7 to kin0). kmimr6 also performs interrupt request mask control for pin irq6 . 0: enables a key-sensing input interrupt request 1: disables a key-sensing input interrupt request wuemrb bit bit name initial value r/w description 7 6 5 4 3 2 1 0 wuemr7 wuemr6 wuemr5 wuemr4 wuemr3 wuemr2 wuemr1 wuemr0 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w wake-up event interrupt mask 7 to 0 these bits enable or disable a wake-up event input interrupt request (wue7 to wue0). 0: enables a wake-up event input interrupt request 1: disables a wake-up event input interrupt request figure 5.2 shows the relationship between interrupts irq7 and irq6, interrupts kin15 to kin0, interrupts wue7 to wue0, and registers kmimra, kmimr, and wuemrb.
rev. 1.0, 09/02, page 76 of 524 internal signal irq6e edge level selection enable/disable circuit edge level selection enable/disable circuit irq6sc interrupt kmimr0 (initial value 1) p60/ kmimr5 (initial value 1) p65/ kmimr6 (initial value 0) p66/ / kmimr7 (initial value 1) p67/ / internal signal irq7e irq7sc interrupt kmimr8 (initial value 1) pa0/ kmimr9 (initial value 1) pa1/ wuemr7 (initial value 1) pb7/ figure 5.2 relationship between interrupts irq7 and irq6, interrupts kin15 to kin0, interrupts wue7 to wue0, and registers kmimr, kmimra, and wuemrb if any of bits kmimr15 to kmimr8 or wuemrb7 to wuemrb0 is cleared to 0, interrupt input from the irq7 pin will be ignored. when pins kin7 to kin0 , kin15 to kin8 , or wue7 to wue0 are used as key-sense interrupt input pins or wakeup event interrupt input pins, either low- level sensing or falling-edge sensing must be designated as the interrupt sense condition for the corresponding interrupt source (irq6 or irq7). 5.4 interrupt sources 5.4.1 external interrupts there are four types of external interrupts: nmi, irq7 to irq0, kin15 to kin0 and wue7 to wue0. wue7 to wue0 and kin15 to kin8 share the irq7 interrupt source, and kin7 to kin0 share the irq6 interrupt source. of these, nmi, irq7, irq6 , and irq2 to irq0 can be used to restore this lsi from software standby mode.
rev. 1.0, 09/02, page 77 of 524 nmi interrupt: nmi is the highest-priority interrupt, and is always accepted by the cpu regardless of the interrupt control mode or the status of the cpu interrupt mask bits. the nmieg bit in syscr can be used to select whether an interrupt is requested at a rising edge or a falling edge on the nmi pin. irq7 to irq0 interrupts: interrupts irq7 to irq0 are requested by an input signal at pins irq7 to irq0 . interrupts irq7 to irq0 have the following features: the interrupt exception handling for interrupt requests irq7 to irq0 can be started at an independent vector address. using iscr, it is possible to select whether an interrupt is generated by a low level, falling edge, rising edge, or both edges, at pins irq7 to irq0 . enabling or disabling of interrupt requests irq7 to irq0 can be selected with ier. interrupt control levels can be specified by the icr settings. the status of interrupt requests irq7 to irq0 is indicated in isr. isr flags can be cleared to 0 by software. the detection of irq7 to irq0 interrupts does not depend on whether the relevant pin has been set for input or output. however, when a pin is used as an external interrupt input pin, do not clear the corresponding ddr to 0 to use the pin as an i/o pin for another function. a block diagram of interrupts irq7 to irq0 is shown in figure 5.3. irqn interrupt request irqne irqnf s r q clear signal edge/level detection circuit irqnsca, irqnscb input n = 7 to 0 figure 5.3 block diagram of interrupts irq7 to irq0
rev. 1.0, 09/02, page 78 of 524 when pin irq6 is used as an irq6 interrupt input pin, clear the kmimr6 bit to 0. when pin irq7 is used as an irq7 interrupt pin, set all of bits kmimr15 to kmimr8 and wuemr7 to wuemr0 to 1. if any of these bits is cleared to 0, irq7 interrupt input from the irq7 pin will be ignored. since interrupt request flags irq7f to irq0f are set each time the setting condition is satisfied, regardless of the ier setting, refer to a needed flag only. kin15 to kin0 interrupts, wue7 to wue0 interrupts: interrupts kin15 to kin0 and wue7 to wue0 are requested by an input signal at pins kin15 to kin0 and wue7 to wue0 . when pins kin15 to kin0 and wue7 to wue0 are used for key-sense input or wakeup event, clear the corresponding kmimr and wuemr bits to 0 in order to enable their key-sense input and wakeup event interrupts. remaining unused kmimr and wuemr bits for key-sense input should be set to 1 in order to disable interrupts. interrupts wue7 to wue0 and kin15 to kin8 generate irq7 interrupts, and interrupts kin7 to kin0 generate irq6 interrupts. the pin conditions for interrupt request generation, enable of interrupt requests, settings of interrupt control levels, and status display of interrupt requests depend on each setting and display of the irq7 or irq6 interrupt. when pins kin7 to kin0 , kin15 to kin8 , or wue7 to wue0 are used as key-sense interrupt input pins or wakeup event interrupt input pins, either low-level sensing or falling-edge sensing must be designated as the interrupt sense condition for the corresponding interrupt source (irq6 or irq7). 5.4.2 internal interrupts internal interrupts issued from the on-chip peripheral modules have the following features: 1. for each on-chip peripheral module there are flags that indicate the interrupt request status, and enable bits that individually select enabling or disabling of these interrupts. when the enable bit for a particular interrupt source is set to 1, an interrupt request is sent to the interrupt controller. 2. the control level for each interrupt can be set by icr. 5.5 interrupt exception handling vector table table 5.3 lists interrupt exception handling sources, vector addresses, and interrupt priorities. for default priorities, the lower the vector number, the higher the priority. modules set at the same priority will conform to their default priorities. priorities within a module are fixed.
rev. 1.0, 09/02, page 79 of 524 an interrupt control level can be specified for a module to which an icr bit is assigned. interrupt requests from modules that are set to control level 1 (priority) by the icr bit setting and the i and ui bits in ccr are given priority and processed before interrupt requests from modules that are set to control level 0 (no priority). table 5.3 interrupt sources, vector addresses, and interrupt priorities vector address origin of interrupt source name vector number normal mode advanced mode icr priority nmi 7 h'000e h'00001c high irq0 16 h'0020 h'000040 icra7 irq1 17 h'0022 h'000044 icra6 irq2 irq3 18 19 h'0024 h'0026 h'000048 h'00004c icra5 irq4 irq5 20 21 h'0028 h'002a h'000050 h'000054 icra4 external pin irq6, kin7 to kin0 irq7, kin15 to kin8, wue7 to wue0 22 23 h'002c h'002e h'000058 h'00005c icra3 reserved for system use 24 h'0030 h'000060 wdt_0 wovi0 (interval timer) 25 h'0032 h'000064 icra1 wdt_1 wovi1 (interval timer) 26 h'0034 h'000068 icra0 address break 27 h'0036 h'00006c reserved for system use 28 to 47 h0038 to h005e h000070 to h0000bc frt icia (input capture a) icib (input capture b) icic (input capture c) icid (input capture d) ocia (output compare a) ocib (output compare b) fovi (overflow) reserved for system use 48 49 50 51 52 53 54 55 h'0060 h'0062 h'0064 h'0066 h'0068 h'006a h'006c h'006e h'0000c0 h'0000c4 h'0000c8 h'0000cc h'0000d0 h'0000d4 h'0000d8 h'0000dc icrb6 reserved for system use 56 to 63 h0070 to h007e h0000e0 to h0000fc tmr_0 cmia0 (compare match a) cmib0 (compare match a) ovi0 (overflow) reserved for system use 64 65 66 67 h'0080 h'0082 h'0084 h'0086 h'000100 h'000104 h'000108 h'00010c icrb3 low
rev. 1.0, 09/02, page 80 of 524 vector address origin of interrupt source name vector number normal mode advanced mode icr priority tmr_1 cmia1 (compare match a) cmib1 (compare match b) ovi1 (overflow) reserved for system use 68 69 70 71 h'0088 h'008a h'008c h'008e h'000110 h'000114 h'000118 h'00011c icrb2 high tmr_x, tmr_y cmiay (compare match a) cmiby (compare match b) oviy (overflow) icix (input capture x) 72 73 74 75 h'0090 h'0092 h'0094 h'0096 h'000120 h'000124 h'000128 h'00012c icrb1 reserved for system use 76 to 83 h'0098 to h'00a6 h'000130 to h'00014c sci_1 eri1 (reception error 1) rxi1 (reception completion 1) txi1 (transmission data empty 1) tei1 (transmission end 1) 84 85 86 87 h'00a8 h'00aa h'00ac h'00ae h'000150 h'000154 h'000158 h'00015c icrc6 reserved for system use 88 to 91 h'00b0 to h'00b6 h'000160 to h'00016c iic_0 iici0 (1-byte transmission/ reception completion) reserved for system use 92 93 h'00b8 h'00ba h'000170 h'000174 icrc4 iic_1 iici1 (1-byte transmission/ reception completion) reserved for system use 94 95 h00bc h00be h000178 h00017c icrc3 keyboard buffer controller kbia (reception completion a) kbib (reception completion b) kbic (reception completion c) reserved for system use 96 97 98 99 h00c0 h00c2 h00c4 h'00c6 h000180 h000184 h000188 h00018c icrb0 reserved for system use 100 to 107 h00c8 to h00d6 h000190 to h0001ac lpc erri (transfer error) ibf1 (idr1 reception completion) ibf2 (idr2 reception completion) ibf3 (idr3 reception completion) 108 109 110 111 h00d8 h00da h00dc h00de h0001b0 h0001b4 h0001b8 h0001bc icrc1 low
rev. 1.0, 09/02, page 81 of 524 5.6 interrupt control modes and interrupt operation the interrupt controller has two modes: interrupt control mode 0 and interrupt control mode 1. interrupt operations differ depending on the interrupt control mode. nmi interrupts and address break interrupts are always accepted except for in reset state or in hardware standby mode. the interrupt control mode is selected by syscr. table 5.4 shows the interrupt control modes. table 5.4 interrupt control modes syscr interrupt control mode intm1 intm0 priority setting registers interrupt mask bits description 0 0 icr i interrupt mask control is performed by the i bit. priority levels can be set with icr. 1 0 1 icr i, ui 3-level interrupt mask control is performed by the i bit. priority levels can be set with icr. 5.6.1 interrupt control mode 0 in interrupt control mode 0, interrupt requests other than nmi and address breaks are masked by icr and the i bit of the ccr in the cpu. figure 5.4 shows a flowchart of the interrupt acceptance operation. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. according to the interrupt control level specified in icr, the interrupt controller only accepts an interrupt request with interrupt control level 1 (priority), and holds pending an interrupt request with interrupt control level 0 (no priority). if several interrupt requests are issued, an interrupt request with the highest priority is accepted according to the priority order, an interrupt handling is requested to the cpu, and other interrupt requests are held pending. 3. if the i bit in ccr is set to 1, only nmi and address break interrupts are accepted by the interrupt controller, and other interrupt requests are held pending. if the i bit is cleared to 0, any interrupt request is accepted. 4. when the cpu accepts an interrupt request, it starts interrupt exception handling after execution of the current instruction has been completed. 5. the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. 6. next, the i bit in ccr is set to 1. this masks all interrupts except for nmi and address break interrupts.
rev. 1.0, 09/02, page 82 of 524 7. the cpu generates a vector address for the accepted interrupt and starts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table. program excution state interrupt generated? nmi an interrupt with interrupt control level 1? irq0 irq1 ibfi3 irq0 irq1 ibfi3 i = 0 save pc and ccr i 1 read vector address branch to interrupt handling routine yes no yes yes yes no no yes no yes no yes yes no no yes yes no hold pending figure 5.4 flowchart of procedure up to interrupt acceptance in interrupt control mode 0
rev. 1.0, 09/02, page 83 of 524 5.6.2 interrupt control mode 1 in interrupt control mode 1, mask control is applied to three levels for irq and on-chip peripheral module interrupt requests by comparing the i and ui bits in ccr in the cpu, and the icr setting. an interrupt request with interrupt control level 0 is accepted when the i bit in ccr is cleared to 0. when the i bit is set to 1, the interrupt request is held pending an interrupt request with interrupt control level 1 is accepted when the i bit or ui bit in ccr is cleared to 0. when both i and ui bits are set to 1, the interrupt request is held pending. for instance, the state transition when the interrupt enable bit corresponding to each interrupt is set to 1, and icra to icrc are set to h20, h00, and h00, respectively (irq2 and irq3 interrupts are set to control level 1, and other interrupts are set to control level 0) is shown below. figure 5.5 shows a state transition diagram. all interrupt requests are accepted when i = 0. (priority order: nmi > irq2 > irq3 > address break > irq0 > irq1 ) only nmi, irq2, irq3 and address break interrupt requests are accepted when i = 1 and ui = 0. only an nmi and address break interrupt request is accepted when i = 1 and ui = 1. only nmi and address break interrupt requests are accepted all interrupt requests are accepted exception handling execution or i 1, ui 1 i 0 i 1, ui 0 i 0 ui 0 exception handling execution or ui 1 only nmi, address break, irq2, and irq3 interrupt requests are accepted figure 5.5 state transition in interrupt control mode 1 figure 5.6 shows a flowchart of the interrupt acceptance operation. 1. if an interrupt source occurs when the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. 2. according to the interrupt control level specified in icr, the interrupt controller only accepts an interrupt request with interrupt control level 1 (priority), and holds pending an interrupt request with interrupt control level 0 (no priority). if several interrupt requests are issued, an interrupt request with the highest priority is accepted according to the priority order, an interrupt handling is requested to the cpu, and other interrupt requests are held pending.
rev. 1.0, 09/02, page 84 of 524 3. an interrupt request with interrupt control level 1 is accepted when the i bit is cleared to 0, or when the i bit is set to 1 while the ui bit is cleared to 0. an interrupt request with interrupt control level 0 is accepted when the i bit is cleared to 0. when the i bit is set to 1, only an nmi or address break interrupt request is accepted, and other interrupts are held pending. when both the i and ui bits are set to 1, only an nmi or address break interrupt request is accepted, and other interrupts are held pending. when the i bit is cleared to 0, the ui bit is not affected. 4. when the cpu accepts an interrupt request, it starts interrupt exception handling after execution of the current instruction has been completed. 5. the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. 6. the i and ui bits in ccr are set to 1. this masks all interrupts except for an nmi or address break interrupt. 7. the cpu generates a vector address for the accepted interrupt and starts execution of the interrupt handling routine at the address indicated by the contents of the vector address in the vector table.
rev. 1.0, 09/02, page 85 of 524 program excution state interrupt generated? nmi an interrupt with interrupt control level 1? irq0 irq1 ifbfi3 irq0 irq1 ifbfi3 ui = 0 save pc and ccr i 1, ui 1 read vector address branch to interrupt handling routine yes no yes yes yes no no yes no yes no yes yes no no yes yes no hold pending i = 0 i = 0 yes yes no no figure 5.6 flowchart of procedure up to interrupt acceptance in interrupt control mode 1 5.6.3 interrupt exception handling sequence figure 5.7 shows the interrupt exception handling sequence. the example shown is for the case where interrupt control mode 0 is set in advanced mode, and the program area and stack area are in on-chip memory.
rev. 1.0, 09/02, page 86 of 524 (14) (12) (10) (6) (4) (2) (1) (5) (7) (9) (11) (13) prefetch of instruction in interrupt-handling routine vector fetch stack access instruction prefetch internal processing internal processing interrupt is accepted interrupt level decision and wait for end of instruction interrupt request signal internal address bus internal read signal internal write signal internal data bus (3) (1) (2) (4) (3) (5) (7) instruction prefetch address (instruction is not executed. address is saved as pc contents, becoming return address.) instruction code (not executed) instruction prefetch address (instruction is not executed.) sp C 2 sp C 4 saved pc and ccr vector address starting address of interrupt-handling routine (contents of vector address) starting address of interrupt-handling routine ((13) = (10) (12)) first instruction in interrupt-handling routine (6) (8) (9) (11) (10) (12) (13) (14) (8) figure 5.7 interrupt exception handling
rev. 1.0, 09/02, page 87 of 524 5.6.4 interrupt response times table 5.5 shows interrupt response times - the intervals between generation of an interrupt request and execution of the first instruction in the interrupt handling routine. the execution status symbols used in table 5.5 are explained in table 5.6. table 5.5 interrupt response times no. execution status normal mode advanced mode 1 interrupt priority determination * 1 3 2 number of wait states until executing instruction ends * 2 1 to (19 + 2s i ) 3 pc, ccr stack save 2s k 2s k 4 vector fetch s i 2s i 5 instruction fetch * 3 2s i 6 internal processing * 4 2 total (using on-chip memory) 11 to 31 12 to 32 notes: 1. two states in case of internal interrupt. 2. refers to mulxs and divxs instructions. 3. prefetch after interrupt acceptance and prefetch of interrupt handling routine. 4. internal processing after interrupt acceptance and internal processing after vector fetch. table 5.6 number of states in interrupt handling routine execution status object of access symbol internal memory instruction fetch s i branch address read s j stack manipulation s k 1 5.7 address break 5.7.1 features this lsi can determine the specific address prefetch by the cpu to generate an address break interrupt by setting abrkcr and bar. if an address break interrupt is generated, the address break interrupt exception handling is performed. with this function, the execution start point of a program containing a bug is detected and execution is branched to the correcting program.
rev. 1.0, 09/02, page 88 of 524 5.7.2 block diagram figure 5.8 shows a block diagram of the address break. abrkcr bar control logic comparator match signal address break interrupt request internal address prefetch signal (internal signal) figure 5.8 address break block diagram 5.7.3 operation if the cpu prefetches an address specified in bar by setting abrkcr and bar, an address break interrupt can be generated. this address break function generates an interrupt request to the interrupt controller at prefetch, and determines the priority by the interrupt controller. when an interrupt is accepted, an interrupt exception handling is activated after the current instruction has been completed. note that the interrupt mask control according to the i and ui bits in ccr of the cpu is invalid to an address break interrupt. to use the address break function, set each register as follows: 1. set a break address in the a23 to a1 bits in bar. 2. set the bie bit in abrkcr to 1 to enable the address break. when the bie bit is cleared to 0, an address break is not requested. when the setting conditions are satisfied, the cmf flag in abrkcr is set to 1 to request an interrupt. the interrupt source should be determined by the interrupt handling routine if necessary.
rev. 1.0, 09/02, page 89 of 524 5.7.4 usage notes 1. in an address break, the break address should be an address where the first byte of the instruction exists. otherwise, a break condition will not be satisfied. 2. in normal mode, addresses a23 to a16 are not compared. 3. when the branch instructions (bcc, bsr), jump instructions (jmp, jsr), rst instruction, and rte instruction are placed immediately prior to the address specified by bar, a prefetch signal to the address may be output to request an address break by executing these instruction. it is necessary to take countermeasures: do not set a break address to an address immediately after these instructions, or determine whether interrupt handling is performed by satisfaction of a normal condition. 4. an address break interrupt is generated by combining the internal prefetch signal and an address. therefore, the timing to enter the interrupt exception handling differs according to the instructions at the specified and at prior addresses and execution cycles. figure 5.9 shows an example of address timing.
rev. 1.0, 09/02, page 90 of 524 instruction fetch address bus break request signal break point nop instruction is executed at break point address h'0312 and following address h'0314. fetching is performed from address h'0316 after exception handling ends. instruction fetch instruction fetch instruction fetch instruction fetch internal operation internal operation vector fetch save to stack instruction fetch h'0310 nop execution h'0310 nop h'0312 nop h'0314 nop h'0316 nop nop execution nop execution interrupt exception handling h'0312 h'0314 h'0316 h'0318 h'0036 sp-2 sp-4 (1) when a break address specified instruction is executed for one state in the program area and on-chip memory address bus break request signal break point mov instruction is executed at break point address h'0312, and nop instruction is not executed at the following address h'0314. fetching is performed from address h'0316 after exception handling ends. instruction fetch instruction fetch instruction fetch internal operation internal operation vector fetch save to stack instruction fetch h'0310 nop execution h'0310 nop h'0312 mov.w #xx:16,rd h'0316 nop h'0318 nop mov.w execution interrupt exception handling h'0312 h'0314 h'0316 h'0318 h'0036 sp-2 sp-4 (2) when a break address specified instruction is executed for two states in the program area and on-chip memory instruction fetch instruction fetch figure 5.9 address break timing example 5.8 usage notes 5.8.1 conflict between interrupt generation and disabling when an interrupt enable bit is cleared to 0 to disable interrupt requests, the disabling becomes effective after execution of the instruction. when an interrupt enable bit is cleared to 0 by an instruction such as bclr or mov, and if an interrupt is generated during execution of the instruction, the interrupt concerned will still be enabled on completion of the instruction, so interrupt exception handling for that interrupt will be executed on completion of the instruction. however, if there is an interrupt request of higher priority than that interrupt, interrupt exception handling will be executed for the higher-priority interrupt, and the lower-priority interrupt will be
rev. 1.0, 09/02, page 91 of 524 ignored. the same rule is also applied when an interrupt source flag is cleared to 0. figure 5.10 shows an example in which the cmiea bit in the tmr's tcr register is cleared to 0. the above conflict will not occur if an enable bit or interrupt source flag is cleared to 0 while the interrupt is masked. internal address bus internal write signal cmiea cmfa cmia interrupt signal tcr write cycle by cpu cmia exception handling tcr address figure 5.10 conflict between interrupt generation and disabling 5.8.2 instructions that disable interrupts the instructions that disable interrupts are ldc, andc, orc, and xorc. after any of these instructions are executed, all interrupts including nmi are disabled and the next instruction is always executed. when the i bit or ui bit is set by one of these instructions, the new value becomes valid two states after execution of the instruction ends. 5.8.3 interrupts during execution of eepmov instruction interrupt operation differs between the eepmov.b instruction and the eepmov.w instruction. with the eepmov.b instruction, an interrupt request (including nmi) issued during the transfer is not accepted until the move is completed. with the eepmov.w instruction, if an interrupt request is issued during the transfer, interrupt exception handling starts at a break in the transfer cycle. the pc value saved on the stack in this
rev. 1.0, 09/02, page 92 of 524 case is the address of the next instruction. therefore, if an interrupt is generated during execution of an eepmov.w instruction, the following coding should be used. l1: eepmov.w mov.w r4,r4 bne l1 5.8.4 irq status register (isr) according to the pin status after a reset, irqnf may be set to 1, so isr should be read after a reset to write 0. (n = 7 to 0)
rev. 1.0, 09/02, page 93 of 524 section 6 bus controller (bsc) since this lsi does not have an externally extended function, it does not have an on-chip bus controller (bsc). considering the software compatibility with similar products, you must be careful to set appropriate values to the control registers for the bus controller. 6.1 register descriptions the bus controller has the following registers. bus control register (bcr) wait state control register (wscr) 6.1.1 bus control register (bcr) bit bit name initial value r/w description 7 1 r/wreserved the initial value should not be changed. 6 icis0 1 r/w idle cycle insertion the initial value should not be changed. 5 brstrm 0 r/w burst rom enable the initial value should not be changed. 4 brsts1 1 r/w burst cycle select 1 the initial value should not be changed. 3 brsts0 0 r/w burst cycle select 0 the initial value should not be changed. 2 ? 0r/wreserved the initial value should not be changed. 1 0 ios1 ios0 1 1 r/w r/w ios select 1, 0 the initial value should not be changed. bscs20aa_010020020800
rev. 1.0, 09/02, page 94 of 524 6.1.2 wait state control register (wscr) bit bit name initial value r/w description 7 6 0 0 r/w r/w reserved the initial value should not be changed. 5 abw 1 r/w bus width control the initial value should not be changed. 4 ast 1 r/w access state control the initial value should not be changed. 3 2 wms1 wms0 0 0 r/w r/w wait mode select 1, 0 the initial value should not be changed. 1 0 wc1 wc0 1 1 r/w r/w wait count 1, 0 the initial value should not be changed.
rev. 1.0, 09/02, page 95 of 524 section 7 i/o ports 7.1 overview this lsi has eleven i/o ports (ports 1 to 9*, a, and b). table 7.1 is a summary of the port functions. the pins of each port also have other functions. each port includes a data direction register (ddr) that controls input/output and data registers (dr, odr) that store output data. ports 1 to 3, 6, a, and b have an on-chip input pull-up mos function. for ports a and b, the on/off status of the input pull-up mos is controlled by ddr and odr. ports 1 to 3 and 6 have an input pull-up mos control register (pcr), in addition to ddr and dr, to control the on/off status of the input pull-up mos. ports 1 to 9*, a, and b can drive a single ttl load and 30 pf capacitive load. all the i/o ports can drive a darlington transistor when in output mode. ports 1, 2, and 3 can drive an led (10 ma sink current). port a input and output use by the vccb power supply, which is independent of the vcc power supply. when the vccb voltage is 5v, the pins on port a will be 5-v tolerant. pa4 to pa7 of port a have bus-buffer drive capability. p52 in port 5, p97 in port 9, p86 in port 8 and p42 in port 4 are nmos push-pull outputs. p52, p97, p86 and p42 are thus 5-v tolerant, with dc characteristics that are dependent on the vcc voltage. for the p42, p52/exsck1, p86/sck1, and p97 outputs, connect pull-up resistors to pins to raise output-high-level voltage. note:* the program development tool (emulator) does not support the output of port 7.
rev. 1.0, 09/02, page 96 of 524 table 7.1 port functions of h8s/2110b port description mode 2, 3 i/o status port 1 general i/o port p17 p16 p15 p14 p13 p12 p11 p10 on-chip input pull-up moss port 2 general i/o port p27 p26 p25 p24 p23 p22 p21 p20 on-chip input pull-up moss port 3 general i/o port also functioning as lpc input/output pins p37/serirq p36/lclk p35/ lreset p34/ lframe p33/lad3 p32/lad2 p31/lad1 p30/lad0 on-chip input pull-up moss
rev. 1.0, 09/02, page 97 of 524 port description mode 2, 3 i/o status port 4 general i/o port also functioning as pwmx output, tmr_0 and tmr_1 input/output, and iic_1 input/output pins p47/pwx1 p46/pwx0 p45/tmri1 p44/tmo1 p43/tmci1 p42/tmri0/sda1 p41/tmo0 p40/tmci0 port 5 general i/o port also functioning as sci_1 extended input/output and iic_0 input/output pins p52/exsck1 * 1 /scl0 p51/exrxd1 * 1 p50/extxd1 * 1 port 6 general i/o port also functioning as interrupt input, frt input/output, tmr_x input/output, tmr_y output, and key-sense interrupt input p67/tmox/ kin7 / irq7 p66/ftob/ kin6 / irq6 p65/ftid/ kin5 p64/ftic/ kin4 p63/ftib/ kin3 p62/ftia/ kin2 /tmiy p61/ftoa/ kin1 p60/ftci/ kin0 /tmix on-chip input pull-up moss
rev. 1.0, 09/02, page 98 of 524 port description mode 2, 3 i/o status port 7 general i/o port * 2 also functioning as tmr_x extended output and tmr_y output pins p77 * 2 /extmox * 1 p76 * 2 /tmoy * 1 p75 * 2 p74 * 2 p73 * 2 p72 * 2 p71 * 2 p70 * 2 port 8 general i/o port also functioning as interrupt input, sci_1 input/output, lpc input/output, and iic_1 input/output pins p86/ irq5 /sck1/scl1 p85/ irq4 /rxd1 p84/ irq3 /txd1 p83/ lpcpd p82/ clkrun p81/ga20 p80/ pme port 9 general i/o port also functioning as iic_0 input/output, subclock input, f output, and interrupt input p97/sda0 p96/ f /excl p95 p94 p93 p92/ irq0 p91/ irq1 p90/ irq2
rev. 1.0, 09/02, page 99 of 524 port description mode 2, 3 i/o status port a general i/o port also functioning as key-sense interrupt input, and keyboard buffer controller input/output pins pa7/ kin15 /ps2cd pa6/ kin14 /ps2cc pa5/ kin13 /ps2bd pa4/ kin12 /ps2bc pa3/ kin11 /ps2ad pa2/ kin10 /ps2ac pa1/ kin9 pa0/ kin8 on-chip input pull-up moss port b general i/o port also functioning as wakeup event interrupt input, and lpc input/output pins pb7/ wue7 pb6/ wue6 pb5/ wue5 pb4/ wue4 pb3/ wue3 pb2/ wue2 pb1/ wue1 /lsci pb0/ wue0 / lsmi on-chip input pull-up moss notes: 1. the program development tool (emulator) does not support this function. 2. the program development tool (emulator) does not support the output.
rev. 1.0, 09/02, page 100 of 524 7.2 port 1 port 1 is an 8-bit i/o port. port 1 has an on-chip input pull-up mos function that can be controlled by software. port 1 has the following registers. port 1 data direction register (p1ddr) port 1 data register (p1dr) port 1 pull-up mos control register (p1pcr) 7.2.1 port 1 data direction register (p1ddr) p1ddr specifies input or output for the pins of port 1 on a bit-by-bit basis. bit bit name initial value r/w description 7 p17ddr 0 w 6 p16ddr 0 w 5 p15ddr 0 w 4 p14ddr 0 w 3 p13ddr 0 w 2 p12ddr 0 w 1 p11ddr 0 w 0 p10ddr 0 w the corresponding port 1 pins are output ports when the p1ddr bits are set to 1, and input ports when the p1ddr bits are cleared to 0. 7.2.2 port 1 data register (p1dr) p1dr stores output data for the port 1 pins. bit bit name initial value r/w description 7 p17dr 0 r/w 6 p16dr 0 r/w 5 p15dr 0 r/w 4 p14dr 0 r/w 3 p13dr 0 r/w 2 p12dr 0 r/w 1 p11dr 0 r/w 0 p10dr 0 r/w if a port 1 read is performed while the p1ddr bits are set to 1, the p1dr values are read. if a port 1 read is performed while the p1ddr bits are cleared to 0, the pin states are read.
rev. 1.0, 09/02, page 101 of 524 7.2.3 port 1 pull-up mos control register (p1pcr) p1pcr controls the on/off status of the port 1 on-chip input pull-up moss. bit bit name initial value r/w description 7 p17pcr 0 r/w 6 p16pcr 0 r/w 5 p15pcr 0 r/w 4 p14pcr 0 r/w 3 p13pcr 0 r/w 2 p12pcr 0 r/w 1 p11pcr 0 r/w 0 p10pcr 0 r/w when a p1pcr bit is set to 1 with the input port setting, the input pull-up mos is turned on. 7.2.4 pin functions p17 to p10 the pin function is switched as shown below according to the status of the p1nddr bit. p1nddr 0 1 pin function p17 to p10 input pins p17 to p10 output pins legend n = 7 to 0 7.2.5 port 1 input pull-up mos port 1 has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. table 7.2 summarizes the input pull-up mos states. table 7.2 input pull-up mos states (port 1) reset hardware standby mode software standby mode in other operations off off on/off on/off legend: off: input pull-up mos is always off. on/off: on when the pin is in the input state, p1ddr = 0, and p1pcr = 1; otherwise off.
rev. 1.0, 09/02, page 102 of 524 7.3 port 2 port 2 is an 8-bit i/o port. port 2 has an on-chip input pull-up mos function that can be controlled by software. port 2 has the following registers. port 2 data direction register (p2ddr) port 2 data register (p2dr) port 2 pull-up mos control register (p2pcr) 7.3.1 port 2 data direction register (p2ddr) p2ddr specifies input or output for the pins of port 2 on a bit-by-bit basis. bit bit name initial value r/w description 7 p27ddr 0 w 6 p26ddr 0 w 5 p25ddr 0 w 4 p24ddr 0 w 3 p23ddr 0 w 2 p22ddr 0 w 1 p21ddr 0 w 0 p20ddr 0 w the corresponding port 2 pins are output ports when p2ddr bits are set to 1, and input ports when p2ddr bits are cleared to 0. 7.3.2 port 2 data register (p2dr) p2dr stores output data for port 2. bit bit name initial value r/w description 7 p27dr 0 r/w 6 p26dr 0 r/w 5 p25dr 0 r/w 4 p24dr 0 r/w 3 p23dr 0 r/w 2 p22dr 0 r/w 1 p21dr 0 r/w 0 p20dr 0 r/w if a port 2 read is performed while p2ddr bits are set to 1, the p2dr values are read directly, regardless of the actual pin states. if a port 2 read is performed while p2ddr bits are cleared to 0, the pin states are read.
rev. 1.0, 09/02, page 103 of 524 7.3.3 port 2 pull-up mos control register (p2pcr) p2pcr controls the port 2 on-chip input pull-up moss. bit bit name initial value r/w description 7 p27pcr 0 r/w 6 p26pcr 0 r/w 5 p25pcr 0 r/w 4 p24pcr 0 r/w 3 p23pcr 0 r/w 2 p22pcr 0 r/w 1 p21pcr 0 r/w 0 p20pcr 0 r/w the input pull-up mos is turned on when a p2pcr bit is set to 1 in the input port state. 7.3.4 pin functions p27, p26, p25, p24, p23, p22, p21, p20 the pin function is switched as shown below according to the status of the p2nddr bit. p2nddr 0 1 pin function p27 to p20 input pins p27 to p20 output pins legend n = 7 to 0 7.3.5 port 2 input pull-up mos port 2 has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. table 7.3 summarizes the input pull-up mos states. table 7.3 input pull-up mos states (port 2) reset hardware standby mode software standby mode in other operations off off on/off on/off legend off: input pull-up mos is always off. on/off: on when the pin is in the input state, p2ddr = 0, and p2pcr = 1; otherwise off.
rev. 1.0, 09/02, page 104 of 524 7.4 port 3 port 3 is an 8-bit i/o port. port 3 pins also function as lpc input/output pins. port 3 has the following registers. port 3 data direction register (p3ddr) port 3 data register (p3dr) port 3 pull-up mos control register (p3pcr) 7.4.1 port 3 data direction register (p3ddr) p3ddr specifies input or output for the pins of port 3 on a bit-by-bit basis. bit bit name initial value r/w description 7 p37ddr 0 w 6 p36ddr 0 w 5 p35ddr 0 w 4 p34ddr 0 w 3 p33ddr 0 w 2 p32ddr 0 w 1 p31ddr 0 w 0 p30ddr 0 w the corresponding port 3 pins are output ports when p3ddr bits are set to 1, and input ports when p3ddr bits are cleared to 0. 7.4.2 port 3 data register (p3dr) p3dr stores output data of port 3. bit bit name initial value r/w description 7 p37dr 0 r/w 6 p36dr 0 r/w 5 p35dr 0 r/w 4 p34dr 0 r/w 3 p33dr 0 r/w 2 p32dr 0 r/w 1 p31dr 0 r/w 0 p30dr 0 r/w if a port 3 read is performed while p3ddr bits are set to 1, the p3dr values are read directly, regardless of the actual pin states. if a port 3 read is performed while p3ddr bits are cleared to 0, the pin states are read.
rev. 1.0, 09/02, page 105 of 524 7.4.3 port 3 pull-up mos control register (p3pcr) p3pcr controls the port 3 on-chip input pull-up moss on a bit-by-bit basis. bit bit name initial value r/w description 7 p37pcr 0 r/w 6 p36pcr 0 r/w 5 p35pcr 0 r/w 4 p34pcr 0 r/w 3 p33pcr 0 r/w 2 p32pcr 0 r/w 1 p31pcr 0 r/w 0 p30pcr 0 r/w the input pull-up mos is turned on when a p3pcr bit is set to 1 in the input port state. the input pull-up mos function cannot be used when the host interface is enabled. 7.4.4 pin functions p37/serirq, p36/lclk, p35/ lreset , p34/ lframe , p33/lad3, p32/lad2, p31/lad1, p30/lad0 the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the lpc3e to lpc1e bits in hicr0 of host interface (lpc), and the p3nddr bit. lpcme all 0 not all 0 hi12e 0 0 p3nddr 0 1 0 pin function p37 to p30 input pins p37 to p30 output pins lpc input/output pins note: * the combination of bits not described in the above table must not be used. m = 3 to 1: lpc input/output pins (serirq, lclk, lreset, lframe, lad3 to lad0) when at least one of lpc3e to lpc1e is set to 1. n = 7 to 0 7.4.5 port 3 input pull-up mos port 3 has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. table 7.4 summarizes the input pull-up mos states.
rev. 1.0, 09/02, page 106 of 524 table 7.4 input pull-up mos states (port 3) reset hardware standby mode software standby mode in other operations off off on/off on/off legend off: input pull-up mos is always off. on/off: on when the pin is in the input state, p3ddr = 0, and p3pcr = 1; otherwise off. 7.5 port 4 port 4 is an 8-bit i/o port. port 4 pins also function as pwmx output pins, tmr_0 and tmr_1 i/o pins, and the iic_1 i/o pin. the output type of p42 is nmos push-pull output. the output type of sda1 is nmos open-drain output. port 4 has the following registers. port 4 data direction register (p4ddr) port 4 data register (p4dr) 7.5.1 port 4 data direction register (p4ddr) p4ddr specifies input or output for the pins of port 4 on a bit-by-bit basis. bit bit name initial value r/w description 7 p47ddr 0 w 6 p46ddr 0 w 5 p45ddr 0 w 4 p44ddr 0 w 3 p43ddr 0 w 2 p42ddr 0 w 1 p41ddr 0 w 0 p40ddr 0 w when a bit in p4ddr is set to 1, the corresponding pin functions as an output port, and when cleared to 0, as an input port. as 14-bit pwm is initialized in software standby mode, the pin states are determined by the tmr_0, tmr_1, iic_1, p4ddr, and p4dr specifications.
rev. 1.0, 09/02, page 107 of 524 7.5.2 port 4 data register (p4dr) p4dr stores output data for port 4. bit bit name initial value r/w description 7 p47dr 0 r/w 6 p46dr 0 r/w 5 p45dr 0 r/w 4 p44dr 0 r/w 3 p43dr 0 r/w 2 p42dr 0 r/w 1 p41dr 0 r/w 0 p40dr 0 r/w if a port 4 read is performed while p4ddr bits are set to 1, the p4dr values are read directly, regardless of the actual pin states. if a port 4 read is performed while p4ddr bits are cleared to 0, the pin states are read. 7.5.3 pin functions p47/pwx1 the pin function is switched as shown below according to the combination of the oeb bit in dacr of the 14-bit pwm and the p47ddr bit. oeb 0 1 p47ddr 0 1 pin function p47 input pin p47 output pin pwx1 output pin p46/pwx0 the pin function is switched as shown below according to the combination of the oea bit in dacr of the 14-bit pwm and the p46ddr bit. oea 0 1 p46ddr 0 1 pin function p46 input pin p46 output pin pwx0 output pin
rev. 1.0, 09/02, page 108 of 524 p45/tmri1 the pin function is switched as shown below according to the status of the p45ddr bit. p45ddr 0 1 p45 input pin p45 output pin pin function tmri1 input pin note: * when bits cclr1 and cclr0 in tcr1 of tmr_1 are set to 1, this pin is used as the tmri1 input pin. p44/tmo1 the pin function is switched as shown below according to the combination of the os3 to os0 bits in tcsr of tmr_1 and the p44ddr bit. os3 to os0 all 0 not all 0 p44ddr 0 1 pin function p44 input pin p44 output pin tmo1 output pin p43/tmci1 the pin function is switched as shown below according to the status of the p43ddr bit. p43ddr 0 1 p43 input pin p43 output pin pin function tmci1 input pin * note: * when the external clock is selected by bits cks2 to cks0 in tcr1 of tmr_1, this pin is used as the tmci1 input pin. p42/tmri0/sda1 the pin function is switched as shown below according to the combination of the ice bit in iccr of iic_1 and the p42ddr bit. ice 0 1 p42ddr 0 1 p42 input pin p42 output pin sda1 i/o pin pin function tmri0 input pin * note: * sda1 is an nmos-only output, and has direct bus drive capability. when bits cclr1 and cclr0 in tcr0 of tmr_0 are set to 1, this pin is used as the tmri0 input pin. when the p42 output pin is set, the output type is nmos push-pull output.
rev. 1.0, 09/02, page 109 of 524 p41/tmo0 the pin function is switched as shown below according to the combination of the os3 to os0 bits in tcsr of tmr_0 and the p41ddr bit. os3 to os0 all 0 not all 0 p41ddr 0 1 pin function p41 input pin p41 output pin tmo0 output pin p40/tmci0 the pin function is switched as shown below according to the status of the p40ddr bit. p40ddr 0 1 p40 input pin p40 output pin pin function tmci0 input pin * note: * when an external clock is selected with bits cks2 to cks0 in tcr0 of tmr_0, this pin is used as the tmci0 input pin. 7.6 port 5 port 5 is a 3-bit i/o port. port 5 pins also function as sci_1 extended i/o pins, and the iic_0 i/o pin. p52 and exsck1 are nmos push-pull outputs, and scl0 is an nmos open-drain output. port 5 has the following registers. port 5 data direction register (p5ddr) port 5 data register (p5dr) 7.6.1 port 5 data direction register (p5ddr) p5ddr specifies input or output for the pins of port 5 on a bit-by-bit basis. bit bit name initial value r/w description 7 to 3 all 1 reserved the initial value should not be changed. 2 p52ddr 0 w 1 p51ddr 0 w 0 p50ddr 0 w the corresponding port 5 pins are output ports when p5ddr bits are set to 1, and input ports when cleared to 0. as sci_1 is initialized in software standby mode, the pin states are determined by the iic_0 iccr, p5ddr, and p5dr specifications.
rev. 1.0, 09/02, page 110 of 524 7.6.2 port 5 data register (p5dr) p5dr stores output data for port 5 pins. bit bit name initial value r/w description 7 to 3 all 1 reserved the initial value should not be changed. 2 p52dr 0 r/w 1 p51dr 0 r/w 0 p50dr 0 r/w if a port 5 read is performed while p5ddr bits are set to 1, the p5dr values are read directly, regardless of the actual pin states. if a port 5 read is performed while p5ddr bits are cleared to 0, the pin states are read. 7.6.3 pin functions p52/exsck1*/scl0 the pin function is switched as shown below according to the combination of the cke1 and cke0 bits in scr, the c/ a bit in smr of sci_1, the sps1 bit* in spsr, the ice bit in iccr of iic_0, and the p52ddr bit. sps1 * 01 ice 0 1 0 1 cke1 0 1 0 c/ a 0 1 0 cke0 0 1 0 p52ddr 0 1 0 1 pin function p52 input pin p52 output pin scl0 i/o pin p52 input pin p52 output pin exsck1 * output pin exsck1 * output pin exsck1 input pin scl0 i/o pin note: * when this pin is used as the scl0 i/o pin by setting 1 to the sps1 bit of spsr, bits cke1 and cke0 in scr of sci_1 and bit c/ a in smr must all be cleared to 0. scl0 is an nmos open-drain output. when set as the p52 output pin or exsck1 output pin, this pin is an nmos push-pull output. the program development tool (emulator) does not support this function.
rev. 1.0, 09/02, page 111 of 524 p51/exrxd1* the pin function is switched as shown below according to the combination of the re bit in scr of sci_1, the sps1 bit* in spsr, and the p51ddr bit. sps1 * 01 re 0 1 p51ddr 0101 pin function p51 input pin p51 output pin p51 input pin p51 output pin exrxd1 input pin * note: * the program development tool (emulator) does not support this function. p50/extxd1* the pin function is switched as shown below according to the combination of the te bit in scr of sci_1, the sps1 bit* in spsr, and the p50ddr bit. sps1 * 01 te 0 1 p50ddr 0101 pin function p50 input pin p50 output pin p50 input pin p50 output pin extxd1 output pin * note: * the program development tool (emulator) does not support this function. 7.7 port 6 port 6 is an 8-bit i/o port. port 6 pins also function as the frt i/o pins, tmr_x i/o pins, tmr_y input pin, key-sense interrupt input pins, and interrupt input pins. the port 6 input level can be switched in four stages. port 6 has the following registers. port 6 data direction register (p6ddr) port 6 data register (p6dr) port 6 pull-up mos control register (kmpcr) system control register 2 (syscr2)
rev. 1.0, 09/02, page 112 of 524 7.7.1 port 6 data direction register (p6ddr) p6ddr specifies input or output for the pins of port 6 on a bit-by-bit basis. bit bit name initial value r/w description 7 p67ddr 0 w 6 p66ddr 0 w 5 p65ddr 0 w 4 p64ddr 0 w 3 p63ddr 0 w 2 p62ddr 0 w 1 p61ddr 0 w 0 p60ddr 0 w the corresponding port 6 pins are output ports when p6ddr bits are set to 1, and input ports when cleared to 0. 7.7.2 port 6 data register (p6dr) p6dr stores output data for port 6. bit bit name initial value r/w description 7 p67dr 0 r/w 6 p66dr 0 r/w 5 p65dr 0 r/w 4 p64dr 0 r/w 3 p63dr 0 r/w 2 p62dr 0 r/w 1 p61dr 0 r/w 0 p60dr 0 r/w if a port 6 read is performed while p6ddr bits are set to 1, the p6dr values are read directly, regardless of the actual pin states. if a port 6 read is performed while p6ddr bits are cleared to 0, the pin states are read.
rev. 1.0, 09/02, page 113 of 524 7.7.3 port 6 pull-up mos control register (kmpcr) kmpcr controls the port 6 on-chip input pull-up moss on a bit-by-bit basis. bit bit name initial value r/w description 7 km7pcr 0 r/w 6 km6pcr 0 r/w 5 km5pcr 0 r/w 4 km4pcr 0 r/w 3 km3pcr 0 r/w 2 km2pcr 0 r/w 1 km1pcr 0 r/w 0 km0pcr 0 r/w the input pull-up mos is turned on when a kmpcr bit is set to 1 with the input port setting.
rev. 1.0, 09/02, page 114 of 524 7.7.4 system control register 2 (syscr2) syscr2 controls the port 6 operations. bit bit name initial value r/w description 7 6 kwul1 kwul0 0 0 r/w r/w key wakeup levels 1 and 0 sets the input level of port 6. the input level of pins functioning as port 6 is also changed. 00: standard input level 01: input level 1 10: input level 2 11: input level 3 5 p6pue 0 r/w port 6 input pull-up mos extra selects the power specifications of the input pull-up mos for port 6. 0: standard power specifications 1: restricted power specifications 4 0r/wreserved the initial value should not be changed. 3 to 1 all 0 r/w reserved the initial value should not be changed. 0 hi12e 0 r/w host interface enabled the initial value should not be changed.
rev. 1.0, 09/02, page 115 of 524 7.7.5 pin functions p67/tmox/ kin7 / irq7 the pin function is switched as shown below according to the combination of the os3 to os0 bits in tcsr of tmr_x, the osx bit* 2 in tcrxy, and the p67ddr bit. osx * 2 01 os3 to os0 all 0 not all 0 p67ddr 0 1 0 1 p67 input pin p67 output pin tmox output pin p67 input pin p67 output pin pin function irq7 input pin, kin7 input pin * 1 notes: 1. this pin is used as the irq7 input pin when bit irq7e is set to 1 in ier. it can always be used as the kin7 input pin. 2. the program development tool (emulator) does not support this function. p66/ftob/ kin6 / irq6 the pin function is switched as shown below according to the combination of the oeb bit in tocr of the frt and the p66ddr bit. oeb 0 1 p66ddr 0 1 p66 input pin p66 output pin ftob output pin pin function irq6 input pin, kin6 input pin * note: * this pin is used as the irq6 input pin when bit irq6e is set to 1 in ier while the kmimr6 bit in kmimr is 0. it can always be used as the kin6 input pin. p65/ftid/ kin5 p65ddr 0 1 p65 input pin p65 output pin pin function ftid input pin, kin5 input pin * note: * this pin can always be used as the ftid or kin5 input pin.
rev. 1.0, 09/02, page 116 of 524 p64/ftic/ kin4 the pin function is switched as shown below according to the status of the p64ddr bit. p64ddr 0 1 p64 input pin p64 output pin pin function ftic input pin, kin4 input pin * note: * this pin can always be used as the ftic or kin4 input pin. p63/ftib/ kin3 p63ddr 0 1 p63 input pin p63 output pin pin function ftib input pin, kin3 input pin * note: * this pin can always be used as the ftib or kin3 input pin. p62/ftia/ kin2 /tmiy p62ddr 0 1 p62 input pin p62 output pin pin function ftia input pin, tmiy input pin, kin2 input pin * note: * this pin can always be used as the ftia, tmiy, or kin2 input pin. p61/ftoa/ kin1 the pin function is switched as shown below according to the combination of the oea bit in tocr of the frt, and the p61ddr bit. oea 0 1 p61ddr 0 1 p61 input pin p61 output pin ftoa input pin pin function kin1 input pin * note: * this pin can always be used as the kin1 input pin. p60/ftci/ kin0 /tmix p60ddr 0 1 p60 input pin p60 output pin pin function ftci input pin, tmix input pin, kin0 input pin* note: * this pin is used as the ftci input pin when an external clock is selected with bits cks1 and cks0 in tcr of the frt. it can always be used as the tmix or kin0 input pin.
rev. 1.0, 09/02, page 117 of 524 7.7.6 port 6 input pull-up mos port 6 has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. the input pull-up mos current specification can be changed by means of the p6pue bit. when a pin is designated as an on-chip peripheral module output pin, the input pull-up mos is always off. table 7.5 summarizes the input pull-up mos states. table 7.5 input pull-up mos states (port 6) reset hardware standby mode software standby mode in other operations off off on/off on/off legend: off: input pull-up mos is always off. on/off: on when the pin is in the input state, p6ddr = 0, and kmpcr = 1; otherwise off. 7.8 port 7 port 7 is an 8-bit i/o port* 1 . port 7 pins also function as the tmr_x extended output pins (extmox)* 2 and tmr_y output pins (tmoy)* 2 . port 7 has the following registers. port 7 input data register (p7pin) port 7 data direction register (p7ddr)* 2 port 7 output data register (p7odr)* 2 notes: 1. the program development tool (emulator) does not support the output. 2. the program development tool (emulator) does not support this function.
rev. 1.0, 09/02, page 118 of 524 7.8.1 port 7 input data register (p7pin) p7pin reflects the pin states of port 7. bit bit name initial value r/w description 7 p77pin undefined * r 6 p76pin undefined * r 5 p75pin undefined * r 4 p74pin undefined * r 3 p73pin undefined * r 2 p72pin undefined * r 1 p71pin undefined * r 0 p70pin undefined * r when a p7pin read is performed, the pin states are always read. p7pin has the same address as pbddr; if a write is performed, data will be written into pbddr and the port b setting will be changed. note: * determined by the pin states of p77 to p70. 7.8.2 port 7 data direction register (p7ddr) p7ddr specifies input or output for the pins of port 7 on a bit-by-bit basis. bit bit name initial value r/w description 7 p77ddr 0 w 6 p76ddr 0 w 5 p75ddr 0 w 4 p74ddr 0 w 3 p73ddr 0 w 2 p72ddr 0 w 1 p71ddr 0 w 0 p70ddr 0 w the corresponding port 7 pins are output ports when p7ddr bits are set to 1, and input ports when p7ddr bits are cleared to 0. note: the program development tool (emulator) does not support this register.
rev. 1.0, 09/02, page 119 of 524 7.8.3 port 7 output data register (p7odr) p7odr stores output for the pins of port 7. bit bit name initial value r/w description 7 p77odr 0 r/w 6 p76odr 0 r/w 5 p75odr 0 r/w 4 p74odr 0 r/w 3 p73odr 0 r/w 2 p72odr 0 r/w 1 p71odr 0 r/w 0 p70odr 0 r/w p7odr can always be read or written to, regardless of the contents of p7ddr. note: the program development tool (emulator) does not support this register. 7.8.4 pin functions p77/extmox* the pin function is switched as shown below according to the combination of the osx bit* in tcrxy of tmr_x, os3 to os0 bits, and p77ddr*. osx * 01 os3 to os0 all 0 not all 0 p77ddr * 0101 pin function p77 input pin p77 output pin * p77 input pin p77 output pin * extmox output pin * note: * the program development tool (emulator) does not support this function. p76/tmoy* the pin function is switched as shown below according to the combination of the oey bit* in tcrxy of tmr_x, os3 to os0 bits, and p76ddr*. oey * 01 os3 to os0 all 0 not all 0 p76ddr * 0101 pin function p76 input pin p76 output pin * p76 input pin p76 output pin * tmoy output pin * note: * the program development tool (emulator) does not support this function.
rev. 1.0, 09/02, page 120 of 524 p75, p74, p73, p72, p71, p70 the pin function is switched as shown below according to the status of p7nddr*. p7nddr * 01 pin function p7n input pin p7n output pin * note: * the program development tool (emulator) does not support this function. (n = 5 to 0) 7.9 port 8 port 8 is an 8-bit i/o port. port 8 pins also function as sci_1 i/o pins, the iic_1 i/o pin, lpc i/o pins, and interrupt input pins. the output type of p86 and sck1 is nmos push-pull output. the output type of scl1 is nmos open-drain output and direct bus driving is enabled. port 8 has the following registers. port 8 data direction register (p8ddr) port 8 data register (p8dr) 7.9.1 port 8 data direction register (p8ddr) p8ddr specifies input or output for the pins of port 8 on a bit-by-bit basis. bit bit name initial value r/w description 7 1 reserved the initial value should not be changed. 6 p86ddr 0 w 5 p85ddr 0 w 4 p84ddr 0 w 3 p83ddr 0 w 2 p82ddr 0 w 1 p81ddr 0 w 0 p80ddr 0 w p8ddr has the same address as pbpin, and if read, the port b state will be returned. the corresponding port 8 pins are output ports when p8ddr bits are set to 1, and input ports when cleared to 0.
rev. 1.0, 09/02, page 121 of 524 7.9.2 port 8 data register (p8dr) p8dr stores output data for the port 8 pins (p86 to p80). bit bit name initial value r/w description 7 1 reserved the initial value should not be changed. 6 p86dr 0 r/w 5 p85dr 0 r/w 4 p84dr 0 r/w 3 p83dr 0 r/w 2 p82dr 0 r/w 1 p81dr 0 r/w 0 p80dr 0 r/w if a port 8 read is performed while p8ddr bits are set to 1, the p8dr values are read directly, regardless of the actual pin states. if a port 8 read is performed while p8ddr bits are cleared to 0, the pin states are read. 7.9.3 pin functions p86/ irq5 / sck1/scl1 the pin function is switched as shown below according to the combination of the cke1 and cke0 bits in scr of sci_1, the c/ a bit in smr of sci_1, the sps1 bit* 2 in spsr, the ice bit in iccr of iic_1, and the p86ddr bit. sps1 * 2 01 ice 0 1 0 1 cke 1 010 c/ a 010 cke0 0 1 0 p86ddr 0 1 0 1 p86 input pin p86 output pin sck1 output pin sck1 output pin sck1 input pin scl1 i/o pin p86 input pin p86 output pin scl1 i/o pin pin function irq input pin * 1 notes: 1. when the irq5e bit in ier is set to 1, this pin is used as the irq5 input pin. when this pin is used as the scl1 i/o pin, bits cke1 and cke0 in scr of sci_1 and bit c/ a in smr of sci_1 must all be cleared to 0. when the p86 output pin and sck1 output pin are set, the output type is nmos push-pull output. scl1 is an nmos-only output, and has direct bus drive capability. 2. the program development tool (emulator) does not support this function.
rev. 1.0, 09/02, page 122 of 524 p85/ irq4 /rxd1 the pin function is switched as shown below according to the combination of the re bit in scr of sci_1, the sps1 bit* 2 in spsr, and the p85ddr bit. sps1 * 2 01 re 0 1 p85ddr 0 1 0 1 p85 input pin p85 output pin rxd1 input pin p85 input pin p85 output pin pin function irq4 input pin * 1 notes: 1. when the irq4e bit in ier is set to 1, this pin is used as the irq4 input pin. 2. the program development tool (emulator) does not support this function. p84/ irq3 /txd1 the pin function is switched as shown below according to the combination of the te bit in scr of sci_1, the sps1 bit* 2 in spsr, and the p84ddr bit. sps1 * 2 01 te 0 1 p84ddr 0 1 0 1 p84 input pin p84 output pin txd1 output pin p84 input pin p84 output pin pin function irq3 input pin * 1 notes: 1. when the irq3e bit in ier is set to 1, this pin is used as the irq3 input pin. 2. the program development tool (emulator) does not support this function. p83/ lpcpd the pin function is switched as shown below according to the status of the p83ddr bit. p83ddr 0 1 p83 input pin p83 output pin pin function lpcpd input pin * note: * when at least one of bits lpc3e to lpc1e is set to 1 in hicr0, this pin is used as the lpcpd input pin.
rev. 1.0, 09/02, page 123 of 524 p82/ clkrun the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the lpc3e to lpc1e bits in hicr0, and the p82ddr bit. lpc3e to lpc1e all 0 not all 0 hi12e 0 0 * p82ddr 0 1 0 * pin function p82 input pin p82 output pin clkrun i/o pin note: * when at least one of bits lpc3e to lpc1e is set to 1, bits hi12e and p82ddr should be cleared to 0. p81/ga20 the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the fga20e bit in hicr0, and the p81ddr bit. fga20e 0 1 hi12e 0 0 * p81ddr 0 1 0 * p81 input pin p81 output pin ga20 output pin pin function ga20 input pin note: * when bit fga20e is set to 1 in hicr0, bits hi12e and p81ddr should be cleared to 0. p80/ pme the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the pmee bit in hicr0, and the p80ddr bit. pmee 0 1 hi12e 0 0 * p80ddr 0 1 0 * p80 input pin p80 output pin pme output pin pin function pme input pin note: * when bit pmee is set to 1 in hicr0, bits hi12e and p80ddr should be cleared to 0. 7.10 port 9 port 9 is an 8-bit i/o port. port 9 pins also function as the interrupt input pins, iic_0 i/o pin, subclock input pin, and system clock ( f ) output pin. p97 is an nmos push-pull output. sda0 is an nmos open-drain output, and has direct bus drive capability. port 9 has the following registers.
rev. 1.0, 09/02, page 124 of 524 port 9 data direction register (p9ddr) port 9 data register (p9dr) 7.10.1 port 9 data direction register (p9ddr) p9ddr specifies input or output for the pins of port 9 on a bit-by-bit basis. bit bit name initial value r/w description 7 p97ddr 0 w 6 p96ddr 0 w 5 p95ddr 0 w 4 p94ddr 0 w 3 p93ddr 0 w 2 p92ddr 0 w 1 p91ddr 0 w 0 p90ddr 0 w when the corresponding p9ddr bits are set to 1, pin p96 functions as the f output pin and pins p97 and p95 to p90 become output ports. when p9ddr bits are cleared to 0, the corresponding pins become input ports. 7.10.2 port 9 data register (p9dr) p9dr stores output data for the port 9 pins. bit bit name initial value r/w description 7 p97dr 0 r/w 6 p96dr undefined * r 5 p95dr 0 r/w 4 p94dr 0 r/w 3 p93dr 0 r/w 2 p92dr 0 r/w 1 p91dr 0 r/w 0 p90dr 0 r/w with the exception of p96, if a port 9 read is performed while p9ddr bits are set to 1, the p9dr values are read directly, regardless of the actual pin states. if a port 9 read is performed while p9ddr bits are cleared to 0, the pin states are read. for p96, the pin state is always read. note: * the initial value of bit 6 is determined according to the p96 pin state.
rev. 1.0, 09/02, page 125 of 524 7.10.3 pin functions p97/sda0 the pin function is switched as shown below according to the combination of the ice bit in iccr of iic_0 and the p97ddr bit. ice 0 1 p97ddr 0 1 pin function p97 input pin p97 output pin sda0 i/o pin note: * when this pin is set as the p97 output pin, it is an nmos push-pull output. sda0 is an nmos open-drain output, and has direct bus drive capability. p96/ f /excl the pin function is switched as shown below according to the combination of the excle bit in lpwrcr and the p96ddr bit. p96ddr 0 1 excle 0 1 0 pin function p96 input pin excl input pin f output pin note: * when this pin is used as the excl input pin, p96ddr should be cleared to 0. p95 the pin function is switched as shown below according to the status of the p95ddr bit. p95ddr 0 1 pin function p95 input pin p95 output pin p94 the pin function is switched as shown below according to the status of the p94ddr bit. p94ddr 0 1 pin function p94 input pin p94 output pin p93 the pin function is switched as shown below according to the status of the p93ddr bit. p93ddr 0 1 pin function p93 input pin p93 output pin
rev. 1.0, 09/02, page 126 of 524 p92/ irq0 the pin function is switched as shown below according to the status of the p92ddr bit. p92ddr 0 1 p92 input pin p92 output pin pin function irq0 input pin * note: * when bit irq0e in ier is set to 1, this pin is used as the irq0 input pin. p91/ irq1 the pin function is switched as shown below according to the status of the p91ddr bit. p91ddr 0 1 p91 input pin p91 output pin pin function irq1 input pin * note: * when bit irq1e in ier is set to 1, this pin is used as the irq1 input pin. p90/ irq2 the pin function is switched as shown below according to the status of the p90ddr bit. p90ddr 0 1 p90 input pin p90 output pin pin function irq2 input pin * note: * when the irq2e bit in ier is set to 1, this pin is used as the irq2 input pin. 7.11 port a port a is an 8-bit i/o port. port a pins also function as keyboard buffer controller i/o pins, and key-sense interrupt input pins. port a input/output operates by vccb power independent from the vcc power. up to 5 v can be applied to port a pins if vccb power is 5 v. port a has the following registers. paddr and papin have the same address. port a data direction register (paddr) port a output data register (paodr) port a input data register (papin)
rev. 1.0, 09/02, page 127 of 524 7.11.1 port a data direction register (paddr) paddr specifies input or output for the pins of port a on a bit-by-bit basis. bit bit name initial value r/w description 7 pa7ddr 0 w 6 pa6ddr 0 w 5 pa5ddr 0 w 4 pa4ddr 0 w 3 pa3ddr 0 w 2 pa2ddr 0 w 1 pa1ddr 0 w 0 pa0ddr 0 w the corresponding port a pins are output ports when paddr bits are set to 1, and input ports when cleared to 0. pa7 to pa2 pins are used as the keyboard buffer controller i/o pins by setting the kbioe bit to 1, while the i/o direction according to pa7ddr to pa2ddr is ignored. paddr has the same address as papin, if read, port a status is returned. 7.11.2 port a output data register (paodr) paodr stores output data for port a. bit bit name initial value r/w description 7 pa7odr 0 r/w 6 pa6odr 0 r/w 5 pa5odr 0 r/w 4 pa4odr 0 r/w 3 pa3odr 0 r/w 2 pa2odr 0 r/w 1 pa1odr 0 r/w 0 pa0odr 0 r/w paodr can always be read or written to, regardless of the contents of paddr.
rev. 1.0, 09/02, page 128 of 524 7.11.3 port a input data register (papin) papin indicates the port a state. bit bit name initial value r/w description 7 pa7pin undefined * r 6 pa6pin undefined * r 5 pa5pin undefined * r 4 pa4pin undefined * r 3 pa3pin undefined * r 2 pa2pin undefined * r 1 pa1pin undefined * r 0 pa0pin undefined * r reading papin always returns the pin states. papin has the same address as paddr. if a write is performed, the port a settings will change. note: * the initial value is determined according to the pa7 to pa0 pin states. 7.11.4 pin functions pa7/ kin15 /ps2cd the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_2 of the keyboard buffer controller, and the pa7ddr bit. kbioe 0 1 pa7ddr 0 1 pa7 input pin pa7 output pin ps2cd output pin pin function kin15 input pin, ps2cd input pin * note: * when the kbioe bit is set to 1 or the iics bit in stcr is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2cd or kin15 input pin.
rev. 1.0, 09/02, page 129 of 524 pa6/ kin14 /ps2cc the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_2 of the keyboard buffer controller, and the pa6ddr bit. kbioe 0 1 pa6ddr 0 1 pa6 input pin pa6 output pin ps2cc output pin pin function kin14 input pin, ps2cc input pin * note: * when the kbioe bit is set to 1 or the iics bit in stcr is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2cc or kin14 input pin. pa5/ kin13 /ps2bd the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_1 of the keyboard buffer controller, and the pa5ddr bit. kbioe 0 1 pa5ddr 0 1 pa5 input pin pa5 output pin ps2bd output pin pin function kin13 input pin, ps2bd input pin * note: * when the kbioe bit is set to 1 or the iics bit in stcr is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2bd or kin13 input pin. pa4/ kin12 /ps2bc the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_1 of the keyboard buffer controller, and the pa4ddr bit. kbioe 0 1 pa4ddr 0 1 pa4 input pin pa4 output pin ps2bc output pin pin function kin12 input pin, ps2bc input pin * note: * when the kbioe bit is set to 1 or the iics bit in stcr is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2bc or kin12 input pin.
rev. 1.0, 09/02, page 130 of 524 pa3/ kin11 /ps2ad the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_0 of the keyboard buffer controller, and the pa3ddr bit. kbioe 0 1 pa3ddr 0 1 pa3 input pin pa3 output pin ps2ad output pin pin function kin11 input pin, ps2ad input pin * note: * when the kbioe bit is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2ad or kin11 input pin. pa2/ kin10 /ps2ac the pin function is switched as shown below according to the combination of the kbioe bit in kbcrh_0 of the keyboard buffer controller, and the pa2ddr bit. kbioe 0 1 pa2ddr 0 1 pa2 input pin pa2 output pin ps2ac output pin pin function kin10 input pin, ps2ac input pin * note: * when the kbioe bit is set to 1, this pin is an nmos open-drain output, and has direct bus drive capability. this pin can always be used as the ps2ac or kin10 input pin. pa1/ kin9 , pa0/ kin8 the pin function is switched as shown below according to the status of the panddr bit. panddr 0 1 pan input pin pan output pin pin function kinm input pin * note: * this pin can always be used as the kinm input pin. (n = 1 or 0, m = 9 or 8) 7.11.5 port a input pull-up mos port a has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. the input pull-up mos for pins pa7 to pa4 is always off when iics is set to 1. when the keyboard buffer control pin function is selected for pins pa7 to pa2, the input pull-up mos is always off. table 7.6 summarizes the input pull-up mos states.
rev. 1.0, 09/02, page 131 of 524 table 7.6 input pull-up mos states (port a) reset hardware standby mode software standby mode in other operations off off on/off on/off legend off: input pull-up mos is always off. on/off: on when the pin is in the input state, paddr = 0, and paodr = 1; otherwise off. 7.12 port b port b is an 8-bit i/o port. port b pins also have lpc input/output pins, and wakeup event interrupt input pins function. port b has the following registers. port b data direction register (pbddr) port b output data register (pbodr) port b input data register (pbpin) 7.12.1 port b data direction register (pbddr) pbddr specifies input or output for the pins of port b on a bit-by-bit basis. bit bit name initial value r/w description 7 pb7ddr 0 w 6 pb6ddr 0 w 5 pb5ddr 0 w 4 pb4ddr 0 w 3 pb3ddr 0 w 2 pb2ddr 0 w 1 pb1ddr 0 w 0 pb0ddr 0 w pbddr has the same address as p7pin, and if read, the port 7 pin states will be returned. a port b pin becomes an output port if the corresponding pbddr bit is set to 1, and an input port if the bit is cleared to 0.
rev. 1.0, 09/02, page 132 of 524 7.12.2 port b output data register (pbodr) pbodr stores output data for port b. bit bit name initial value r/w description 7 pb7odr 0 r/w 6 pb6odr 0 r/w 5 pb5odr 0 r/w 4 pb4odr 0 r/w 3 pb3odr 0 r/w 2 pb2odr 0 r/w 1 pb1odr 0 r/w 0 pb0odr 0 r/w pbodr can always be read or written to, regardless of the contents of pbddr. 7.12.3 port b input data register (pbpin) pbpin indicates the port b state. bit bit name initial value r/w description 7 pb7pin undefined * r 6 pb6pin undefined * r 5 pb5pin undefined * r 4 pb4pin undefined * r 3 pb3pin undefined * r 2 pb2pin undefined * r 1 pb1pin undefined * r 0 pb0pin undefined * r reading pbpin always returns the pin states. pbpin has the same address as p8ddr. if a write is performed, data will be written to p8ddr and the port 8 settings will change. note: * the initial value is determined according to the pb7 to pb0 pin states.
rev. 1.0, 09/02, page 133 of 524 7.12.4 pin functions pb7/ wue7 , pb6/ wue6 , pb5/ wue5 , pb4/ wue4 , pb3/ wue3 , pb2/ wue2 the pin function is switched as shown below according to the status of the pbnddr bit. pbnddr 0 1 pbn input pin pbn output pin pin function wuen input pin * note: * this pin can always be used as the wuen input pin. (n = 7 to 2) pb1/ wue1 /lsci the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the lscie bits in hicr0 of host interface (lpc), and the pb1ddr bit. lscie 0 1 hi12e 0 0 * 1 pb1ddr 0 1 0 * 1 pb1input pin pb1 output pin lsci output pin pin function wue1 input pin * 2 , lsci input pin * 2 notes: 1. when bit lscie is set to 1 in hicr0, bits hi12e and pb1ddr should be cleared to 0. 2. this pin can always be used as the wue1 or lsci input pin. pb0/ wue0 / lsmi the pin function is switched as shown below according to the combination of the hi12e bit in syscr2, the lsmie bits in hicr0 of host interface (lpc), and the pb0ddr bit. lsmie 0 1 hi12e 0 0 * 1 pb0ddr 0 1 0 * 1 pb0 input pin pb0 output pin lsmi output pin pin function wue0 input pin * 2 , lsmi input pin * 2 notes: 1. when bit lsmie is set to 1 in hicr0, bits hi12e and pb0ddr should be cleared to 0. 2. this pin can always be used as the wue0 or lsmi input pin.
rev. 1.0, 09/02, page 134 of 524 7.12.5 port b input pull-up mos port b has an on-chip input pull-up mos function that can be controlled by software. this input pull-up mos function can be specified as on or off on a bit-by-bit basis. when a pin is designated as an on-chip peripheral module output pin, the input pull-up mos is always off. table 7.7 summarizes the input pull-up mos states. table 7.7 input pull-up mos states (port b) reset hardware standby mode software standby mode in other operations off off on/off on/off legend off: input pull-up mos is always off. on/off: on when the pin is in the input state, pbddr = 0, and pbodr = 1; otherwise off.
rev. 1.0, 09/02, page 135 of 524 section 8 14-bit pwm timer (pwmx) this lsi has an on-chip 14-bit pulse-width modulator (pwm) timer with two output channels. it can be connected to an external low-pass filter to operate as a 14-bit d/a converter. 8.1 features division of pulse into multiple base cycles to reduce ripple two resolution settings the resolution can be set equal to one or two system clock cycles. two base cycle settings the base cycle can be set equal to t 64 or t 256, where t is the resolution. four operating speeds four operation clocks (by combination of two resolution settings and two base cycle settings) figure 8.1 shows a block diagram of the pwm (d/a) module. select clock bus interface clock internal data bus comparator a comparator b dadra dadrb pwx1 internal clock /2 pwx0 fineCadjustment pulse addition fineCadjustment pulse addition legend dacr dadra dadrb dacnt : pwm d/a control register : pwm d/a data register a : pwm d/a data register b : pwm d/a counter dacnt dacr control logic base cycle compare match a base cycle compare match b base cycle overflow module data bus figure 8.1 pwm (d/a) block diagram dtch80ba_010020020900
rev. 1.0, 09/02, page 136 of 524 8.2 input/output pins table 8.1 lists the pwm (d/a) module input and output pins. table 8.1 pin configuration name abbreviation i/o function pwm output pin x0 pwx0 output pwm output of pwmx channel a pwm output pin x1 pwx1 output pwm output of pwmx channel b 8.3 register descriptions the pwm (d/a) module has the following registers. the pwm (d/a) registers are assigned to the same addresses with other registers. the registers are selected by the iice bit in the serial timer control register (stcr). for details on stcr, see section 3.2.3, serial timer control register (stcr). pwm (d/a) counter h (dacnth) pwm (d/a) counter l (dacntl) pwm (d/a) data register ah (dadrah) pwm (d/a) data register al (dadral) pwm (d/a) data register bh (dadrbh) pwm (d/a) data register bl (dadrbl) pwm (d/a) control register (dacr) note: the same addresses are shared by dadra and dacr, and by dadrb and dacnt. switching is performed by the regs bit in dacnt or dadrb. 8.3.1 pwm (d/a) counters h and l (dacnth, dacntl) dacnt is a 14-bit readable/writable up-counter. the input clock is selected by the clock select bit (cks) in dacr. dacnt functions as the time base for both pwm (d/a) channels. when a channel operates with 14-bit precision, it uses all dacnt bits. when a channel operates with 12- bit precision, it uses the lower 12 bits and ignores the upper two bits. since dacnt consists of 16-bit data, dacnt transfers data to the cpu via the temporary register (temp). for details, refer to section 8.4, bus master interface.
rev. 1.0, 09/02, page 137 of 524 15 7 dacnth dacntl 14 6 13 5 12 4 11 3 10 2 9 1 8 0 7 8 6 9 5 10 4 11 3 12 2 13 1 - 0 - bit (cpu) bit (counter) : : - regs dacnth bit bit name initial value r/w description 7 to 0 uc7 to uc0 all 0 r/w upper up-counter dacntl bit bit name initial value r/w description 7 to 2 uc8 to uc13 all 0 r/w lower up-counter 1 1 r reserved this bit is always read as 1 and cannot be modified. 0 regs 1 r/w register select dadra and dacr, and dadrb and dacnt, are located at the same addresses. the regs bit specifies which registers can be accessed. 0: dadra and dadrb can be accessed 1: dacr and dacnt can be accessed
rev. 1.0, 09/02, page 138 of 524 8.3.2 pwm (d/a) data registers a and b (dadra, dadrb) dadra corresponds to pwm (d/a) channel a, and dadrb to pwm (d/a) channel b. since dadr consists of 16-bit data, dadr transfers data to the cpu via the temporary register (temp). for details, refer to section 8.4, bus master interface. dadra bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w d/a data 13 to 0 these bits set a digital value to be converted to an analog value. in each base cycle, the dacnt value is continually compared with the dadr value to determine the duty cycle of the output waveform, and to decide whether to output a fine-adjustment pulse equal in width to the resolution. to enable this operation, this register must be set within a range that depends on the cfs bit. if the dadr value is outside this range, the pwm output is held constant. a channel can be operated with 12-bit precision by keeping the two lowest data bits (da1 and da0) cleared to 0. the two lowest data bits correspond to the two highest bits in dacnt. 1 cfs 1 r/w carrier frequency select 0: base cycle = resolution (t) 64 dadr range = h'0401 to h'fffd 1: base cycle = resolution (t) 256 dadr range = h'0103 to h'ffff 0 1 r reserved this bit is always read as 1 and cannot be modified.
rev. 1.0, 09/02, page 139 of 524 dadrb bit bit name initial value r/w description 15 14 13 12 11 10 9 8 7 6 5 4 3 2 da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w d/a data 13 to 0 these bits set a digital value to be converted to an analog value. in each base cycle, the dacnt value is continually compared with the dadr value to determine the duty cycle of the output waveform, and to decide whether to output a fine-adjustment pulse equal in width to the resolution. to enable this operation, this register must be set within a range that depends on the cfs bit. if the dadr value is outside this range, the pwm output is held constant. a channel can be operated with 12-bit precision by keeping the two lowest data bits (da1 and da0) cleared to 0. the two lowest data bits correspond to the two highest bits in dacnt. 1 cfs 1 r/w carrier frequency select 0: base cycle = resolution (t) 64 dadr range = h'0401 to h'fffd 1: base cycle = resolution (t) 256 dadr range = h'0103 to h'ffff 0 regs 1 r/w register select dadra and dacr, and dadrb and dacnt, are located at the same addresses. the regs bit specifies which registers can be accessed. 0: dadra and dadrb can be accessed 1: dacr and dacnt can be accessed
rev. 1.0, 09/02, page 140 of 524 8.3.3 pwm (d/a) control register (dacr) dacr selects test mode, enables the pwm outputs, and selects the output phase and operating speed. bit bit name initial value r/w description 7 test 0 r/w test mode selects test mode, which is used in testing this lsi. normally this bit should be cleared to 0. 0: pwm (d/a) in user state: normal operation 1: pwm (d/a) in test state: correct conversion results unobtainable 6 pwme 0 r/w pwm enable starts or stops the pwm d/a counter (dacnt). 0: dacnt operates as a 14-bit up-counter 1: dacnt halts at h'0003 5 4 1 1 r r reserved these bits are always read as 1 and cannot be modified. 3 oeb 0 r/w output enable b enables or disables output on pwm (d/a) channel b. 0: pwm (d/a) channel b output (at the pwx1 pin) is disabled 1: pwm (d/a) channel b output (at the pwx1 pin) is enabled
rev. 1.0, 09/02, page 141 of 524 bit bit name initial value r/w description 2 oea 0 r/w output enable a enables or disables output on pwm (d/a) channel a. 0: pwm (d/a) channel a output (at the pwx0 pin) is disabled 1: pwm (d/a) channel a output (at the pwx0 pin) is enabled 1 os 0 r/w output select selects the phase of the pwm (d/a) output. 0: direct pwm (d/a) output 1: inverted pwm (d/a) output 0 cks 0 r/w clock select selects the pwm (d/a) resolution. if the system clock ( f ) frequency is 10 mhz, resolutions of 100 ns and 200 ns, can be selected. 0: operates at resolution (t) = system clock cycle time (t cyc ) 1: operates at resolution (t) = system clock cycle time (t cyc ) 2
rev. 1.0, 09/02, page 142 of 524 8.4 bus master interface dacnt, dadra, and dadrb are 16-bit registers. the data bus linking the bus master and the on-chip peripheral modules, however, is only 8 bits wide. when the bus master accesses these registers, it therefore uses an 8-bit temporary register (temp). these registers are written to and read from as follows. write: when the upper byte is written to, the upper-byte write data is stored in temp. next, when the lower byte is written to, the lower-byte write data and temp value are combined, and the combined 16-bit value is written in the register. read: when the upper byte is read from, the upper-byte value is transferred to the cpu and the lower-byte value is transferred to temp. next, when the lower byte is read from, the lower-byte value in temp is transferred to the cpu. these registers should always be accessed 16 bits at a time with a mov instruction, and the upper byte should always be accessed before the lower byte. correct data will not be transferred if only the upper byte or only the lower byte is accessed. also note that a bit manipulation instruction cannot be used to access these registers. example 1: write to dacnt mov.w r0, @dacnt ; write r0 contents to dacnt example 2: read dadra mov.w @dadra, r0 ; copy contents of dadra to r0 table 8.2 read and write access methods for 16-bit registers read write register name word byte word byte dadra and dadrb yes yes yes dacnt yes yes legend yes: permitted type of access. word access includes successive byte accesses to the upper byte (first) and lower byte (second). : this type of access may give incorrect results.
rev. 1.0, 09/02, page 143 of 524 8.5 operation a pwm waveform like the one shown in figure 8.2 is output from the pwmx pin. the value in dadr corresponds to the total width (t l ) of the low (0) pulses output in one conversion cycle (256 pulses when cfs = 0, 64 pulses when cfs = 1). when os = 0, this waveform is directly output. when os = 1, the output waveform is inverted, and the dadr value corresponds to the total width (t h ) of the high (1) output pulses. figures 8.3 and 8.4 show the types of waveform output available. t f t l t: resolution t l = t ln (os = 0) (when cfs = 0, m = 256 when cfs = 1, m = 64) m n = 1 1 conversion cycle (t 2 14 (= 16384)) base cycle (t 64 or t 256) figure 8.2 pwm (d/a) operation
rev. 1.0, 09/02, page 144 of 524 table 8.3 summarizes the relationships between the cks, cfs, and os bit settings and the resolution, base cycle, and conversion cycle. the pwm output remains fixed unless dadr contains at least a certain minimum value. table 8.3 settings and operation (examples when f = 10 mhz) fixed dadr bits bit data cks resolution t (s) cfs base cycle (s) conversion cycle (s) t l (if os = 0) t h (if os = 1) accura- cy (bits) 3 2 1 0 conversion cycle * (s) 14 1638.4 12 0 0 409.6 06.4 1. always low (or high) (dadr = h'0001 to h'03fd) 2. (data value) t (dadr = h'0401 to h'fffd) 10 0 0 0 0 102.4 14 1638.4 12 0 0 409.6 00.1 1 25.6 1638.4 1. always low (or high) (dadr = h'0003 to h'00ff) 2. (data value) t (dadr = h'0103 to h'ffff) 10 0 0 0 0 102.4 14 3276.8 12 0 0 819.2 0 12.8 1. always low (or high) (dadr = h'0001 to h'03fd) 2. (data value) t (dadr = h'0401 to h'fffd) 10 0 0 0 0 204.8 14 3276.8 12 0 0 819.2 10.2 1 51.2 3276.8 1. always low (or high) (dadr = h'0003 to h'00ff) 2. (data value) t (dadr = h'0103 to h'ffff) 10 0 0 0 0 204.8 note: * this column indicates the conversion cycle when specific dadr bits are fixed.
rev. 1.0, 09/02, page 145 of 524 t f1 t f2 t f255 t f256 t l1 t l2 t l3 t l255 t l256 1 conversion cycle t f1 = t f2 = t f3 = = t f255 = t f256 = t 64 t l1 + t l2 + t l3 + + t l255 + t l256 = t l t f1 t f2 t f63 t f64 t l1 t l2 t l3 t l63 t l64 1 conversion cycle t f1 = t f2 = t f3 = = t f63 = t f64 = t 256 t l1 + t l2 + t l3 + + t l63 + t l64 = t l a. cfs = 0 [base cycle = resolution (t) 64] b. cfs = 1 [base cycle = resolution (t) 256] figure 8.3 output waveform (os = 0, dadr corresponds to t l )
rev. 1.0, 09/02, page 146 of 524 t f1 t f2 t f255 t f256 t h1 t h2 t h3 t h255 t h256 1 conversion cycle t f1 = t f2 = t f3 = = t f255 = t f256 = t 64 t h1 + t h2 + t h3 + + t h255 + t h256 = t h t f1 t f2 t f63 t f64 t h1 t h2 t h3 t h63 t h64 1 conversion cycle t f1 = t f2 = t f3 = = t f63 = t f64 = t 256 t h1 + t h2 + t h3 + + t h63 + t h64 = t h a. cfs = 0 [base cycle = resolution (t) 64] b. cfs = 1 [base cycle = resolution (t) 256] figure 8.4 output waveform (os = 1, dadr corresponds to t h ) an example of setting cfs to 1 (basic cycle = resolution (t) 256) and os to 1 (pwmx inverted output) is shown as an additional pulse. when cfs is set to 1, the duty ratio of the basic pulse is determined by the upper eight bits (da13 to da6) in dadr, and the position of the additional pulse is determined by the following six bits (da5 to da0) as shown in figure 8.5. tables 8.4 to 8.6 show the position of the additional pulse. basic pulse duty ratio da13 da12 da11 da10 da9 da8 da7 da6 da5 da4 da3 da2 da1 da0 cfs 11 additional pulse position figure 8.5 d/a data register configuration when cfs = 1 here, the case of dadr = h0207 (b0000 0010 0000 0111) is considered. figure 8.6 shows an output waveform. because cfs = 1 and the value of upper eight bits is b0000 0010, the duty ratio of the basic pulse is 2/256 (t) of high width. since the value of the following six bits is b0000 01, the additional pulse is output at the position of basic pulse no. 63 as shown in table 8.4. only 1/256 (t) of the additional pulse is added to the basic pulse.
rev. 1.0, 09/02, page 147 of 524 one conversion cycle no.1 no.0 basic cycle no.63 basic cycle basic cycle basic pulse 2/256 (t) additional pulse 1/256 (t) additional pulse output position basic pulse high width: 2/256 (t) figure 8.6 output waveform when dadr = h0207 (os = 1) note that the case of cfs = 0 (basic cycle = resolution (t) 64) is similar other than the duty ratio of the basic pulse is determined by the upper six bits, and the position of the additional pulse is determined by the following eight bits.
rev. 1.0, 09/02, page 148 of 524 table 8.4 position of pulse to be added to basic pulse with 14-bit conversion accuracy (cfs = 1) lower 6 bits basic pulse no. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 1 2 3 4 5 6 7 8 9 1011121314 151617 181920212223 24252627 282930313233 3435 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s
rev. 1.0, 09/02, page 149 of 524 table 8.5 position of pulse to be added to basic pulse with 12-bit conversion accuracy (cfs = 1) lower 6 bits basic pulse no. 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 1 2 3 4 5 6 7 8 9 1011121314 151617 181920212223 24252627 282930313233 3435 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s
rev. 1.0, 09/02, page 150 of 524 table 8.6 position of pulse to be added to basic pulse with 10-bit conversion accuracy (cfs = 1) lower 6 bits basic pulse no. 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 16 32 48 1 2 3 4 5 6 7 8 9 1011121314 151617 181920212223 24252627 282930313233 3435 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s
rev. 1.0, 09/02, page 151 of 524 8.6 usage note 8.6.1 module stop mode setting pwmx operation can be enabled or disabled using the module stop control register. the initial setting is for pwmx operation to be halted. register access is enabled by canceling the module stop mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 152 of 524
rev. 1.0, 09/02, page 153 of 524 section 9 16-bit free-running timer (frt) this lsi has an on-chip 16-bit free-running timer (frt). the frt operates on the basis of the 16- bit free-running counter (frc), and outputs two independent waveforms, and measures the input pulse width and external clock periods. 9.1 features selection of four clock sources one of the three internal clocks ( f /2, f /8, or f /32), or an external clock input can be selected (enabling use as an external event counter). two independent comparators two independent waveforms can be output. four independent input capture channels the rising or falling edge can be selected. buffer modes can be specified. counter clearing the free-running counters can be cleared on compare-match a. seven independent interrupts two compare-match interrupts, four input capture interrupts, and one overflow interrupt can be requested independently. special functions provided by automatic addition function the contents of ocrar and ocraf can be added to the contents of ocra automatically, enabling a periodic waveform to be generated without software intervention. the contents of icrd can be added automatically to the contents of ocrdm 2, enabling input capture operations in this interval to be restricted. tim8fr1a_010020020800
rev. 1.0, 09/02, page 154 of 524 figure 9.1 shows a block diagram of the frt. clock selector clock compare-match a ocra (h/l) comparator a internal data bus frc (h/l) comparator b ocrb (h/l) icra (h/l) icrb (h/l) icrc (h/l) icrd (h/l) tcsr ftci ftob ftia external clock internal clock /2 /8 /32 ftib ftic ftid ftoa compare-match b overflow clear input capture tier tcr tocr icia icib icic icid interrupt signal legend ocra, ocrb ocrar,ocraf ocrdm frc icra to d tcsr tier tcr tocr : output compare register a, b (16-bit) : output compare register ar, af (16-bit) : output compare register dm (16-bit) : free-running counter (16-bit) : input capture registers a to d (16-bit) : timer control/status register (8-bit) : timer interrupt enable register (8-bit) : timer control register (8-bit) : timer output compare control register (8-bit) ocia ocib fovi ocrar/f (h/l) ocrdm l comparator m compare-match m 1 2 control logic module data bus bus interface figure 9.1 block diagram of 16-bit free-running timer
rev. 1.0, 09/02, page 155 of 524 9.2 input/output pins table 9.1 lists the frt input and output pins. table 9.1 pin configuration name abbreviation i/o function counter clock input pin ftci input frc counter clock input output compare a output pin ftoa output output compare a output output compare b output pin ftob output output compare b output input capture a input pin ftia input input capture a input input capture b input pin ftib input input capture b input input capture c input pin ftic input input capture c input input capture d input pin ftid input input capture d input 9.3 register descriptions the frt has the following registers. free-running counter (frc) output compare register a (ocra) output compare register b (ocrb) input capture register a (icra) input capture register b (icrb) input capture register c (icrc) input capture register d (icrd) output compare register ar (ocrar) output compare register af (ocraf) output compare register dm (ocrdm) timer interrupt enable register (tier) timer control/status register (tcsr) timer control register (tcr) timer output compare control register (tocr) note: ocra and ocrb share the same address. register selection is controlled by the ocrs bit in tocr. icra, icrb, and icrc share the same addresses with ocrar, ocraf, and ocrdm. register selection is controlled by the icrs bit in tocr.
rev. 1.0, 09/02, page 156 of 524 9.3.1 free-running counter (frc) frc is a 16-bit readable/writable up-counter. the clock source is selected by bits cks1 and cks0 in tcr. frc can be cleared by compare-match a. when frc overflows from h'ffff to h'0000, the overflow flag bit (ovf) in tcsr is set to 1. frc should always be accessed in 16-bit units; cannot be accessed in 8-bit units. frc is initialized to h'0000. 9.3.2 output compare registers a and b (ocra, ocrb) the frt has two output compare registers, ocra and ocrb, each of which is a 16-bit readable/writable register whose contents are continually compared with the value in frc. when a match is detected (compare-match), the corresponding output compare flag (ocfa or ocfb) is set to 1 in tcsr. if the oea or oeb bit in tocr is set to 1, when the ocr and frc values match, the output level selected by the olvla or olvlb bit in tocr is output at the output compare output pin (ftoa or ftob). following a reset, the ftoa and ftob output levels are 0 until the first compare-match. ocr should always be accessed in 16-bit units; cannot be accessed in 8-bit units. ocr is initialized to h'ffff. 9.3.3 input capture registers a to d (icra to icrd) the frt has four input capture registers, icra to icrd, each of which is a 16-bit read-only register. when the rising or falling edge of the signal at an input capture input pin (ftia to ftid) is detected, the current frc value is transferred to the corresponding input capture register (icra to icrd). at the same time, the corresponding input capture flag (icfa to icfd) in tcsr is set to 1. the frc contents are transferred to icr regardless of the value of icf. the input capture edge is selected by the input edge select bits (iedga to iedgd) in tcr. icrc and icrd can be used as icra and icrb buffer registers, respectively, by means of buffer enable bits a and b (bufea and bufeb) in tcr. for example, if an input capture occurs when icrc is specified as the icra buffer register, the frc contents are transferred to icra, and then transferred to the buffer register icrc. to ensure input capture, the input capture pulse width should be at least 1.5 system clocks (?) for a single edge. when triggering is enabled on both edges, the input capture pulse width should be at least 2.5 system clocks ( f ). icra to icrd should always be accessed in 16-bit units; cannot be accessed in 8-bit units. icr is initialized to h'0000.
rev. 1.0, 09/02, page 157 of 524 9.3.4 output compare registers ar and af (ocrar, ocraf) ocrar and ocraf are 16-bit readable/writable registers. when the ocrams bit in tocr is set to 1, the operation of ocra is changed to include the use of ocrar and ocraf. the contents of ocrar and ocraf are automatically added alternately to ocra, and the result is written to ocra. the write operation is performed on the occurrence of compare-match a. in the 1st compare-match a after setting the ocrams bit to 1, ocraf is added. the operation due to compare-match a varies according to whether the compare-match follows addition of ocrar or ocraf. the value of the olvla bit in tocr is ignored, and 1 is output on a compare-match a following addition of ocraf, while 0 is output on a compare-match a following addition of ocrar. when using the ocra automatic addition function, do not select internal clock ?/2 as the frc input clock together with a set value of h'0001 or less for ocrar (or ocraf). ocrar and ocraf should always be accessed in 16-bit units; cannot be accessed in 8-bit units. ocrar and ocraf are initialized to h'ffff. 9.3.5 output compare register dm (ocrdm) ocrdm is a 16-bit readable/writable register in which the upper 8 bits are fixed at h'00. when the icrdms bit in tocr is set to 1 and the contents of ocrdm are other than h'0000, the operation of icrd is changed to include the use of ocrdm. the point at which input capture d occurs is taken as the start of a mask interval. next, twice the contents of ocrdm is added to the contents of icrd, and the result is compared with the frc value. the point at which the values match is taken as the end of the mask interval. new input capture d events are disabled during the mask interval. a mask interval is not generated when the contents of ocrdm are h'0000 while the icrdms bit is set to 1. ocrdm should always be accessed in 16-bit units; cannot be accessed in 8-bit units. ocrdm is initialized to h'0000.
rev. 1.0, 09/02, page 158 of 524 9.3.6 timer interrupt enable register (tier) tier enables and disables interrupt requests. bit bit name initial value r/w description 7 iciae 0 r/w input capture interrupt a enable selects whether to enable input capture interrupt a request (icia) when input capture flag a (icfa) in tcsr is set to 1. 0: icia requested by icfa is disabled 1: icia requested by icfa is enabled 6 icibe 0 r/w input capture interrupt b enable selects whether to enable input capture interrupt b request (icib) when input capture flag b (icfb) in tcsr is set to 1. 0: icib requested by icfb is disabled 1: icib requested by icfb is enabled 5 icice 0 r/w input capture interrupt c enable selects whether to enable input capture interrupt c request (icic) when input capture flag c (icfc) in tcsr is set to 1. 0: icic requested by icfc is disabled 1: icic requested by icfc is enabled 4 icide 0 r/w input capture interrupt d enable selects whether to enable input capture interrupt d request (icid) when input capture flag d (icfd) in tcsr is set to 1. 0: icid requested by icfd is disabled 1: icid requested by icfd is enabled 3 ociae 0 r/w output compare interrupt a enable selects whether to enable output compare interrupt a request (ocia) when output compare flag a (ocfa) in tcsr is set to 1. 0: ocia requested by ocfa is disabled 1: ocia requested by ocfa is enabled
rev. 1.0, 09/02, page 159 of 524 bit bit name initial value r/w description 2 ocibe 0 r/w output compare interrupt b enable selects whether to enable output compare interrupt b request (ocib) when output compare flag b (ocfb) in tcsr is set to 1. 0: ocib requested by ocfb is disabled 1: ocib requested by ocfb is enabled 1 ovie 0 r/w timer overflow interrupt enable selects whether to enable a free-running timer overflow request interrupt (fovi) when the timer overflow flag (ovf) in tcsr is set to 1. 0: fovi requested by ovf is disabled 1: fovi requested by ovf is enabled 0 0 r reserved this bit is always read as 1 and cannot be modified. 9.3.7 timer control/status register (tcsr) tcsr is used for counter clear selection and control of interrupt request signals. bit bit name initial value r/w description 7 icfa 0 r/(w) * input capture flag a this status flag indicates that the frc value has been transferred to icra by means of an input capture signal. when bufea = 1, icfa indicates that the old icra value has been moved into icrc and the new frc value has been transferred to icra. only 0 can be written to this bit to clear the flag. [setting condition] when an input capture signal causes the frc value to be transferred to icra [clearing condition] read icfa when icfa = 1, then write 0 to icfa
rev. 1.0, 09/02, page 160 of 524 bit bit name initial value r/w description 6 icfb 0 r/(w) * input capture flag b this status flag indicates that the frc value has been transferred to icrb by means of an input capture signal. when bufeb = 1, icfb indicates that the old icrb value has been moved into icrd and the new frc value has been transferred to icrb. only 0 can be written to this bit to clear the flag. [setting condition] when an input capture signal causes the frc value to be transferred to icrb [clearing condition] read icfb when icfb = 1, then write 0 to icfb 5 icfc 0 r/(w) * input capture flag c this status flag indicates that the frc value has been transferred to icrc by means of an input capture signal. when bufea = 1, on occurrence of an input capture signal specified by the iedgc bit at the ftic input pin, icfc is set but data is not transferred to icrc. in buffer operation, icfc can be used as an external interrupt signal by setting the icice bit to 1. only 0 can be written to this bit to clear the flag. [setting condition] when an input capture signal is received [clearing condition] read icfc when icfc = 1, then write 0 to icfc 4 icfd 0 r/(w) * input capture flag d this status flag indicates that the frc value has been transferred to icrd by means of an input capture signal. when bufeb = 1, on occurrence of an input capture signal specified by the iedgd bit at the ftid input pin, icfd is set but data is not transferred to icrd. in buffer operation, icfd can be used as an external interrupt signal by setting the icide bit to 1. only 0 can be written to this bit to clear the flag. [setting condition] when an input capture signal is received [clearing condition] read icfd when icfd = 1, then write 0 to icfd
rev. 1.0, 09/02, page 161 of 524 bit bit name initial value r/w description 3 ocfa 0 r/(w) * output compare flag a this status flag indicates that the frc value matches the ocra value. only 0 can be written to this bit to clear the flag. [setting condition] when frc = ocra [clearing condition] read ocfa when ocfa = 1, then write 0 to ocfa 2 ocfb 0 r/(w) * output compare flag b this status flag indicates that the frc value matches the ocrb value. only 0 can be written to this bit to clear the flag. [setting condition] when frc = ocrb [clearing condition] read ocfb when ocfb = 1, then write 0 to ocfb 1ovf 0 r/(w) * timer overflow this status flag indicates that the frc has overflowed. only 0 can be written to this bit to clear the flag. [setting condition] when frc overflows (changes from h'ffff to h'0000) [clearing condition] read ovf when ovf = 1, then write 0 to ovf 0 cclra 0 r/w counter clear a this bit selects whether the frc is to be cleared at compare-match a (when the frc and ocra values match). 0: frc clearing is disabled 1: frc is cleared at compare-match a note: * only 0 can be written to clear the flag.
rev. 1.0, 09/02, page 162 of 524 9.3.8 timer control register (tcr) tcr selects the rising or falling edge of the input capture signals, enables the input capture buffer mode, and selects the frc clock source. bit bit name initial value r/w description 7 iedga 0 r/w input edge select a selects the rising or falling edge of the input capture a signal (ftia). 0: capture on the falling edge of ftia 1: capture on the rising edge of ftia 6 iedgb 0 r/w input edge select b selects the rising or falling edge of the input capture b signal (ftib). 0: capture on the falling edge of ftib 1: capture on the rising edge of ftib 5 iedgc 0 r/w input edge select c selects the rising or falling edge of the input capture c signal (ftic). 0: capture on the falling edge of ftic 1: capture on the rising edge of ftic 4 iedgd 0 r/w input edge select d selects the rising or falling edge of the input capture d signal (ftid). 0: capture on the falling edge of ftid 1: capture on the rising edge of ftid 3 bufea 0 r/w buffer enable a selects whether icrc is to be used as a buffer register for icra. 0: icrc is not used as a buffer register for icra 1: icrc is used as a buffer register for icra 2 bufeb 0 r/w buffer enable b selects whether icrd is to be used as a buffer register for icrb. 0: icrd is not used as a buffer register for icrb 1: icrd is used as a buffer register for icrb
rev. 1.0, 09/02, page 163 of 524 bit bit name initial value r/w description 1 0 cks1 cks0 0 0 r/w clock select 1, 0 select clock source for frc. 00: f /2 internal clock source 01: f /8 internal clock source 10: f /32 internal clock source 11: external clock source (counting at ftci rising edge) 9.3.9 timer output compare control register (tocr) tocr enables output from the output compare pins, selects the output levels, switches access between output compare registers a and b, controls the icrd and ocra operating modes, and switches access to input capture registers a, b, and c. bit bit name initial value r/w description 7 icrdms 0 r/w input capture d mode select specifies whether icrd is used in the normal operating mode or in the operating mode using ocrdm. 0: the normal operating mode is specified for icrd 1: the operating mode using ocrdm is specified for icrd 6 ocrams 0 r/w output compare a mode select specifies whether ocra is used in the normal operating mode or in the operating mode using ocrar and ocraf. 0: the normal operating mode is specified for ocra 1: the operating mode using ocrar and ocraf is specified for ocra 5 icrs 0 r/w input capture register select the same addresses are shared by icra and ocrar, by icrb and ocraf, and by icrc and ocrdm. the icrs bit determines which registers are selected when the shared addresses are read from or written to. the operation of icra, icrb, and icrc is not affected. 0: icra, icrb, and icrc are selected 1: ocrar, ocraf, and ocrdm are selected
rev. 1.0, 09/02, page 164 of 524 bit bit name initial value r/w description 4 ocrs 0 r/w output compare register select ocra and ocrb share the same address. when this address is accessed, the ocrs bit selects which register is accessed. the operation of ocra or ocrb is not affected. 0: ocra is selected 1: ocrb is selected 3 oea 0 r/w output enable a enables or disables output of the output compare a output pin (ftoa). 0: output compare a output is disabled 1: output compare a output is enabled 2 oeb 0 r/w output enable b enables or disables output of the output compare b output pin (ftob). 0: output compare b output is disabled 1: output compare b output is enabled 1 olvla 0 r/w output level a selects the level to be output at the output compare a output pin (ftoa) in response to compare-match a (signal indicating a match between the frc and ocra values). when the ocrams bit is 1, this bit is ignored. 0: 0 is output at compare-match a 1: 1 is output at compare-match a 0 olvlb 0 r/w output level b selects the level to be output at the output compare b output pin (ftob) in response to compare-match b (signal indicating a match between the frc and ocrb values). 0: 0 is output at compare-match b 1: 1 is output at compare-match b
rev. 1.0, 09/02, page 165 of 524 9.4 operation 9.4.1 pulse output figure 9.2 shows an example of 50%-duty pulses output with an arbitrary phase difference. when a compare match occurs while the cclra bit in tcsr is set to 1, the olvla and olvlb bits are inverted by software. h'ffff ocra ocrb h'0000 ftoa ftob counter clear frc figure 9.2 example of pulse output 9.5 operation timing 9.5.1 frc increment timing figure 9.3 shows the frc increment timing with an internal clock source. figure 9.4 shows the increment timing with an external clock source. the pulse width of the external clock signal must be at least 1.5 system clocks ( f ). the counter will not increment correctly if the pulse width is shorter than 1.5 system clocks ( f ). internal clock frc input clock frc n C 1 n + 1 n figure 9.3 increment timing with internal clock source
rev. 1.0, 09/02, page 166 of 524 external clock input pin frc input clock frc n + 1 n figure 9.4 increment timing with external clock source 9.5.2 output compare output timing a compare-match signal occurs at the last state when the frc and ocr values match (at the timing when the frc updates the counter value). when a compare-match signal occurs, the level selected by the olvl bit in tocr is output at the output compare pin (ftoa or ftob). figure 9.5 shows the timing of this operation for compare-match a. frc ocra nn n + 1 n + 1 nn compare-match a signal olvla output compare a output pin ftoa clear * note : * indicates instruction execution by software. figure 9.5 timing of output compare a output
rev. 1.0, 09/02, page 167 of 524 9.5.3 frc clear timing frc can be cleared when compare-match a occurs. figure 9.6 shows the timing of this operation. frc n h'0000 compare-match a signal figure 9.6 clearing of frc by compare-match a signal 9.5.4 input capture input timing the rising or falling edge can be selected for the input capture input timing by the iedga to iedgd bits in tcr. figure 9.7 shows the usual input capture timing when the rising edge is selected. input capture input pin input capture signal figure 9.7 input capture input signal timing (usual case)
rev. 1.0, 09/02, page 168 of 524 if icra to icrad are read when the corresponding input capture signal arrives, the internal input capture signal is delayed by one system clock ( f ). figure 9.8 shows the timing for this case. t 1 t 2 read cycle of icra to icrd input capture input pin input capture signal figure 9.8 input capture input signal timing (when icra to icrd are read) 9.5.5 buffered input capture input timing icrc and icrd can operate as buffers for icra and icrb, respectively. figure 9.9 shows how input capture operates when icrc is used as icra's buffer register (bufea = 1) and iedga and iedgc are set to different values (iedga = 0 and iedgc = 1, or iedga = 1 and iedgc = 0), so that input capture is performed on both the rising and falling edges of ftia. input capture signal ftia frc icra icrc n n + 1 n + 1 n mn m m n m n n figure 9.9 buffered input capture timing
rev. 1.0, 09/02, page 169 of 524 even when icrc or icrd is used as a buffer register, its input capture flag is set by the selected transition of its input capture signal. for example, if icrc is used to buffer icra, when the edge transition selected by the iedgc bit occurs on the ftic input capture line, icfc will be set, and if the icice bit is set at this time, an interrupt will be requested. the frc value will not be transferred to icrc, however. in buffered input capture, if either set of two registers to which data will be transferred (icra and icrc, or icrb and icrd) is being read when the input capture input signal arrives, input capture is delayed by one system clock ( f ). figure 9.10 shows the timing when bufea = 1. input capture signal ftia t 1 t 2 cpu read cycle of icra or icrc figure 9.10 buffered input capture timing (bufea = 1) 9.5.6 timing of input capture flag (icf) setting the input capture flag, icfa, icfb, icfc, or icfd, is set to 1 by the input capture signal. the frc value is simultaneously transferred to the corresponding input capture register (icra, icrb, icrc, or icrd). figure 9.11 shows the timing of setting the icfa to icfd flag. input capture signal icfa to icfd icra to icrd frc n n figure 9.11 timing of input capture flag (icfa, icfb, icfc, or icfd) setting
rev. 1.0, 09/02, page 170 of 524 9.5.7 timing of output compare flag (ocf) setting the output compare flag, ocfa or ocfb, is set to 1 by a compare-match signal generated when the frc value matches the ocra or ocrb value. this compare-match signal is generated at the last state in which the two values match, just before frc increments to a new value. when the frc and ocra or ocrb value match, the compare-match signal is not generated until the next cycle of the clock source. figure 9.12 shows the timing of setting the ocfa or ocfb flag. compare-match signal ocfa, ocfb ocra, ocrb n frc n n + 1 figure 9.12 timing of output compare flag (ocfa or ocfb) setting 9.5.8 timing of frc overflow flag setting the frc overflow flag (ovf) is set to 1 when frc overflows (changes from h'ffff to h'0000). figure 9.13 shows the timing of setting the ovf flag. overflow signal frc h'ffff h'0000 ovf figure 9.13 timing of overflow flag (ovf) setting
rev. 1.0, 09/02, page 171 of 524 9.5.9 automatic addition timing when the ocrams bit in tocr is set to 1, the contents of ocrar and ocraf are automatically added to ocra alternately, and when an ocra compare-match occurs a write to ocra is performed. figure 9.14 shows the ocra write timing. compare-match signal ocrar, ocraf a ocra n n + a frc n n +1 figure 9.14 ocra automatic addition timing 9.5.10 mask signal generation timing when the icrdms bit in tocr is set to 1 and the contents of ocrdm are other than h'0000, a signal that masks the icrd input capture signal is generated. the mask signal is set by the input capture signal. the mask signal is cleared by the sum of the icrd contents and twice the ocrdm contents, and an frc compare-match. figure 9.15 shows the timing of setting the mask signal. figure 9.16 shows the timing of clearing the mask signal. input capture signal input capture mask signal figure 9.15 timing of input capture mask signal setting
rev. 1.0, 09/02, page 172 of 524 compare-match signal input capture mask signal icrd + ocrdm 2 n frc n n + 1 figure 9.16 timing of input capture mask signal clearing 9.6 interrupt sources the free-running timer can request seven interrupts: icia to icid, ocia, ocib, and fovi. each interrupt can be enabled or disabled by an enable bit in tier. independent signals are sent to the interrupt controller for each interrupt. table 9.2 lists the sources and priorities of these interrupts. table 9.2 frt interrupt sources interrupt interrupt source interrupt flag priority icia input capture of icra icfa high icib input capture of icrb icfb icic input capture of icrc icfc icid input capture of icrd icfd ocia compare match of ocra ocfa ocib compare match of ocrb ocfb fovi overflow of frc ovf low
rev. 1.0, 09/02, page 173 of 524 9.7 usage notes 9.7.1 conflict between frc write and clear if an internal counter clear signal is generated during the state after an frc write cycle, the clear signal takes priority and the write is not performed. figure 9.17 shows the timing for this type of conflict. address frc address internal write signal counter clear signal frc n h'0000 t 1 t 2 write cycle of frc figure 9.17 frc write-clear conflict
rev. 1.0, 09/02, page 174 of 524 9.7.2 conflict between frc write and increment if an frc increment pulse is generated during the state after an frc write cycle, the write takes priority and frc is not incremented. figure 9.18 shows the timing for this type of conflict. address frc address internal write signal frc input clock write data frc n m t 1 t 2 write cycle of frc figure 9.18 frc write-increment conflict 9.7.3 conflict between ocr write and compare-match if a compare-match occurs during the state after an ocra or ocrb write cycle, the write takes priority and the compare-match signal is disabled. figure 9.19 shows the timing for this type of conflict. if automatic addition of ocrar and ocraf to ocra is selected, and a compare-match occurs in the cycle following the ocra, ocrar, and ocraf write cycle, the ocra, ocrar and ocraf write takes priority and the compare-match signal is disabled. consequently, the result of the automatic addition is not written to ocra. figure 9.20 shows the timing for this type of conflict.
rev. 1.0, 09/02, page 175 of 524 address ocr address internal write signal compare-match signal frc write data disabled ocr n m n n + 1 t 1 t 2 write cycle of ocr figure 9.19 conflict between ocr write and compare-match (when automatic addition function is not used)
rev. 1.0, 09/02, page 176 of 524 address ocrar (ocraf) address internal write signal compare-match signal frc automatic addition is not performed because compare-match signals are disabled. disabled ocra n n n+1 ocrar (ocraf) old data new data t 1 t 2 write cycle of ocrar/ocraf figure 9.20 conflict between ocrar/ocraf write and compare-match (when automatic addition function is used) 9.7.4 switching of internal clock and frc operation when the internal clock is changed, the changeover may cause frc to increment. this depends on the time at which the clock is switched (bits cks1 and cks0 are rewritten), as shown in table 9.3. when an internal clock is used, the frc clock is generated on detection of the falling edge of the internal clock scaled from the system clock ( f ). if the clock is changed when the old source is high and the new source is low, as in case no. 3 in table 9.3, the changeover is regarded as a falling edge that triggers the frc clock, and frc is incremented. switching between an internal clock and external clock can also cause frc to increment.
rev. 1.0, 09/02, page 177 of 524 table 9.3 switching of internal clock and frc operation no. timing of switchover by means of cks1 and cks0 bits frc operation 1 switching from low to low clock before switchover clock after switchover frc clock frc cks bit rewrite n n + 1 2 switching from low to high clock before switchover clock after switchover frc clock frc n n + 1 n + 2 cks bit rewrite
rev. 1.0, 09/02, page 178 of 524 no. timing of switchover by means of cks1 and cks0 bits frc operation 3 switching from high to low clock before switchover clock after switchover frc clock frc cks bit rewrite n n + 2 n + 1 * 4 switching from high to high clock before switchover clock after switchover frc clock frc n n + 1 cks bit rewrite n + 2 note: * generated on the assumption that the switchover is a falling edge; frc is incremented. 9.7.5 module stop mode setting frt operation can be enabled or disabled using the module stop control register. the initial setting is for frt operation to be halted. register access is enabled by canceling the module stop mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 179 of 524 section 10 8-bit timer (tmr) this lsi has an on-chip 8-bit timer module (tmr_0 and tmr_1) with two channels operating on the basis of an 8-bit counter. the 8-bit timer module can be used as a multifunction timer in a variety of applications, such as generation of counter reset, interrupt requests, and pulse output with an arbitrary duty cycle using a compare-match signal with two registers. this lsi also has a similar on-chip 8-bit timer module (tmr_y and tmr_x) with two channels. 10.1 features selection of clock sources ? tmr_0, tmr_1: the counter input clock can be selected from six internal clocks and an external clock ? tmr_y, tmr_x: the counter input clock can be selected from six internal clocks* 1 and an external clock selection of three ways to clear the counters ? the counters can be cleared on compare-match a or compare-match b, or by an external reset signal. timer output controlled by two compare-match signals ? the timer output signal in each channel is controlled by two independent compare-match signals, enabling the timer to be used for various applications, such as the generation of pulse output or pwm output with an arbitrary duty cycle. cascading of two channels ? cascading of tmr_0 and tmr_1 operation as a 16-bit timer can be performed using tmr_0 as the upper half and tmr_1 as the lower half (16-bit count mode). tmr_1 can be used to count tmr_0 compare-match occurrences (compare-match count mode). ? cascading of tmr_y and tmr_x* 2 operation as a 16-bit timer can be performed using tmr_y as the upper half and tmr_x as the lower half (16-bit count mode). tmr_x can be used to count tmr_y compare-match occurrences (compare-match count mode). multiple interrupt sources for each channel ? tmr_0, tmr_1, and tmr_y: three types of interrupts: compare-match a, compare- match b, and overflow ? tmr_x: one type of interrupt: input capture timh265a_000020020800
rev. 1.0, 09/02, page 180 of 524 notes: 1. the program development tool (emulator) supports three internal clocks. 2. the program development tool (emulator) does not support this function. figures 10.1 and 10.2 show block diagrams of 8-bit timers. an input capture function is added to tmr_x. external clock sources internal clock sources tmr_0 f /2, f /8, f /32, f /64, f /256, f /1024 clock 1 clock 0 compare-match a1 compare-match a0 clear 1 interrupt signals cmia0 cmib0 ovi0 cmia1 cmib1 ovi1 tmo0 tmri0 internal bus tcora_0 comparator a_0 comparator b_0 tcorb_0 tcsr_0 tcr_0 tcora_1 comparator a_1 tcnt_1 comparator b_1 tcorb_1 tcsr_1 tcr_1 tmci0 tmci1 tcnt_0 overflow 1 overflow 0 compare-match b1 compare-match b0 tmo1 tmri1 clock select control logic clear 0 tmr_1 f /2, f /8, f /64, f /128, f /1024, f /2048 legend tcora_0 tcorb_0 tcnt_0 tcsr_0 tcr_0 : time constant register a_0 : time constant register b_0 : timer counter_0 : timer control/status register_0 : timer control register_0 tcora_1 tcorb_1 tcnt_1 tcsr_1 tcr_1 : time constant register a_1 : time constant register b_1 : timer counter_1 : timer control/status register_1 : timer control register_1 figure 10.1 block diagram of 8-bit timer (tmr_0 and tmr_1)
rev. 1.0, 09/02, page 181 of 524 external clock sources internal clock sources tmr_x f , f /2, f /4, f /2048 * , f /4096 * , f /8192 * clock x clock y compare-match a x compare-match a y clear x cmiay cmiby oviy icix tmoy * tmriy tcora_y comparator a_y comparator b_y tcorb_y tcsr_y tcr_y tcora_x comparator a_x tcnt_x comparator b_x comparator c tcorb_x tcorc ticrr ticrf ticr tcsr_x tcr_x tmciy tmcix tisr tcnt_y overflow x overflow y compare- match b x compare-match b y compare-match c input capture clock select internal bus control logic legend tcora_x: time constant register a_x tcorb_x: time constant register b_x tcnt_x: timer counter_x tcsr_x: timer control/status register_x tcr_x: timer control register_x ticr: input capture register tcorc: time constant register c ticrr: input capture register r ticrf: input capture register f tcora_y: time constant register a_y tcorb_y: time constant register b_y tcnt_y: timer counter_y tcsr_y: timer control/status register_y tcr_y: timer control register_y tisr: timer input select register clear y tmr_y f /4, f /256, f /2048, f /4096 * , f /8192 * , f /16384 * interrupt signals + extmox * /tmox tmrix * * note: the program development tool (emulator) does not support this function. figure 10.2 block diagram of 8-bit timer (tmr_y and tmr_x)
rev. 1.0, 09/02, page 182 of 524 10.2 input/output pins table 10.1 summarizes the input and output pins of the tmr. table 10.1 pin configuration channel name symbol i/o function timer output tmo0 output output controlled by compare-match timer clock input tmci0 input external clock input for the counter tmr_0 timer reset input tmri0 input external reset input for the counter timer output tmo1 output output controlled by compare-match timer clock input tmci1 input external clock input for the counter tmr_1 timer reset input tmri1 input external reset input for the counter tmr_y timer clock/reset input tmiy (tmciy/tmriy) input external clock input/external reset input for the counter tmr_y timer output tmoy * output output controlled by compare-match timer output tmox/ extmox * output output controlled by compare-match tmr_x timer clock/reset input tmix (tmcix/tmrix) input external clock input/external reset input for the counter note: * the program development tool (emulator) does not support this pin. 10.3 register descriptions the tmr has the following registers. for details on the serial timer control register, see section 3.2.3, serial timer control register (stcr). tmr_0 timer counter_0 (tcnt_0) time constant register a_0 (tcora_0) time constant register b_0 (tcorb_0) timer control register_0 (tcr_0) timer control/status register_0 (tcsr_0)
rev. 1.0, 09/02, page 183 of 524 tmr_1 timer counter_1 (tcnt_1) time constant register a_1 (tcora_1) time constant register b_1 (tcorb_1) timer control register_1 (tcr_1) timer control/status register_1 (tcsr_1) tmr_y timer counter_y (tcnt_y) time constant register a_y (tcora_y) time constant register b_y (tcorb_y) timer control register_y (tcr_y) timer control/status register_y (tcsr_y) timer input select register (tisr) timer connection register s (tconrs) tmr_x timer counter_x (tcnt_x) time constant register a_x (tcora_x) time constant register b_x (tcorb_x) timer control register_x (tcr_x) timer control/status register_x (tcsr_x) input capture register (ticr) time constant register (tcorc) input capture register r (ticrr) input capture register f (ticrf) timer connection register i (tconri) for both tmr_y and tmr_x timer xy control register (tcrxy) note: some of the registers of tmr_x and tmr_y use the same address. the registers can be switched by the tmrx/y bit in tconrs. 10.3.1 timer counter (tcnt) each tcnt is an 8-bit readable/writable up-counter. tcnt_0 and tcnt_1 comprise a single 16- bit register, so they can be accessed together by word access. the clock source is selected by the cks2 to cks0 bits in tcr. tcnt can be cleared by an external reset input signal, compare- match a signal or compare-match b signal. the method of clearing can be selected by the cclr1
rev. 1.0, 09/02, page 184 of 524 and cclr0 bits in tcr. when tcnt overflows (changes from h'ff to h'00), the ovf bit in tcsr is set to 1. tcnt is initialized to h'00. tcnt_y can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 1. tcnt_x can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 0. 10.3.2 time constant register a (tcora) tcora is an 8-bit readable/writable register. tcora_0 and tcora_1 comprise a single 16-bit register, so they can be accessed together by word access. tcora is continually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag a (cmfa) in tcsr is set to 1. note however that comparison is disabled during the t2 state of a tcora write cycle. the timer output from the tmo pin can be freely controlled by these compare-match a signals and the settings of output select bits os1 and os0 in tcsr. tcora is initialized to h'ff. tcora_y can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 1. tcora_x can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 0. 10.3.3 time constant register b (tcorb) tcorb is an 8-bit readable/writable register. tcorb_0 and tcorb_1 comprise a single 16-bit register, so they can be accessed together by word access. tcorb is continually compared with the value in tcnt. when a match is detected, the corresponding compare-match flag b (cmfb) in tcsr is set to 1. note however that comparison is disabled during the t2 state of a tcorb write cycle. the timer output from the tmo pin can be freely controlled by these compare-match b signals and the settings of output select bits os3 and os2 in tcsr. tcorb is initialized to h'ff. tcorb_y can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 1. tcorb_x can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 0. 10.3.4 timer control register (tcr) tcr selects the tcnt clock source and the condition by which tcnt is cleared, and enables/disables interrupt requests. tcr_y can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 1. tcr_x can be accessed when the hie bit in syscr is 0 and the tmrx/y bit in tconrs is 0.
rev. 1.0, 09/02, page 185 of 524 bit bit name initial value r/w description 7 cmieb 0 r/w compare-match interrupt enable b selects whether the cmfb interrupt request (cmib) is enabled or disabled when the cmfb flag in tcsr is set to 1. for tmr_x, a cmib interrupt does not occur irrespective of the value of this bit. 0: cmfb interrupt request (cmib) is disabled 1: cmfb interrupt request (cmib) is enabled 6 cmiea 0 r/w compare-match interrupt enable a selects whether the cmfa interrupt request (cmia) is enabled or disabled when the cmfa flag in tcsr is set to 1. for tmr_x, a cmia interrupt does not occur irrespective of the value of this bit. 0: cmfa interrupt request (cmia) is disabled 1: cmfa interrupt request (cmia) is enabled 5 ovie 0 r/w timer overflow interrupt enable selects whether the ovf interrupt request (ovi) is enabled or disabled when the ovf flag in tcsr is set to 1. for tmr_x, an ovi interrupt does not occur irrespective of the value of this bit. 0: ovf interrupt request (ovi) is disabled 1: ovf interrupt request (ovi) is enabled 4 3 cclr1 cclr0 0 0 r/w r/w counter clear 1, 0 these bits select the method by which the timer counter is cleared. 00: clearing is disabled 01: cleared on compare-match a 10: cleared on compare-match b 11: cleared on rising edge of external reset input 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 these bits select the clock input to tcnt and count condition, together with the icks1 and icks0 bits in stcr. for details, see table 10.2.
rev. 1.0, 09/02, page 186 of 524 table 10.2 clock input to tcnt and count condition (1) tcr stcr channel cks2 cks1 cks0 icks1 icks0 description 0 0 0 disables clock input 0 0 1 0 increments at falling edge of internal clock f /8 0 0 1 1 increments at falling edge of internal clock f /2 0 1 0 0 increments at falling edge of internal clock f /64 0 1 0 1 increments at falling edge of internal clock f /32 0 1 1 0 increments at falling edge of internal clock f /1024 0 1 1 1 increments at falling edge of internal clock f /256 tmr_0 1 0 0 increments at overflow signal from tcnt_1 * 0 0 0 disables clock input 0 0 1 0 increments at falling edge of internal clock f /8 0 0 1 1 increments at falling edge of internal clock f /2 0 1 0 0 increments at falling edge of internal clock f /64 0 1 0 1 increments at falling edge of internal clock f /128 0 1 1 0 increments at falling edge of internal clock f /1024 0 1 1 1 increments at falling edge of internal clock f /2048 tmr_1 1 0 0 increments at compare-match a from tcnt_0 *
rev. 1.0, 09/02, page 187 of 524 tcr stcr channel cks2 cks1 cks0 icks1 icks0 description common 1 0 1 increments at rising edge of external clock 1 1 0 increments at falling edge of external clock 1 1 1 increments at both rising and falling edges of external clock note: * if the tmr_0 clock input is set as the tcnt_1 overflow signal and the tmr_1 clock input is set as the tcnt_0 compare-match signal simultaneously, a count-up clock cannot be generated. these settings should not be made. table 10.2 clock input to tcnt and count condition (2) tcr tcrxy * 2 channel cks2 cks1 cks0 cksx cksy description tmr_y 0 0 0 0 disables clock input 0 0 1 0 increments at f /4 0 1 0 0 increments at f /256 0 1 1 0 increments at f /2048 1 0 0 0 disables clock input 0 0 0 1 disables clock input 0 0 1 1 increments at f /4096 0 1 0 1 increments at f /8192 0 1 1 1 increments at f /16384 1 0 0 1 increments at overflow signal from tcnt_x * 1 1 0 1 increments at rising edge of external clock 1 1 0 increments at falling edge of external clock 1 1 1 increments at both rising and falling edges of external clock
rev. 1.0, 09/02, page 188 of 524 tcr tcrxy * 2 channel cks2 cks1 cks0 cksx cksy description tmr_x 0 0 0 0 disables clock input 0 0 1 0 increments at f 0 1 0 0 increments at f /2 0 1 1 0 increments at f /4 1 0 0 0 disables clock input 0 0 0 1 disables clock input 0 0 1 1 increments at f /2048 0 1 0 1 increments at f /4096 0 1 1 1 increments at f /8192 1 0 0 1 increments at compare-match a from tcnt_y * 1 1 0 1 increments at rising edge of external clock 1 1 0 increments at falling edge of external clock 1 1 1 increments at both rising and falling edges of external clock notes: 1. if the tmr_y clock input is set as the tcnt_x overflow signal and the tmr_x clock input is set as the tcnt_y compare-match signal simultaneously, a count-up clock cannot be generated. these settings should not be made. 2. the program development tool (emulator) does not support tcrxy. selection of the internal clock is only available when cksx = 0 and cksy = 0.
rev. 1.0, 09/02, page 189 of 524 10.3.5 timer control/status register (tcsr) tcsr indicates the status flags and controls compare-match output. tcsr_0 bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_0 and tcorb_0 match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_0 and tcora_0 match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5ovf0 r/(w) * timer overflow flag [setting condition] when tcnt_0 overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 adte 0 r/w a/d trigger enable enables or disables a/d converter start requests by compare-match a. 0: a/d converter start requests by compare-match a are disabled 1: a/d converter start requests by compare-match a are enabled 3 2 os3 os2 0 0 r/w r/w output select 3, 2 these bits specify how the tmo0 pin output level is to be changed by compare-match b of tcorb_0 and tcnt_0. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output)
rev. 1.0, 09/02, page 190 of 524 bit bit name initial value r/w description 1 0 os1 os0 0 0 r/w r/w output select 1, 0 these bits specify how the tmo0 pin output level is to be changed by compare-match a of tcora_0 and tcnt_0. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) note: * only 0 can be written, for flag clearing. tcsr_1 bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_1 and tcorb_1 match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_1 and tcora_1 match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5ovf0 r/(w) * timer overflow flag [setting condition] when tcnt_1 overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 1 rreserved this bit is always read as 1 and cannot be modified.
rev. 1.0, 09/02, page 191 of 524 bit bit name initial value r/w description 3 2 os3 os2 0 0 r/w r/w output select 3, 2 these bits specify how the tmo1 pin output level is to be changed by compare-match b of tcorb_1 and tcnt_1. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) 1 0 os1 os0 0 0 r/w r/w output select 1, 0 these bits specify how the tmo1 pin output level is to be changed by compare-match a of tcora_1 and tcnt_1. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) note: * only 0 can be written, for flag clearing. tcsr_x bit bit name initial value r/w description 7 cmfb 0 r/(w) * compare-match flag b [setting condition] when the values of tcnt_x and tcorb_x match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * compare-match flag a [setting condition] when the values of tcnt_x and tcora_x match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa
rev. 1.0, 09/02, page 192 of 524 bit bit name initial value r/w description 5ovf0 r/(w) * timer overflow flag [setting condition] when tcnt_x overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4icf 0 r/(w) * input capture flag [setting condition] when a rising edge and falling edge is detected in the external reset signal in that order. [clearing condition] read icf when icf = 1, then write 0 in icf 3 2 os3 os2 0 0 r/w r/w output select 3, 2 these bits specify how the tmox pin output level is to be changed by compare-match b of tcorb_x and tcnt_x. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) 1 0 os1 os0 0 0 r/w r/w output select 1, 0 these bits specify how the tmox pin output level is to be changed by compare-match a of tcora_x and tcnt_x. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) note: * only 0 can be written, for flag clearing.
rev. 1.0, 09/02, page 193 of 524 tcsr_y bit bit name initial value r/w description 7 cmfb 0 r/(w) * 1 compare-match flag b [setting condition] when the values of tcnt_y and tcorb_y match [clearing condition] read cmfb when cmfb = 1, then write 0 in cmfb 6 cmfa 0 r/(w) * 1 compare-match flag a [setting condition] when the values of tcnt_y and tcora_y match [clearing condition] read cmfa when cmfa = 1, then write 0 in cmfa 5ovf0 r/(w) * 1 timer overflow flag [setting condition] when tcnt_y overflows from h'ff to h'00 [clearing condition] read ovf when ovf = 1, then write 0 in ovf 4 icie 0 r/w input capture interrupt enable enables or disables the icf interrupt request (icix) when the icf bit in tcsr_x is set to 1. 0: icf interrupt request (icix) is disabled 1: icf interrupt request (icix) is enabled 3 2 os3 os2 0 0 r/w r/w output select 3, 2 these bits specify how the tmoy pin * 2 output level is to be changed by compare-match b of tcorb_y and tcnt_y. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output)
rev. 1.0, 09/02, page 194 of 524 bit bit name initial value r/w description 1 0 os1 os0 0 0 r/w r/w output select 1, 0 these bits specify how the tmoy pin * 2 output level is to be changed by compare-match a of tcora_y and tcnt_y. 00: no change 01: 0 is output 10: 1 is output 11: output is inverted (toggle output) notes: 1. only 0 can be written, for flag clearing. 2. the program development tool (emulator) does not support this pin. 10.3.6 time constant register (tcorc) tcorc is an 8-bit readable/writable register. the sum of contents of tcorc and ticr is always compared with tcnt. when a match is detected, a compare-match c signal is generated. however, comparison at the t2 state in the write cycle to tcorc and at the input capture cycle of ticr is disabled. tcorc is initialized to h'ff. 10.3.7 input capture registers r and f (ticrr and ticrf) ticrr and ticrf are 8-bit read-only registers. while the icst bit in tconri is set to 1, the contents of tcnt are transferred at the rising edge and falling edge of the external reset input (tmrix) in that order. the icst bit is cleared to 0 when one capture operation ends. ticrr and ticrf are initialized to h'00. 10.3.8 timer input select register (tisr) tisr permits or prohibits a signal source of external clock/reset input for the counter. bit bit name initial value r/w description 7 to 1 all 1 r/(w) reserved the initial value should not be changed. 0 is 0 r/w input select selects a timer clock/reset input pin (tmiy) as the signal source of external clock/reset input for the tmr_y counter. 0: input is prohibited 1: tmiy (tmciy/tmriy) is permitted for input
rev. 1.0, 09/02, page 195 of 524 10.3.9 timer connection register i (tconri) tconri controls the input capture function. bit bit name initial value r/w description 7 to 5 all 0 r/w reserved the initial value should not be changed. 4 icst 0 r/w input capture start bit tmr_x has input capture registers (ticrr and ticrf). ticrr and ticrf can measure the width of a pulse by means of a single capture operation under the control of the icst bit. when a rising edge followed by a falling edge is detected on tmrix after the icst bit is set to 1, the contents of tcnt at those points are captured into ticrr and ticrf, respectively, and the icst bit is cleared to 0. [clearing condition] when a rising edge followed by a falling edge is detected on tmrix [setting condition] when 1 is written in icst after reading icst = 0 3 to 0 all 0 r/w reserved the initial values should not be modified. 10.3.10 timer connection register s (tconrs) tconrs selects whether to access tmr_x or tmr_y registers. bit bit name initial value r/w description 7 tmr_x/y 0 r/w tmr_x/tmr_y access select for details, see table 10.3. 0: the tmr_x registers are accessed at addresses h'(ff)fff0 to h'(ff)fff5 1: the tmr_y registers are accessed at addresses h'(ff)fff0 to h'(ff)fff5 6 to 0 all 0 r/w reserved the initial values should not be modified.
rev. 1.0, 09/02, page 196 of 524 table 10.3 registers accessible by tmr_x/tmr_y tmrx/y h'fff0 h'fff1 h'fff2 h'fff3 h'fff4 h'fff5 h'fff6 h'fff7 0tmr_x tcr_x tmr_x tcsr_x tmr_x ticrr tmr_x ticrf tmr_x tcnt tmr_x tcorc tmr_x tcora_x tmr_x tcorb_x 1tmr_y tcr_y tmr_y tcsr_y tmr_y tcora_y tmr_y tcorb_y tmr_y tcnt_y tmr_y tisr 10.3.11 timer xy control register (tcrxy) tcrxy selects the tmr_x and tmr_y output pins and internal clock. bit bit name initial value r/w description 7 osx 0 r/w tmr_x output select 0: output to p67/tmox 1: output to p77/extmox 6 oey 0 r/w tmr_y output enable 0: output to p76/tmoy is prohibited 1: output to p76/tmoy is permitted 5 cksx 0 r/w tmr_x clock select for details about selection, see the clock conditions in table 10.2. 4 cksy 0 r/w tmr_y clock select for details about selection, see the clock conditions in table 10.2. 3 to 0 all 0 r/w reserved the initial value should not be changed. note: * the program development tool (emulator) does not support tcrxy.
rev. 1.0, 09/02, page 197 of 524 10.4 operation 10.4.1 pulse output figure 10.3 shows an example for outputting an arbitrary duty pulse. 1. clear the cclr1 bit in tcr to 0 so that tcnt is cleared according to the compare match of tcora, and then set the cclr0 bit to 1. 2. set the os3 to os0 bits in tcsr to b'0110 so that 1 is output according to the compare match of tcora and 0 is output according to the compare match of tcorb. according to the above settings, the waveforms with the tcora cycle and tcorb pulse width can be output without the intervention of software. tcnt h'ff counter clear tcora tcorb h'00 tmo figure 10.3 pulse output example
rev. 1.0, 09/02, page 198 of 524 10.5 operation timing 10.5.1 tcnt count timing figure 10.4 shows the tcnt count timing with an internal clock source. figure 10.5 shows the tcnt count timing with an external clock source. the pulse width of the external clock signal must be at least 1.5 system clocks ( f ) for a single edge and at least 2.5 system clocks ( f ) for both edges. the counter will not increment correctly if the pulse width is less than these values. f internal clock tcnt input clock tcnt n C 1 n n + 1 figure 10.4 count timing for internal clock input f external clock input pin tcnt input clock tcnt n C 1 n n + 1 figure 10.5 count timing for external clock input (both edges) 10.5.2 timing of cmfa and cmfb setting at compare-match the cmfa and cmfb flags in tcsr are set to 1 by a compare-match signal generated when the tcnt and tcor values match. the compare-match signal is generated at the last state in which the match is true, just when the timer counter is updated. therefore, when tcnt and tcor match, the compare-match signal is not generated until the next tcnt input clock. figure 10.6 shows the timing of cmf flag setting.
rev. 1.0, 09/02, page 199 of 524 f tcnt n n + 1 tcor n compare-match signal cmf figure 10.6 timing of cmf setting at compare-match 10.5.3 timing of timer output at compare-match when a compare-match signal occurs, the timer output changes as specified by the os3 to os0 bits in tcsr. figure 10.7 shows the timing of timer output when the output is set to toggle by a compare-match a signal. f compare-match a signal timer output pin figure 10.7 timing of toggled timer output by compare-match a signal 10.5.4 timing of counter clear at compare-match tcnt is cleared when compare-match a or compare-match b occurs, depending on the setting of the cclr1 and cclr0 bits in tcr. figure 10.8 shows the timing of clearing the counter by a compare-match. f n h'00 compare-match signal tcnt figure 10.8 timing of counter clear by compare-match
rev. 1.0, 09/02, page 200 of 524 10.5.5 tcnt external reset timing tcnt is cleared at the rising edge of an external reset input, depending on the settings of the cclr1 and cclr0 bits in tcr. the width of the clearing pulse must be at least 1.5 states. figure 10.9 shows the timing of clearing the counter by an external reset input. f clear signal external reset input pin tcnt n h'00 n C 1 figure 10.9 timing of counter clear by external reset input 10.5.6 timing of overflow flag (ovf) setting the ovf bit in tcsr is set to 1 when the tcnt overflows (changes from h'ff to h'00). figure 10.10 shows the timing of ovf flag setting. f ovf overflow signal tcnt h'ff h'00 figure 10.10 timing of ovf flag setting
rev. 1.0, 09/02, page 201 of 524 10.6 tmr_0 and tmr_1 cascaded connection if bits cks2 to cks0 in either tcr_0 or tcr_1 are set to b'100, the 8-bit timers of the two channels are cascaded. with this configuration, the 16-bit count mode or compare-match count mode is available. 10.6.1 16-bit count mode when bits cks2 to cks0 in tcr_0 are set to b'100, the timer functions as a single 16-bit timer with tmr_0 occupying the upper 8 bits and tmr_1 occupying the lower 8 bits. setting of compare-match flags ? the cmf flag in tcsr_0 is set to 1 when a 16-bit compare-match occurs. ? the cmf flag in tcsr_1 is set to 1 when a lower 8-bit compare-match occurs. counter clear specification ? if the cclr1 and cclr0 bits in tcr_0 have been set for counter clear at compare-match, the 16-bit counter (tcnt_0 and tcnt_1 together) is cleared when a 16-bit compare- match occurs. the 16-bit counter (tcnt_0 and tcnt_1 together) is also cleared when counter clear by the tmi0 pin has been set. ? the settings of the cclr1 and cclr0 bits in tcr_1 are ignored. the lower 8 bits cannot be cleared independently. pin output ? control of output from the tmo0 pin by bits os3 to os0 in tcsr_0 is in accordance with the 16-bit compare-match conditions. ? control of output from the tmo1 pin by bits os3 to os0 in tcsr_1 is in accordance with the lower 8-bit compare-match conditions. 10.6.2 compare-match count mode when bits cks2 to cks0 in tcr_1 are b'100, tcnt_1 counts the occurrence of compare-match a for tmr_0. tmr_0 and tmr_1 are controlled independently. conditions such as setting of the cmf flag, generation of interrupts, output from the tmo pin, and counter clearing are in accordance with the settings for each or tmr_0 and tmr_1.
rev. 1.0, 09/02, page 202 of 524 10.7 tmr_y and tmr_x cascaded connection if bits cks2 to cks0 in either tcr_y or tcr_x are set to b'100, the 8-bit timers of the two channels are cascaded. with this configuration, 16-bit count mode or compare-match count mode can be selected by the settings of the cksx and cksy bits in tcrxy. 10.7.1 16-bit count mode when bits cks2 to cks0 in tcr_y are set to b'100 and the cksy bit in tcrxy is set to 1, the timer functions as a single 16-bit timer with tmr_y occupying the upper eight bits and tmr_x occupying the lower 8 bits. setting of compare-match flags ? the cmf flag in tcsr_y is set to 1 when an upper 8-bit compare-match occurs. ? the cmf flag in tcsr_x is set to 1 when a lower 8-bit compare-match occurs. counter clear specification ? if the cclr1 and cclr0 bits in tcr_y have been set for counter clear at compare- match, only the upper eight bits of tcnt_y are cleared. the upper eight bits of tcnt_y are also cleared when counter clear by the tmriy pin has been set. ? the settings of the cclr1 and cclr0 bits in tcr_x are enabled, and the lower 8 bits of tcnt_x can be cleared by the counter. pin output ? control of output from the tmoy pin by bits os3 to os0 in tcsr_y is in accordance with the upper 8-bit compare-match conditions. ? control of output from the tmox pin by bits os3 to os0 in tcsr_x is in accordance with the lower 8-bit compare-match conditions. note: the program development tool (emulator) does not support 16-bit count mode. 10.7.2 compare-match count mode when bits cks2 to cks0 in tcr_x are set to b'100 and the cksx bit in tcrxy is set to 1, tcnt_x counts the occurrence of compare-match a for tmr_y. tmr_x and tmr_y are controlled independently. conditions such as setting of the cmf flag, generation of interrupts, output from the tmo pin, and counter clearing are in accordance with the settings for each channel. note: the program development tool (emulator) does not support compare-match count mode.
rev. 1.0, 09/02, page 203 of 524 10.7.3 input capture operation tmr_x has input capture registers (ticrr and ticrf). a narrow pulse width can be measured with ticrr and ticrf, using a single capture. if the falling edge of tmrix (tmr_x input capture input signal) is detected after its rising edge has been detected, the value of tcnt_x at that time is transferred to both ticrr and ticrf. input capture signal input timing: figure 10.11 shows the timing of the input capture operation. f tmrix input capture signal tcntx n nn m m m n + 1 n n n + 1 ticrr ticrf figure 10.11 timing of input capture operation if the input capture signal is input while ticrr and ticrf are being read, the input capture signal is delayed by one system clock (f ) cycle. figure 10.12 shows the timing of this operation.
rev. 1.0, 09/02, page 204 of 524 f tmrix ticrr, ticrf read cycle t 1 t 2 input capture signal figure 10.12 timing of input capture signal (input capture signal is input during ticrr and ticrf read) selection of input capture signal input: tmrix (input capture input signal of tmr_x) is selected according to the setting of the icst bit in tconri of the timer connection. the input capture signal selection is shown in table 10.4. table 10.4 input capture signal selection tconri bit 4 icst description 0 input capture function not used 1 tmix pin input selection 10.8 interrupt sources tmr_0, tmr_1, and tmr_y can generate three types of interrupts: cmia, cmib, and ovi. tmr_x can generate an icix interrupt. table 10.5 shows the interrupt sources and priorities. each interrupt source can be enabled or disabled independently by interrupt enable bits in tcr or tcsr. independent signals are sent to the interrupt controller for each interrupt.
rev. 1.0, 09/02, page 205 of 524 table 10.5 interrupt sources of 8-bit timers tmr_0, tmr_1, tmr_y, and tmr_x channel name interrupt source interrupt flag interrupt priority cmia0 tcora_0 compare-match cmfa high cmib0 tcorb_0 compare-match cmfb tmr_0 ovi0 tcnt_0 overflow ovf cmia1 tcora_1 compare-match cmfa cmib1 tcorb_1 compare-match cmfb tmr_1 ovi1 tcnt_1 overflow ovf cmiay tcora_y compare-match cmfa cmiby tcorb_y compare-match cmfb tmr_y oviy tcnt_y overflow ovf tmr_x icix input capture icf low 10.9 usage notes 10.9.1 conflict between tcnt write and counter clear if a counter clear signal is generated during the t 2 state of a tcnt write cycle as shown in figure 10.13, clearing takes priority and the counter write is not performed. f address tcnt address internal write signal counter clear signal tcnt n h'00 t 1 t 2 tcnt write cycle by cpu figure 10.13 conflict between tcnt write and clear
rev. 1.0, 09/02, page 206 of 524 10.9.2 conflict between tcnt write and count-up if a count-up occurs during the t 2 state of a tcnt write cycle as shown in figure 10.14, the counter write takes priority and the counter is not incremented. f address tcnt address internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle by cpu counter write data figure 10.14 conflict between tcnt write and count-up 10.9.3 conflict between tcor write and compare-match if a compare-match occurs during the t 2 state of a tcor write cycle as shown in figure 10.15, the tcor write takes priority and the compare-match signal is disabled. with tmr_x, a ticr input capture conflicts with a compare-match in the same way as with a write to tcorc. in this case also, the input capture takes priority and the compare-match signal is disabled.
rev. 1.0, 09/02, page 207 of 524 f address tcor address internal write signal tcnt tcor nm t 1 t 2 tcor write cycle by cpu tcor write data n n + 1 compare-match signal disabled figure 10.15 conflict between tcor write and compare-match 10.9.4 conflict between compare-matches a and b if compare-matches a and b occur at the same time, the operation follows the output status that is defined for compare-match a or b, according to the priority of the timer output shown in table 10.6. table 10.6 timer output priorities output setting priority toggle output high 1 output 0 output no change low 10.9.5 switching of internal clocks and tcnt operation tcnt may increment erroneously when the internal clock is switched over. table 10.7 shows the relationship between the timing at which the internal clock is switched (by writing to the cks1 and cks0 bits) and the tcnt operation.
rev. 1.0, 09/02, page 208 of 524 when the tcnt clock is generated from an internal clock, the falling edge of the internal clock pulse is detected. if clock switching causes a change from high to low level, as shown in no. 3 in table 10.7, a tcnt clock pulse is generated on the assumption that the switchover is a falling edge, and tcnt is incremented. erroneous incrementation can also happen when switching between internal and external clocks. table 10.7 switching of internal clocks and tcnt operation no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 1 clock switching from low to low level * 1 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1
rev. 1.0, 09/02, page 209 of 524 table 10.7 switching of internal clocks and tcnt operation (cont) no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 2 clock switching from low to high level * 2 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 3 clock switching from high to low level * 3 clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 * 4 4 clock switching from high to high level clock before switchover clock after switchover tcnt clock tcnt cks bit rewrite n n + 1 n + 2 notes: 1. includes switching from low to stop, and from stop to low. 2. includes switching from stop to high. 3. includes switching from high to stop. 4. generated on the assumption that the switchover is a falling edge; tcnt is incremented.
rev. 1.0, 09/02, page 210 of 524 10.9.6 mode setting with cascaded connection if the 16-bit count mode and compare-match count mode are set simultaneously, the input clock pulses for tcnt_0 and tcnt_1, and tcnt_x and tcnt_y are not generated, and thus the counters will stop operating. simultaneous setting of these two modes should therefore be avoided. 10.9.7 module stop mode setting tmr operation can be enabled or disabled using the module stop control register. the initial setting is for tmr operation to be halted. register access is enabled by canceling the module stop mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 211 of 524 section 11 watchdog timer (wdt) this lsi incorporates two watchdog timer channels (wdt_0 and wdt_1). the watchdog timer can generate an internal reset signal or an internal nmi interrupt signal if a system crash prevents the cpu from writing to the timer counter, thus allowing it to overflow. simultaneously, it can output an overflow signal ( reso ) externally. when this watchdog function is not needed, the wdt can be used as an interval timer. in interval timer operation, an interval timer interrupt is generated each time the counter overflows. a block diagram of the wdt_0 and wdt_1 is shown in figure 11.1. 11.1 features selectable from eight (wdt_0) or 16 (wdt_1) counter input clocks. switchable between watchdog timer mode and interval timer mode watchdog timer mode: if the counter overflows, an internal reset or an internal nmi interrupt is generated. when the lsi is selected to be internally reset at counter overflow, a low level signal is output from the reso pin if the counter overflows. interval timer mode: if the counter overflows, an interval timer interrupt (wovi) is generated. wdt0102b_000020020800
rev. 1.0, 09/02, page 212 of 524 wovi0 (interrupt request signal) internal nmi (interrupt request signal * 2 ) signal * 1 internal reset signal * 1 tcnt_0 tcsr_0 /2 /64 /128 /512 /2048 /8192 /32768 /131072 internal clock overflow interrupt control reset control wovi1 (interrupt request signal) internal reset signal * 1 signal * 1 tcnt_1 tcsr_1 /2 /64 /128 /512 /2048 /8192 /32768 /131072 clock clock selection internal clock bus interface module bus tcsr_0 : timer control/status register_0 tcnt_0 : timer counter_0 tcsr_1 : timer control/status register_1 tcnt_1 : timer counter_1 notes: 1. the signal outputs the low level signal when the internal reset signal is generated due to a tcnt overflow of either wdt_0 or wdt_1. the internal reset signal first resets the wdt in which the overflow has occurred first. 2. the internal nmi interrupt signal can be independently output from either wdt_0 or wdt_1. the interrupt controller does not distinguish the nmi interrupt request from wdt_0 from that from wdt_1. internal bus wdt_1 legend internal nmi (interrupt request signal * 2 ) sub/2 sub/4 sub/8 sub/16 sub/32 sub/64 sub/128 sub/256 overflow interrupt control reset control clock clock selection bus interface module bus internal bus wdt_0 figure 11.1 block diagram of wdt
rev. 1.0, 09/02, page 213 of 524 11.2 input/output pins the wdt has the pins listed in table 11.1. table 11.1 pin configuration name symbol i/o function reset output pin reso output outputs the counter overflow signal in watchdog timer mode external sub-clock input pin excl input inputs the clock pulses to the wdt_1 prescaler counter 11.3 register descriptions the wdt has the following registers. to prevent accidental overwriting, tcsr and tcnt have to be written to in a method different from normal registers. for details, refer to section 11.6.1, notes on register access. for details on the system control register, refer to section 3.2.2, system control register (syscr). timer counter (tcnt) timer control/status register (tcsr) 11.3.1 timer counter (tcnt) tcnt is an 8-bit readable/writable up-counter. tcnt is initialized to h'00 when the tme bit in the timer control/status register (tcsr) is cleared to 0.
rev. 1.0, 09/02, page 214 of 524 11.3.2 timer control/status register (tcsr) tcsr selects the clock source to be input to tcnt, and the timer mode. tcsr_0 bit bit name initial value r/w description 7ovf0 r/(w) * 1 overflow flag indicates that tcnt has overflowed (changes from hff to h00). [setting condition] when tcnt overflows (changes from hff to h00) however, when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing conditions] when tcsr is read when ovf = 1 * 2 , then 0 is written to ovf when 0 is written to tme 6wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5 tme 0 r/w timer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00. 4 0 r/(w)reserved the initial value should not be changed. 3 rst/ nmi 0 r/w reset or nmi selects to request an internal reset or an nmi interrupt when tcnt has overflowed. 0: an nmi interrupt is requested 1: an internal reset is requested
rev. 1.0, 09/02, page 215 of 524 bit bit name initial value r/w description 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 selects the clock source to be input to. the overflow frequency for ? = 10 mhz is enclosed in parentheses. 000: f /2 (frequency: 51.2 m s) 001: f /64 (frequency: 1.64 ms) 010: f /128 (frequency: 3.28 ms) 011: f /512 (frequency: 13.1 ms) 100: f /2048 (frequency: 52.4 ms) 101: f /8192 (frequency: 209.7 ms) 110: f /32768 (frequency: 0.84 s) 111: f /131072 (frequency: 3.36 s) notes: 1. only 0 can be written, to clear the flag. 2. when ovf is polled with the interval timer interrupt disabled, ovf = 1 must be read at least twice.
rev. 1.0, 09/02, page 216 of 524 tcsr_1 bit bit name initial value r/w description 7 ovf 0 r/(w) * 1 overflow flag indicates that tcnt has overflowed (changes from hff to h00). [setting condition] when tcnt overflows (changes from hff to h00) however, when internal reset request generation is selected in watchdog timer mode, ovf is cleared automatically by the internal reset. [clearing conditions] when tcsr is read when ovf = 1 * 2 , then 0 is written to ovf when 0 is written to tme 6wt/ it 0 r/w timer mode select selects whether the wdt is used as a watchdog timer or interval timer. 0: interval timer mode 1: watchdog timer mode 5 tme 0 r/w timer enable when this bit is set to 1, tcnt starts counting. when this bit is cleared, tcnt stops counting and is initialized to h'00.
rev. 1.0, 09/02, page 217 of 524 bit bit name initial value r/w description 4 pss 0 r/w prescaler select selects the clock source to be input to tcnt. 0: counts the divided cycle of ?Cbased prescaler (psm) 1: counts the divided cycle of ?subCbased prescaler (pss) 3 rst/ nmi 0 r/w reset or nmi selects to request an internal reset or an nmi interrupt when tcnt has overflowed. 0: an nmi interrupt is requested 1: an internal reset is requested 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select 2 to 0 selects the clock source to be input to tcnt. the overflow cycle for ? = 10 mhz and ?sub = 32.768 khz is enclosed in parentheses. when pss = 0: 000: f /2 (frequency: 51.2 m s) 001: f /64 (frequency: 1.64 ms) 010: f /128 (frequency: 3.28 ms) 011: f /512 (frequency: 13.1 ms) 100: f /2048 (frequency: 52.4 ms) 101: f /8192 (frequency: 209.7 ms) 110: f /32768 (frequency: 0.84 s) 111: f /131072 (frequency: 3.36 s) when pss = 1: 000: f sub/2 (cycle: 15.6 ms) 001: f sub/4 (cycle: 31.3 ms) 010: f sub/8 (cycle: 62.5 ms) 011: f sub/16 (cycle: 125 ms) 100: f sub/32 (cycle: 250 ms) 101: f sub/64 (cycle: 500 ms) 110: f sub/128 (cycle: 1 s) 111: f /256 (cycle: 2 s) notes: 1. only 0 can be written, to clear the flag. 2. when ovf is polled with the interval timer interrupt disabled, ovf = 1 must be read at least twice.
rev. 1.0, 09/02, page 218 of 524 11.4 operation 11.4.1 watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it bit and the tme bit in tcsr to 1. while the wdt is used as a watchdog timer, if tcnt overflows without being rewritten because of a system malfunction or another error, an internal reset or nmi interrupt request is generated. tcnt does not overflow while the system is operating normally. software must prevent tcnt overflows by rewriting the tcnt value (normally be writing h'00) before overflows occurs. if the rst/ nmi bit of tcsr is set to 1, when the tcnt overflows, an internal reset signal for this lsi is issued for 518 system clocks, and the low level signal is simultaneously output from the reso pin for 132 states, as shown in figure 11.2. if the rst/ nmi bit is cleared to 0, when the tcnt overflows, an nmi interrupt request is generated. here, the output from the reso pin remains high. an internal reset request from the watchdog timer and a reset input from the res pin are processed in the same vector. reset source can be identified by the xrst bit status in syscr. if a reset caused by a signal input to the res pin occurs at the same time as a reset caused by a wdt overflow, the res pin reset has priority and the xrst bit in syscr is set to 1. an nmi interrupt request from the watchdog timer and an interrupt request from the nmi pin are processed in the same vector. do not handle an nmi interrupt request from the watchdog timer and an interrupt request from the nmi pin at the same time.
rev. 1.0, 09/02, page 219 of 524 tcnt value h'00 time h'ff wt/ = 1 tme = 1 write h'00 to tcnt wt/ = 1 tme = 1 write h'00 to tcnt 518 system clocks internal reset signal wt/ tme ovf overflow ovf = 1 * : timer mode select bit : timer enable bit : overflow flag note: * after the ovf bit becomes 1, it is cleared to 0 by an internal reset. the xrst bit is also cleared to 0. signal 132 system clocks and internal reset signals generated figure 11.2 watchdog timer mode (rst/ n m i = 1) operation
rev. 1.0, 09/02, page 220 of 524 11.4.2 interval timer mode when the wdt is used as an interval timer, an interval timer interrupt (wovi) is generated each time the tcnt overflows, as shown in figure 11.3. therefore, an interrupt can be generated at intervals. when the tcnt overflows in interval timer mode, an interval timer interrupt (wovi) is requested at the same time the ovf bit of tcsr is set to 1. the timing is shown in figure 11.4. tcnt value h'00 time h'ff wt/ = 0 tme = 1 wovi overflow overflow overflow overflow wovi : internal timer interrupt request occurrence wovi wovi wovi figure 11.3 interval timer mode operation tcnt h'ff h'00 overflow signal (internal signal) ovf figure 11.4 ovf flag set timing
rev. 1.0, 09/02, page 221 of 524 11.4.3 r e s o signal output timing when tcnt overflows in watchdog timer mode, the ovf bit in tcsr is set to 1. when the rst/ nmi bit is 1 here, the internal reset signal is generated for the entire lsi. at the same time, the low level signal is output from the reso pin. the timing is shown in figure 11.5. tcnt h'ff h'00 132 states 518 states overflow signal (internal signal) ovf signal internal reset signal figure 11.5 output timing of r e s o signal 11.5 interrupt sources during interval timer mode operation, an overflow generates an interval timer interrupt (wovi). the interval timer interrupt is requested whenever the ovf flag is set to 1 in tcsr. ovf must be cleared to 0 in the interrupt handling routine. when the nmi interrupt request is selected in watchdog timer mode, an nmi interrupt request is generated by an overflow. table 11.2 wdt interrupt source name interrupt source interrupt flag wovi tcnt overflow ovf
rev. 1.0, 09/02, page 222 of 524 11.6 usage notes 11.6.1 notes on register access the watchdog timers registers, tcnt and tcsr differ from other registers in being more difficult to write to. the procedures for writing to and reading from these registers are given below. writing to tcnt and tcsr (example of wdt_0): these registers must be written to by a word transfer instruction. they cannot be written to by a byte transfer instruction. tcnt and tcsr both have the same write address. therefore, satisfy the relative condition shown in figure 11.6 to write to tcnt or tcsr. to write to tcnt, the upper bytes must contain the value h5a and the lower bytes must contain the write data before the transfer instruction execution. to write to tcsr, the upper bytes must contain the value ha5 and the lower bytes must contain the write data. address : h'ffa8 address : h'ffa8 h'5a write data 15 8 7 0 0 h'a5 write data 15 8 7 0 0 figure 11.6 writing to tcnt and tcsr (wdt_0) reading from tcnt and tcsr (example of wdt_0): these registers are read in the same way as other registers. the read address is h'ffa8 for tcsr and h'ffa9 for tcnt.
rev. 1.0, 09/02, page 223 of 524 11.6.2 conflict between timer counter (tcnt) write and increment if a timer counter clock pulse is generated during the t2 state of a tcnt write cycle, the write takes priority and the timer counter is not incremented. figure 11.7 shows this operation. address internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle counter write data figure 11.7 conflict between tcnt write and increment 11.6.3 changing values of cks2 to cks0 bits if bits cks2 to cks0 in tcsr are written to while the wdt is operating, errors could occur in the incrementation. software must stop the watchdog timer (by clearing the tme bit to 0) before changing the values of bits cks2 to cks0. 11.6.4 switching between watchdog timer mode and interval timer mode if the mode is switched from watchdog timer to interval timer, while the wdt is operating, errors could occur in the incrementation. software must stop the watchdog timer (by clearing the tme bit to 0) before switching the mode.
rev. 1.0, 09/02, page 224 of 524 11.6.5 system reset by r e s o signal inputting the reso output signal to the reso pin of this lsi prevents the lsi from being initialized correctly; the reso signal must not be logically connected to the res pin of the lsi. to reset the entire system by the reso signal, use the circuit as shown in figure 11.8. this lsi figure 11.8 sample circuit for resetting system by r e s o signal 11.6.6 counter values during transitions between high-speed, sub-active, and watch modes when wdt_1 is used as a clock counter and is allowed to transit between high-speed mode and sub-active or watch mode, the counter does not display the correct value due to internal clock switching. specifically, when transiting from high-speed mode to sub-active or watch mode, that is, when the control clock for wdt_1 switches from the main clock to the sub-clock, the counter incrementing timing is delayed for approximately two to three clock cycles. similarly, when transiting from sub-active or watch mode to high-speed mode, the clock is not supplied until stabilized internal oscillation is available because the main clock oscillator is halted in sub-clock mode. the counter is therefore prevented from incrementing for the time specified by the sts2 to sts0 bits in sbycr after internal oscillation starts, thus producing counter value differences for this time. special care must be taken when using wdt_1 as a clock counter. note that no counter value difference is produced while operated in the same mode.
rev. 1.0, 09/02, page 225 of 524 section 12 serial communication interface (sci) this lsi has a serial communication interface (sci). the sci can handle both asynchronous and clocked synchronous serial communication. asynchronous serial data communication can be carried out with standard asynchronous communication chips such as a universal asynchronous receiver/transmitter (uart) or asynchronous communication interface adapter (acia). a function is also provided for serial communication between processors (multiprocessor communication function) in asynchronous mode. 12.1 features choice of asynchronous or clocked synchronous serial communication mode full-duplex communication capability the transmitter and receiver are mutually independent, enabling transmission and reception to be executed simultaneously. double-buffering is used in both the transmitter and the receiver, enabling continuous transmission and continuous reception of serial data. the on-chip baud rate generator allows any bit rate to be selected an external clock can be selected as a transfer clock source. choice of lsb-first or msb-first transfer (except in the case of asynchronous mode 7-bit data) four interrupt sources four interrupt sources transmit-end, transmit-data-empty, receive-data-full, and receive error that can issue requests. asynchronous mode: data length: 7 or 8 bits stop bit length: 1 or 2 bits parity: even, odd, or none receive error detection: parity, overrun, and framing errors break detection: break can be detected by reading the rxd pin level directly in case of a framing error sci0022c_000020020800
rev. 1.0, 09/02, page 226 of 524 clocked synchronous mode: data length: 8 bits receive error detection: overrun errors serial data communication with other lsis that have the clock synchronized communication function a block diagram of the sci is shown in figure 12.1. exrxd * /rxd extxd * /txd exsck * /sck clock /4 /16 /64 tei txi rxi eri scmr ssr scr smr transmission/ reception control baud rate generator brr module data bus rdr tsr rsr parity generation parity check legend rsr : receive shift register rdr : receive data register tsr : transmit shift register tdr : transmit data register smr : serial mode register tdr bus interface internal data bus external clock scr : serial control register ssr : serial status register scmr : smart card mode register brr : bit rate register note: * the program development tool (emulator) does not support this function. figure 12.1 block diagram of sci
rev. 1.0, 09/02, page 227 of 524 12.2 input/output pins table 12.1 shows the input/output pins for each sci channel. table 12.1 pin configuration channel symbol * 1 input/output function sck1/ exsck1 * 2 input/output channel 1 clock input/output rxd1/ exrxd1 * 2 input channel 1 receive data input 1 txd1/ extxd1 * 2 output channel 1 transmit data output notes: 1. pin names sck, rxd, and txd are used in the text for all channels, omitting the channel designation. 2. the program development tool (emulator) does not support this function. 12.3 register descriptions the sci has the following registers. receive shift register (rsr) receive data register (rdr) transmit data register (tdr) transmit shift register (tsr) serial mode register (smr) serial control register (scr) serial status register (ssr) serial interface mode register (scmr) bit rate register (brr) serial pin select register (spsr)* note:* the program development tool (emulator) does not support this function.
rev. 1.0, 09/02, page 228 of 524 12.3.1 receive shift register (rsr) rsr is a shift register used to receive serial data that converts it into parallel data. when one frame of data has been received, it is transferred to rdr automatically. rsr cannot be directly accessed by the cpu. 12.3.2 receive data register (rdr) rdr is an 8-bit register that stores receive data. when the sci has received one frame of serial data, it transfers the received serial data from rsr to rdr where it is stored. after this, rsr can receive the next data. since rsr and rdr function as a double buffer in this way, continuous receive operations can be performed. after confirming that the rdrf bit in ssr is set to 1, read rdr for only once. rdr cannot be written to by the cpu. rdr is initialized to h00. 12.3.3 transmit data register (tdr) tdr is an 8-bit register that stores transmit data. when the sci detects that tsr is empty, it transfers the transmit data written in tdr to tsr and starts transmission. the double-buffered structures of tdr and tsr enables continuous serial transmission. if the next transmit data has already been written to tdr when one frame of data is transmitted, the sci transfers the written data to tsr to continue transmission. although tdr can be read from or written to by the cpu at all times, to achieve reliable serial transmission, write transmit data to tdr for only once after confirming that the tdre bit in ssr is set to 1. tdr is initialized to hff. 12.3.4 transmit shift register (tsr) tsr is a shift register that transmits serial data. to perform serial data transmission, the sci first transfers transmit data from tdr to tsr, then sends the data to the txd pin. tsr cannot be directly accessed by the cpu.
rev. 1.0, 09/02, page 229 of 524 12.3.5 serial mode register (smr) smr is used to set the scis serial transfer format and select the on-chip baud rate generator clock source. bit bit name initial value r/w description 7c/ a 0 r/w communication mode 0: asynchronous mode 1: clocked synchronous mode 6 chr 0 r/w character length (enabled only in asynchronous mode) 0: selects 8 bits as the data length. 1: selects 7 bits as the data length. lsb-first is fixed and the msb of tdr is not transmitted in transmission. in clocked synchronous mode, a fixed data length of 8 bits is used. 5 pe 0 r/w parity enable (enabled only in asynchronous mode) when this bit is set to 1, the parity bit is added to transmit data before transmission, and the parity bit is checked in reception. for a multiprocessor format, parity bit addition and checking are not performed regardless of the pe bit setting. 4o/ e 0 r/w parity mode (enabled only when the pe bit is 1 in asynchronous mode) 0: selects even parity. 1: selects odd parity.
rev. 1.0, 09/02, page 230 of 524 bit bit name initial value r/w description 3 stop 0 r/w stop bit length (enabled only in asynchronous mode) selects the stop bit length in transmission. 0: 1 stop bit 1: 2 stop bits in reception, only the first stop bit is checked. if the second stop bit is 0, it is treated as the start bit of the next transmit frame. 2 mp 0 r/w multiprocessor mode (enabled only in asynchronous mode) when this bit is set to 1, the multiprocessor communication function is enabled. the pe bit and o/ e bit settings are invalid in multiprocessor mode. 1 0 cks1 cks0 0 0 r/w r/w clock select 1,0 these bits select the clock source for the on-chip baud rate generator. 00: f clock (n = 0) 01: f /4 clock (n = 1) 10: f /16 clock (n = 2) 11: f /64 clock (n = 3) for the relation between the bit rate register setting and the baud rate, see section 12.3.9, bit rate register (brr). n is the decimal display of the value of n in brr.
rev. 1.0, 09/02, page 231 of 524 12.3.6 serial control register (scr) scr is a register that performs enabling or disabling of sci transfer operations and interrupt requests, and selection of the transfer clock source. for details on interrupt requests, refer to section 12.7, interrupt sources. bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when this bit is set to 1, a txi interrupt request is enabled. 6 rie 0 r/w receive interrupt enable when this bit is set to 1, rxi and eri interrupt requests are enabled. 5 te 0 r/w transmit enable when this bit is set to 1, transmission is enabled. 4 re 0 r/w receive enable when this bit is set to 1, reception is enabled. 3 mpie 0 r/w multiprocessor interrupt enable (enabled only when the mp bit in smr is 1 in asynchronous mode) when this bit is set to 1, receive data in which the multiprocessor bit is 0 is skipped, and setting of the rdrf, fer, and orer status flags in ssr is disabled. on receiving data in which the multiprocessor bit is 1, this bit is automatically cleared and normal reception is resumed. for details, refer to section 12.5, multiprocessor communication function. 2 teie 0 r/w transmit end interrupt enable when this bit is set to 1, a tei interrupt request is enabled.
rev. 1.0, 09/02, page 232 of 524 bit bit name initial value r/w description 1 0 cke1 cke0 0 0 r/w r/w clock enable 1, 0 these bits select the clock source and sck pin function. asynchronous mode 00: internal clock (sck pin functions as i/o port.) 01: internal clock (outputs a clock of the same frequency as the bit rate from the sck pin.) 1x: external clock (inputs a clock with a frequency 16 times the bit rate from the sck pin.) clocked synchronous mode 0x: internal clock (sck pin functions as clock output.) 1x: external clock (sck pin functions as clock input.) legend x: dont care
rev. 1.0, 09/02, page 233 of 524 12.3.7 serial status register (ssr) ssr is a register containing status flags of the sci and multiprocessor bits for transfer. tdre, rdrf, orer, per, and fer can only be cleared. bit bit name initial value r/w description 7 tdre 1 r/(w) * transmit data register empty indicates whether tdr contains transmit data. [setting conditions] when the te bit in scr is 0 when data is transferred from tdr to tsr and tdr is ready for data write [clearing conditions] when 0 is written to tdre after reading tdre = 1 6 rdrf 0 r/(w) * receive data register full indicates that receive data is stored in rdr. [setting condition] when serial reception ends normally and receive data is transferred from rsr to rdr [clearing conditions] when 0 is written to rdrf after reading rdrf = 1 the rdrf flag is not affected and retains its previous value when the re bit in scr is cleared to 0. 5 orer 0 r/(w) * overrun error [setting condition] when the next data is received while rdrf = 1 [clearing condition] when 0 is written to orer after reading orer = 1
rev. 1.0, 09/02, page 234 of 524 bit bit name initial value r/w description 4fer 0 r/(w) * framing error [setting condition] when the stop bit is 0 [clearing condition] when 0 is written to fer after reading fer = 1 in 2-stop-bit mode, only the first stop bit is checked. 3 per 0 r/(w) * parity error [setting condition] when a parity error is detected during reception [clearing condition] when 0 is written to per after reading per = 1 2 tend 1 r transmit end [setting conditions] when the te bit in scr is 0 when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character [clearing conditions] when 0 is written to tdre after reading tdre = 1 1 mpb 0 r multiprocessor bit mpb stores the multiprocessor bit in the receive frame. when the re bit in scr is cleared to 0 its previous state is retained. 0 mpbt 0 r/w multiprocessor bit transfer mpbt stores the multiprocessor bit to be added to the transmit frame. note: * only 0 can be written, to clear the flag.
rev. 1.0, 09/02, page 235 of 524 12.3.8 serial interface mode register (scmr) scmr selects sci functions and its format. bit bit name initial value r/w description 7 to 4 all 1 r reserved these bits are always read as 1 and cannot be modified. 3 sdir 0 r/w data transfer direction selects the serial/parallel conversion format. 0: tdr contents are transmitted with lsb-first. receive data is stored as lsb first in rdr. 1: tdr contents are transmitted with msb-first. receive data is stored as msb first in rdr. the sdir bit is valid only when the 8-bit data format is used for transmission/reception; when the 7-bit data format is used, data is always transmitted/received with lsb-first. 2 sinv 0 r/w data invert specifies inversion of the data logic level. the sinv bit does not affect the logic level of the parity bit. when the parity bit is inverted, invert the o/ e bit in smr. 0: tdr contents are transmitted as they are. receive data is stored as it is in rdr. 1: tdr contents are inverted before being transmitted. receive data is stored in inverted form in rdr. 1 1 r reserved this bit is always read as 1 and cannot be modified. 0 smif 0 r/w serial communication interface mode select: 0: normal asynchronous or clocked synchronous mode 1: reserved mode
rev. 1.0, 09/02, page 236 of 524 12.3.9 bit rate register (brr) brr is an 8-bit register that adjusts the bit rate. as the sci performs baud rate generator control independently for each channel, different bit rates can be set for each channel. table 12.2 shows the relationships between the n setting in brr and bit rate b for normal asynchronous mode and clocked synchronous mode. the initial value of brr is h'ff, and it can be read from or written to by the cpu at all times. table 12.2 relationships between n setting in brr and bit rate b mode bit rate error asynchronous mode b = 64 2 (n+1) 2n-1 10 6 error (%) = { b 64 2 (n+1) 2n-1 10 6 - 1 } 100 clocked synchronous mode b = 64 2 (n+1) 2n-1 10 6 legend b: bit rate (bit/s) n: brr setting for baud rate generator (0 n 255) f : operating frequency (mhz) n: determined by the smr settings shown in the following table. smr setting cks1 cks0 n 000 011 102 113 table 12.3 shows sample n settings in brr in normal asynchronous mode. table 12.4 shows the maximum bit rate settable for each frequency. table 12.6 shows sample n settings in brr in clocked synchronous mode. tables 12.5 and 12.7 show the maximum bit rates with external clock input.
rev. 1.0, 09/02, page 237 of 524 table 12.3 brr settings for various bit rates (asynchronous mode) (1) operating frequency f (mhz) 2 2.097152 2.4576 3 bit rate (bit/s) nn error (%) n n error (%) n n error (%) n n error (%) 110 1 141 0.03 1 148 C0.04 1 174 C0.26 1 212 0.03 150 1 103 0.16 1 108 0.21 1 127 0.00 1 155 0.16 300 0 207 0.16 0 217 0.21 0 255 0.00 1 77 0.16 600 0 103 0.16 0 108 0.21 0 127 0.00 0 155 0.16 1200 0 51 0.16 0 54 C0.70 0 63 0.00 0 77 0.16 2400 0 25 0.16 0 26 1.14 0 31 0.00 0 38 0.16 4800 0 12 0.16 0 13 C2.48 0 15 0.00 0 19 C2.34 9600 0 6 C2.48 0 7 0.00 0 9 C2.34 19200 0 3 0.00 0 4 C2.34 31250 0 1 0.00 0 2 0.00 38400 0 1 0.00 operating frequency f (mhz) 3.6864 4 4.9152 5 bit rate (bit/s) nn error (%) n n error (%) n n error (%) n n error (%) 110 2 64 0.70 2 70 0.03 2 86 0.31 2 88 C0.25 150 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 300 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 600 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 1200 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 2400 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 4800 0 23 0.00 0 25 0.16 0 31 0.00 0 32 C1.36 9600 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 19200 0 5 0.00 0 7 0.00 0 7 1.73 31250 0 3 0.00 0 4 C1.70 0 4 0.00 38400 0 2 0.00 0 3 0.00 0 3 1.73 legend : can be set, but there will be a degree of error. note: * make the settings so that the error does not exceed 1%.
rev. 1.0, 09/02, page 238 of 524 table 12.3 brr settings for various bit rates (asynchronous mode) (2) operating frequency f (mhz) 6 6.144 7.3728 8 bit rate (bit/s) nn error (%) n n error (%) n n error (%) n n error (%) 110 2 106 C0.44 2 108 0.08 2 130 C0.07 2 141 0.03 150 2 77 0.16 2 79 0.00 2 95 0.00 2 103 0.16 300 1 155 0.16 1 159 0.00 1 191 0.00 1 207 0.16 600 1 77 0.16 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 155 0.16 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 77 0.16 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 38 0.16 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 C2.34 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 C2.34 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 0.00 0 5 2.40 0 7 0.00 38400 0 4 C2.34 0 4 0.00 0 5 0.00 operating frequency f (mhz) 9.8304 10 bit rate (bit/s) nn error (%) n n error (%) 110 2 174 C0.26 2 177 C0.25 150 2 127 0.00 2 129 0.16 300 1 255 0.00 2 64 0.16 600 1 127 0.00 1 129 0.16 1200 0 255 0.00 1 64 0.16 2400 0 127 0.00 0 129 0.16 4800 0 63 0.00 0 64 0.16 9600 0 31 0.00 0 32 C1.36 19200 0 15 0.00 0 15 1.73 31250 0 9 C1.70 0 9 0.00 38400 0 7 0.00 0 7 1.73 legend : can be set, but there will be a degree of error. note: * make the settings so that the error does not exceed 1%.
rev. 1.0, 09/02, page 239 of 524 table 12.4 maximum bit rate for each frequency (asynchronous mode) f (mhz) maximum bit rate (bit/s) n n f (mhz) maximum bit rate (bit/s) n n 2 62500 0 0 9.8304 307200 0 0 2.097152 65536 0 0 10 312500 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 5 156250 0 0 6 187500 0 0 6.144 192000 0 0 7.3728 230400 0 0 8 250000 0 0 table 12.5 maximum bit rate with external clock input (asynchronous mode) f (mhz) external input clock (mhz) maximum bit rate (bit/s) f (mhz) external input clock (mhz) maximum bit rate (bit/s) 2 0.5000 31250 9.8304 2.4576 153600 2.097152 0.5243 32768 10 2.5000 156250 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 5 1.2500 78125 6 15.000 93750 6.144 1.5360 96000 7.3728 1.8432 115200 8 2.0000 125000
rev. 1.0, 09/02, page 240 of 524 table 12.6 brr settings for various bit rates (clocked synchronous mode) operating frequency f (mhz) 24810 bit rate (bit/s) n n n n n n n n 110 3 70 250 2 124 2 249 3 124 500 1 249 2 124 2 249 1k 1 124 1 249 2 124 2.5k 0 199 1 99 1 199 1 249 5k 0 99 0 199 1 99 1 124 10k 0 49 0 99 0 199 0 249 25k 0 19 0 39 0 79 0 99 50k 0 9 0 19 0 39 0 49 100k 0 4 0 9 0 19 0 24 250k 0 1 0 3 0 7 0 9 500k 0 0 * 01 * 0304 1m 0001 2.5m 0 0 * 5m legend blank: cannot be set. : can be set, but there will be a degree of error. * : continuous transfer or reception is not possible. table 12.7 maximum bit rate with external clock input (clocked synchronous mode) f (mhz) external input clock (mhz) maximum bit rate (bit/s) 2 0.3333 333333.3 4 0.6667 666666.7 6 1.0000 1000000.0 8 1.3333 1333333.3 10 1.6667 1666666.7
rev. 1.0, 09/02, page 241 of 524 12.3.10 serial pin select register (spsr) spsr selects the serial i/o pins. spsr should be set before initialization. do not set during communication. bit bit name initial value r/w description 7 sps1 0 r/w serial port select selects the serial i/o pins. 0: p86/sck1, p85/rxd1, p84/txd1 1: p52/exsck1, p51/exrxd1, p50/extxd1 6 to 0 all 0 r/w reserved the initial value should not be changed. note: the program development tool (emulator) does not support spsr.
rev. 1.0, 09/02, page 242 of 524 12.4 operation in asynchronous mode figure 12.2 shows the general format for asynchronous serial communication. one frame consists of a start bit (low level), followed by transmit/receive data, a parity bit, and finally stop bits (high level). in asynchronous serial communication, the transmission line is usually held in the mark state (high level). the sci monitors the transmission line, and when it goes to the space state (low level), recognizes a start bit and starts serial communication. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling continuous data transfer and reception. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit or none one unit of transfer data (character or frame) figure 12.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits) 12.4.1 data transfer format table 12.8 shows the data transfer formats that can be used in asynchronous mode. any of 12 transfer formats can be selected according to the smr setting. for details on the multiprocessor bit, refer to section 12.5, multiprocessor communication function.
rev. 1.0, 09/02, page 243 of 524 table 12.8 serial transfer formats (asynchronous mode) pe 0 0 1 1 0 0 1 1 s 8-bit data stop s 7-bit data stop s 8-bit data stop stop s 8-bit data p stop s 7-bit data stop p s 8-bit data mpb stop s 8-bit data mpb stop stop s 7-bit data stop mpb s 7-bit data stop mpb stop s 7-bit data stop stop chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 stop 0 1 0 1 0 1 0 1 0 1 0 1 smr settings 123456789101112 serial transmit/receive format and frame length stop s 8-bit data p stop s 7-bit data stop p stop
rev. 1.0, 09/02, page 244 of 524 12.4.2 receive data sampling timing and reception margin in asynchronous mode in asynchronous mode, the sci operates on a basic clock with a frequency of 16 times the bit rate. in reception, the sci samples the falling edge of the start bit using the basic clock, and performs internal synchronization. since receive data is latched internally at the rising edge of the 8th pulse of the basic clock, data is latched at the middle of each bit, as shown in figure 12.3. thus the reception margin in asynchronous mode is determined by formula (1) below. m = (0.5 C ) C (1 + f) C (l C 0.5) f } 100 [%] ... formula (1) 2n 1 n d C 0.5 m: reception margin (%) n : ratio of bit rate to clock (n = 16) d : clock duty (d = 0.5 to 1.0) l : frame length (l = 9 to 12) f : absolute value of clock rate deviation } assuming values of f = 0 and d = 0.5 in formula (1), the reception margin is determined by the formula below. m = {0.5 C 1/(2 16)} 100 [%] = 46.875 % however, this is only the computed value, and a margin of 20% to 30% should be allowed in system design. internal basic clock 16 clocks 8 clocks receive data (rxd) synchronization sampling timing start bit d0 d1 data sampling timing 15 0 7 15 0 07 figure 12.3 receive data sampling timing in asynchronous mode
rev. 1.0, 09/02, page 245 of 524 12.4.3 clock either an internal clock generated by the on-chip baud rate generator or an external clock input at the sck pin can be selected as the scis transfer clock, according to the setting of the c/ a bit in smr and the cke1 and cke0 bits in scr. when an external clock is input at the sck pin, the clock frequency should be 16 times the bit rate used. when the sci is operated on an internal clock, the clock can be output from the sck pin. the frequency of the clock output in this case is equal to the bit rate, and the phase is such that the rising edge of the clock is in the middle of the transmit data, as shown in figure 12.4. 0 1 frame d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 sck txd figure 12.4 relation between output clock and transmit data phase (asynchronous mode)
rev. 1.0, 09/02, page 246 of 524 12.4.4 sci initialization (asynchronous mode) before transmitting and receiving data, you should first clear the te and re bits in scr to 0, then initialize the sci as shown in figure 12.5. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag in ssr is set to 1. note that clearing the re bit to 0 does not initialize the contents of the rdrf, per, fer, and orer flags in ssr, or the contents of rdr. when an external clock is used in asynchronous mode, the clock must be supplied even during initialization. wait start initialization set data transfer/receive format in smr and scmr [1] set cke1 and cke0 bits in scr (te and re bits are 0) no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, and bits te and re, to 0. when the clock is selected in asynchronous mode, it is output immediately after scr settings are made. [2] set the data transfer/receive format in smr and scmr. [3] write a value corresponding to the bit rate to brr. not necessary if an external clock is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie, teie, and mpie bits. setting the te and re bits enables the txd and rxd pins to be used. figure 12.5 sample sci initialization flowchart
rev. 1.0, 09/02, page 247 of 524 12.4.5 data transmission (asynchronous mode) figure 12.6 shows an example of the operation for transmission in asynchronous mode. in transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if it is cleared to 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a transmit data empty interrupt request (txi) is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has finished, continuous transmission can be enabled. 3. data is sent from the txd pin in the following order: start bit, transmit data, parity bit or multiprocessor bit (may be omitted depending on the format), and stop bit. 4. the sci checks the tdre flag at the timing for sending the stop bit. 5. if the tdre flag is 0, the data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started. 6. if the tdre flag is 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the mark state is entered in which 1 is output. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. figure 12.7 shows a sample flowchart for transmission in asynchronous mode. tdre tend 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 1 data start bit parity bit stop bit start bit data parity bit stop bit txi interrupt request generated data written to tdr and tdre flag cleared to 0 in txi interrupt handling routine tei interrupt request generated idle state (mark state) txi interrupt request generated figure 12.6 example of sci transmit operation in asynchronous mode (example with 8- bit data, parity, one stop bit)
rev. 1.0, 09/02, page 248 of 524 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and clear the tdre flag to 0. [4] break output at the end of serial transmission: to output a break in serial transmission, set ddr for the port corresponding to the txd pin to 1, clear dr to 0, then clear the te bit in scr to 0. figure 12.7 sample serial transmission flowchart
rev. 1.0, 09/02, page 249 of 524 12.4.6 serial data reception (asynchronous mode) figure 12.8 shows an example of the operation for reception in asynchronous mode. in serial reception, the sci operates as described below. 1. the sci monitors the communication line, and if a start bit is detected, performs internal synchronization, receives receive data in rsr, and checks the parity bit and stop bit. 2. if an overrun error (when reception of the next data is completed while the rdrf flag in ssr is still set to 1) occurs, the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive data is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if a parity error is detected, the per bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 4. if a framing error (when the stop bit is 0) is detected, the fer bit in ssr is set to 1 and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. 5. if reception finishes successfully, the rdrf bit in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interrupt routine reads the receive data transferred to rdr before reception of the next receive data has finished, continuous reception can be enabled. rdrf fer 0 1 frame d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 0 1 1 data start bit parity bit stop bit start bit data parity bit stop bit eri interrupt request generated by framing error idle state (mark state) rdr data read and rdrf flag cleared to 0 in rxi interrupt handling routine rxi interrupt request generated figure 12.8 example of sci receive operation in asynchronous mode (example with 8-bit data, parity, one stop bit)
rev. 1.0, 09/02, page 250 of 524 table 12.9 shows the states of the ssr status flags and receive data handling when a receive error is detected. if a receive error is detected, the rdrf flag retains its state before receiving data. reception cannot be resumed while a receive error flag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 12.9 shows a sample flow chart for serial data reception. table 12.9 ssr status flags and receive data handling ssr status flag rdrf * orer fer per receive data receive error type 1 1 0 0 lost overrun error 0 0 1 0 transferred to rdr framing error 0 0 0 1 transferred to rdr parity error 1 1 1 0 lost overrun error + framing error 1 1 0 1 lost overrun error + parity error 0 0 1 1 transferred to rdr framing error + parity error 1 1 1 1 lost overrun error + framing error + parity error note: * the rdrf flag retains the state it had before data reception.
rev. 1.0, 09/02, page 251 of 524 yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 read orer, per, and fer flags in ssr error processing (continued on next page) [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes per fer orer = 1 rdrf = 1 all data received? [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing and break detection: if a receive error occurs, read the orer, per, and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer, per, and fer flags are all cleared to 0. reception cannot be resumed if any of these flags are set to 1. in the case of a framing error, a break can be detected by reading the value of the input port corresponding to the rxd pin. [4] sci status check and receive data read: read ssr and check that rdrf = 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the stop bit for the current frame is received, read the rdrf flag, read rdr, and clear the rdrf flag to 0. legend: : logical or figure 12.9 sample serial reception flowchart (1)
rev. 1.0, 09/02, page 252 of 524 [3] error processing parity error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing no yes overrun error processing orer = 1 fer = 1 break? per = 1 clear re bit in scr to 0 figure 12.9 sample serial reception flowchart (2)
rev. 1.0, 09/02, page 253 of 524 12.5 multiprocessor communication function use of the multiprocessor communication function enables data transfer to be performed among a number of processors sharing communication lines by means of asynchronous serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data. when multiprocessor communication is carried out, each receiving station is addressed by a unique id code. the serial communication cycle consists of two component cycles: an id transmission cycle which specifies the receiving station, and a data transmission cycle for the specified receiving station. the multiprocessor bit is used to differentiate between the id transmission cycle and the data transmission cycle. if the multiprocessor bit is 1, the cycle is an id transmission cycle, and if the multiprocessor bit is 0, the cycle is a data transmission cycle. figure 12.10 shows an example of inter-processor communication using the multiprocessor format. the transmitting station first sends the id code of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. the receiving station skips data until data with a 1 multiprocessor bit is sent. when data with a 1 multiprocessor bit is received, the receiving station compares that data with its own id. the station whose id matches then receives the data sent next. stations whose id does not match continue to skip data until data with a 1 multiprocessor bit is again received. the sci uses the mpie bit in scr to implement this function. when the mpie bit is set to 1, transfer of receive data from rsr to rdr, error flag detection, and setting the ssr status flags, rdrf, fer, and orer in ssr to 1 are prohibited until data with a 1 multiprocessor bit is received. on reception of a receive character with a 1 multiprocessor bit, the mpb bit in ssr is set to 1 and the mpie bit is automatically cleared, thus normal reception is resumed. if the rie bit in scr is set to 1 at this time, an rxi interrupt is generated. when the multiprocessor format is selected, the parity bit setting is invalid. all other bit settings are the same as those in normal asynchronous mode. the clock used for multiprocessor communication is the same as that in normal asynchronous mode.
rev. 1.0, 09/02, page 254 of 524 transmitting station receiving station a receiving station b receiving station c receiving station d (id = 01) (id = 02) (id = 03) (id = 04) serial communication line serial data id transmission cycle = receiving station specification data transmission cycle = data transmission to receiving station specified by id (mpb = 1) (mpb = 0) h'01 h'aa legend mpb: multiprocessor bit figure 12.10 example of communication using multiprocessor format (transmission of data h'aa to receiving station a)
rev. 1.0, 09/02, page 255 of 524 12.5.1 multiprocessor serial data transmission figure 12.11 shows a sample flowchart for multiprocessor serial data transmission. for an id transmission cycle, set the mpbt bit in ssr to 1 before transmission. for a data transmission cycle, clear the mpbt bit in ssr to 0 before transmission. all other sci operations are the same as those in asynchronous mode. no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and set mpbt bit in ssr no yes no yes read tend flag in ssr [3] no yes [4] clear dr to 0 and set ddr to 1 clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 break output? clear tdre flag to 0 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. after the te bit is set to 1, a frame of 1s is output, and transmission is enabled. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr. set the mpbt bit in ssr to 0 or 1. finally, clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. [4] break output at the end of serial transmission: to output a break in serial transmission, set port ddr to 1, clear dr to 0, and then clear the te bit in scr to 0. figure 12.11 sample multiprocessor serial transmission flowchart
rev. 1.0, 09/02, page 256 of 524 12.5.2 multiprocessor serial data reception figure 12.13 shows a sample flowchart for multiprocessor serial data reception. if the mpie bit in scr is set to 1, data is skipped until data with a 1 multiprocessor bit is sent. on receiving data with a 1 multiprocessor bit, the receive data is transferred to rdr. an rxi interrupt request is generated at this time. all other sci operations are the same as in asynchronous mode. figure 12.12 shows an example of sci operation for multiprocessor format reception. mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 0 1 1 1 data (id1) start bit mpb stop bit start bit data (data 1) mpb stop bit data (id2) start bit stop bit start bit data (data 2) stop bit rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt handling routine if not this stations id, mpie bit is set to 1 again rxi interrupt request is not generated, and rdr retains its state id1 (a) data does not match stations id mpie rdr value 0 d0 d1 d7 1 1 0 d0 d1 d7 0 1 1 1 mpb mpb rxi interrupt request (multiprocessor interrupt) generated idle state (mark state) rdrf rdr data read and rdrf flag cleared to 0 in rxi interrupt handling routine matches this stations id, so reception continues, and data is received in rxi interrupt service routine mpie bit set to 1 again id2 (b) data matches stations id data 2 id1 mpie = 0 mpie = 0 figure 12.12 example of sci receive operation (example with 8-bit data, multiprocessor bit, one stop bit)
rev. 1.0, 09/02, page 257 of 524 yes [1] no initialization start reception no yes [4] clear re bit in scr to 0 error processing (continued on next page) [5] no yes fer orer = 1 rdrf = 1 all data received? set mpie bit in scr to 1 [2] read orer and fer flags in ssr read rdrf flag in ssr [3] read receive data in rdr no yes this stations id? read orer and fer flags in ssr yes no read rdrf flag in ssr no yes fer orer = 1 read receive data in rdr rdrf = 1 [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] id reception cycle: set the mpie bit in scr to 1. [3] sci status check, id reception and comparison: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and compare it with this stations id. if the data is not this stations id, set the mpie bit to 1 again, and clear the rdrf flag to 0. if the data is this stations id, clear the rdrf flag to 0. [4] sci status check and data reception: read ssr and check that the rdrf flag is set to 1, then read the data in rdr. [5] receive error processing and break detection: if a receive error occurs, read the orer and fer flags in ssr to identify the error. after performing the appropriate error processing, ensure that the orer and fer flags are all cleared to 0. reception cannot be resumed if either of these flags is set to 1. in the case of a framing error, a break can be detected by reading the rxd pin value. legend: : logical or figure 12.13 sample multiprocessor serial reception flowchart (1)
rev. 1.0, 09/02, page 258 of 524 error processing yes no clear orer, per, and fer flags in ssr to 0 no yes no yes framing error processing overrun error processing orer = 1 fer = 1 break? clear re bit in scr to 0 [5] figure 12.13 sample multiprocessor serial reception flowchart (2)
rev. 1.0, 09/02, page 259 of 524 12.6 operation in clocked synchronous mode figure 12.14 shows the general format for clocked synchronous communication. in clocked synchronous mode, data is transmitted or received in synchronization with clock pulses. one character in transfer data consists of 8-bit data. in data transmission, the sci outputs data from one falling edge of the synchronization clock to the next. in data reception, the sci receives data in synchronization with the rising edge of the synchronization clock. after 8-bit data is output, the transmission line holds the msb state. in clocked synchronous mode, no parity or multiprocessor bit is added. inside the sci, the transmitter and receiver are independent units, enabling full- duplex communication by use of a common clock. both the transmitter and the receiver also have a double-buffered structure, so that the next transmit data can be written during transmission or the previous receive data can be read during reception, enabling continuous data transfer. dont care dont care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * high except in continuous transfer/reception figure 12.14 data format in clocked synchronous communication (lsb-first) 12.6.1 clock either an internal clock generated by the on-chip baud rate generator or an external synchronization clock input at the sck pin can be selected, according to the setting of the cke1 and cke0 bits in scr. when the sci is operated on an internal clock, the synchronization clock is output from the sck pin. eight synchronization clock pulses are output in the transfer of one character, and when no transfer is performed the clock is fixed high.
rev. 1.0, 09/02, page 260 of 524 12.6.2 sci initialization (clocked synchronous mode) before transmitting and receiving data, you should first clear the te and re bits in scr to 0, then initialize the sci as described in a sample flowchart in figure 12.15. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag in ssr is set to 1. however, clearing the re bit to 0 does not initialize the rdrf, per, fer, and orer flags in ssr, or rdr. wait start initialization set data transfer/receive format in smr and scmr no yes set value in brr clear te and re bits in scr to 0 [2] [3] set te and re bits in scr to 1, and set rie, tie, teie, and mpie bits [4] 1-bit interval elapsed? set cke1 and cke0 bits in scr (te and re bits are 0) [1] [1] set the clock selection in scr. be sure to clear bits rie, tie, teie, and mpie, te and re to 0. [2] set the data transfer/receive format in smr and scmr. [3] write a value corresponding to the bit rate to brr. this step is not necessary if an external clock is used. [4] wait at least one bit interval, then set the te bit or re bit in scr to 1. also set the rie, tie teie, and mpie bits. setting the te and re bits enables the txd and rxd pins to be used. note: * in simultaneous transmit and receive operations, the te and re bits should both be cleared to 0 or set to 1 simultaneously. figure 12.15 sample sci initialization flowchart
rev. 1.0, 09/02, page 261 of 524 12.6.3 serial data transmission (clocked synchronous mode) figure 12.16 shows an example of sci operation for transmission in clocked synchronous mode. in serial transmission, the sci operates as described below. 1. the sci monitors the tdre flag in ssr, and if it is 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. 2. after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit in scr is set to 1 at this time, a txi interrupt request is generated. because the txi interrupt routine writes the next transmit data to tdr before transmission of the current transmit data has finished, continuous transmission can be enabled. 3. 8-bit data is sent from the txd pin synchronized with the output clock when output clock mode has been specified and synchronized with the input clock when use of an external clock has been specified. 4. the sci checks the tdre flag at the timing for sending the last bit. 5. if the tdre flag is cleared to 0, data is transferred from tdr to tsr, and serial transmission of the next frame is started. 6. if the tdre flag is set to 1, the tend flag in ssr is set to 1, and the txd pin maintains the output state of the last bit. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. the sck pin is fixed high. figure 12.17 shows a sample flow chart for serial data transmission. even if the tdre flag is cleared to 0, transmission will not start while a receive error flag (orer, fer, or per) is set to 1. make sure to clear the receive error flags to 0 before starting transmission. note that clearing the re bit to 0 does not clear the receive error flags. transfer direction bit 0 serial data synchronization clock 1 frame tdre tend data written to tdr and tdre flag cleared to 0 in txi interrupt handling routine txi interrupt request generated bit 1 bit 7 bit 0 bit 1 bit 6 bit 7 txi interrupt request generated tei interrupt request generated figure 12.16 example of sci transmit operation in clocked synchronous mode
rev. 1.0, 09/02, page 262 of 524 no [1] yes initialization start transmission read tdre flag in ssr [2] write transmit data to tdr and clear tdre flag in ssr to 0 no yes no yes read tend flag in ssr [3] clear te bit in scr to 0 tdre = 1 all data transmitted? tend = 1 [1] sci initialization: the txd pin is automatically designated as the transmit data output pin. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. [3] serial transmission continuation procedure: to continue serial transmission, be sure to read 1 from the tdre flag to confirm that writing is possible, then write data to tdr, and then clear the tdre flag to 0. figure 12.17 sample serial transmission flowchart
rev. 1.0, 09/02, page 263 of 524 12.6.4 serial data reception (clocked synchronous mode) figure 12.18 shows an example of sci operation for reception in clocked synchronous mode. in serial reception, the sci operates as described below. 1. the sci performs internal initialization in synchronization with a synchronization clock input or output, starts receiving data, and stores the receive data in rsr. 2. if an overrun error (when reception of the next data is completed while the rdrf flag is still set to 1) occurs, the orer bit in ssr is set to 1. if the rie bit in scr is set to 1 at this time, an eri interrupt request is generated. receive data is not transferred to rdr. the rdrf flag remains to be set to 1. 3. if reception finishes successfully, the rdrf bit in ssr is set to 1, and receive data is transferred to rdr. if the rie bit in scr is set to 1 at this time, an rxi interrupt request is generated. because the rxi interrupt routine reads the receive data transferred to rdr before reception of the next receive data has finished, continuous reception can be enabled. bit 7 serial data synchronization clock 1 frame rdrf orer eri interrupt request generated by overrun error rxi interrupt request generated rdr data read and rdrf flag cleared to 0 in rxi interrupt handling routine rxi interrupt request generated bit 0 bit 7 bit 0 bit 1 bit 6 bit 7 figure 12.18 example of sci receive operation in clocked synchronous mode
rev. 1.0, 09/02, page 264 of 524 reception cannot be resumed while a receive error flag is set to 1. accordingly, clear the orer, fer, per, and rdrf bits to 0 before resuming reception. figure 12.19 shows a sample flowchart for serial data reception. yes [1] no initialization start reception [2] no yes read rdrf flag in ssr [4] [5] clear re bit in scr to 0 error processing (continued below) [3] read receive data in rdr and clear rdrf flag in ssr to 0 no yes orer = 1 rdrf = 1 all data received? read orer flag in ssr error processing overrun error processing clear orer flag in ssr to 0 [3] [1] sci initialization: the rxd pin is automatically designated as the receive data input pin. [2] [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transfer cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial reception continuation procedure: to continue serial reception, before the msb (bit 7) of the current frame is received, reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0 should be finished. figure 12.19 sample serial reception flowchart
rev. 1.0, 09/02, page 265 of 524 12.6.5 simultaneous serial data transmission and reception (clocked synchronous mode) figure 12.20 shows a sample flowchart for simultaneous serial transmit and receive operations. after initializing the sci, the following procedure should be used for simultaneous serial data transmit and receive operations. to switch from transmit mode to simultaneous transmit and receive mode, check that the sci has finished transmission and the tdre and tend flags in ssr are set to 1, clear the te bit in scr to 0, and then set the te and re bits to 1 simultaneously with a single instruction. to switch from receive mode to simultaneous transmit and receive mode, check that the sci has finished reception, and clear the re bit to 0. then after checking that the rdrf bit in ssr and receive error flags (orer, fer, and per) are cleared to 0, set the te and re bits to 1 simultaneously with a single instruction.
rev. 1.0, 09/02, page 266 of 524 yes [1] no initialization start transmission/reception [5] error processing [3] read receive data in rdr, and clear rdrf flag in ssr to 0 no yes orer = 1 all data received? [2] read tdre flag in ssr no yes tdre = 1 write transmit data to tdr and clear tdre flag in ssr to 0 no yes rdrf = 1 read orer flag in ssr [4] read rdrf flag in ssr clear te and re bits in scr to 0 [1] sci initialization: the txd pin is designated as the transmit data output pin, and the rxd pin is designated as the receive data input pin, enabling simultaneous transmit and receive operations. [2] sci status check and transmit data write: read ssr and check that the tdre flag is set to 1, then write transmit data to tdr and clear the tdre flag to 0. transition of the tdre flag from 0 to 1 can also be identified by a txi interrupt. [3] receive error processing: if a receive error occurs, read the orer flag in ssr, and after performing the appropriate error processing, clear the orer flag to 0. transmission/reception cannot be resumed if the orer flag is set to 1. [4] sci status check and receive data read: read ssr and check that the rdrf flag is set to 1, then read the receive data in rdr and clear the rdrf flag to 0. transition of the rdrf flag from 0 to 1 can also be identified by an rxi interrupt. [5] serial transmission/reception continuation procedure: to continue serial transmission/ reception, before the msb (bit 7) of the current frame is received, finish reading the rdrf flag, reading rdr, and clearing the rdrf flag to 0. also, before the msb (bit 7) of the current frame is transmitted, read 1 from the tdre flag to confirm that writing is possible. then write data to tdr and clear the tdre flag to 0. note: * when switching from transmit or receive operation to simultaneous transmit and receive operations, first clear the te bit and re bit to 0, then set both these bits to 1 simultaneously. figure 12.20 sample flowchart of simultaneous serial transmission and reception
rev. 1.0, 09/02, page 267 of 524 12.7 interrupt sources table 12.10 shows the interrupt sources in serial communication interface. a different interrupt vector is assigned to each interrupt source, and individual interrupt sources can be enabled or disabled using the enable bits in scr. when the tdre flag in ssr is set to 1, a txi interrupt request is generated. when the tend flag in ssr is set to 1, a tei interrupt request is generated. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when the orer, per, or fer flag in ssr is set to 1, an eri interrupt request is generated. a tei interrupt is requested when the tend flag is set to 1 while the teie bit is set to 1. if a tei interrupt and a txi interrupt are requested simultaneously, the txi interrupt has priority for acceptance. however, note that if the tdre and tend flags are cleared simultaneously by the txi interrupt routine, the sci cannot branch to the tei interrupt routine later. table 12.10 sci interrupt sources channel name interrupt source interrupt flag priority eri1 receive error orer, fer, per rxi1 receive data full rdrf txi1 transmit data empty tdre high 1 tei1 transmit end tend low
rev. 1.0, 09/02, page 268 of 524 12.8 usage notes 12.8.1 module stop mode setting sci operation can be disabled or enabled using the module stop control register. the initial setting is for sci operation to be halted. register access is enabled by clearing module stop mode. for details, refer to section 19, power-down modes. 12.8.2 break detection and processing when framing error detection is performed, a break can be detected by reading the rxd pin value directly. in a break, the input from the rxd pin becomes all 0s, and so the fer flag in ssr is set, and the per flag may also be set. note that, since the sci continues the receive operation even after receiving a break, even if the fer flag is cleared to 0, it will be set to 1 again. 12.8.3 mark state and break detection when the te bit in scr is 0, the txd pin is used as an i/o port whose direction (input or output) and level are determined by dr and ddr of the port. this can be used to set the txd pin to the mark state (high level) or send a break during serial data transmission. to maintain the communication line at mark state until te is set to 1, set both ddr and dr to 1. since the te bit is cleared to 0 at this point, the txd pin becomes an i/o port, and 1 is output from the txd pin. to send a break during serial transmission, first set ddr to 1 and dr to 0, and then clear the te bit to 0. when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, the txd pin becomes an i/o port, and 0 is output from the txd pin. 12.8.4 receive error flags and transmit operations (clocked synchronous mode only) transmission cannot be started when a receive error flag (orer, fer, or rer) is ssr is set to 1, even if the tdre flag in ssr is cleared to 0. be sure to clear the receive error flags to 0 before starting transmission. note also that the receive error flags cannot be cleared to 0 even if the re bit in scr is cleared to 0. 12.8.5 relation between writing to tdr and tdre flag data can be written to tdr irrespective of the tdre flag status in ssr. however, if the new data is written to tdr when the tdre flag is 0, that is, when the previous data has not been transferred to tsr yet, the previous data in tdr is lost. be sure to write transmit data to tdr after verifying that the tdre flag is set to 1.
rev. 1.0, 09/02, page 269 of 524 12.8.6 sci operations during mode transitions transmission: before making a transition to module stop, software standby, or sub-sleep mode, stop all transmit operations (te = tie = teie = 0). tsr, tdr, and ssr are reset. the states of the output pins during each mode depend on the port settings, and the pins output a high-level signal after mode cancellation. if a transition is made during data transmission, the data being transmitted will be undefined. to transmit data in the same transmission mode after mode cancellation, set te to 1, read ssr, write to tdr, clear tdre in this order, and then start transmission. to transmit data in a different transmission mode, initialize the sci first. figure 12.21 shows a sample flowchart for mode transition during transmission. figures 12.22 and 12.23 show the pin states during transmission. reception: before making a transition to module stop, software standby, watch, sub-active, or sub-sleep mode, stop reception (re = 0). rsr, rdr, and ssr are reset. if a transition is made during data reception, the data being received will be invalid. to receive data in the same reception mode after mode cancellation, set re to 1, and then start reception. to receive data in a different reception mode, initialize the sci first. figure 12.24 shows a sample flowchart for mode transition during reception.
rev. 1.0, 09/02, page 270 of 524 start transmission transmission [1] no no no yes yes yes read tend flag in ssr make transition to software standby mode etc. cancel software standby mode etc. te = 0 initialization te = 1 [2] [3] all data transmitted? change operating mode? tend = 1 [1] data being transmitted is lost halfway. data can be normally transmitted from the cpu by setting te to 1, reading ssr, writing to tdr, and clearing tdre to 0 after mode cancellation. [2] also clear tie and teie to 0 when they are 1. [3] module stop, watch, sub-active, and sub-sleep modes are included. figure 12.21 sample flowchart for mode transition during transmission te bit sck output pin txd output pin port input/output port input/output port input/output start stop high output high output transmission start transmission end transition to software standby mode software standby mode cancelled sci txd output port port sci txd output figure 12.22 pin states during transmission in asynchronous mode (internal clock)
rev. 1.0, 09/02, page 271 of 524 te bit sck output pin txd output pin port input/output port input/output port input/output high output * marking output transmission start transmission end transition to software standby mode software standby mode cancelled sci txd output port port sci txd output last txd bit retained note: * initialized in software standby mode figure 12.23 pin states during transmission in clocked synchronous mode (internal clock)
rev. 1.0, 09/02, page 272 of 524 start reception reception [1] no no yes yes read receive data in rdr read rdrf flag in ssr make transition to software standby mode etc. cancel software standby mode etc. re = 0 initialization re = 1 [2] change operating mode? rdrf = 1 [1] data being received will be invalid. [2] module stop, watch, sub-active, and sub- sleep modes are included. figure 12.24 sample flowchart for mode transition during reception
rev. 1.0, 09/02, page 273 of 524 12.8.7 switching from sck pins to port pins when sck pins are switched to port pins after transmission has completed, pins are enabled for port output after outputting a low pulse of half a cycle as shown in figure 12.25. sck/port cke0 cke1 c/ te data 1. transmission end 2. te = 0 3. c/ = 0 4. low pulse output bit 6 bit 7 low pulse of half a cycle figure 12.25 switching from sck pins to port pins to prevent the low pulse output that is generated when switching the sck pins to the port pins, specify the sck pins for input (pull up the sck/port pins externally), and follow the procedure below with ddr = 1, dr = 1, c/ a = 1, cke1 = 0, cke1 = 0, and te = 1. 1. end serial data transmission 2. te bit = 0 3. cke1 bit = 1 4. c/ a bit = 0 (switch to port output) 5. cke1 bit = 0 sck/port cke0 cke1 c/ te data 1. transmission end 2. te = 0 4. c/ = 0 3. cke1 = 1 5. cke1 = 0 bit 6 bit 7 high output figure 12.26 prevention of low pulse output at switching from sck pins to port pins
rev. 1.0, 09/02, page 274 of 524
rev. 1.0, 09/02, page 275 of 524 section 13 i 2 c bus interface (iic) the i 2 c bus interface is provided as an optional function. note the following point when using this optional function. although the product type name is identical, please contact hitachi before using this optional function on an f-ztat version product. this lsi has a two-channel i 2 c bus interface. the i 2 c bus interface conforms to and provides a subset of the philips i 2 c bus (inter-ic bus) interface functions. the register configuration that controls the i 2 c bus differs partly from the philips configuration, however. 13.1 features selection of addressing format or non-addressing format ? i 2 c bus format: addressing format with an acknowledge bit, for master/slave operation ? clocked synchronous serial format: non-addressing format without an acknowledge bit, for master operation only conforms to philips i 2 c bus interface (i 2 c bus format) two ways of setting slave address (i 2 c bus format) start and stop conditions generated automatically in master mode (i 2 c bus format) selection of the acknowledge output level in reception (i 2 c bus format) automatic loading of an acknowledge bit in transmission (i 2 c bus format) wait function in master mode (i 2 c bus format) ? a wait can be inserted by driving the scl pin low after data transfer, excluding acknowledgement. ? the wait can be cleared by clearing the interrupt flag. wait function (i 2 c bus format) ? a wait request can be generated by driving the scl pin low after data transfer. ? the wait request is cleared when the next transfer becomes possible. interrupt sources ? data transfer end (including when a transition to transmit mode with i 2 c bus format occurs, when icdr data is transferred, or during a wait state) ? address match: when any slave address matches or the general call address is received in slave receive mode with i 2 c bus format (including address reception after loss of master arbitration) ? start condition detection (in master mode) ? stop condition detection (in slave mode) selection of 16 internal clocks (in master mode) ifiic60b_000020020800
rev. 1.0, 09/02, page 276 of 524 direct bus drive (scl/sda pin) ? four pinsp52/scl0, p97/sda0, p86/scl1, and p42/sda1 (normally nmos push- pull outputs) function as nmos open-drain outputs when the bus drive function is selected.
rev. 1.0, 09/02, page 277 of 524 figure 13.1 shows a block diagram of the i 2 c bus interface. figure 13.2 shows an example of i/o pin connections to external circuits. since i 2 c bus interface i/o pins are different in structure from normal port pins, they have different specifications for permissible applied voltages. for details, see section 21, electrical characteristics. scl ps noise canceler bus state decision circuit arbitration decision circuit output data control circuit iccr clock control icxr icmr icsr icdrs address comparator sar, sarx sda noise canceler interrupt generator interrupt request internal data bus icdrr icdrt legend: iccr: icmr: icsr: icdr: icxr: sar: sarx: ps: i 2 c bus control register i 2 c bus mode register i 2 c bus status register i 2 c bus data register i 2 c bus extended control register slave address register slave address register x prescaler figure 13.1 block diagram of i 2 c bus interface
rev. 1.0, 09/02, page 278 of 524 scl in out sda in out (slave 1) scl sda scl in out sda in out (slave 2) scl sda scl in out sda in out (master) this lsi scl sda v cc v cc scl sda v dd figure 13.2 i 2 c bus interface connections (example: this lsi as master) 13.2 input/output pins table 13.1 summarizes the input/output pins used by the i 2 c bus interface. table 13.1 pin configuration channel symbol * input/output function scl0 input/output serial clock input/output pin of iic_0 0 sda0 input/output serial data input/output pin of iic_0 scl1 input/output serial clock input/output pin of iic_1 1 sda1 input/output serial data input/output pin of iic_1 note: * in the text, the channel subscript is omitted, and only scl and sda are used.
rev. 1.0, 09/02, page 279 of 524 13.3 register descriptions the i 2 c bus interface has the following registers. registers icdr and sarx and registers icmr and sar are allocated to the same addresses. accessible registers differ depending on the ice bit in iccr. when the ice bit is cleared to 0, sar and sarx can be accessed, and when the ice bit is set to 1, icmr and icdr can be accessed. for details on the serial timer control register, refer to section 3.2.3, serial timer control register (stcr). i 2 c bus control register (iccr) i 2 c bus status register (icsr) i 2 c bus data register (icdr) i 2 c bus mode register (icmr) slave address register (sar) second slave address register (sarx) i 2 c bus extended control register (icxr) ddc switch register (ddcswr) 13.3.1 i 2 c bus data register (icdr) icdr is an 8-bit readable/writable register that is used as a transmit data register when transmitting and a receive data register when receiving. icdr is internally divided into a shift register (icdrs), receive buffer (icdrr), and transmit buffer (icdrt). data transfers among these three registers are performed automatically in accordance with changes in the bus state, and they affect the status of internal flags such as icdre and icdrf. in master transmit mode with the i 2 c bus format, writing transmit data to icdr should be performed after start condition detection. when the start condition is detected, previous write data is ignored. in slave transmit mode, writing should be performed after the slave addresses match and the trs bit is automatically changed to 1. if the iic is in transmit mode (trs = 1) and icdrt has the next transmit data (the icdre flag is 0) after successful transmission/reception of one frame of data using icdrs, data is transferred automatically from icdrt to icdrs. if the iic is in transmit mode (trs = 1) and icdrt has the next data (the icdre flag is 0), data is transferred automatically from icdrt to icdrs, following transmission of one frame of data using icdrs. when the icdre flag is 1 and the next transmit data writing is waited, data is transferred automatically from icdrt to icdrs by writing to icdr. if i 2 c is in receive mode (trs = 0), no data is transferred from icdrt to icdrs. note that data should not be written to icdr in receive mode. reading receive data from icdr is performed after data is transferred from icdrs to icdrr.
rev. 1.0, 09/02, page 280 of 524 if i 2 c is in receive mode and no previous data remains in icdrr (the icdrf flag is 0), data is transferred automatically from icdrs to icdrr, following reception of one frame of data using icdrs. if additional data is received while the icdrf flag is 1, data is transferred automatically from icdrs to icdrr by reading from icdr. in transmit mode, no data is transferred from icdrs to icdrr. always set i 2 c to receive mode before reading from icdr. if the number of bits in a frame, excluding the acknowledge bit, is less than eight, transmit data and receive data are stored differently. transmit data should be written justified toward the msb side when mls = 0 in icmr, and toward the lsb side when mls = 1. receive data bits should be read from the lsb side when mls = 0, and from the msb side when mls = 1. icdr can be written to and read from only when the ice bit is set to 1 in iccr. the initial value of icdr is undefined. 13.3.2 slave address register (sar) sar sets the slave address and selects the communication format. if the lsi is in slave mode with the i 2 c bus format selected, when the fs bit is set to 0 and the upper 7 bits of sar match the upper 7 bits of the first frame received after a start condition, the lsi operates as the slave device specified by the master device. sar can be accessed only when the ice bit in iccr is cleared to 0. bit bit name initial value r/w description 7 6 5 4 3 2 1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w slave address 6 to 0 set a slave address. 0fs 0 r/wformat select selects the communication format together with the fsx bit in sarx. refer to table 13.2. this bit should be set to 0 when general call address recognition is performed.
rev. 1.0, 09/02, page 281 of 524 13.3.3 second slave address register (sarx) sarx sets the second slave address and selects the communication format. if the lsi is in slave mode with the i 2 c bus format selected, when the fsx bit is set to 0 and the upper 7 bits of sarx match the upper 7 bits of the first frame received after a start condition, the lsi operates as the slave device specified by the master device. sarx can be accessed only when the ice bit in iccr is cleared to 0. bit bit name initial value r/w description 7 6 5 4 3 2 1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w second slave address 6 to 0 set the second slave address. 0 fsx 1 r/w format select x selects the communication format together with the fs bit in sar. refer to table 13.2. table 13.2 communication format sar sarx fs fsx operating mode 0i 2 c bus format sar and sarx slave addresses recognized general call address recognized 0 1i 2 c bus format sar slave address recognized sarx slave address ignored general call address recognized 0i 2 c bus format sar slave address ignored sarx slave address recognized general call address ignored 1 1 clocked synchronous serial format sar and sarx slave addresses ignored general call address ignored
rev. 1.0, 09/02, page 282 of 524 i 2 c bus format: addressing format with an acknowledge bit clocked synchronous serial format: non-addressing format without an acknowledge bit, for master mode only 13.3.4 i 2 c bus mode register (icmr) icmr sets the communication format and transfer rate. it can only be accessed when the ice bit in iccr is set to 1. bit bit name initial value r/w description 7 mls 0 r/w msb-first/lsb-first select 0: msb-first 1: lsb-first set this bit to 0 when the i 2 c bus format is used. 6 wait 0 r/w wait insertion bit this bit is valid only in master mode with the i 2 c bus format. 0: data and the acknowledge bit are transferred consecutively with no wait inserted. 1: after the fall of the clock for the final data bit (8 th clock), the iric flag is set to 1 in iccr, and a wait state begins (with scl at the low level). when the iric flag is cleared to 0 in iccr, the wait ends and the acknowledge bit is transferred. for details, refer to section 13.4.7, iric setting timing and scl control. 5 4 3 cks2 cks1 cks0 0 0 0 r/w r/w r/w transfer clock select 2 to 0 these bits are used only in master mode. these bits select the required transfer rate, together with the iicx1 (iic_1) and iicx0 (iic_0) bits in stcr. refer to table 13.3.
rev. 1.0, 09/02, page 283 of 524 bit bit name initial value r/w description 2 1 0 bc2 bc1 bc0 0 0 0 r/w r/w r/w bit counter 2 to 0 these bits specify the number of bits to be transferred next. bit bc2 to bc0 settings should be made during an interval between transfer frames. if bits bc2 to bc0 are set to a value other than 000, the setting should be made while the scl line is low. the bit counter is initialized to 000 when a start condition is detected. the value returns to 000 at the end of a data transfer. i 2 c bus format clocked synchronous serial mode 000: 9 bits 000: 8 bits 001: 2 bits 001: 1 bits 010: 3 bits 010: 2 bits 011: 4 bits 011: 3 bits 100: 5 bits 100: 4 bits 101: 6 bits 101: 5 bits 110: 7 bits 110: 6 bits 111: 8 bits 111: 7 bits
rev. 1.0, 09/02, page 284 of 524 table 13.3 i 2 c transfer rate stcr icmr bits 5 and 6 bit 5 bit 4 bit 3 transfer rate iicx cks2 cks1 cks0 clock f = 5 mhz f = 8 mhz f = 10 mhz 0000 f /28 179 khz 286 khz 357 khz 0001 f /40 125 khz 200 khz 250 khz 0010 f /48 104 khz 167 khz 208 khz 0011 f /64 78.1 khz 125 khz 156 khz 0100 f /80 62.5 khz 100 khz 125 khz 0101 f /100 50.0 khz 80.0 khz 100 khz 0110 f /112 44.6 khz 71.4 khz 89.3 khz 0111 f /128 39.1 khz 62.5 khz 78.1 khz 1000 f /56 89.3 khz 143 khz 179 khz 1001 f /80 62.5 khz 100 khz 125 khz 1010 f /96 52.1 khz 83.3 khz 104 khz 1011 f /128 39.1 khz 62.5 khz 78.1 khz 1100 f /160 31.3 khz 50.0 khz 62.5 khz 1101 f /200 25.0 khz 40.0 khz 50.0 khz 1110 f /224 22.3 khz 35.7 khz 44.6 khz 1111 f /256 19.5 khz 31.3 khz 39.1 khz
rev. 1.0, 09/02, page 285 of 524 13.3.5 i 2 c bus control register (iccr) iccr controls the i 2 c bus interface and performs interrupt flag confirmation. bit bit name initial value r/w description 7ice 0 r/wi 2 c bus interface enable 0: i 2 c bus interface modules are stopped and i 2 c bus interface module internal state is initialized. sar and sarx can be accessed. 1: i 2 c bus interface modules can perform transfer operation, and the ports function as the scl and sda input/output pins. icmr and icdr can be accessed. 6ieic 0 r/wi 2 c bus interface interrupt enable 0: disables interrupts from the i 2 c bus interface to the cpu 1: enables interrupts from the i 2 c bus interface to the cpu. 5 4 mst trs 0 0 r/w r/w master/slave select transmit/receive select 00: slave receive mode 01: slave transmit mode 10: master receive mode 11: master transmit mode both these bits will be cleared by hardware when they lose in a bus contention in master mode with the i 2 c bus format. in slave receive mode with i 2 c bus format, the r/w bit in the first frame immediately after the start condition sets these bits in receive mode or transmit mode automatically by hardware. modification of the trs bit during transfer is deferred until transfer is completed, and the changeover is made after completion of the transfer.
rev. 1.0, 09/02, page 286 of 524 bit bit name initial value r/w description 5 4 mst trs 0 0 r/w [mst clearing conditions] 1. when 0 is written by software 2. when lost in bus contention in i 2 c bus format master mode [mst setting conditions] 1. when 1 is written by software (for mst clearing condition 1) 2. when 1 is written in mst after reading mst = 0 (for mst clearing condition 2) [trs clearing conditions] 1. when 0 is written by software (except for trs setting condition 3) 2. when 0 is written in trs after reading trs = 1 (for trs setting condition 3) 3. when lost in bus contention in i 2 c bus format master mode [trs setting conditions] 1. when 1 is written by software (except for trs clearing condition 3) 2. when 1 is written in trs after reading trs = 0 (for trs clearing condition 3) 3. when 1 is received as the r/ w bit after the first frame address matching in i 2 c bus format slave mode 3 acke 0 r/w acknowledge bit decision and selection 0: the value of the acknowledge bit is ignored, and continuous transfer is performed. the value of the received acknowledge bit is not indicated by the ackb bit in icsr, which is always 0. 1: if the received acknowledge bit is 1, continuous transfer is halted. depending on the receiving device, the acknowledge bit may be significant, in indicating completion of processing of the received data, for instance, or may be fixed at 1 and have no significance.
rev. 1.0, 09/02, page 287 of 524 bit bit name initial value r/w description 2 0 bbsy scp 0 1 r/w w bus busy start condition/stop condition prohibit in master mode: writing 0 in bbsy and 0 in scp: a stop condition is issued writing 1 in bbsy and 0 in scp: a start condition and a restart condition are issued in slave mode: writing to the bbsy flag is disabled. [bbsy setting condition] when the sda level changes from high to low under the condition of scl = high, assuming that the start condition has been issued. [bbsy clearing condition] when the sda level changes from low to high under the condition of scl = high, assuming that the stop condition has been issued. to issue a start/stop condition, use the mov instruction. the i 2 c bus interface must be set in master transmit mode before the issue of a start condition. set mst to 1 and trs to 1 before writing 1 in bbsy and 0 in scp. the bbsy flag can be read to check whether the i 2 c bus (scl, sda) is busy or free. the scp bit is always read as 1. if 0 is written, the data is not stored.
rev. 1.0, 09/02, page 288 of 524 bit bit name initianl value r/w description 1 iric 0 r/w i 2 c bus interface interrupt request flag indicates that the i 2 c bus interface has issued an interrupt request to the cpu. iric is set at different times depending on the fs bit in sar, the fsx bit in sarx, and the wait bit in icmr. see section 13.4.7, iric setting timing and scl control. the conditions under which iric is set also differ depending on the setting of the acke bit in iccr. [setting conditions] i 2 c bus format master mode: when a start condition is detected in the bus line state after a start condition is issued (when the icdre flag is set to 1 because of first frame transmission) when a wait is inserted between the data and acknowledge bit when the wait bit is 1 (fall of the 8th transmit/receive clock) at the end of data transfer (rise of the 9th transmit/receive clock while no wait is inserted) when a slave address is received after bus arbitration is lost (the first frame after the start condition) if 1 is received as the acknowledge bit (when the ackb bit in icsr is set to 1) when the acke bit is 1 when the al flag is set to 1 after bus arbitration is lost while the alie bit is 1 i 2 c bus format slave mode: when the slave address (sva or svax) matches (when the aas or aasx flag in icsr is set to 1) and at the end of data transfer up to the subsequent retransmission start condition or stop condition detection (rise of the 9th transmit/receive clock) when the general call address is detected (when 0 is received as the r/ w bit and the adz flag in icsr is set to 1) and at the end of data reception up to the subsequent retransmission start condition or stop condition detection (rise of the 9th receive clock) if 1 is received as the acknowledge bit (when the ackb bit in icsr is set to 1) while the acke bit is 1 when a stop condition is detected (when the stop or estp flag in icsr is set to 1) while the stopim bit is 0
rev. 1.0, 09/02, page 289 of 524 bit bit name initial value r/w description 1 iric 0 r/w clocked synchronous serial format mode: at the end of data transfer (rise of the 8th transmit/receive) when a start condition is detected when the icdre or icdrf flag is set to 1 in any operating mode: when a start condition is detected in transmit mode (when a start condition is detected in transmit mode and the icdre flag is set to 1) when data is transferred among the icdr register and buffer (when data is transferred from icdrt to icdrs in transmit mode and the icdre flag is set to 1, or when data is transferred from icdrs to icdrr in receive mode and the icdrf flag is set to 1) [clearing conditions] when 0 is written in iric after reading iric = 1 note: * only 0 can be written, to clear the flag. when, with the i 2 c bus format selected, iric is set to 1 and an interrupt is generated, other flags must be checked in order to identify the source that set iric to 1. although each source has a corresponding flag, caution is needed at the end of a transfer. when the icdre or icdrf flag is set, the irtr flag may or may not be set. the irtr flag is not set at the end of a data transfer up to detection of a retransmission start condition or stop condition after a slave address (sva) or general call address match in i 2 c bus format slave mode. tables 13.4 and 13.5 show the relationship between the flags and the transfer states.
rev. 1.0, 09/02, page 290 of 524 table 13.4 flags and transfer states (master mode) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 1100000 00 0 0 0 idle state (flag clearing required) 111 - 001 - 000001 - start condition detected 11000000wait state 1110000001 - transmission end (acke=1 and ackb=1) 111001 - 000001 - transmission end with icdre=0 11100000000 icdr write with the above state 11100000001transmission end with icdre=1 11100000000 icdr write with the above state or after start condition detected 111001 - 000001 - automatic data transfer from icdrt to icdrs with the above state 101001 - 00001 - reception end with icdrf=0 1010000000 icdr read with the above state 1010000001reception end with icdrf=1 1010000000 icdr read with the above state 101001 - 00001 - automatic data transfer from icdrs to icdrr with the above state
rev. 1.0, 09/02, page 291 of 524 table 13.4 flags and transfer states (master mode) (cont) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 0 0 10001 - 0 0 arbitration lost 10 0000000 stop condition detected legend 0: 0-state retained 1: 1-state retained : previous state retained 0 : cleared to 0 1 - : set to 1
rev. 1.0, 09/02, page 292 of 524 table 13.5 flags and transfer states (slave mode) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 000000000000idle state (flag clearing required) 001 - 0000 00001 - start condition detected 01 - /0 * 1 100001 - 001 - 1 sar match in first frame (sarx 1 sar) 00100001 - 1 - 01 - 1 general call address match in first frame (sarx 1 h00) 01 - /0 * 1 1001 - 1 - 0001 - 1 sars match in first frame (sar 1 sarx) 0110001 - transmission end (acke=1 and ackb=1) 011001 - /0 * 1 0 0 1 - transmission end with icdre=0 011000 0 000 icdr write with the above state 0110010 1transmission end with icdre=1 011000 0 00 0 icdr write with the above state 011001 - /0 * 2 0 0 0 0 1 - automatic data transfer from icdrt to icdrs with the above state 001001 - /0 * 2 1 - reception end with icdrf=0 001000 0 0 0 icdr read with the above state
rev. 1.0, 09/02, page 293 of 524 table 13.5 flags and transfer states (slave mode) (cont) mst trs bbsy estp stop irtr aasx al aas adz ackb icdrf icdre state 0 0 1 0 0 1 reception end with icdrf=1 001000 0 0 0 icdr read with the above state 001001 - /0 * 2 0 0 0 1 - automatic data transfer from icdrs to icdrr with the above state 00 1 - /0 * 3 0/1 - * 3 0 stop condition detected legend 0: 0-state retained 1: 1-state retained : previous state retained 0 : cleared to 0 1 - : set to 1 notes: 1. set to 1 when 1 is received as a r/ w bit following an address. 2. set to 1 when the aasx bit is set to 1. 3. when estp=1, stop is 0, or when stop=1, estp is 0.
rev. 1.0, 09/02, page 294 of 524 13.3.6 i 2 c bus status register (icsr) icsr consists of status flags. also see tables 13.4 and 13.5. bit bit name initial value r/w description 7 estp 0 r/(w) * error stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected during frame transfer. [clearing conditions] when 0 is written in estp after reading estp = 1 when the iric flag in iccr is cleared to 0 6 stop 0 r/(w) * normal stop condition detection flag this bit is valid in i 2 c bus format slave mode. [setting condition] when a stop condition is detected after frame transfer completion. [clearing conditions] when 0 is written in stop after reading stop = 1 when the iric flag is cleared to 0 5 irtr 0 r/(w) * i 2 c bus interface continuous transfer interrupt request flag indicates that the i 2 c bus interface has issued an interrupt request to the cpu, and the source is completion of reception/transmission of one frame in continuous transmission/reception. when the irtr flag is set to 1, the iric flag is also set to 1 at the same time. [setting conditions] i 2 c bus format slave mode: when the icdre or icdrf flag in icdr is set to 1 when aasx = 1 master mode or clocked synchronous serial format mode with i 2 c bus format: when the icdre or icdrf flag is set to 1 [clearing conditions] when 0 is written after reading irtr = 1 when the iric flag is cleared to 0 while ice is 1
rev. 1.0, 09/02, page 295 of 524 bit bit name initial value r/w description 4 aasx 0 r/(w) * second slave address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition matches bits svax6 to svax0 in sarx. [setting condition] when the second slave address is detected in slave receive mode and fsx = 0 in sarx [clearing conditions] when 0 is written in aasx after reading aasx = 1 when a start condition is detected in master mode 3 al 0 r/(w) * arbitration lost flag indicates that arbitration was lost in master mode. [setting conditions] when alsl=0 if the internal sda and sda pin disagree at the rise of scl in master transmit mode if the internal scl line is high at the fall of scl in master transmit mode when alsl=1 if the internal sda and sda pin disagree at the rise of scl in master transmit mode if the sda pin is driven low by another device before the i 2 c bus interface drives the sda pin low, after the start condition instruction was executed in master transmit mode [clearing conditions] when icdr is written to (transmit mode) or read from (receive mode) when 0 is written in al after reading al = 1
rev. 1.0, 09/02, page 296 of 524 bit bit name initial value r/w description 2 aas 0 r/(w) * slave address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition matches bits sva6 to sva0 in sar, or if the general call address (h'00) is detected. [setting condition] when the slave address or general call address (one frame including a r/ w bit is h00) is detected in slave receive mode and fs = 0 in sar [clearing conditions] when icdr is written to (transmit mode) or read from (receive mode) when 0 is written in aas after reading aas = 1 in master mode 1adz 0 r/(w) * general call address recognition flag in i 2 c bus format slave receive mode, this flag is set to 1 if the first frame following a start condition is the general call address (h'00). [setting condition] when the general call address (one frame including a r/ w bit is h00) is detected in slave receive mode and fs = 0 or fsx = 0 [clearing conditions] when icdr is written to (transmit mode) or read from (receive mode) when 0 is written in adz after reading adz = 1 in master mode if a general call address is detected while fs=1 and fsx=0, the adz flag is set to 1; however, the general call address is not recognized (aas flag is not set to 1).
rev. 1.0, 09/02, page 297 of 524 bit bit name initial value r/w description 0 ackb 0 r/w acknowledge bit stores acknowledge data. transmit mode: [setting condition] when 1 is received as the acknowledge bit when acke=1 in transmit mode [clearing conditions] when 0 is received as the acknowledge bit when acke=1 in transmit mode when 0 is written to the acke bit receive mode: 0: returns 0 as acknowledge data after data reception 1: returns 1 as acknowledge data after data reception when this bit is read, the value loaded from the bus line (returned by the receiving device) is read in transmission (when trs = 1). in reception (when trs = 0), the value set by internal software is read. when this bit is written, acknowledge data that is returned after receiving is rewritten regardless of the trs value. if the icsr register bit is written using bit-manipulation instructions, the acknowledge data should be re-set since the acknowledge data setting is rewritten by the ackb bit reading value. write the acke bit to 0 to clear the ackb flag to 0, before transmission is ended and a stop condition is issued in master mode, or before transmission is ended and sda is released to issue a stop condition by a master device. note: * only 0 can be written to clear the flag.
rev. 1.0, 09/02, page 298 of 524 13.3.7 ddc switch register (ddcswr) ddcswr controls iic internal latch clearance. bit bit name initial value r/w description 7 to 5 all 0 r/w reserved the initial value should not be changed. 4 0 r reserved 3 2 1 0 clr3 clr2 clr1 clr0 1 1 1 1 w * w * w * w * iic clear 3 to 0 controls initialization of the internal state of iic_0 and iic_1. 00--: setting prohibited 0100: setting prohibited 0101: iic_0 internal latch cleared 0110: iic_1 internal latch cleared 0111: iic_0 and iic_1 internal latches cleared 1---: invalid setting when a write operation is performed on these bits, a clear signal is generated for the internal latch circuit of the corresponding module, and the internal state of the iic module is initialized. these bits can only be written to; they are always read as 1. write data to this bit is not retained. to perform iic clearance, bits clr3 to clr0 must be written to simultaneously using an mov instruction. do not use a bit manipulation instruction such as bclr. when clearing is required again, all the bits must be written to in accordance with the setting. note: * this bit is always read as 1.
rev. 1.0, 09/02, page 299 of 524 13.3.8 i 2 c bus extended control register (icxr) icxr enables or disables the i 2 c bus interface interrupt generation and continuous receive operation, and indicates the status of receive/transmit operations. bit bit name initial value r/w description 7 stopim 0 r/w stop condition interrupt source mask enables or disables the interrupt generation when the stop condition is detected in slave mode. 0: enables iric flag setting and interrupt generation when the stop condition is detected (stop = 1 or estp = 1) in slave mode. 1: disables iric flag setting and interrupt generation when the stop condition is detected. 6 hnds 0 r/w handshake receive operation select enables or disables continuous receive operation in receive mode. 0: enables continuous receive operation 1: disables continuous receive operation when the hnds bit is cleared to 0, receive operation is performed continuously after data has been received successfully while icdrf flag is 0. when the hnds bit is set to 1, scl is fixed to the low level and the next data transfer is disabled after data has been received successfully while the icdrf flag is 0. the bus line is released and next receive operation is enabled by reading the receive data in icdr.
rev. 1.0, 09/02, page 300 of 524 bit bit name initial value r/w description 5 icdrf 0 r receive data read request flag indicates the icdr (icdrr) status in receive mode. 0: indicates that the data has been already read from icdr (icdrr) or icdr is initialized. 1: indicates that data has been received successfully and transferred from icdrs to icdrr, and the data is ready to be read out. [setting conditions] when data is received successfully and transferred from icdrs to icdrr. (1) when data is received successfully while icdrf = 0 (at the rise of the 9th clock pulse). (2) when icdr is read successfully in receive mode after data was received while icdrf = 1. [clearing conditions] when icdr (icdrr) is read. when 0 is written to the ice bit. when the iic is internally initialized using the clr3 to clr0 bits in ddcswr. when icdrf is set due to the condition (2) above, icdrf is temporarily cleared to 0 when icdr (icdrr) is read; however, since data is transferred from icdrs to icdrr immediately, icdrf is set to 1 again. note that icdr cannot be read successfully in transmit mode (trs = 1) because data is not transferred from icdrs to icdrr. be sure to read data from icdr in receive mode (trs = 0).
rev. 1.0, 09/02, page 301 of 524 bit bit name initial value r/w description 4 icdre 0 r transmit data write request flag indicates the icdr (icdrt) status in transmit mode. 0: indicates that the data has been already written to icdr (icdrt) or icdr is initialized. 1: indicates that data has been transferred from icdrt to icdrs and is being transmitted, or the start condition has been detected or transmission has been complete, thus allowing the next data to be written to. [setting conditions] when the start condition is detected from the bus line state with i 2 c bus format or serial format. when data is transferred from icdrt to icdrs. 1. when data transmission completed while icdre = 0 (at the rise of the 9th clock pulse). 2. when data is written to icdr in transmit mode after data transmission was completed while icdre = 1. [clearing conditions] when data is written to icdr (icdrt). when the stop condition is detected with i 2 c bus format or serial format. when 0 is written to the ice bit. when the iic is internally initialized using the clr3 to clr0 bits in ddcswr. note that if the acke bit is set to 1 with i 2 c bus format thus enabling acknowledge bit decision, icdre is not set when data transmission is completed while the acknowledge bit is 1. when icdre is set due to the condition (2) above, icdre is temporarily cleared to 0 when data is written to icdr (icdrt); however, since data is transferred from icdrt to icdrs immediately, icdre is set to 1 again. do not write data to icdr when trs = 0 because the icdre flag value is invalid during the time.
rev. 1.0, 09/02, page 302 of 524 bit bit name initial value r/w description 3 alie 0 r/w arbitration lost interrupt enable enables or disables iric flag setting and interrupt generation when arbitration is lost. 0: disables interrupt request when arbitration is lost. 1: enables interrupt request when arbitration is lost. 2 alsl 0 r/w arbitration lost condition select selects the condition under which arbitration is lost. 0: when the sda pin state disagrees with the data that iic bus interface outputs at the rise of scl, or when the scl pin is driven low by another device. 1: when the sda pin state disagrees with the data that iic bus interface outputs at the rise of scl, or when the sda line is driven low by another device in idle state or after the start condition instruction was executed. 1 0 fnc1 fnc0 0 0 r/w r/w function bit cancels some restrictions on usage. for details, refer to section 13.6, usage notes. 00: restrictions on operation remaining in effect 01: setting prohibited 10: setting prohibited 11: restrictions on operation canceled
rev. 1.0, 09/02, page 303 of 524 13.4 operation the i 2 c bus interface has an i 2 c bus format and a serial format. 13.4.1 i 2 c bus data format the i 2 c bus format is an addressing format with an acknowledge bit. this is shown in figure 13.3. the first frame following a start condition always consists of 9 bits. the serial format is a non-addressing format with no acknowledge bit. this is shown in figure 13.4. figure 13.5 shows the i 2 c bus timing. the symbols used in figures 13.3 to 13.5 are explained in table 13.6. sa sla 7n r/ data a 1 1m 11 1 a/ 1 p 1 transfer bit count ( n = 1 to 8) transfer frame count (m = from 1) s sla 7n1 7 r/ a data 11 1m1 1 a/ 1 s 1 sla r/ 1 1m2 a 1 data n2 a/ 1 p 1 (a) fs = 0 or fsx = 0 (b) start condition retransmission fs = 0 or fsx = 0 upper row: transfer bit count (n1, n2 = 1 to 8) lower row: transfer frame count (m1, m2 = from 1) figure 13.3 i 2 c bus data format (i 2 c bus format) s data 8n data 1 1m p 1 fs=1 and fsx=1 transfer bit count ( n = 1 to 8) transfer frame count (m = from 1) figure 13.4 i 2 c bus data format (serial format)
rev. 1.0, 09/02, page 304 of 524 sda scl s sla r/ a 9 8 1C7 9 8 1C7 9 8 1C7 data a data a/ p figure 13.5 i 2 c bus timing table 13.6 i 2 c bus data format symbols legend s start condition. the master device drives sda from high to low while scl is high sla slave address. the master device selects the slave device. r/ w indicates the direction of data transfer: from the slave device to the master device when r/ w is 1, or from the master device to the slave device when r/ w is 0 a acknowledge. the receiving device drives sda low to acknowledge a transfer. (the slave device returns acknowledge in master transmit mode, and the master device returns acknowledge in master receive mode.) data transferred data. the bit length of transferred data is set with the bc2 to bc0 bits in icmr. the msb first or lsb first is switched with the mls bit in icmr. p stop condition. the master device drives sda from low to high while scl is high
rev. 1.0, 09/02, page 305 of 524 13.4.2 initialization initialize the iic by the procedure shown in figure 13.6 before starting transmission/reception of data. start initialization set mstp4 = 0 (iic_0) mstp3 = 0 (iic_1) (mstpcrl) set ice = 0 in iccr set icsr set stcr cancel module stop mode set the first and second slave addresses and iic communication format (sva6 to sva0, fs, svax6 to svax0, and fsx) enable icmr and icdr to be accessed use scl/sda pin as an iic port set transfer rate (iicx) enable the cpu accessing to the iic control register and data register set communication format, wait insertion, and transfer rate (mls, wait, cks2 to cks0) enable interrupt (stopim, hnds, alie, alsl, fnc1, and fnc0) set acknowledge bit (ackb) set icmr set iccr set iice = 1 in stcr set sar and sarx set ice = 1 in iccr set icxr << start transmit/receive operation >> set interrupt enable, transfer mode, and acknowledge decision (ieic, mst, trs, and acke) enable sar and sarx to be accessed figure 13.6 sample flowchart for iic initialization note: be sure to modify the icmr register after transmit/receive operation has been completed. if the icmr register is modified during transmit/receive operation, bit counter bc2 to bc0 will be modified erroneously, thus causing incorrect operation. 13.4.3 master transmit operation in i 2 c bus format master transmit mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. figure 13.7 shows the sample flowchart for the operations in master transmit mode.
rev. 1.0, 09/02, page 306 of 524 start initialize iic set mst = 1 and trs = 1 in iccr set bbsy =1 and scp = 0 in iccr write transmit data in icdr clear iric flag in iccr no no yes yes yes yes no no [1] initialization [3] select master transmit mode. [4] start condition issuance [6] set transmit data for the first byte (slave address + r/ ). (after writing to icdr, clear iric flag continuously.) [9] set transmit data for the second and subsequent bytes. (after writing to icdr, clear iric flag continuously.) [2] test the status of the scl and sda lines. [7] wait for 1 byte to be transmitted. [10] wait for 1 byte to be transmitted. [11] determine end of tranfer [12] stop condition issuance [8] test the acknowledge bit transferred from the slave device. [5] wait for a start condition generation read iric flag in iccr read ackb bit in icsr iric = 1? ackb = 0? transmit mode? write transmit data in icdr clear iric flag in iccr read iric flag in iccr read ackb bit in icsr clear iric flag in iccr end of transmission? or ackb = 1? set bbsy = 0 and scp = 0 in iccr end read bbsy flag in iccr bbsy = 0? yes no read iric flag in iccr iric = 1? yes no yes no iric = 1? master receive mode figure 13.7 sample flowchart for operations in master transmit mode
rev. 1.0, 09/02, page 307 of 524 the transmission procedure and operations by which data is sequentially transmitted in synchronization with icdr (icdrt) write operations, are described below. 1. initialize the iic as described in section 13.4.2, initialization. 2. read the bbsy flag in iccr to confirm that the bus is free. 3. set bits mst and trs to 1 in iccr to select master transmit mode. 4. write 1 to bbsy and 0 to scp in iccr. this changes sda from high to low when scl is high, and generates the start condition. 5. then the iric and irtr flags are set to 1. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. 6. write the data (slave address + r/ w ) to icdr. with the i 2 c bus format (when the fs bit in sar or the fsx bit in sarx is 0), the first frame data following the start condition indicates the 7-bit slave address and transmit/receive direction (r/ w ). to determine the end of the transfer, the iric flag is cleared to 0. after writing to icdr, clear iric continuously so no other interrupt handling routine is executed. if the time for transmission of one frame of data has passed before the iric clearing, the end of transmission cannot be determined. the master device sequentially sends the transmission clock and the data written to icdr. the selected slave device (i.e. the slave device with the matching slave address) drives sda low at the 9th transmit clock pulse and returns an acknowledge signal. 7. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted, scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 8. read the ackb bit in icsr to confirm that ackb is cleared to 0. when the slave device has not acknowledged (ackb bit is 1), operate step [12] to end transmission, and retry the transmit operation. 9. write the transmit data to icdr. as indicating the end of the transfer, the iric flag is cleared to 0. perform the icdr write and the iric flag clearing sequentially, just as in step [6]. transmission of the next frame is performed in synchronization with the internal clock. 10. when one frame of data has been transmitted, the iric flag is set to 1 at the rise of the 9th transmit clock pulse. after one frame has been transmitted, scl is automatically fixed low in synchronization with the internal clock until the next transmit data is written. 11. read the ackb bit in icsr. confirm that the slave device has been acknowledged (ackb bit is 0). when there is still data to be transmitted, go to step [9] to continue the next transmission operation. when the slave device has not acknowledged (ackb bit is set to 1), operate step [12] to end transmission.
rev. 1.0, 09/02, page 308 of 524 12. clear the iric flag to 0. write 0 to acke in iccr, to clear received ackb contents to 0. write 0 to bbsy and scp in iccr. this changes sda from low to high when scl is high, and generates the stop condition. sda (master output) sda (slave output) 2 1 r/w 4 36 58 7 12 9 a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 icdre irtr icdrt note: * data write in icdr prohibited scl (master output) start condition generation slave address data 1 data 1 [9] icdr write [9] iric clear [6] icdr write [6] iric clear [4] bbsy set to 1 scp cleared to 0 (start condition issuance) user processing interrupt request interrupt request address + r/ iric [7] [5] icdrs data 1 address + r/ figure 13.8 example of operation timing in master transmit mode (mls = wait = 0)
rev. 1.0, 09/02, page 309 of 524 sda (master output) sda (slave output) 2 14 36 58 79 89 a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 icdre irtr icdr scl (master output) start condition issuance data 2 [9] icdr write [9] iric clear [12] iric clear [11] ackb read [12] set bbsy=1and scp=0 (stop condition issuance) iric a [10] [7] data 1 data 1 data 2 user processing figure 13.9 example of stop condition issuance operation timing in master transmit mode (mls = wait = 0) 13.4.4 master receive operation in i 2 c bus format master receive mode, the master device outputs the receive clock, receives data, and returns an acknowledge signal. the slave device transmits data. the master device transmits data containing the slave address and r/ w (1: read) in the first frame following the start condition issuance in master transmit mode, selects the slave device, and then switches the mode for receive operation. receive operation using the hnds function (hnds = 1): figure 13.10 shows the sample flowchart for the operations in master receive mode (hnds = 1).
rev. 1.0, 09/02, page 310 of 524 end set trs = 0 in iccr set ackb = 1 in icsr read iric flag in iccr clear iric flag in iccr clear iric flag in iccr clear iric flag in iccr set hnds = 1 in icxr set bbsy = 0 and scp = 0 in iccr iric = 1? no yes yes read icdr no [4] clear iric flag. [1] select receive mode. [2] start receiving. the first read is a dummy read. [5] read the receive data (for the second and subsequent read) [3] wait for 1 byte to be received. (set iric at the rise of the 9th clock for the receive frame) [6] set acknowledge data for the last reception. [10] read the receive data. [9] clear iric flag. [7] read the receive data. dummy read to start receiving if the first frame is the last receive data. [11] set stop condition issuance. generate stop condition. master receive mode read iric flag in iccr iric = 1? no yes [8] wait for 1 byte to be received. set ackb = 0 in icsr last receive? read icdr read icdr set trs = 1 in iccr figure 13.10 sample flowchart for operations in master receive mode (hnds = 1) the reception procedure and operations using the hnds function, by which the data reception process is provided in 1-byte units with scl fixed low at each data reception, are described below.
rev. 1.0, 09/02, page 311 of 524 1. clear the trs bit in iccr to 0 to switch from transmit mode to receive mode. clear the ackb bit in icsr to 0 (acknowledge data setting). set the hnds bit in icxr to 1. clear the iric flag to 0 to determine the end of reception. go to step [6] to halt reception operation if the first frame is the last receive data. 2. when icdr is read (dummy data read), reception is started, the receive clock is output in synchronization with the internal clock, and data is received. (data from the sda pin is sequentially transferred to icdrs in synchronization with the rise of the receive clock pulses.) 3. the master device drives sda low to return the acknowledge data at the 9th receive clock pulse. the receive data is transferred from icdrs to icdrr at the rise of the 9th clock pulse, setting the icdrf, iric, and irtr flags to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. the master device drives scl low from the fall of the 9th receive clock pulse to the icdr data reading. 4. clear the iric flag to clear the wait state. go to step [6] to halt reception operation if the next frame is the last receive data. 5. read icdr receive data. this clears the icdrf flag to 0. the master device outputs the receive clock continuously to receive the next data. data can be received continuously by repeating steps [3] to [5]. 6. set the ackb bit to 1 so as to return the acknowledge data for the last reception. 7. read icdr receive data. this clears the icdrf flag to 0. the master device outputs the receive clock to receive data. 8. when one frame of data has been received, the icdrf, iric, and irtr flags are set to 1 at the rise of the 9th receive clock pulse. 9. clear the iric flag to 0. 10. read icdr receive data after setting the trs bit. this clears the icdrf flag to 0. 11. clear the bbsy bit and scp bit to 0 in iccr. this changes sda from low to high when scl is high, and generates the stop condition.
rev. 1.0, 09/02, page 312 of 524 sda (master output) sda (slave output) 2 14 3 6 5 8 7 1 2 9 9 a a bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 irtr icdrf icdrr scl (master output) master transmit mode master receive mode data 1 data 1 data 2 [1] trs=0 clear [2] iric read (dummy read) [1] iric clear scl is fixed low until icdr is read scl is fixed low until icdr is read [4] iric clear user processing iric [3] [5] icdr read (data 1) undefined value figure 13.11 example of operation timing in master receive mode (mls = wait = 0, hnds = 1) sda (master output) sda (slave output) 2 14 3 6 5 8 7 9 9 78 a a bit 7 bit 1 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 iric icdrf icdrr scl (master output) data 3 data 2 data 1 data 2 data 3 [9] iric clear user processing irtr [8] [3] bit 0 [11] set bbsy=0 and scp=0 (stop condition instruction issuance) [4] iric clear [7] icdr read (data 2) [10] icdr read (data 3) [6] set ackb = 1 bit 0 stop condition generation scl is fixed low until icdr is read scl is fixed low until stop condition is issued figure 13.12 example of stop condition issuance operation timing in master receive mode (mls = wait = 0, hnds = 1) receive operation using the wait function: figures 13.13 and 13.14 show the sample flowcharts for the operations in master receive mode (wait = 1).
rev. 1.0, 09/02, page 313 of 524 set trs = 0 in iccr set ackb = 0 in icsr set wait = 1 in icmr yes yes yes clear iric flag in iccr clear iric flag in iccr read iric flag in iccr last receive? iric = 1? irtr = 1? yes irtr=1? no no no no read iric flag in iccr iric=1? no yes read icdr [4] determine end of reception [13] determine end of reception [1] select receive mode. [2] start receiving. the first read is a dummy read. [3] wait for a receive wait (set iric at the fall of the 8th clock) or, wait for 1 byte to be received (set iric at the rise of the 9th clock) [12] wait for a receive wait (set iric at the fall of the 8th clock) or, wait for 1 byte to be received (set iric at the rise of the 9th clock) [5] read the receive data. [6] clear iric flag. (to end the wait insertion) [15] clear wait mode. clear iric flag. ( iric flag should be cleared to 0 after setting wait = 0.) [17] generate stop condition master receive mode [14] clear iric. (to end the wait insertion) [16] read the last receive data. [7] set acknowledge data for the last reception. [8] wait for trs setting [9] set trs for stop condition issuance [10] read the receive data. [11] clear iric flag. (to end the wait insertion) read icdr clear iric flag in iccr set hnds = 0 in icxr wait for one clock pulse set ackb = 1 in icsr set trs = 1 in iccr end set wait = 0 in icmr set bbsy= 0 and scp= 0 in iccr clear iric flag in iccr read icdr clear iric flag in iccr read icdr figure 13.13 sample flowchart for operations in master receive mode (receiving multiple bytes) (wait = 1)
rev. 1.0, 09/02, page 314 of 524 end set hnds = 0 in icxr set wait = 0 in icmr set wait = 0 in icmr set ackb = 0 in icsr set ackb = 1 in icsr read icdr clear iric flag in iccr clear iric flag in iccr clear iric flag in iccr read iric flag in iccr read icdr read iric flag in iccr iric = 1? yes no no iric = 1? yes [1] select receive mode. [2] start receiving. the first read is a dummy read. [15] clear wait mode. clear iric flag. ( iric flag should be cleared to 0 after setting wait = 0.) [11] clear iric flag. (to end the wait insertion) [12] wait for 1 byte to be received. (set iric at the rise of the 9th clock) [9] set trs for stop condition issuance [7] set acknowledge data for the last reception. [16] read the last receive data slave receive mode set trs = 0 in iccr set trs = 1 in iccr [17] generate stop condition set bbsy = 0 and scp = 0 in iccr figure 13.14 sample flowchart for operations in master receive mode (receiving a single byte) (wait = 1)
rev. 1.0, 09/02, page 315 of 524 the reception procedure and operations using the wait function (wait bit), by which data is sequentially received in synchronization with icdr (icdrr) read operations, are described below. the following describes the multiple-byte reception procedure. in single-byte reception, some steps of the following procedure are omitted. at this time, follow the procedure shown in figure 13.14. 1. clear the trs bit in iccr to 0 to switch from transmit mode to receive mode. clear the ackb bit in icsr to 0 to set the acknowledge data. clear the hnds bit in icxr to 0 to cancel the handshake function. clear the iric flag to 0, and then set the wait bit in icmr to 1. 2. when icdr is read (dummy data is read), reception is started, the receive clock is output in synchronization with the internal clock, and data is received. 3. the iric flag is set to 1 in either of the following cases. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. ? at the fall of the 8th receive clock pulse for one frame scl is automatically fixed low in synchronization with the internal clock until the iric flag clearing. ? at the rise of the 9th receive clock pulse for one frame the irtr and icdrf flags are set to 1, indicating that one frame of data has been received. the master device outputs the receive clock continuously to receive the next data. 4. read the irtr flag in icsr. if the irtr flag is 0, execute step [6] to clear the iric flag to 0 to release the wait state. if the irtr flag is 1 and the next data is the last receive data, execute step [7] to halt reception. 5. if irtr flag is 1, read icdr receive data. 6. clear the iric flag. when the flag is set as the first case in step [3], the master device outputs the 9th clock and drives sda low at the 9th receive clock pulse to return an acknowledge signal. data can be received continuously by repeating steps [3] to [6]. 7. set the ackb bit in icsr to 1 so as to return the acknowledge data for the last reception. 8. after the iric flag is set to 1, wait for at least one clock pulse until the rise of the first clock pulse for the next receive data. 9. set the trs bit in iccr to 1 to switch from receive mode to transmit mode. the trs bit value becomes valid when the rising edge of the next 9th clock pulse is input. 10. read the icdr receive data. 11. clear the iric flag to 0.
rev. 1.0, 09/02, page 316 of 524 12. the iric flag is set to 1 in either of the following cases. ? at the fall of the 8th receive clock pulse for one frame scl is automatically fixed low in synchronization with the internal clock until the iric flag is cleared. ? at the rise of the 9th receive clock pulse for one frame the irtr and icdrf flags are set to 1, indicating that one frame of data has been received. the master device outputs the receive clock continuously to receive the next data. 13. read the irtr flag in icsr. if the irtr flag is 0, execute step [14] to clear the iric flag to 0 to release the wait state. if the irtr flag is 1 and data reception is complete, execute step [15] to issue the stop condition. 14. if irtr flag is 0, clear the iric flag to 0 to release the wait state. execute step [12] to read the iric flag to detect the end of reception. 15. clear the wait bit in cmr to cancel the wait mode. then, clear the iric flag. clearing of the iric flag should be done while wait = 0. (if the wait bit is cleared to 0 after clearing the iric flag and then an instruction to issue a stop condition is executed, the stop condition may not be issued correctly.) 16. read the last icdr receive data. 17. clear the bbsy bit and scp bit to 0 in iccr. this changes sda from low to high when scl is high, and generates the stop condition.
rev. 1.0, 09/02, page 317 of 524 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 iric irtr icdr scl (master output) data 1 [1] trs cleared to 0 iric cleard to 0 [6] iric clear [5] icdr read (data 1) [6] iric clear (to end wait insertion) user processing bit 5 bit 4 bit 3 5 4 3 9 data 1 data 2 [3] [3] a [2] icdr read (dummy read) master tansmit mode master receive mode a [4]irtr=0 [4] irtr=1 figure 13.15 example of master receive mode operation timing (mls = ackb = 0, wait = 1) sda (master output) sda (slave output) 2 14 3 6 5 8 7 9 9 8 a a bit 7 bit 0 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 iric irtr icdr scl (master output) data 3 data 2 data 1 data 2 data 3 [6] iric clear [8] wait for one clock pulse [11] iric clear [14] iric clear [16] icdr read (data 3) user processing [12] [3] [10] icdr read (data 2) [9] set trs=1 [7] set ackb=1 [15] wait cleared to 0, iric clear [17] stop condition issuance bit 0 stop condition generation [13] irtr=1 [13] irtr=0 [12] [4] irtr=1 [4] irtr=0 [3] figure 13.16 example of stop condition issuance timing in master receive mode (mls = ackb = 0, wait = 1) 13.4.5 slave receive operation in i 2 c bus format slave receive mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal.
rev. 1.0, 09/02, page 318 of 524 the slave device operates as the device specified by the master device when the slave address in the first frame following the start condition that is issued by the master device matches its own address. receive operation using the hnds function (hnds = 1): figure 13.17 shows the sample flowchart for the operations in slave receive mode (hnds = 1).
rev. 1.0, 09/02, page 319 of 524 slave receive mode end read iric flag in iccr clear iric flag in iccr read iric flag in iccr read aasx, aas and adz in icsr read trs in iccr read iric flag in iccr clear iric in iccr clear iric flag in iccr read icdr read icdr general call address processing * description omitted set mst = 0 and trs = 0 in iccr iric = 1? no yes read iric flag in iccr set ackb = 1 in icsr iric = 1? no yes trs = 1? iric = 1? yes yes no yes no aas = 1 and adz = 1? [1] initialization. select slave receive mode. [2] read the receive data remaining unread. [3] to [7] wait for one byte to be received (slave address + r/w) [10] read the receive data. the first read is a dummy read. [9] set acknowledge data for the last reception. [8] clear iric [5] to [7] wait for the reception to end. [11] detect stop condition slave transmit mode last reception? no no yes read icdr, clear iric flag no yes initialize iic icdrf = 1? [8] clear iric flag. [12] clear iric flag. [10] read the receive data. set ackb = 0 in icsr and hnds = 1 in icxr figure 13.17 sample flowchart for operations in slave receive mode (hnds = 1)
rev. 1.0, 09/02, page 320 of 524 the reception procedure and operations using the hnds bit function, by which data reception process is provided in 1-byte unit with scl being fixed low at every data reception, are described below. 1. initialize the iic as described in section 13.4.2, initialization. clear the mst and trs bits to 0 to set slave receive mode, and set the hnds bit to 1 and the ackb bit to 0. clear the iric flag in iccr to 0 to see the end of reception. 2. confirm that the icdrf flag is 0. if the icdrf flag is set to 1, read the icdr and then clear the iric flag to 0. 3. when the start condition output by the master device is detected, the bbsy flag in iccr is set to 1. the master device then outputs the 7-bit slave address and transmit/receive direction (r/w), in synchronization with the transmit clock pulses. 4. when the slave address matches in the first frame following the start condition, the device operates as the slave device specified by the master device. if the 8th data bit (r/ w ) is 0, the trs bit remains cleared to 0, and slave receive operation is performed. if the 8th data bit (r/ w ) is 1, the trs bit is set to 1, and slave transmit operation is performed. when the slave address does not match, receive operation is halted until the next start condition is detected. 5. at the 9th clock pulse of the receive frame, the slave device returns the data in the ackb bit as an acknowledge signal. 6. at the rise of the 9th clock pulse, the iric flag is set to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. if the aasx bit has been set to 1, irtr flag is also set to 1. 7. at the rise of the 9th clock pulse, the receive data is transferred from icdrs to icdrr, setting the icdrf flag to 1. the slave device drives scl low from the fall of the 9th receive clock pulse until data is read from icdr. 8. confirm that the stop bit is cleared to 0, and clear the iric flag to 0. 9. if the next frame is the last receive frame, set the ackb bit to 1. 10. if icdr is read, the icdrf flag is cleared to 0, releasing the scl bus line. this enables the master device to transfer the next data. receive operations can be performed continuously by repeating steps [5] to [10]. 11. when the stop condition is detected (sda is changed from low to high when scl is high), the bbsy flag is cleared to 0 and the stop bit is set to 1. if the stopim bit has been cleared to 0, the iric flag is set to 1. 12. confirm that the stop bit is set to 1, and clear the iric flag to 0.
rev. 1.0, 09/02, page 321 of 524 sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icdrf iric icdrs icdrr scl (master output) scl (slave output) address +r/ address +r/ undefined value [8] iric clear [10] icdr read (dummy read) user processing 2 1 2 1 4 36 58 79 scl (pin waveform) start condition generation slave address data 1 [6] a r/ [7] scl is fixed low until icdr is read [2] icdr read interrupt request occurrence figure 13.18 example of slave receive mode operation timing (1) (mls = 0, hnds= 1) sda (master output) sda (slave output) 2 14 36 58 79 89 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 icdrf icdrs icdrr iric scl (master output) scl (slave output) [8] iric clear [12] iric clear [9] set ackb=1 [5] icdr read ( data (n- 1)) [10] icdr read ( data (n )) user processing data (n ) data (n- 1) data (n-2 ) [6] [6] [11] a a stop condition generation [7] scl is fixed low until icdr is read [7] scl is fixed low until icdr is read data (n- 1) data (n ) data (n ) [8] iric clear data (n- 1) figure 13.19 example of slave receive mode operation timing (2) (mls = 0, hnds= 1)
rev. 1.0, 09/02, page 322 of 524 continuous receive operation: figure 13.20 shows the sample flowchart for the operations in slave receive mode (hnds = 0). slave receive mode end read iric in iccr clear iric in iccr clear iric in iccr read aasx, aas and adz in icsr read trs in iccr read iric in iccr clear iric in iccr clear iric in iccr read icdr wait for one frame read icdr set ackb = 0 in icsr set ackb = 1 in icsr set hnds = 0 in icxr general call address processing * description omitted set mst = 0 and trs = 0 in iccr iric = 1? no yes icdrf = 1? yes trs = 1? iric = 1? icdrf = 1? yes yes no no yes no aas = 1 and adz = 1? no no [1] select slave receive mode. [2] read the receive data remaining unread. [3] to [7] wait for one byte to be received (slave address + r/w) (set iric at the rise of the 9th clock) [9] wait for ackb setting and set acknowledge data for the last reception (after the rise of the 9th clock of (n-1)th byte data) [15] clear iric [14] read the last receive data [8] clear iric [13] clear iric [10] read the receive data. the first read is a dummy read. [11] wait for one byte to be received (set iric at the rise of the 9th clock) [12] detect stop condition slave transmit mode yes no no read icdr no yes icdrf = 1? (n-2)th-byte reception? estp = 1 or stop = 1? * n: address + total number of bytes received figure 13.20 sample flowchart for operations in slave receive mode (hnds = 0)
rev. 1.0, 09/02, page 323 of 524 the reception procedure and operations in slave receive are described below. 1. initialize the iic as described in section 13.4.2, initialization. clear the mst and trs bits to 0 to set slave receive mode, and set the hnds and ackb bits to 0. clear the iric flag in iccr to 0 to see the end of reception. 2. confirm that the icdrf flag is 0. if the icdrf flag is set to 1, read the icdr and then clear the iric flag to 0. 3. when the start condition output by the master device is detected, the bbsy flag in iccr is set to 1. the master device then outputs the 7-bit slave address and transmit/receive direction (r/w) in synchronization with the transmit clock pulses. 4. when the slave address matches in the first frame following the start condition, the device operates as the slave device specified by the master device. if the 8th data bit (r/ w ) is 0, the trs bit remains cleared to 0, and slave transmit operation is performed. when the slave address does not match, receive operation is halted until the next start condition is detected. 5. at the 9th clock pulse of the receive frame, the slave device returns the data in the ackb bit as an acknowledge signal. 6. at the rise of the 9th clock pulse, the iric flag is set to 1. if the ieic bit has been set to 1, an interrupt request is sent to the cpu. if the aasx bit has been set to 1, the irtr flag is also set to 1. 7. at the rise of the 9th clock pulse, the receive data is transferred from icdrs to icdrr, setting the icdrf flag to 1. 8. confirm that the stop bit is cleared to 0 and clear the icic flag to 0. 9. if the next read data is the third last receive frame, wait for at least one frame time to set the ackb bit. set the ackb bit after the rise of the 9th clock pulse of the second last receive frame. 10. confirm that the icdrf flag is set to 1 and read icdr. this clears the icdrf flag to 0. 11. at the rise of the 9th clock pulse or when the receive data is transferred from irdrs to icdrr due to icdr read operation, the iric and icdrf flags are set to 1. 12. when the stop condition is detected (sda is changed from low to high when scl is high), the bbsy flag is cleared to 0 and the stop or estp flag is set to 1. if the stopim bit has been cleared to 0, the iric flag is set to 1. in this case, execute step [14] to read the last receive data. 13. clear the iric flag to 0. receive operations can be performed continuously by repeating steps [9] to [13]. 14. confirm that the icdrf flag is set to 1, and read icdr. 15. clear the iric flag.
rev. 1.0, 09/02, page 324 of 524 sda (master output) sda (slave output) 2 14 32 14 3 6 58 79 bit 7 bit 6 bit 7 bit 6 bit 5 bit 4 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icdrf icdrs icdrr iric scl (master output) start condition issuance address+r/ data 1 address+r/ [8] iric clear [10] icdr read user processing slave address [6] [7] a r/ data 1 figure 13.21 example of slave receive mode operation timing (1) (mls = ackb = 0, hnds = 0) start condition detection sda (master output) sda (slave output) 2 14 36 5 2 14 36 58 79 8 79 89 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 1 bit 0 icdrf icdrs icdrr iric scl (master output) [9] set ackb = 1 [13] iric clear [10] icdr read (data n-2) [10] icdr read (data n-1) [13] iric clear [9] wait for one frame user processing bit 7 bit 0 bit 6 bit 5 bit 4 bit 3 bit 2 data n data n-1 data n-1 data n-1 data n-2 data n-2 data n data n data n-2 [11] [11] [11] a aa [13] iric clear [14] icdr read (data n) [15] iric clear [11] figure 13.22 example of slave receive mode operation timing (2) (mls = ackb = 0, hnds = 0)
rev. 1.0, 09/02, page 325 of 524 13.4.6 slave transmit operation if the slave address matches to the address in the first frame (address reception frame) following the start condition detection when the 8th bit data (r/ w ) is 1 (read), the trs bit in iccr is automatically set to 1 and the mode changes to slave transmit mode. figure 13.23 shows the sample flowchart for the operations in slave transmit mode. end write transmit data in icdr clear iric in iccr clear iric in iccr clear acke to 0 in iccr (ackb=0 clear) clear iric in iccr read iric in iccr read ackb in icsr set trs = 0 in iccr read icdr read iric in iccr iric = 1? yes yes no no iric = 1? yes no [1], [2] if the slave address matches to the address in the first frame following the start condition detection and the r/ bit is 1 in slave recieve mode, the mode changes to slave transmit mode. [8] set slave receive mode. [6] read iric in iccr [7] clear acknowledge bit data [9] dummy read (to release the scl line). [10] wait for stop condition [3], [5] set transmit data for the second and subsequent bytes. [3], [4] wait for 1 byte to be transmitted. [4] determine end of transfer. slave transmit mode end of transmission (ackb = 1)? clear iric in iccr figure 13.23 sample flowchart for slave transmit mode
rev. 1.0, 09/02, page 326 of 524 in slave transmit mode, the slave device outputs the transmit data, while the master device outputs the receive clock and returns an acknowledge signal. the transmission procedure and operations in slave transmit mode are described below. 1. initialize slave receive mode and wait for slave address reception. 2. when the slave address matches in the first frame following detection of the start condition, the slave device drives sda low at the 9th clock pulse and returns an acknowledge signal. if the 8th data bit (r/w) is 1, the trs bit in iccr is set to 1, and the mode changes to slave transmit mode automatically. the iric flag is set to 1 at the rise of the 9th clock. if the ieic bit in iccr has been set to 1, an interrupt request is sent to the cpu. at the same time, the icdre flag is set to 1. the slave device drives scl low from the fall of the transmit clock until icdr data is written, to disable the master device to output the next transfer clock. 3. after clearing the iric flag to 0, write data to icdr. at this time, the icdre flag is cleared to 0. the written data is transferred to icdrs, and the icdre and iric flags are set to 1 again. the slave device sequentially sends the data written into icdrs in accordance with the clock output by the master device. the iric flag is cleared to 0 to detect the end of transmission. processing from the icdr register writing to the iric flag clearing should be performed continuously. prevent any other interrupt processing from being inserted. 4. the master device drives sda low at the 9th clock pulse, and returns an acknowledge signal. as this acknowledge signal is stored in the ackb bit in icsr, this bit can be used to determine whether the transfer operation was performed successfully. when one frame of data has been transmitted, the iric flag in iccr is set to 1 at the rise of the 9th transmit clock pulse. when the icdre flag is 0, the data written into icdr is transferred to icdrs, transmission starts, and the icdre and iric flags are set to 1 again. if the icdre flag has been set to 1, this slave device drives scl low from the fall of the transmit clock until data is written to icdr. 5. to continue transmission, write the next data to be transmitted into icdr. the icdre flag is cleared to 0. the iric flag is cleared to 0 to detect the end of transmission. processing from the icdr register writing to the iric flag clearing should be performed continuously. prevent any other interrupt processing from being inserted. transmit operations can be performed continuously by repeating steps [4] and [5]. 6. clear the iric flag to 0. 7. to end transmission, clear the acke bit in iccr to 0, to clear the acknowledge bit stored in the ackb bit to 0. 8. clear the trs bit to 0 for the next address reception, to set slave receive mode. 9. dummy-read icdr to release sda on the slave side.
rev. 1.0, 09/02, page 327 of 524 10. when the stop condition is detected, that is, when sda is changed from low to high when scl is high, the bbsy flag in iccr is cleared to 0 and the stop flag in icsr is set to 1. when the stopim bit in icxr is 0, the iric flag is set to 1. if the iric flag has been set, it is cleared to 0. sda (master output) sda (slave output) 2 1 2 1 4 36 58 79 9 8 bit 7 bit 6 bit 5 bit 7 bit 6 bit 4 bit 3 bit 2 bit 1 bit 0 icdre icdr iric scl (master output) slave receive mode slave transmit mode [3] icdr write user processing data 1 data 1 data 2 data 2 a r/ a [4] [3] iric clear [3] iric clear [5] iric clear [5] icdr write [2] figure 13.24 example of slave transmit mode operation timing (mls = 0) 13.4.7 iric setting timing and scl control the interrupt request flag (iric) is set at different times depending on the wait bit in icmr, the fs bit in sar, and the fsx bit in sarx. if the icdre or icdrf flag is set to 1, scl is automatically held low after one frame has been transferred in synchronization with the internal clock. figures 13.25 to 13.27 show the iric set timing and scl control.
rev. 1.0, 09/02, page 328 of 524 scl sda iric user processing clear iric 23 1 a 8 7 3 2 1 9 8 7 when wait = 0, and fs = 0 or fsx = 0 (i 2 c bus format, no wait) (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. scl sda iric user processing clear iric clear iric write to icdr (transmit) or read from icdr (receive) 1 a 8 7 1 9 8 7 figure 13.25 iric setting timing and scl control (1)
rev. 1.0, 09/02, page 329 of 524 scl sda iric user processing clear iric 2 13 a 8 123 9 8 clear iric when wait = 1, and fs = 0 or fsx = 0 (i 2 c bus format, wait inserted) scl sda iric user processing clear iric write to icdr (transmit) or read from icdr (receive) 1 a 8 1 9 8 clear iric (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. figure 13.26 iric setting timing and scl control (2)
rev. 1.0, 09/02, page 330 of 524 scl sda iric user processing clear iric 1 8 7 4 123 8 7 when fs = 1 and fsx = 1 (clocked synchronous serial format) (a) data transfer ends with icdre=0 at transmission, or icdrf=0 at reception. scl sda iric user processing clear iric clear iric write to icdr (transmit) or read from icdr (receive) 8 72 14 3 1 8 7 (b) data transfer ends with icdre=1 at transmission, or icdrf=1 at reception. figure 13.27 iric setting timing and scl control (3) 13.4.8 noise canceler the logic levels at the scl and sda pins are routed through noise cancelers before being latched internally. figure 13.28 shows a block diagram of the noise canceler. the noise canceler consists of two cascaded latches and a match detector. the scl (or sda) pin input signal is sampled on the system clock, but is not passed forward to the next circuit unless the outputs of both latches agree. if they do not agree, the previous value is held.
rev. 1.0, 09/02, page 331 of 524 system clock cycle sampling clock c dq latch c dq latch scl or sda input signal match detector internal scl or sda signal sampling clock figure 13.28 block diagram of noise canceler 13.4.9 initialization of internal state the iic has a function for forcible initialization of its internal state if a deadlock occurs during communication. initialization is executed in accordance with the setting of bits clr3 to clr0 in ddcswr or clearing ice bit. for details on the setting of bits clr3 to clr0, see section 13.3.7, ddc switch register (ddcswr). scope of initialization: the initialization executed by this function covers the following items: icdre and icdrf internal flags transmit/receive sequencer and internal operating clock counter internal latches for retaining the output state of the scl and sda pins (wait, clock, data output, etc.) the following items are not initialized: actual register values (icdr, sar, sarx, icmr, iccr, icsr, icxr (except for the icdre and icdrf flags) internal latches used to retain register read information for setting/clearing flags in icmr, iccr, and icsr the value of the icmr bit counter (bc2 to bc0) generated interrupt sources (interrupt sources transferred to the interrupt controller)
rev. 1.0, 09/02, page 332 of 524 notes on initialization: interrupt flags and interrupt sources are not cleared, and so flag clearing measures must be taken as necessary. basically, other register flags are not cleared either, and so flag clearing measures must be taken as necessary. when initialization is executed by ddcswr, the write data for bits clr3 to clr0 is not retained. to perform iic clearance, bits clr3 to clr0 must be written to simultaneously using an mov instruction. do not use a bit manipulation instruction such as bclr. similarly, when clearing is required again, all the bits must be written to simultaneously in accordance with the setting. if a flag clearing setting is made during transmission/reception, the iic module will stop transmitting/receiving at that point and the scl and sda pins will be released. when transmission/reception is started again, register initialization, etc., must be carried out as necessary to enable correct communication as a system. the value of the bbsy bit cannot be modified directly by this module clear function, but since the stop condition pin waveform is generated according to the state and release timing of the scl and sda pins, the bbsy bit may be cleared as a result. similarly, state switching of other bits and flags may also have an effect. to prevent problems caused by these factors, the following procedure should be used when initializing the iic state. 1. execute initialization of the internal state according to the setting of bits clr3 to clr0 or ice bit clearing. 2. execute a stop condition issuance instruction (write 0 to bbsy and scp) to clear the bbsy bit to 0, and wait for two transfer rate clock cycles. 3. re-execute initialization of the internal state according to the setting of bits clr3 to clr0 or ice bit clearing. 4. initialize (re-set) the iic registers.
rev. 1.0, 09/02, page 333 of 524 13.5 interrupt sources the iic has interrupt source iici. table 13.7 shows the interrupt sources and priority. individual interrupt sources can be enabled or disabled using the enable bits in iccr, and are sent to the interrupt controller independently. table 13.7 iic interrupt sources channel name enable bit interrupt source interrupt flag priority 0 iici0 ieic i 2 c bus interface interrupt request iric high 1 iici1 ieic i 2 c bus interface interrupt request iric low 13.6 usage notes 1. in master mode, if an instruction to generate a start condition is issued and then an instruction to generate a stop condition is issued before the start condition is output to the i 2 c bus, neither condition will be output correctly. to output the start condition followed by the stop condition, after issuing the instruction that generates the start condition, read dr in each i 2 c bus output pin, and check that scl and sda are both low. the pin states can be monitored by reading dr even if the ice bit is set to 1. then issue the instruction that generates the stop condition. note that scl may not yet have gone low when bbsy is cleared to 0. 2. either of the following two conditions will start the next transfer. pay attention to these conditions when accessing to icdr. ? write to icdr when ice = 1 and trs = 1 (including automatic transfer from icdrt to icdrs) ? read from icdr when ice = 1 and trs = 0 (including automatic transfer from icdrs to icdrr) 3. table 13.8 shows the timing of scl and sda outputs in synchronization with the internal clock. timings on the bus are determined by the rise and fall times of signals affected by the bus load capacitance, series resistance, and parallel resistance.
rev. 1.0, 09/02, page 334 of 524 table 13.8 i 2 c bus timing (scl and sda outputs) item symbol output timing unit notes scl output cycle time t sclo 28t cyc to 256t cyc ns scl output high pulse width t sclho 0.5t sclo ns scl output low pulse width t scllo 0.5t sclo ns sda output bus free time t bufo 0.5t sclo C 1t cyc ns start condition output hold time t staho 0.5t sclo C 1t cyc ns retransmission start condition output setup time t staso 1t sclo ns stop condition output setup time t stoso 0.5t sclo + 2t cyc ns data output setup time (master) 1t scllo C 3t cyc data output setup time (slave) t sdaso 1t scll C (6t cyc or 12t cyc * ) ns data output hold time t sdaho 3t cyc ns see figure 21.21. note: * 6t cyc when iicx is 0, 12t cyc when 1. 4. scl and sda inputs are sampled in synchronization with the internal clock. the ac timing therefore depends on the system clock cycle t cyc , as shown in section 21, electrical characteristics. note that the i 2 c bus interface ac timing specifications will not be met with a system clock frequency of less than 5 mhz. 5. the i 2 c bus interface specification for the scl rise time t sr is 1000 ns or less (300 ns for high- speed mode). in master mode, the i 2 c bus interface monitors the scl line and synchronizes one bit at a time during communication. if t sr (the time for scl to go from low to v ih ) exceeds the time determined by the input clock of the i 2 c bus interface, the high period of scl is extended. the scl rise time is determined by the pull-up resistance and load capacitance of the scl line. to insure proper operation at the set transfer rate, adjust the pull-up resistance and load capacitance so that the scl rise time does not exceed the values given in table 13.9.
rev. 1.0, 09/02, page 335 of 524 table 13.9 permissible scl rise time (t sr ) values time indication [ns] iicx t cyc indication i 2 c bus specification (max.) f = 5 mhz f = 8 mhz f = 10 mhz standard mode 1000 1000 937 750 0 7.5 t cyc high-speed mode 300 300 300 300 standard mode 1000 1000 1000 1000 1 17.5 t cyc high-speed mode 300 300 300 300 6. the i 2 c bus interface specifications for the scl and sda rise and fall times are under 1000 ns and 300 ns. the i 2 c bus interface scl and sda output timing is prescribed by t cyc , as shown in table 13.8. however, because of the rise and fall times, the i 2 c bus interface specifications may not be satisfied at the maximum transfer rate. table 13.10 shows output timing calculations for different operating frequencies, including the worst-case influence of rise and fall times. t bufo fails to meet the i 2 c bus interface specifications at any frequency. the solution is either (a) to provide coding to secure the necessary interval (approximately 1 s) between issuance of a stop condition and issuance of a start condition, or (b) to select devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus. t scllo in high-speed mode and t staso in standard mode fail to satisfy the i 2 c bus interface specifications for worst-case calculations of t sr /t sf . possible solutions that should be investigated include (a) adjusting the rise and fall times by means of a pull-up resistor and capacitive load, (b) reducing the transfer rate to meet the specifications, or (c) selecting devices whose input timing permits this output timing for use as slave devices connected to the i 2 c bus.
rev. 1.0, 09/02, page 336 of 524 table 13.10 i 2 c bus timing (with maximum influence of t sr /t sf ) time indication (at maximum transfer rate) [ns] item t cyc indication t sr /t sf influence (max.) i 2 c bus specifi- cation (min.) f = 5 mhz f = 8 mhz f = 10 mhz standard mode C1000 4000 4000 4000 4000 t sclho 0.5 t sclo (Ct sr ) high-speed mode C300 600 950 950 950 standard mode C250 4700 4750 4750 4750 t scllo 0.5 t sclo (Ct sf ) high-speed mode C250 1300 1000 * 1 1000 * 1 1000 * 1 standard mode C1000 4700 3800 * 1 3875 * 1 3900 * 1 t bufo 0.5 t sclo C1 t cyc (Ct sr ) high-speed mode C300 1300 750 * 1 825 * 1 850 * 1 standard mode C250 4000 4550 4625 4650 t staho 0.5 t sclo C1 t cyc (Ct sf ) high-speed mode C250 600 800 875 900 standard mode C1000 4700 9000 9000 9000 t staso 1 t sclo (Ct sr ) high-speed mode C300 600 2200 2200 2200 standard mode C1000 4000 4400 4250 4200 t stoso 0.5 t sclo + 2 t cyc (Ct sr ) high-speed mode C300 600 1350 1200 1150 standard mode C1000 250 3100 3325 3400 t sdaso (master) 1 t scllo * 3 C3 t cyc (Ct sr ) high-speed mode C300 100 400 625 700 standard mode C1000 250 1300 2200 2500 t sdaso (slave) 1 t scll * 3 C12 t cyc * 2 (Ct sr ) high-speed mode C300 100 C1400 * 1 C500 * 1 C200 * 1 standard mode 0 0 600 375 300 t sdaho 3 t cyc high-speed mode 0 0 600 375 300 notes: 1. does not meet the i 2 c bus interface specification. remedial action such as the following is necessary: (a) secure a start/stop condition issuance interval; (b) adjust the rise and fall times by means of a pull-up resistor and capacitive load; (c) reduce the transfer rate; (d) select slave devices whose input timing permits this output timing. the values in the above table will vary depending on the settings of the iicx bit and bits cks0 to cks2. depending on the frequency it may not be possible to achieve the maximum transfer rate; therefore, whether or not the i 2 c bus interface specifications are met must be determined in accordance with the actual setting conditions. 2. value when the iicx bit is set to 1. when the iicx bit is cleared to 0, the value is (t scll C 6t cyc ). 3. calculated using the i 2 c bus specification values (standard mode: 4700 ns min.; high- speed mode: 1300 ns min.).
rev. 1.0, 09/02, page 337 of 524 7. notes on icdr read at end of master reception to halt reception at the end of a receive operation in master receive mode, set the trs bit to 1 and write 0 to bbsy and scp in iccr. this changes sda from low to high when scl is high, and generates the stop condition. after this, receive data can be read by means of an icdr read, but if data remains in the buffer the icdrs receive data will not be transferred to icdr (icdrr), and so it will not be possible to read the second byte of data. if it is necessary to read the second byte of data, issue the stop condition in master receive mode (i.e. with the trs bit cleared to 0). when reading the receive data, first confirm that the bbsy bit in iccr is cleared to 0, the stop condition has been generated, and the bus has been released, then read icdr with trs cleared to 0. note that if the receive data (icdr data) is read in the interval between execution of the instruction for issuance of the stop condition (writing of 0 to bbsy and scp in iccr) and the actual generation of the stop condition, the clock may not be output correctly in subsequent master transmission. clearing of the mst bit after completion of master transmission/reception, or other modifications of iic control bits to change the transmit/receive operating mode or settings, must be carried out during interval (a) in figure 13.29 (after confirming that the bbsy bit in iccr has been cleared to 0). sda scl internal clock bbsy bit master receive mode icdr read disabled period bit 0 a 8 9 stop condition (a) start condition execution of instruction for issuing stop condition (write 0 to bbsy and scp) confirmation of stop condition issuance (read bbsy = 0) start condition issuance figure 13.29 notes on reading master receive data note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr.
rev. 1.0, 09/02, page 338 of 524 8. notes on start condition issuance for retransmission figure 13.30 shows the timing of start condition issuance for retransmission, and the timing for subsequently writing data to icdr, together with the corresponding flowchart. write the transmit data to icdr after the start condition for retransmission is issued and then the start condition is actually generated.
rev. 1.0, 09/02, page 339 of 524 sda iric scl [3] (retransmission) start condition instruction issuance [4] iric determination [5] icdr write (transmit data) [2] determination of scl = low [1] iric determination start condition generation (retransmission) iric = 1? yes clear iric in icsr read scl pin write transmit data to icdr set bbsy = 1, scp = 0 (icsr) [1] [1] wait for end of 1-byte transfer [2] determine whether scl is low [3] issue start condition instruction for retransmission [4] determine whether start condition is generated or not [5] set transmit data (slave address + r/ ) [2] [3] [4] [5] yes yes no no iric = 1? yes scl = low? start condition issuance? no no other processing note: * program so that processing from [3] to [5] is executed continuously. bit7 ack 9 figure 13.30 flowchart for start condition issuance instruction for retransmission and timing note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr.
rev. 1.0, 09/02, page 340 of 524 9. note on when i 2 c bus interface stop condition instruction is issued in cases where the rise time of the 9th clock of scl exceeds the stipulated value because of a large bus load capacity or where a slave device in which a wait can be inserted by driving the scl pin low is used, the stop condition instruction should be issued after reading scl after the rise of the 9th clock pulse and determining that it is low. stop condition generation scl iric [1] scl = low determination vih [2] stop condition instruction issuance sda 9th clock secures a high period scl is detected as low because the rise of the waveform is delayed figure 13.31 stop condition issuance timing note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr. 10. note on iric flag clear when the wait function is used if the rise time of scl exceeds the stipulated value or a slave device in which a wait can be inserted by driving the scl pin low is used when the wait function is used in i 2 c bust interface master mode, the iric flag should be cleared after determining that the scl is low, as described below. if the iric flag is cleared to 0 when wait = 1 while the scl is extending the high level time, the sda level may change before the scl goes low, which may generate a start or stop condition erroneously.
rev. 1.0, 09/02, page 341 of 524 scl iric [1] scl = low determination vih [2] iric clear sda secures a high period scl = low detected figure 13.32 iric flag clearing timing when wait = 1 note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr. 11. note on icdr read and iccr access in slave transmit mode in i 2 c bus interface slave transmit mode, do not read icdr or do not read/write from/to iccr during the time shaded in figure 13.33. however, such read and write operations cause no problem in interrupt handling processing that is generated in synchronization with the rising edge of the 9th clock pulse because the shaded time has passed before making the transition to interrupt handling. to handle interrupts securely, be sure to keep either of the following conditions. ? read icdr data that has been received so far or read/write from/to iccr before starting the receive operation of the next slave address. ? monitor the bc2 to bc0 bit counter in icmr; when the count is 000 (8th or 9th clock pulse), wait for at least two transfer clock times in order to read icdr or read/write from/to iccr during the time other than the shaded time. data transmission bit 7 address reception scl trs bit waveform at problem occurrence icdr read and iccr read/write are disabled (6 system clock period) 8 r/w a 9 the rise of the 9th clock is detected sda icdr write figure 13.33 icdr read and iccr access timing in slave transmit mode
rev. 1.0, 09/02, page 342 of 524 note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr. 12. note on trs bit setting in slave mode in i 2 c bus interface slave mode, if the trs bit value in iccr is set after detecting the rising edge of the 9th clock pulse or the stop condition before detecting the next rising edge on the scl pin (the time indicated as (a) in figure 13.34), the bit value becomes valid immediately when it is set. however, if the trs bit is set during the other time (the time indicated as (b) in figure 13.34), the bit value is suspended and remains invalid until the rising edge of the 9th clock pulse or the stop condition is detected. therefore, when the address is received after the restart condition is input without the stop condition, the effective trs bit value remains 1 (transmit mode) internally and thus the acknowledge bit is not transmitted after the address has been received at the 9th clock pulse. to receive the address in slave mode, clear the trs bit to 0 during the time indicated as (a) in figure 13.34. to release the scl low level that is held by means of the wait function in slave mode, clear the trs bit to and then dummy-read icdr. restart condition data transmission address reception scl trs trs bit setting is suspended in this period icdr dummy read trs bit setting (a) (b) 8 a 9 123 456789 the rise of the 9th clock is detected sda the rise of the 9th clock is detected figure 13.34 trs bit set timing in slave mode note: this restriction on usage can be canceled by setting the fnc1 and fnc0 bits to 1 in icxr.
rev. 1.0, 09/02, page 343 of 524 13. note on icdr read in transmit mode and icdr write in receive mode if icdr is read in transmit mode (trs = 1) or icdr is written to in receive mode (trs = 0), the scl pin may not be held low in some cases after transmit/receive operation has been completed, thus inconveniently allowing clock pulses to be output on the scl bus line before icdr is accessed correctly. to access icdr correctly, read icdr after setting receive mode or write to icdr after setting transmit mode. 14. note on acke and trs bits in slave mode in the i 2 c bus interface, if 1 is received as the acknowledge bit value (ackb = 1) in transmit mode (trs = 1) and then the address is received in slave mode without performing appropriate processing, interrupt handling may start at the rising edge of the 9th clock pulse even when the address does not match. similarly, if the start condition or address is transmitted from the master device in slave transmit mode (trs = 1), the iric flag may be set after the icdre flag is set and 1 received as the acknowledge bit value (ackb = 1), thus causing an interrupt source even when the address does not match. to use the i 2 c bus interface module in slave mode, be sure to follow the procedures below. a. when having received 1 as the acknowledge bit value for the last transmit data at the end of a series of transmit operation, clear the acke bit in iccr once to initialize the ackb bit to 0. b. set receive mode (trs = 0) before the next start condition is input in slave mode. complete transmit operation by the procedure shown in figure 13.23, in order to switch from slave transmit mode to slave receive mode. 13.6.1 module stop mode setting the iic operation can be enabled or disabled using the module stop control register. the initial setting is for the iic operation to be halted. register access is enabled by canceling module stop mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 344 of 524
rev. 1.0, 09/02, page 345 of 524 section 14 keyboard buffer controller this lsi has three on-chip keyboard buffer controller channels. the keyboard buffer controller is provided with functions conforming to the ps/2 interface specifications. data transfer using the keyboard buffer controller employs a data line (kd) and a clock line (kclk), providing economical use of connectors, board surface area, etc. figure 14.1 shows a block diagram of the keyboard buffer controller. 14.1 features conforms to ps/2 interface specifications direct bus drive (via the kclk and kd pins) interrupt sources: on completion of data reception and on detection of clock edge error detection: parity error and stop bit monitoring kd (ps2ad, ps2bd, ps2cd) kdi kclki kdo kclko parity register counter value kbi interrupt kclk (ps2ac, ps2bc, ps2cc) legend kd: kbc data i/o pin kclk: kbc clock i/o pin kbbr: keyboard data buffer register kbcrh: keyboard control register h kbcrl: keyboard control register l control logic kbbr kbcrh kbcrl bus interface internal data bus module data bus figure 14.1 block diagram of keyboard buffer controller ifkey10a_000020020800
rev. 1.0, 09/02, page 346 of 524 figure 14.2 shows how the keyboard buffer controller is connected. vcc kclk in kclk out kd in kd out keyboard buffer controller (this lsi) system side kclk in kclk out kd in kd out i/f keyboard side vcc clock data figure 14.2 keyboard buffer controller connection 14.2 input/output pins table 14.1 lists the input/output pins used by the keyboard buffer controller. table 14.1 pin configuration channel name abbreviation * i/o function kbc clock i/o pin (kclk0) ps2ac i/o kbc clock input/output 0 kbc data i/o pin (kd0) ps2ad i/o kbc data input/output kbc clock i/o pin (kclk1) ps2bc i/o kbc clock input/output 1 kbc data i/o pin (kd1) ps2bd i/o kbc data input/output kbc clock i/o pin (kclk2) ps2cc i/o kbc clock input/output 2 kbc data i/o pin (kd2) ps2cd i/o kbc data input/output note: * these are the external i/o pin names. in the text, clock i/o pins are referred to as kclk and data i/o pins as kd, omitting the channel designations.
rev. 1.0, 09/02, page 347 of 524 14.3 register descriptions the keyboard buffer controller has the following registers for each channel. keyboard control register h (kbcrh) keyboard control register l (kbcrl) keyboard data buffer register (kbbr) 14.3.1 keyboard control register h (kbcrh) kbcrh indicates the operating status of the keyboard buffer controller. bit bit name initial value r/w description 7 kbioe 0 r/w keyboard in/out enable selects whether or not the keyboard buffer controller is used. 0: the keyboard buffer controller is non-operational (kclk and kd signal pins have port functions) 1: the keyboard buffer controller is enabled for transmission and reception (kclk and kd signal pins are in the bus drive state) 6 kclki 1 r keyboard clock in monitors the kclk i/o pin. this bit cannot be modified. 0: kclk i/o pin is low 1: kclk i/o pin is high 5 kdi 1 r keyboard data in: monitors the kdi i/o pin. this bit cannot be modified. 0: kd i/o pin is low 1: kd i/o pin is high 4 kbfsel 1 r/w keyboard buffer register full select selects whether the kbf bit is used as the keyboard buffer register full flag or as the kclk fall interrupt flag. when kbfsel is cleared to 0, the kbe bit in kbcrl should be cleared to 0 to disable reception. 0: kbf bit is used as kclk fall interrupt flag 1: kbf bit is used as keyboard buffer register full flag
rev. 1.0, 09/02, page 348 of 524 bit bit name initial value r/w description 3 kbie 0 r/w keyboard interrupt enable enables or disables interrupts from the keyboard buffer controller to the cpu. 0: interrupt requests are disabled 1: interrupt requests are enabled 2 kbf 0 r/(w) * keyboard buffer register full indicates that data reception has been completed and the received data is in kbbr. 0: [clearing condition] read kbf when kbf =1, then write 0 in kbf 1: [setting conditions] when data has been received normally and has been transferred to kbbr while kbfsel = 1 (keyboard buffer register full flag) when a kclk falling edge is detected while kbfsel = 0 (kclk interrupt flag) 1 per 0 r/(w) * parity error indicates that an odd parity error has occurred. 0: [clearing condition] read per when per =1, then write 0 in per 1: [setting condition] when an odd parity error occurs 0 kbs 0 r keyboard stop indicates the receive data stop bit. valid only when kbf = 1. 0: 0 stop bit received 1: 1 stop bit received note: * only 0 can be written for clearing the flag.
rev. 1.0, 09/02, page 349 of 524 14.3.2 keyboard control register l (kbcrl) kbcrl enables the receive counter count and controls the keyboard buffer controller pin output. bit bit name initial value r/w description 7 kbe 0 r/w keyboard enable enables or disables loading of receive data into kbbr. 0: loading of receive data into kbbr is disabled 1: loading of receive data into kbbr is enabled 6 kclko 1 r/w keyboard clock out controls kbc clock i/o pin output. 0: kbc clock i/o pin is low 1: kbc clock i/o pin is high 5 kdo 1 r/w keyboard data out controls kbc data i/o pin output. 0: kbc data i/o pin is low 1: kbc data i/o pin is high 4 1 reserved this bit is always read as 1 and cannot be modified.
rev. 1.0, 09/02, page 350 of 524 bit bit name initial value r/w description 3 2 1 0 rxcr3 rxcr2 rxcr1 rxcr0 0 0 0 0 r r r r receive counter these bits indicate the received data bit. their value is incremented on the fall of kclk. these bits cannot be modified. the receive counter is initialized to 0000 by a reset and when 0 is written in kbe. its value returns to 0000 after a stop bit is received. 0000: 0001: start bit 0010: kb0 0011: kb1 0100: kb2 0101: kb3 0110: kb4 0111: kb5 1000: kb6 1001: kb7 1010: parity bit 1011: 11- - : 14.3.3 keyboard data buffer register (kbbr) kbbr stores receive data. its value is valid only when kbf = 1. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 kb7 kb6 kb5 kb4 kb3 kb2 kb1 kb0 0 0 0 0 0 0 0 0 r r r r r r r r keyboard data 7 to 0 8-bit read only data. initialized to h'00 by a reset, in standby mode, watch mode, subactive mode, subsleep mode, and module stop mode, and when kbioe is cleared to 0.
rev. 1.0, 09/02, page 351 of 524 14.4 operation 14.4.1 receive operation in a receive operation, both kclk (clock) and kd (data) are outputs on the keyboard side and inputs on this lsi chip (system) side. kd receives a start bit, 8 data bits (lsb-first), an odd parity bit, and a stop bit, in that order. the kd value is valid when kclk is low. a sample receive processing flowchart is shown in figure 14.3, and the receive timing in figure 14.4. start set kbioe bit read kbcrh kclki and kdi bits both 1? set kbe bit receive enabled state kbf = 1? per = 0? kbs = 1? read kbbr receive data processing clear kbf flag (receive enabled state) keyboard side in data transmission state. execute receive abort processing. error handling [1] set the kbioe bit to 1 in kbcrl. [2] read kbcrh, and if the kclki and kdi bits are both 1, set the kbe bit (receive enabled state). [3] detect the start bit output on the keyboard side and receive data in synchronization with the fall of kclk. [4] when a stop bit is received, the keyboard buffer controller drives kclk low to disable keyboard transmission (automatic i/o inhibit). if the kbie bit is set to 1 in kbcrh, an interrupt request is sent to the cpu at the same time. [5] perform receive data processing. [6] clear the kbf flag to 0 in kbcrl. at the same time, the system automatically drives kclk high, setting the receive enabled state. the receive operation can be continued by repeating steps [3] to [6]. [1] [2] [3] [4] [5] [6] yes no yes yes yes no no no figure 14.3 sample receive processing flowchart
rev. 1.0, 09/02, page 352 of 524 123 kclk (pin state) kd (pin state) kclk (input) kclk (output) kb7 to kb0 per kbs kbf start bit parity bit stop bit receive processing/ error handling automatic i/o inhibit previous data receive data flag cleared 9 10 11 7 01 kb0 kb1 [1] [2] [3] [4] [5] [6] figure 14.4 receive timing 14.4.2 transmit operation in a transmit operation, kclk (clock) is an output on the keyboard side, and kd (data) is an output on the chip (system) side. kd outputs a start bit, 8 data bits (lsb-first), an odd parity bit, and a stop bit, in that order. the kd value is valid when kclk is high. a sample transmit processing flowchart is shown in figure 14.5, and the transmit timing in figure 14.6.
rev. 1.0, 09/02, page 353 of 524 start set kbioe bit kclki = 0? read kbcrh kclki and kdi bits both 1? set i/o inhibit (kclko = 0) kbe = 0 (kbbr reception prohibited) kdo remains at 1 wait set start bit (kdo = 0) clear i/o inhibit (kclko = 1) kclko remains at 0 kdo remains at 0 i = 0 read kbcrh set transmit data (kdo = d(i)) read kbcrh kclki = 1? i = i + 1 i > 9? read kbcrh kclki = 1? yes no i = 0 to 7: transmit data i = 8: parity bit i = 9: stop bit no yes yes yes yes no no no 1 2 [1] set the kbe bit to 1 in kbcrh. [2] read kbcrh, and if the kclki and kdi bits are both 1, write 0 in the kclko bit (set i/o inhibit). [3] write 0 in the kbe bit (prohibit kbbr receive operation). [4] write 0 in the kdo bit (set start bit). [5] write 1 in the kclko bit (clear i/o inhibit). [6] read kbcrh, and when kclki = 0, set the transmit data in the kdo bit (lsb-first). next, set the parity bit and stop bit in the kdo bit. [7] after transmitting the stop bit, read kbcrl and confirm that kdi = 0 (receive completed notification from the keyboard). [8] read kbcrh. confirm that the kclki and kdi bits are both 1. the transmit operation can be continued by repeating steps [2] to [8]. [1] [2] [3] [4] [5] [6] (continued on next page) (continued on next page) figure 14.5 (1) sample transmit processing flowchart
rev. 1.0, 09/02, page 354 of 524 read kbcrh transmit end state (kclk = high, kd = high) yes note: * to switch to reception after transmission, set kbe to 1 (kbbr receive enable) while kclki is low. 1 kclki = 0? no kdi = 0? read kbcrh kclk = 1? yes yes no no error handling to receive operation or transmit operation keyboard side in data transmission state. execute receive abort processing. 2 * [7] [8] figure 14.5 (2) sample transmit processing flowchart 1 01 01 7 7 2891011 kclk (pin state) kd (pin state) kclk (output) kd (output) kclk (input) kd (input) start bit start bit parity bit stop bit parity bit stop bit i/o inhibit receive completed notification [1] [2] [3] [4] [5] [6] [7] [8] figure 14.6 transmit timing
rev. 1.0, 09/02, page 355 of 524 14.4.3 receive abort this lsi (system side) can forcibly abort transmission from the device connected to it (keyboard side) in the event of a protocol error, etc. in this case, the system holds the clock low. during reception, the keyboard also outputs a clock for synchronization, and the clock is monitored when the keyboard output clock is high. if the clock is low at this time, the keyboard judges that there is an abort request from the system, and data transmission from the keyboard is aborted. thus the system can abort reception by holding the clock low for a certain period. a sample receive abort processing flowchart is shown in figure 14.7, and the receive abort timing in figure 14.8. read kbcrl kbf = 0? rxcr3 to rxcr0 3 b'1001? disable receive abort requests yes start receive state read kbcrh processing 1 kclko = 0 (receive abort request) retransmit command transmission (data)? kbe = 0 (disable kbbr reception and clear receive counter) set start bit (kdo = 0) clear i/o inhibit (kclko = 1) transmit data to transmit operation kbe = 0 (disable kbbr reception and clear receive counter) kbe = 1 (enable kb operation) clear i/o inhibit (kclko = 1) to receive operation [1] read kbcrl, and if kbf = 1, perform processing 1. [2] read kbcrh, and if the value of bits rxcr3 to rxcr0 is less than b'1001, write 0 in kclko to abort reception. if the value of bits rxcr3 to rxcr0 is b'1001 or greater, wait until stop bit reception is completed, then perform receive data processing, and proceed to the next operation. [3] if the value of bits rxcr3 to rxcr0 is b'1001 or greater, the parity bit is being received. with the ps2 interface, a receive abort request following parity bit reception is disabled. wait until stop bit reception is completed, perform receive data processing and clear the kbf flag, then proceed to the next operation. yes no no no yes [1] [2] [3] figure 14.7 (1) sample receive abort processing flowchart
rev. 1.0, 09/02, page 356 of 524 receive data processing clear kbf flag (kclk = high) processing 1 receive operation ends normally [1] on the system side, drive the kclk pin low, setting the i/o inhibit state. [1] transmit enabled state. if there is transmit data, the data is transmitted. figure 14.7 (2) sample receive abort processing flowchart keyboard side monitors clock during receive operation (transmit operation as seen from keyboard), and aborts receive operation during this period. kclk (pin state) kd (pin state) kclk (input) kclk (output) kd (input) kd (output) reception in progress receive abort request transmit operation start bit figure 14.8 receive abort and transmit start (transmission/reception switchover) timing
rev. 1.0, 09/02, page 357 of 524 14.4.4 kclki and kdi read timing figure 14.9 shows the kclki and kdi read timing. t 1 t 2 * internal read signal kclk, kd (pin state) kclki, kdi (register) internal data bus (read data) note: * the clock shown here is scaled by 1/n in medium-speed mode when the operating mode is active mode. figure 14.9 kclki and kdi read timing 14.4.5 kclko and kdo write timing figure 14.10 shows the klcko and kdo write timing and the kclk and kd pin states. internal write signal * kclko, kdo (register) kclk, kd (pin state) note: * the clock shown here is scaled by 1/n in medium-speed mode when the operating mode is active mode. t 1 t 2 figure 14.10 kclko and kdo write timing
rev. 1.0, 09/02, page 358 of 524 14.4.6 kbf setting timing and kclk control figure 14.11 shows the kbf setting timing and the kclk pin states. kclk (pin) * internal kclk falling edge signal rxcr3 to rxcr0 kclk (output) kbf 11th fall automatic i/o inhibit b'0000 b'1010 note: * the clock shown here is scaled by 1/n in medium-speed mode when the operating mode is active mode. figure 14.11 kbf setting and kclk automatic i/o inhibit generation timing
rev. 1.0, 09/02, page 359 of 524 14.4.7 receive timing figure 14.12 shows the receive timing. n + 1 n + 2 n kclk (pin) note: * the clock shown here is scaled by 1/n in medium-speed mode when the operating mode is active mode. kd (pin) internal kclk (kclki) falling edge signal rxcr3 to rxcr0 internal kd (kdi) kbbr7 to kbbr0 * figure 14.12 receive counter and kbbr data load timing
rev. 1.0, 09/02, page 360 of 524 14.4.8 kclk fall interrupt operation in this device, clearing the kbfsel bit to 0 in kbcrh enables the kbf bit in kbcrl to be used as a flag for the interrupt generated by the fall of kclk input. figure 14.13 shows the setting method and an example of operation. start set kbioe kbf = 1 (interrupt generated) kbe = 0 (kbbr reception disabled) interrupt handling clear kbf kclk pin fall detected? kbfsel = 0 kbie = 1 (kclk falling edge interrupts enabled) ye s no kclk (pin state) kbf bit interrupt generated interrupt generated cleared by software note: * the kbf setting timing is the same as the timing of kbf setting and kclk automatic i/o inhibit bit generation in figure 14.11. when the kbf bit is used as the kclk input fall interrupt flag, the automatic i/o inhibit function does not operate. figure 14.13 example of kclk input fall interrupt operation
rev. 1.0, 09/02, page 361 of 524 14.5 usage notes 14.5.1 kbioe setting and kclk falling edge detection when kbioe is 0, the internal kclk and internal kd settings are fixed at 1. therefore, if the kclk pin is low when the kbioe bit is set to 1, the edge detection circuit operates and the kclk falling edge is detected. if the kbfsel bit and kbe bit are both 0 at this time, the kbf bit is set. figure 14.14 shows the timing of kbioe setting and kclk falling edge detection. t 1 t 2 kclk (pin) internal kclk (kclki) falling edge signal kbioe kbfsel kbe kbf figure 14.14 kbioe setting and kclk falling edge detection timing 14.5.2 module stop mode setting keyboard buffer controller operation can be enabled or disabled using the module stop control register. the initial setting is for keyboard buffer controller operation to be halted. register access is enabled by canceling module stop mode. for details, refer to section 19, power-down modes.
rev. 1.0, 09/02, page 362 of 524
rev. 1.0, 09/02, page 363 of 524 section 15 host interface lpc interface (lpc) this lsi has an on-chip lpc interface. the lpc performs serial transfer of cycle type, address, and data, synchronized with the 33-mhz pci clock. it uses four signal lines for address/data, and one for host interrupt requests. this lpc module supports only i/o read cycle and i/o write cycle transfers. it is also provided with power-down functions that can control the pci clock and shut down the host interface. 15.1 features supports lpc interface i/o read cycles and i/o write cycles ? uses four signal lines (lad3 to lad0) to transfer the cycle type, address, and data. ? uses three control signals: clock (lclk), reset ( lreset ), and frame ( lframe ). has three register sets comprising data and status registers ? the basic register set comprises three bytes: an input register (idr), output register (odr), and status register (str). ? channels 1 and 2 have fixed i/o addresses of h'60/h'64 and h'62/h'66, respectively. a fast a20 gate function is also provided. ? the i/o address can be set for channel 3. sixteen bidirectional data register bytes can be manipulated in addition to the basic register set. supports serirq ? host interrupt requests are transferred serially on a single signal line (serirq). ? on channel 1, hirq1 and hirq12 can be generated. ? on channels 2 and 3, smi, hirq6, and hirq9 to hirq11 can be generated. ? operation can be switched between quiet mode and continuous mode. ? the clkrun signal can be manipulated to restart the pci clock (lclk). eleven interrupt sources ? the lpc module can be shut down by inputting the lpcpd signal. ? three pins, pme , lsmi , and lsci, are provided for general input/output. ifhstl0a_010020020800
rev. 1.0, 09/02, page 364 of 524 figure 15.1 shows a block diagram of the lpc. twr1C15 idr3 idr2 idr1 h'0060/64 h'0062/66 ladr3 sirqcr0 sirqcr1 twr0mw twr1C15 odr3 odr2 odr1 str3 str2 str1 hicr0 hicr1 hicr2 hicr3 twr0sw lscie lscib lsci input pb1 i/o lsmie lsmib lsmi input pb0 i/o pmee pmeb pme input p80 i/o lad0C lad3 serirq lsci ga20 lclk ibfi1 ibfi2 ibfi3 erri module data bus cycle detection serial ? parallel conversion serial ? parallel conversion address match sync output parallel ? serial conversion control logic internal interrupt control hisel legend hicr0 to hicr3: host interface control registers 0 to 3 ladr3h, 3l: lpc channel 3 address register 3h and 3l idr1 to idr3: input data registers 1 to 3 odr1 to dor3: output data registers 1 to 3 str1 to str3: status registers 1 to 3 hisel: host interface select register twr0mw: two-way register 0mw twr0sw: two-way register 0sw twr1 to twr15: two-way data registers 1 to 15 serirq0, 1: serieq control registers 0 and 1 figure 15.1 block diagram of lpc
rev. 1.0, 09/02, page 365 of 524 15.2 input/output pins table 15.1 lists the input and output pins of the lpc module. table 15.1 pin configuration name abbreviation port i/o function lpc address/ data 3 to 0 lad3 to lad0 p33 to p30 input/ output serial (4-signal-line) transfer cycle type/address/data signals, synchronized with lclk lpc frame lframe p34 input * 1 transfer cycle start and forced termination signal lpc reset lreset p35 input * 1 lpc interface reset signal lpc clock lclk p36 input 33 mhz pci clock signal serialized interrupt request serirq p37 input/ output * 1 serialized host interrupt request signal, synchronized with lclk (smi, irq1, irq6, irq9 to irq12) lsci general output lsci pb1 output * 1, * 2 general output lsmi general output lsmi pb0 output * 1, * 2 general output pme general output pme p80 output * 1, * 2 general output gate a20 ga20 p81 output * 1, * 2 a20 gate control signal output lpc clock run clkrun p82 input/ output * 1, * 2 lclk restart request signal in case of serial host interrupt request lpc power-down lpcpd p83 input * 1 lpc module shutdown signal notes: 1. pin state monitoring input is possible in addition to the lpc interface control input/output function. 2. only 0 can be output. if 1 is output, the pin goes to the high-impedance state, so an external resistor is necessary to pull the signal up to v cc .
rev. 1.0, 09/02, page 366 of 524 15.3 register descriptions the lpc has the following registers. the settings of the hi12e bit in syscr2 do not affect the operation of the lpc. for reasons relating to the configuration of the program development tool (emulator), when the lpc is used, the hi12e bit in syscr2 should not be set to 1. for details, see section 3.2.2, system control register (syscr), and section 7.7.4, system control register 2 (syscr2). host interface control register 0 (hicr0) host interface control register 1 (hicr1) host interface control register 2 (hicr2) host interface control register 3 (hicr3) lpc channel 3 address registers (ladr3h, ladr3l) input data register 1 (idr1) output data register 1 (odr1) status register 1 (str1) input data register 2 (idr2) output data register 2 (odr2) status register 2 (str2) input data register 3 (idr3) output data register 3 (odr3) status register 3 (str3) bidirectional data registers 0 to 15 (twr0 to twr15) serirq control register 0 (sirqcr0) serirq control register 1 (sirqcr1) host interface select register (hisel)
rev. 1.0, 09/02, page 367 of 524 15.3.1 host interface control registers 0 and 1 (hicr0, hicr1) hicr0 and hicr1 contain control bits that enable or disable host interface functions, control bits that determine pin output and the internal state of the host interface, and status flags that monitor the internal state of the host interface. hicr0 r/w bit bit name initial value slave host description 7 6 5 lpc3e lpc2e lpc1e 0 0 0 r/w r/w r/w lpc enable 3 to 1 enable or disable the host interface function in single-chip mode. when the host interface is enabled (one of the three bits is set to 1), processing for data transfer between the slave processor (this lsi) and the host processor is performed using pins lad3 to lad0, lframe , lreset , lclk, serirq, clkrun , and lpcpd . lpc3e 0: lpc channel 3 operation is disabled no address (ladr3) matches for idr3, odr3, str3, or twr0 to twr15 1: lpc channel 3 operation is enabled lpc2e 0: lpc channel 2 operation is disabled no address (h'0062, 66) matches for idr2, odr2, or str2 1: lpc channel 2 operation is enabled lpc1e 0: lpc channel 1 operation is disabled no address (h'0060, 64) matches for idr1, odr1, or str1 1: lpc channel 1 operation is enabled
rev. 1.0, 09/02, page 368 of 524 r/w bit bit name initial value slave host description 4 fga20e 0 r/w fast a20 gate function enable enables or disables the fast a20 gate function. when the fast a20 gate is disabled, the normal a20 gate can be implemented by firmware operation of the p81 output. when the fast a20 gate function is enabled, the ddr bit for p81 must not be set to 1. 0: fast a20 gate function disabled other function of pin p81 is enabled ga20 output internal state is initialized to 1 1: fast a20 gate function enabled ga20 pin output is open-drain (external vcc pull- up resistor required) 3 sdwne 0 r/w lpc software shutdown enable controls host interface shutdown. for details of the lpc shutdown function, and the scope of initialization by an lpc reset and an lpc shutdown, see section 15.4.4, host interface shutdown function (lpcpd). 0: normal state, lpc software shutdown setting enabled [clearing conditions] writing 0 lpc hardware reset or lpc software reset lpc hardware shutdown release (rising edge of lpcpd signal) 1: lpc hardware shutdown state setting enabled hardware shutdown state when lpcpd signal is low [setting condition] writing 1 after reading sdwne = 0
rev. 1.0, 09/02, page 369 of 524 r/w bit bit name initial value slave host description 2 pmee 0 r/w pme output enable controls pme output in combination with the pmeb bit in hicr1. pme pin output is open-drain, and an external pull-up resistor is needed to pull the output up to v cc . when the pme output function is used, the ddr bit for p80 must not be set to 1. pmee pmeb 0 x: pme output disabled, other function of pin is enabled 1 0: pme output enabled, pme pin output goes to 0 level 1 1: pme output enabled, pme pin output is high-impedance 1 lsmie 0 r/w lsmi output enable controls lsmi output in combination with the lsmib bit in hicr1. lsmi pin output is open-drain, and an external pull-up resistor is needed to pull the output up to v cc . when the lsmi output function is used, the ddr bit for pb0 must not be set to 1. lsmie lsmib 0 x: lsmi output disabled, other function of pin is enabled 1 0: lsmi output enabled, lsmi pin output goes to 0 level 1 1: lsmi output enabled, lsmi pin output is high-impedance
rev. 1.0, 09/02, page 370 of 524 r/w bit bit name initial value slave host description 0 lscie 0 r/w lsci output enable controls lsci output in combination with the lscib bit in hicr1. lsci pin output is open-drain, and an external pull-up resistor is needed to pull the output up to v cc when the lsci output function is used, the ddr bit for pb1 must not be set to 1. lscie lscib 0 x: lsci output disabled, other function of pin is enabled 1 0: lsci output enabled, lsci pin output goes to 0 level 1 1: lsci output enabled, lsci pin output is high-impedance legend x: don't care
rev. 1.0, 09/02, page 371 of 524 hicr1 r/w bit bit name initial value slave host description 7 lpcbsy 0 r/w lpc busy indicates that the host interface is processing a transfer cycle. 0: host interface is in transfer cycle wait state bus idle, or transfer cycle not subject to processing is in progress cycle type or address indeterminate during transfer cycle [clearing conditions] lpc hardware reset or lpc software reset lpc hardware shutdown or lpc software shutdown forced termination (abort) of transfer cycle subject to processing normal termination of transfer cycle subject to processing 1: host interface is performing transfer cycle processing [setting condition] match of cycle type and address
rev. 1.0, 09/02, page 372 of 524 r/w bit bit name initial value slave host description 6 clkreq 0 r lclk request indicates that the host interfaces serirq output is requesting a restart of lclk. 0: no lclk restart request [clearing conditions] lpc hardware reset or lpc software reset lpc hardware shutdown or lpc software shutdown serirq is set to continuous mode there are no further interrupts for transfer to the host in quiet mode 1: lclk restart request issued [setting condition] in quiet mode, serirq interrupt output becomes necessary while lclk is stopped 5 irqbsy 0 r serirq busy indicates that the host interfaces serirq signal is engaged in transfer processing. 0: serirq transfer frame wait state [clearing conditions] lpc hardware reset or lpc software reset lpc hardware shutdown or lpc software shutdown end of serirq transfer frame 1: serirq transfer processing in progress [setting condition] start of serirq transfer frame
rev. 1.0, 09/02, page 373 of 524 r/w bit bit name initial value slave host description 4 lrstb 0 lpc software reset bit resets the host interface. for the scope of initialization by an lpc reset, see section 15.4.4, host interface shutdown function (lpcpd). 0: normal state [clearing conditions] writing 0 lpc hardware reset 1: lpc software reset state [setting condition] writing 1 after reading lrstb = 0 3 sdwnb 0 r/w lpc software shutdown bit controls host interface shutdown. for details of the lpc shutdown function, and the scope of initialization by an lpc reset and an lpc shutdown, see section 15.4.4, host interface shutdown function (lpcpd). 0: normal state [clearing conditions] writing 0 lpc hardware reset or lpc software reset lpc hardware shutdown lpc hardware shutdown release (rising edge of lpcpd signal when sdwne = 0) 1: lpc software shutdown state [setting condition] writing 1 after reading sdwnb = 0 2 pmeb 0 r/w pme output bit controls pme output in combination with the pmee bit. for details, refer to description on the pmee bit in hicr0. 1 lsmib 0 r/w lsmi output bit controls lsmi output in combination with the lsmie bit. for details, refer to description on the lsmie bit in hicr0.
rev. 1.0, 09/02, page 374 of 524 r/w bit bit name initial value slave host description 0 lscib 0 r/w lsci output bit controls lsci output in combination with the lscie bit in hicr1. for details, refer to description on the lscie bit. 15.3.2 host interface control registers 2 and 3 (hicr2, hicr3) bits 6 to 0 in hicr2 control interrupts from the host interface (lpc) module to the slave processor (this lsi). bit 7 in hicr2 and hicr3 monitor host interface pin states. the pin states can be monitored regardless of the host interface operating state or the operating state of the functions that use pin multiplexing. hicr2 r/w bit bit name initial value slave host description 7 ga20 undefined r ga20 pin monitor 6 lrst 0 r/(w) * lpc reset interrupt flag this bit is a flag that generates an erri interrupt when an lpc hardware reset occurs. 0: [clearing conditions] writing 0 after reading lrst = 1 1: [setting condition] lreset pin falling edge detection 5 sdwn 0 r/(w) * lpc shutdown interrupt flag this bit is a flag that generates an erri interrupt when an lpc hardware shutdown request is generated. 0: [clearing conditions] writing 0 after reading sdwn = 1 lpc hardware reset and lpc software reset 1: [setting condition] lpcpd pin falling edge detection
rev. 1.0, 09/02, page 375 of 524 r/w bit bit name initial value slave host description 4 abrt 0 r/(w) * lpc abort interrupt flag this bit is a flag that generates an erri interrupt when a forced termination (abort) of an lpc transfer cycle occurs. 0: [clearing conditions] writing 0 after reading abrt = 1 lpc hardware reset and lpc software reset lpc hardware shutdown and lpc software shutdown 1: [setting condition] lframe pin falling edge detection during lpc transfer cycle 3 ibfie3 0 r/w idr3 and twr receive completion interrupt enable enables or disables ibfi3 interrupt to the slave processor (this lsi). 0: input data register idr3 and twr receive completed interrupt requests disabled 1: [when twrie = 0 in ladr3] input data register (idr3) receive completed interrupt requests enabled [when twrie = 1 in ladr3] input data register (idr3) and twr receive completed interrupt requests enabled 2 ibfie2 0 r/w idr2 receive completion interrupt enable enables or disables ibfi2 interrupt to the slave processor (this lsi). 0: input data register (idr2) receive completed interrupt requests disabled 1: input data register (idr2) receive completed interrupt requests enabled 1 ibfie1 0 r/w idr1 receive completion interrupt enable enables or disables ibfi1 interrupt to the slave processor (this lsi). 0: input data register (idr1) receive completed interrupt requests disabled 1: input data register (idr1) receive completed interrupt requests enabled
rev. 1.0, 09/02, page 376 of 524 r/w bit bit name initial value slave host description 0 errie 0 r/w error interrupt enable enables or disables erri interrupt to the slave processor (this lsi). 0: error interrupt requests disabled 1: error interrupt requests enabled note: * only 0 can be written to bits 6 to 4, to clear the flag. hicr3 r/w bit bit name initial value slave host description 7 lframe undefined r lframe pin monitor 6 clkrun undefined r clkrun pin monitor 5 serirq undefined r serirq pin monitor 4 lreset undefined r lreset pin monitor 3 lpcpd undefined r lpcpd pin monitor 2 pme undefined r pme pin monitor 1 lsmi undefined r lsmi pin monitor 0 lsci undefined r lsci pin monitor
rev. 1.0, 09/02, page 377 of 524 15.3.3 lpc channel 3 address register (ladr3) ladr3 comprises two 8-bit readable/writable registers that perform lpc channel-3 host address setting and control the operation of the bidirectional data registers. the contents of the address field in ladr3 must not be changed while channel 3 is operating (while lpc3e is set to 1). ladr3h bit bit name initial value r/w description 7 6 5 4 3 2 1 0 bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w channel 3 address bits 15 to 8: when lpc3e = 1, an i/o address received in an lpc i/o cycle is compared with the contents of ladr3. when determining an idr3, odr3, or str3 address match, bit 0 of ladr3 is regarded as 0, and the value of bit 2 is ignored. when determining a twr0 to twr15 address match, bit 4 of ladr3 is inverted, and the values of bits 3 to 0 are ignored. register selection according to the bits ignored in address match determination is as shown in table 15.2. ladr3l bit bit name initial value r/w description 7 6 5 4 3 bit 7 bit 6 bit 5 bit 4 bit 3 0 0 0 0 0 r/w r/w r/w r/w r/w channel 3 address bits 7 to 3 2 ? 0r/wreserved this bit is readable/writable, however, only 0 should be written to this bit. 1 bit 1 0 r/w channel 3 address bit 1 0 twre 0 r/w bidirectional data register enable enables or disables bidirectional data register operation. 0: twr operation is disabled twr-related i/o address match determination is halted 1: twr operation is enabled
rev. 1.0, 09/02, page 378 of 524 table 15.2 register selection i/o address bit 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection bit 4 bit 3 0 bit 1 0 i/o write idr3 write, c/ d 3 ? 0 bit 4 bit 3 1 bit 1 0 i/o write idr3 write, c/ d 3 ? 1 bit 4 bit 3 0 bit 1 0 i/o read odr3 read bit 4 bit 3 1 bit 1 0 i/o read str3 read bit 4 0 0 0 0 i/o write twr0mw write 0 0 0 1 i/o write twr1 to twr15 write bit 4 1111 bit 4 0 0 0 0 i/o read twr0sw read bit 4 0 0 0 1 i/o read twr1 to twr15 read 1111 15.3.4 input data registers 1 to 3 (idr1 to idr3) the idr registers are 8-bit read-only registers for the slave processor (this lsi), and 8-bit write- only registers for the host processor. the registers selected from the host according to the i/o address are shown in the following table. for information on idr3 selection, see section 15.3.3, lpc channel 3 address register (ladr3). data transferred in an lpc i/o write cycle is written to the selected register. the state of bit 2 of the i/o address is latched into the c/ d bit in str, to indicate whether the written information is a command or data. the initial values of idr1 to idr3 are undefined. i/o address bits 15 to 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection 0000 0000 0110 0 0 0 0 i/o write idr1 write, c/ d 1 ? 0 0000 0000 0110 0 1 0 0 i/o write idr1 write, c/ d 1 ? 1 0000 0000 0110 0 0 1 0 i/o write idr2 write, c/ d 2 ? 0 0000 0000 0110 0 1 1 0 i/o write idr2 write, c/ d 2 ? 1
rev. 1.0, 09/02, page 379 of 524 15.3.5 output data registers 1 to 3 (odr1 to odr3) the odr registers are 8-bit readable/writable registers for the slave processor (this lsi), and 8-bit read-only registers for the host processor. the registers selected from the host according to the i/o address are shown in the following table. for information on odr3 selection, see section 15.3.3, lpc channel 3 address register (ladr3). in an lpc i/o read cycle, the data in the selected register is transferred to the host. the initial values of odr1 to odr3 are undefined. i/o address bits 15 to 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection 0000 0000 0110 0 0 0 0 i/o read odr1 read 0000 0000 0110 0 0 1 0 i/o read odr2 read 15.3.6 bidirectional data registers 0 to 15 (twr0 to twr15) the twr registers are sixteen 8-bit readable/writable registers to both the slave processor (this lsi) and the host processor. in twr0, however, two registers (twr0mw and twr0sw) are allocated to the same address for both the host address and the slave address. twr0mw is a write-only register for the host processor, and a read-only register for the slave processor, while twr0sw is a write-only register for the slave processor and a read-only register for the host processor. when the host and slave processors begin a write, after the respective twr0 registers have been written to, access right arbitration for simultaneous access is performed by checking the status flags to see if those writes were valid. for the registers selected from the host according to the i/o address, see section 15.3.3, lpc channel 3 address register (ladr3). data transferred in an lpc i/o write cycle is written to the selected register; in an lpc i/o read cycle, the data in the selected register is transferred to the host. the initial values of twr0 to twr15 are undefined.
rev. 1.0, 09/02, page 380 of 524 15.3.7 status registers 1 to 3 (str1 to str3) the str registers are 8-bit registers that indicate status information during host interface processing. bits 3, 1, and 0 of str1 to str3, and bits 7 to 4 of str3, are read-only bits for both the host processor and the slave processor (this lsi). however, only 0 can be written to bit 0 of str1 to str3 and bits 6 and 4 of str3, from the slave processor (this lsi), in order to clear the flags to 0. the registers selected from the host processor according to the i/o address are shown in the following table. for information on str3 selection, see section 15.3.3, lpc channel 3 address register (ladr3). in an lpc i/o read cycle, the data in the selected register is transferred to the host processor. the initial values of str1 to str3 are h00. i/o address bits 15 to 4 bit 3 bit 2 bit 1 bit 0 transfer cycle host register selection 0000 0000 0110 0 1 0 0 i/o read str1 read 0000 0000 0110 0 1 1 0 i/o read str2 read
rev. 1.0, 09/02, page 381 of 524 str1 r/w bit bit name initial value slave host description 7 6 5 4 dbu17 dbu16 dbu15 dbu14 0 0 0 0 r/w r/w r/w r/w r r r r defined by user the user can use these bits as necessary. 3c/ d 1 0 r r command/data when the host processor writes to an idr register, bit 2 of the i/o address is written into this bit to indicate whether idr contains data or a command. 0: contents of data register (idr) are data 1: contents of data register (idr) are a command 2 dbu12 0 r/w r defined by user the user can use this bit as necessary. 1 ibf1 0 r r input buffer full set to 1 when the host processor writes to idr. this bit is an internal interrupt source to the slave processor (this lsi). ibf is cleared to 0 when the slave processor reads idr. the ibf1 flag setting and clearing conditions are different when the fast a20 gate is used. for details, see table 15.3. 0: [clearing condition] when the slave processor reads idr 1: [setting condition] when the host processor writes to idr using i/o write cycle 0 obf1 0 r/(w) * r output buffer full set to 1 when the slave processor (this lsi) writes to odr. cleared to 0 when the host processor reads odr. 0: [clearing condition] when the host processor reads odr using i/o read cycle, or the slave processor writes 0 to the obf bit 1: [setting condition] when the slave processor writes to odr note: * only 0 can be written to clear the flag.
rev. 1.0, 09/02, page 382 of 524 str2 r/w bit bit name initial value slave host description 7 6 5 4 dbu27 dbu26 dbu25 dbu24 0 0 0 0 r/w r/w r/w r/w r r r r defined by user the user can use these bits as necessary. 3c/ d 2 0 r r command/data when the host processor writes to an idr register, bit 2 of the i/o address is written into this bit to indicate whether idr contains data or a command. 0: contents of data register (idr) are data 1: contents of data register (idr) are a command 2 dbu22 0 r/w r defined by user the user can use this bit as necessary. 1 ibf2 0 r r input buffer full set to 1 when the host processor writes to idr. this bit is an internal interrupt source to the slave processor (this lsi). ibf is cleared to 0 when the slave processor reads idr. the ibf1 flag setting and clearing conditions are different when the fast a20 gate is used. for details, see table 15.3. 0: [clearing condition] when the slave processor reads idr 1: [setting condition] when the host processor writes to idr using i/o write cycle 0 obf2 0 r/(w) * r output buffer full set to 1 when the slave processor (this lsi) writes to odr. cleared to 0 when the host processor reads odr. 0: [clearing condition] when the host processor reads odr using i/o read cycle, or the slave processor writes 0 to the obf bit 1: [setting condition] when the slave processor writes to odr note: * only 0 can be written to clear the flag.
rev. 1.0, 09/02, page 383 of 524 str3 (twre = 1 or selstr3 = 0) r/w bit bit name initial value slave host description 7 ibf3b 0 r r bidirectional data register input buffer full set to 1 when the host processor writes to twr15. this is an internal interrupt source to the slave processor (this lsi). ibf3b is cleared to 0 when the slave processor reads twr15. 0: [clearing condition] when the slave processor reads twr15 1: [setting condition] when the host processor writes to twr15 using i/o write cycle 6obf3b0 r/(w) * r bidirectional data register output buffer full set to 1 when the slave processor (this lsi) writes to twr15. obf3b is cleared to 0 when the host processor reads twr15. 0: [clearing condition] when the host processor reads twr15 using i/o read cycle, or the slave processor writes 0 to the obf3b bit 1: [setting condition] when the slave processor writes to twr15 5 mwmf 0 r r master write mode flag set to 1 when the host processor writes to twr0. mwmf is cleared to 0 when the slave processor (this lsi) reads twr15. 0: [clearing condition] when the slave processor reads twr15 1: [setting condition] when the host processor writes to twr0 using i/o write cycle while swmf = 0
rev. 1.0, 09/02, page 384 of 524 r/w bit bit name initial value slave host description 4 swmf 0 r/(w) * r slave write mode flag set to 1 when the slave processor (this lsi) writes to twr0. in the event of simultaneous writes by the master and the slave, the master write has priority. swmf is cleared to 0 when the host reads twr15 0: [clearing condition] when the host processor reads twr15 using i/o read cycle, or the slave processor writes 0 to the swmf bit 1: [setting condition] when the slave processor writes to twr0 while mwmf = 0 3 c/d3 0 r r command/data when the host processor writes to an idr register, bit 2 of the i/o address is written into this bit to indicate whether idr contains data or a command. 0: contents of data register (idr) are data 1: contents of data register (idr) are a command 2 dbu32 0 r/w r defined by user the user can use this bit as necessary. 1 ibf3a 0 r r input buffer full set to 1 when the host processor writes to idr. this bit is an internal interrupt source to the slave processor (this lsi). ibf is cleared to 0 when the slave processor reads idr. the ibf1 flag setting and clearing conditions are different when the fast a20 gate is used. for details, see table 15.3. 0: [clearing condition] when the slave processor reads idr 1: [setting condition] when the host processor writes to idr using i/o write cycle
rev. 1.0, 09/02, page 385 of 524 r/w bit bit name initial value slave host description 0obf3a0 r/(w) * r output buffer full set to 1 when the slave processor (this lsi) writes to odr. obf3a is cleared to 0 when the host processor reads odr. 0: [clearing condition] when the host processor reads odr using i/o read cycle, or the slave processor writes 0 to the obf bit 1: [setting condition] when the slave processor writes to odr note: * only 0 can be written to clear the flag. str3 (twre = 0 and selstr3 = 1) r/w bit bit name initial value slave host description 7 6 5 4 dbu37 dbu36 dbu35 dbu34 0 0 0 0 r/w r/w r/w r/w r r r r defined by user the user can use these bits as necessary. 3c/ d 3 0 r r command/data when the host processor writes to an idr register, bit 2 of the i/o address is written into this bit to indicate whether idr contains data or a command. 0: contents of data register (idr) are data 1: contents of data register (idr) are a command 2 dbu32 0 r/w r defined by user the user can use this bit as necessary.
rev. 1.0, 09/02, page 386 of 524 r/w bit bit name initial value slave host description 1 ibf3a 0 r r input buffer full set to 1 when the host processor writes to idr. this bit is an internal interrupt source to the slave processor (this lsi). ibf is cleared to 0 when the slave processor reads idr. the ibf1 flag setting and clearing conditions are different when the fast a20 gate is used. for details, see table 15.3. 0: [clearing condition] when the slave processor reads idr 1: [setting condition] when the host processor writes to idr using i/o write cycle 0obf3a0 r/(w) * r output buffer full set to 1 when the slave processor (this lsi) writes to odr. obf3a is cleared to 0 when the host processor reads odr. 0: [clearing condition] when the host processor reads odr using i/o read cycle, or the slave processor writes 0 to the obf bit 1: [setting condition] when the slave processor writes to odr note: * only 0 can be written to clear the flag.
rev. 1.0, 09/02, page 387 of 524 15.3.8 serirq control registers 0 and 1 (sirqcr0, sirqcr1) the sirqcr registers contain status bits that indicate the serirq operating mode and bits that specify serirq interrupt sources. sirqcr0 r/w bit bit name initial value slave host description 7q/ c 0 r quiet/continuous mode flag indicates the mode specified by the host at the end of an serirq transfer cycle (stop frame). 0: continuous mode [clearing conditions] lpc hardware reset, lpc software reset specification by serirq transfer cycle stop frame 1: quiet mode [setting condition] specification by serirq transfer cycle stop frame. 6 selreq 0 r/w start frame initiation request select selects whether start frame initiation is requested when one or more interrupt requests are cleared, or when all interrupt requests are cleared, in quiet mode. 0: start frame initiation is requested when all interrupt requests are cleared in quiet mode. 1: start frame initiation is requested when one or more interrupt requests are cleared in quiet mode. 5 iedir 0 r/w interrupt enable direct mode specifies whether lpc channel 2 and channel 3 serirq interrupt source (smi, irq6, irq9 to irq11) generation is conditional upon obf, or is controlled only by the host interrupt enable bit. 0: host interrupt is requested when host interrupt enable bit and corresponding obf are both set to 1 1: host interrupt is requested when host interrupt enable bit is set to 1
rev. 1.0, 09/02, page 388 of 524 r/w bit bit name initial value slave host description 4 smie3b 0 r/w host smi interrupt enable 3b enables or disables a host smi interrupt request when obf3b is set by a twr15 write. 0: host smi interrupt request by obf3b and smie3b is disabled [clearing conditions] writing 0 to smie3b lpc hardware reset, lpc software reset clearing obf3b to 0 (when iedir = 0) 1: [when iedir = 0] host smi interrupt request by setting obf3b to 1 is enabled [when iedir = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie3b = 0 3 smie3a 0 r/w host smi interrupt enable 3a enables or disables a host smi interrupt request when obf3a is set by an odr3 write. 0: host smi interrupt request by obf3a and smie3a is disabled [clearing conditions] writing 0 to smie3a lpc hardware reset, lpc software reset clearing obf3a to 0 (when iedir = 0) 1: [when iedir = 0] host smi interrupt request by setting obf3a to 1 is enabled [when iedir = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie3a = 0
rev. 1.0, 09/02, page 389 of 524 r/w bit bit name initial value slave host description 2 smie2 0 r/w host smi interrupt enable 2 enables or disables a host smi interrupt request when obf2 is set by an odr2 write. 0: host smi interrupt request by obf2 and smie2 is disabled [clearing conditions] writing 0 to smie2 lpc hardware reset, lpc software reset clearing obf2 to 0 (when iedir = 0) 1: [when iedir = 0] host smi interrupt request by setting obf2 to 1 is enabled [when iedir = 1] host smi interrupt is requested [setting condition] writing 1 after reading smie2 = 0 1 irq12e1 0 r/w host irq12 interrupt enable 1 enables or disables a host irq12 interrupt request when obf1 is set by an odr1 write. 0: host irq12 interrupt request by obf1 and irq12e1 is disabled [clearing conditions] writing 0 to irq12e1 lpc hardware reset, lpc software reset clearing obf1 to 0 1: host irq12 interrupt request by setting obf1 to 1 is enabled [setting condition] writing 1 after reading irq12e1 = 0
rev. 1.0, 09/02, page 390 of 524 r/w bit bit name initial value slave host description 0 irq1e1 0 r/w host irq1 interrupt enable 1 enables or disables a host irq1 interrupt request when obf1 is set by an odr1 write. 0: host irq1 interrupt request by obf1 and irq1e1 is disabled [clearing conditions] writing 0 to irq1e1 lpc hardware reset, lpc software reset clearing obf1 to 0 1: host irq1 interrupt request by setting obf1 to 1 is enabled [setting condition] writing 1 after reading irq1e1 = 0 sirqcr1 r/w bit bit name initial value slave host description 7 irq11e3 0 r/w host irq11 interrupt enable 3 enables or disables a host irq11 interrupt request when obf3a is set by an odr3 write. 0: host irq11 interrupt request by obf3a and irq11e3 is disabled [clearing conditions] writing 0 to irq11e3 lpc hardware reset, lpc software reset clearing obf3a to 0 (when iedir = 0) 1: [when iedir = 0] host irq11 interrupt request by setting obf3a to 1 is enabled [when iedir = 1] host irq11 interrupt is requested. [setting condition] writing 1 after reading irq11e3 = 0
rev. 1.0, 09/02, page 391 of 524 r/w bit bit name initial value slave host description 6 irq10e3 0 r/w host irq10 interrupt enable 3 enables or disables a host irq10 interrupt request when obf3a is set by an odr3 write. 0: host irq10 interrupt request by obf3a and irq10e3 is disabled [clearing conditions] writing 0 to irq10e3 lpc hardware reset, lpc software reset clearing ob3fa to 0 (when iedir = 0) 1: [when iedir = 0] host irq10 interrupt request by setting obf3a to 1 is enabled [when iedir = 1] host irq10 interrupt is requested. [setting condition] writing 1 after reading irq10e3 = 0 5 irq9e3 0 r/w host irq9 interrupt enable 3 enables or disables a host irq9 interrupt request when obf3a is set by an odr3 write. 0: host irq9 interrupt request by obf3a and irq9e3 is disabled [clearing conditions] writing 0 to irq9e3 lpc hardware reset, lpc software reset clearing obf3a to 0 (when iedir = 0) 1: [when iedir = 0] host irq9 interrupt request by setting obf3a to 1 is enabled [when iedir = 1] host irq9 interrupt is requested. [setting condition] writing 1 after reading irq9e3 = 0
rev. 1.0, 09/02, page 392 of 524 r/w bit bit name initial value slave host description 4 irq6e3 0 r/w host irq6 interrupt enable 3 enables or disables a host irq6 interrupt request when obf3a is set by an odr3 write. 0: host irq6 interrupt request by obf3a and irq6e3 is disabled [clearing conditions] writing 0 to irq6e3 lpc hardware reset, lpc software reset clearing obf3a to 0 (when iedir = 0) 1: [when iedir = 0] host irq6 interrupt request by setting obf3a to 1 is enabled [when iedir = 1] host irq6 interrupt is requested. [setting condition] writing 1 after reading irq6e3 = 0 3 irq11e2 0 r/w host irq11 interrupt enable 2 enables or disables a host irq11 interrupt request when obf2 is set by an odr2 write. 0: host irq11 interrupt request by obf2 and irq11e2 is disabled [clearing conditions] writing 0 to irq11e2 lpc hardware reset, lpc software reset clearing obf2 to 0 (when iedir = 0) 1: [when iedir = 0] host irq11 interrupt request by setting obf2 to 1 is enabled [when iedir = 1] host irq11 interrupt is requested. [setting condition] writing 1 after reading irq11e2 = 0
rev. 1.0, 09/02, page 393 of 524 r/w bit bit name initial value slave host description 2 irq10e2 0 r/w host irq10 interrupt enable 2 enables or disables a host irq10 interrupt request when obf2 is set by an odr2 write. 0: host irq10 interrupt request by obf2 and irq10e2 is disabled [clearing conditions] writing 0 to irq10e2 lpc hardware reset, lpc software reset clearing obf2 to 0 (when iedir = 0) 1: [when iedir = 0] host irq10 interrupt request by setting obf2 to 1 is enabled [when iedir = 1] host irq10 interrupt is requested. [setting condition] writing 1 after reading irq10e2 = 0 1 irq9e2 0 r/w host irq9 interrupt enable 2 enables or disables a host irq9 interrupt request when obf2 is set by an odr2 write. 0: host irq9 interrupt request by obf2 and irq9e2 is disabled [clearing conditions] writing 0 to irq9e2 lpc hardware reset, lpc software reset clearing obf2 to 0 (when iedir = 0) 1: [when iedir = 0] host irq9 interrupt request by setting obf2 to 1 is enabled [when iedir = 1] host irq9 interrupt is requested. [setting condition] writing 1 after reading irq9e2 = 0
rev. 1.0, 09/02, page 394 of 524 r/w bit bit name initial value slave host description 0 irq6e2 0 r/w host irq6 interrupt enable 2 enables or disables a host irq6 interrupt request when obf2 is set by an odr2 write. 0: host irq6 interrupt request by obf2 and irq6e2 is disabled [clearing conditions] writing 0 to irq6e2 lpc hardware reset, lpc software reset clearing obf2 to 0 (when iedir = 0) 1: [when iedir = 0] host irq6 interrupt request by setting obf2 to 1 is enabled [when iedir = 1] host irq6 interrupt is requested. [setting condition] writing 1 after reading irq6e2 = 0
rev. 1.0, 09/02, page 395 of 524 15.3.9 host interface select register (hisel) hisel selects the function of bits 7 to 4 in str3 and specifies the output of the host interrupt request signal of each frame. r/w bit bit name initial value slave host description 7 selstr3 0 w str3 register function select 3 selects the function of bits 7 to 4 in str3 in combination with the twre bit in ladr3l. see description on str3 in section 15.3.7, status registers 1 to 3 (str1 to str3), for details. 0: bits 7 to 4 in str3 are status bits of the host interface. 1: [when twre = 1] bits 7 to 4 in str3 are status bits of the host interface. [when twre = 0] bits 7 to 4 in str3 are user bits. 6 5 4 3 2 1 0 selirq11 selirq10 selirq9 selirq6 selsmi selirq12 selirq1 0 0 0 0 0 1 1 w w w w w w w serirq output select selects the pin output status of host interrupt requests (hirq11, hirq10, hirq9, hirq6, smi, hirq12, and hirq1) of the lpc. 0: [when host interrupt request is cleared] serirq pin output is in the high-impedance state. [when host interrupt request is set] serirq pin output is 0. 1: [when host interrupt request is cleared] serirq pin output is 0. [when host interrupt request is set] serirq pin output is in the high-impedance state.
rev. 1.0, 09/02, page 396 of 524 15.4 operation 15.4.1 host interface activation the host interface is activated by setting one of bits lpc3e to lpc1e in hicr0 to 1 in single- chip mode. when the host interface is activated, the related i/o ports (ports 37 to 30, ports 83 and 82) function as dedicated host interface input/output pins. in addition, setting the fga20e, pmee, lsmie, and lscie bits to 1 adds the related i/o ports (ports 81 and 80, ports pb0 and pb1) to the host interfaces input/output pins. use the following procedure to activate the host interface after a reset release. 1. read the signal line status and confirm that the lpc module can be connected. also check that the lpc module is initialized internally. 2. when using channel 3, set ladr3 to determine the channel 3 i/o address and whether bidirectional data registers are to be used. 3. set the enable bit (lpc3e to lpc1e) for the channel to be used. 4. set the enable bits (ga20e, pmee, lsmie, and lscie) for the additional functions to be used. 5. set the selection bits for other functions (sdwne, iedir). 6. as a precaution, clear the interrupt flags (lrst, sdwn, abrt, obf). read idr or twr15 to clear ibf. 7. set interrupt enable bits (ibfie3 to ibfie1, errie) as necessary.
rev. 1.0, 09/02, page 397 of 524 15.4.2 lpc i/o cycles there are ten kinds of lpc transfer cycle: memory read, memory write, i/o read, i/o write, dma read, dma write, bus master memory read, bus master memory write, bus master i/o read, and bus master i/o write. of these, the chip's lpc supports only i/o read and i/o write cycles. an lpc transfer cycle is started when the lframe signal goes low in the bus idle state. if the lframe signal goes low when the bus is not idle, this means that a forced termination (abort) of the lpc transfer cycle has been requested. in an i/o read cycle or i/o write cycle, transfer is carried out using lad3 to lad0 in the following order, in synchronization with lclk. the host can be made to wait by sending back a value other than b 0000 in the slaves synchronization return cycle, but with the chips lpc a value of b 0000 is always returned. if the received address matches the host address in an lpc register (idr, odr, str, twr), the host interface enters the busy state; it returns to the idle state by output of a state count 12 turnaround. register and flag changes are made at this timing, so in the event of a transfer cycle forced termination (abort) before state #12, registers and flags are not changed. i/o read cycle i/o write cycle state count contents drive source value (3 to 0) contents drive source value (3 to 0) 1 start host 0000 start host 0000 2 cycle type/direction host 0000 cycle type/direction host 0010 3 address 1 host bits 15 to 12 address 1 host bits 15 to 12 4 address 2 host bits 11 to 8 address 2 host bits 11 to 8 5 address 3 host bits 7 to 4 address 3 host bits 7 to 4 6 address 4 host bits 3 to 0 address 4 host bits 3 to 0 7 turnaround (recovery) host 1111 data 1 host bits 3 to 0 8 turnaround none zzzz data 2 host bits 7 to 4 9 synchronization slave 0000 turnaround (recovery) host 1111 10 data 1 slave bits 3 to 0 turnaround none zzzz 11 data 2 slave bits 7 to 4 synchronization slave 0000 12 turnaround (recovery) slave 1111 turnaround (recovery) slave 1111 13 turnaround none zzzz turnaround none zzzz
rev. 1.0, 09/02, page 398 of 524 the timing of the lframe , lclk, and lad signals is shown in figures 15.2 and 15.3. addr start lad3Clad0 number of clocks lclk tar sync data tar start cycle type, direction, and size 114 1 2221 figure 15.2 typical l f r a m e timing addr start lad3Clad0 lclk tar sync cycle type, direction, and size slave must stop driving too many syncs cause timeout master will drive high figure 15.3 abort mechanism
rev. 1.0, 09/02, page 399 of 524 15.4.3 a20 gate the a20 gate signal can mask address a20 to emulate an addressing mode used by personal computers with an 8086*-family cpu. a regular-speed a20 gate signal can be output under firmware control. the fast a20 gate function that is speeded up by hardware is enabled by setting the fga20e bit to 1 in hicr0. note: an intel microprocessor regular a20 gate operation: output of the a20 gate signal can be controlled by an h'd1 command followed by data. when the slave processor (this lsi) receives data, it normally uses an interrupt routine activated by the ibf1 interrupt to read idr1. at this time, firmware copies bit 1 of data following an h'd1 command and outputs it at the gate a20 pin. fast a20 gate operation: the internal state of ga20 output is initialized to 1 when fga20e = 0. when the fga20e bit is set to 1, p81/ga20 is used for output of a fast a20 gate signal. the state of the p81/ga20 pin can be monitored by reading the ga20 bit in hicr2. the initial output from this pin will be a logic 1, which is the initial value. afterward, the host processor can manipulate the output from this pin by sending commands and data. this function is only available via the idr1 register. the host interface decodes commands input from the host. when an h'd1 host command is detected, bit 1 of the data following the host command is output from the ga20 output pin. this operation does not depend on firmware or interrupts, and is faster than the regular processing using interrupts. table 15.3 shows the conditions that set and clear ga20 (p81). figure 15.4 shows the ga20 output in flowchart form. table 15.4 indicates the ga20 output signal values. table 15.3 ga20 (p81) set/clear timing pin name setting condition clearing condition ga20 (p81) when bit 1 of the data that follows an h'd1 host command is 1 when bit 1 of the data that follows an h'd1 host command is 0
rev. 1.0, 09/02, page 400 of 524 start wait for next byte h'd1 command received? host write host write yes no data byte? no write bit 1 of data byte to dr bit of p81/ga20 yes figure 15.4 ga20 output
rev. 1.0, 09/02, page 401 of 524 table 15.4 fast a20 gate output signals ha0 data/command internal cpu interrupt flag (ibf) ga20 (p81) remarks 1 h'd1 command 0 q 0 1 data * 1 01 1 h'ff command 0 q (1) turn-on sequence 1 h'd1 command 0 q 0 0 data * 2 00 1 h'ff command 0 q (0) turn-off sequence 1 h'd1 command 0 q 0 1 data * 1 01 1/0 command other than h'ff and h'd1 1 q (1) turn-on sequence (abbreviated form) 1 h'd1 command 0 q 0 0 data * 2 00 1/0 command other than h'ff and h'd1 1 q (0) turn-off sequence (abbreviated form) 1 h'd1 command 0 q 1 command other than h'd1 1 q cancelled sequence 1 h'd1 command 0 q 1 h'd1 command 0 q retriggered sequence 1 h'd1 command 0 q 0 any data 0 1/0 1 h'd1 command 0 q (1/0) consecutively executed sequences notes: 1. arbitrary data with bit 1 set to 1. 2. arbitrary data with bit 1 cleared to 0.
rev. 1.0, 09/02, page 402 of 524 15.4.4 host interface shutdown function (lpcpd) the host interface can be placed in the shutdown state according to the state of the lpcpd pin. there are two kinds of host interface shutdown state: lpc hardware shutdown and lpc software shutdown. the lpc hardware shutdown state is controlled by the lpcpd pin, while the software shutdown state is controlled by the sdwnb bit. in both states, the host interface enters the reset state by itself, and is no longer affected by external signals other than the lreset and lpcpd signals. placing the slave processor in sleep mode or software standby mode is effective in reducing current dissipation in the shutdown state. if software standby mode is set, some means must be provided for exiting software standby mode before clearing the shutdown state with the lpcpd signal. if the sdwne bit has been set to 1 beforehand, the lpc hardware shutdown state is entered at the same time as the lpcpd signal falls, and prior preparation is not possible. if the lpc software shutdown state is set by means of the sdwnb bit, on the other hand, the lpc software shutdown state cannot be cleared at the same time as the rise of the lpcpd signal. taking these points into consideration, the following operating procedure uses a combination of lpc software shutdown and lpc hardware shutdown. 1. clear the sdwne bit to 0. 2. set the errie bit to 1 and wait for an interrupt by the sdwn flag. 3. when an erri interrupt is generated by the sdwn flag, check the host interface internal status flags and perform any necessary processing. 4. set the sdwnb bit to 1 to set lpc software standby mode. 5. set the sdwne bit to 1 and make a transition to lpc hardware standby mode. the sdwnb bit is cleared automatically. 6. check the state of the lpcpd signal to make sure that the lpcpd signal has not risen during steps 3 to 5. if the signal has risen, clear sdwne to 0 to return to the state in step 1. 7. place the slave processor in sleep mode or software standby mode as necessary. 8. if software standby mode has been set, exit software standby mode by some means independent of the lpc. 9. when a rising edge is detected in the lpcpd signal, the sdwne bit is automatically cleared to 0. if the slave processor has been placed in sleep mode, the mode is exited by means of lreset signal input, on completion of the lpc transfer cycle, or by some other means.
rev. 1.0, 09/02, page 403 of 524 table 15.5 shows the scope of the host interface pin shutdown. table 15.5 scope of host interface pin shutdown abbreviation port scope of shutdown i/o notes lad3 to lad0 p33Cp30 o i/o hi-z lframe p34 o input hi-z lreset p35 input lpc hardware reset function is active lclk p36 o input hi-z serirq p37 o i/o hi-z lsci pb1 d i/o hi-z, only when lscie = 1 lsmi pb0 d i/o hi-z, only when lsmie = 1 pme p80 d i/o hi-z, only when pmee = 1 ga20 p81 d i/o hi-z, only when fga20e = 1 clkrun p82 o i/o hi-z lpcpd p83 input needed to clear shutdown state legend o: pin that is shutdown by the shutdown function d : pin that is shutdown only when the lpc function is selected by register setting : pin that is not shutdown in the lpc shutdown state, the lpcs internal state and some register bits are initialized. the order of priority of lpc shutdown and reset states is as follows. 1. system reset (reset by stby or res pin input, or wdt0 overflow) ? all register bits, including bits lpc3e to lpc1e, are initialized. 2. lpc hardware reset (reset by lreset pin input) ? lrstb, sdwne, and sdwnb bits are cleared to 0. 3. lpc software reset (reset by lrstb) ? sdwne and sdwnb bits are cleared to 0. 4. lpc hardware shutdown ? sdwnb bit is cleared to 0. 5. lpc software shutdown
rev. 1.0, 09/02, page 404 of 524 the scope of the initialization in each mode is shown in table 15.6. table 15.6 scope of initialization in each host interface mode items initialized system reset lpc reset lpc shutdown lpc transfer cycle sequencer (internal state), lpcbsy and abrt flags initialized initialized initialized serirq transfer cycle sequencer (internal state), clkreq and irqbsy flags initialized initialized initialized host interface flags (ibf1, ibf2, ibf3a, ibf3b, mwmf, c/ d 1, c/ d 2, c/ d 3, obf1, obf2, obf3a, obf3b, swmf, dbu), ga20 (internal state) initialized initialized retained host interrupt enable bits (irq1e1, irq12e1, smie2, irq6e2, irq9e2 to irq11e2, smie3b, smie3a, irq6e3, irq9e3 to irq11e3), q/ c flag, selreq bit initialized initialized retained lrst flag initialized (0) can be set/cleared can be set/cleared sdwn flag initialized (0) initialized (0) can be set/cleared lrstb bit initialized (0) hr: 0 sr: 1 0 (can be set) sdwnb bit initialized (0) initialized (0) hs: 0 ss: 1 sdwne bit initialized (0) initialized (0) hs: 1 ss: 0 or 1 host interface operation control bits (lpc3e to lpc1e, fga20e, ladr3, ibfie1 to ibfie3, pmee, pmeb, lsmie, lsmib, lscie, lscib, twre, selstr3, selirq1, selsmi, selirq6, selirq9, selirq10, selirq11, selirq12) initialized retained retained lreset signal input (port function input input lpcpd signal input input lad3 to lad0, lframe , lclk, serirq, clkrun signals input hi-z pme , lsmi , lsci, ga20 signals (when function is selected) output hi-z pme , lsmi , lsci, ga20 signals (when function is not selected) port function port function
rev. 1.0, 09/02, page 405 of 524 note: system reset: reset by stby input, res input, or wdt overflow lpc reset: reset by lpc hardware reset (hr) or lpc software reset (sr) lpc shutdown: reset by lpc hardware shutdown (hs) or lpc software shutdown (ss) figure 15.5 shows the timing of the lpcpd and lreset signals. lad3Clad0 lclk at least 30 m s at least 100 m s at least 60 m s figure 15.5 power-down state termination timing
rev. 1.0, 09/02, page 406 of 524 15.4.5 host interface serialized interrupt operation (serirq) a host interrupt request can be issued from the host interface by means of the serirq pin. in a host interrupt request via the serirq pin, lclk cycles are counted from the start frame of the serialized interrupt transfer cycle generated by the host or a peripheral function, and a request signal is generated by the frame corresponding to that interrupt. the timing is shown in figure 15.6. irq1 irq1 host controller none none serirq drive source lclk start start frame irq0 frame irq1 frame irq2 frame sl or h hrtr st r st r st irq15 host controller none none serirq driver lclk start stop frame stop frame next cycle irq14 frame irq15 frame r st r st r st rt h i h = host control, sl = slave control, r = recovery, t = turnaround, s = sample h = host control, r = recovery, t = turnaround, s = sample, i = idle figure 15.6 serirq timing the frame configuration of the serialized interrupt transfer cycle is as follows. two of the states comprising each frame are the recover state in which the serirq signal is returned to the 1-level at the end of the frame, and the turnaround state in which the serirq signal is not driven. the recover state must be driven by the host or slave processor that was driving the preceding state.
rev. 1.0, 09/02, page 407 of 524 table 15.7 frame configuration of serial interrupt transfer cycle serial interrupt transfer cycle frame count contents drive source number of states notes 0 start slave host 6 in quiet mode only, slave drive possible in first state, then next 3 states 0-driven by host 1irq0 slave3 2 irq1 slave 3 drive possible in lpc channel 1 3 smi slave 3 drive possible in lpc channels 2 and 3 4irq3 slave3 5irq4 slave3 6irq5 slave3 7 irq6 slave 3 drive possible in lpc channels 2 and 3 8irq7 slave3 9irq8 slave3 10 irq9 slave 3 drive possible in lpc channels 2 and 3 11 irq10 slave 3 drive possible in lpc channels 2 and 3 12 irq11 slave 3 drive possible in lpc channels 2 and 3 13 irq12 slave 3 drive possible in lpc channel 1 14 irq13 slave 3 15 irq14 slave 3 16 irq15 slave 3 17 iochck slave 3 18 stop host undefined first, 1 or more idle states, then 2 or 3 states 0-driven by host 2 states: quiet mode next 3 states: continuous mode next there are two modescontinuous mode and quiet modefor serialized interrupts. the mode initiated in the next transfer cycle is selected by the stop frame of the serialized interrupt transfer cycle that ended before that cycle. in continuous mode, the host initiates host interrupt transfer cycles at regular intervals. in quiet mode, the slave processor with interrupt sources requiring a request can also initiate an interrupt transfer cycle, in addition to the host. in quiet mode, since the host does not necessarily initiate interrupt transfer cycles, it is possible to suspend the clock (lclk) supply and enter the power- down state. in order for a slave to transfer an interrupt request in this case, a request to restart the clock must first be issued to the host. for details, see section 15.4.6, host interface clock start request (clkrun).
rev. 1.0, 09/02, page 408 of 524 15.4.6 host interface clock start request (clkrun) a request to restart the clock (lclk) can be sent to the host processor by means of the clkrun pin. with lpc data transfer and serirq in continuous mode, a clock restart is never requested since the transfer cycles are initiated by the host. with serirq in quiet mode, when a host interrupt request is generated the clkrun signal is driven and a clock (lclk) restart request is sent to the host. the timing for this operation is shown in figure 15.7. clk pull-up enable drive by the host processor drive by the slave processor 1 2 3 4 5 6 figure 15.7 clock start request timing cases other than serirq in quiet mode when clock restart is required must be handled with a different protocol, using the pme signal, etc. 15.5 interrupt sources 15.5.1 ibfi1, ibfi2, ibfi3, and erri the host interface has four interrupt requests for the slave processor (this lsi): ibf1, ibf2, ibf3, and erri. ibfi1, ibfi2, and ibfi3 are idr receive complete interrupts for idr1, idr2, and idr3 and twr, respectively. the erri interrupt indicates the occurrence of a special state such as an lpc reset, lpc shutdown, or transfer cycle abort. an interrupt request is enabled by setting the corresponding enable bit. table 15.8 receive complete interrupts and error interrupt interrupt description ibfi1 when ibfie1 is set to 1 and idr1 reception is completed ibfi2 when ibfie2 is set to 1 and idr2 reception is completed ibfi3 when ibfie3 is set to 1 and idr3 reception is completed, or when twre and ibfie3 are set to 1 and reception is completed up to twr15 erri when errie is set to 1 and one of lrst, sdwn and abrt is set to 1
rev. 1.0, 09/02, page 409 of 524 15.5.2 smi, hirq1, hirq6, hirq9, hirq10, hirq11, and hirq12 the host interface can request seven kinds of host interrupt by means of serirq. hirq1 and hirq12 are used on lpc channel 1 only, while smi, hirq6, hirq9, hirq10, and hirq11 can be requested from lpc channel 2 or 3. there are two ways of clearing a host interrupt request. when the iedir bit is cleared to 0 in sirqcr0, host interrupt sources and lpc channels are all linked to the host interrupt request enable bits. when the obf flag is cleared to 0 by a read of odr or twr15 by the host in the corresponding lpc channel, the corresponding host interrupt enable bit is automatically cleared to 0, and the host interrupt request is cleared. when the iedir bit is set to 1 in sirqcr0, lpc channel 2 and 3 interrupt requests are dependent only upon the host interrupt enable bits. the host interrupt enable bit is not cleared when obf for channel 2 or 3 is cleared. therefore, smie2, smie3a and smie3b, irq6e2 and irq6e3, irq9e2 and irq9e3, irq10e2 and irq10e3, and irq11e2 and irq11e3 lose their respective functional differences. in order to clear a host interrupt request, it is necessary to clear the host interrupt enable bit.
rev. 1.0, 09/02, page 410 of 524 table 15.9 summarizes the methods of setting and clearing these bits, and figure 15.8 shows the processing flowchart. table 15.9 hirq setting and clearing conditions host interrupt setting condition clearing condition hirq1 (independent from iedir) internal cpu writes to odr1, then reads 0 from bit irq1e1 and writes 1 internal cpu writes 0 to bit irq1e1, or host reads odr1 hirq12 (independent from iedir) internal cpu writes to odr1, then reads 0 from bit irq12e1 and writes 1 internal cpu writes 0 to bit irq12e1, or host reads odr1 smi (iedir = 0) internal cpu writes to odr2, then reads 0 from bit smie2 and writes 1 writes to odr3, then reads 0 from bit smie3a and writes 1 writes to twr15, then reads 0 from bit smie3b and writes 1 internal cpu writes 0 to bit smie2, or host reads odr2 writes 0 to bit smie3a, or host reads odr3 writes 0 to bit smie3b, or host reads twr15 smi (iedir = 1) internal cpu reads 0 from bit smie2, then writes 1 reads 0 from bit smie3a, then writes 1 reads 0 from bit smie3b, then writes 1 internal cpu writes 0 to bit smie2 writes 0 to bit smie3a writes 0 to bit smie3b hirqi (i = 6, 9, 10, 11) (iedir = 0) internal cpu writes to odr2, then reads 0 from bit irqie2 and writes 1 writes to odr3, then reads 0 from bit irqie3 and writes 1 internal cpu writes 0 to bit irqie2, or host reads odr2 cpu writes 0 to bit irqie3, or host reads odr3 hirqi (i = 6, 9, 10, 11) (iedir = 1) internal cpu reads 0 from bit irqie2, then writes 1 reads 0 from bit irqie3, then writes 1 internal cpu writes 0 to bit irqie2 writes 0 to bit irqie3
rev. 1.0, 09/02, page 411 of 524 slave cpu master cpu odr1 write write 1 to irq1e1 obf1 = 0? yes no no yes all bytes transferred? serirq irq1 output serirq irq1 source clearance interrupt initiation odr1 read hardware operation software operation figure 15.8 hirq flowchart (example of channel 1) 15.6 usage notes 15.6.1 module stop mode setting lpc operation can be enabled or disabled using the module stop control register. the initial setting is for lpc operation to be halted. register access is enabled by canceling module stop mode. for details, refer to section 19, power-down modes. 15.6.2 notes on using host interface the host interface provides buffering of asynchronous data from the host processor and slave processor (this lsi), but an interface protocol that uses the flags in str must be followed to avoid data contention. for example, if the host and slave processor both try to access idr or odr at the same time, the data will be corrupted. to prevent simultaneous accesses, ibf and obf must be used to allow access only to data for which writing has finished. unlike the idr and odr registers, the transfer direction is not fixed for the bidirectional data registers (twr). mwmf and swmf are provided in str to handle this situation. after writing
rev. 1.0, 09/02, page 412 of 524 to twr0, mwmf and swmf must be used to confirm that the write authority for twr1 to twr15 has been obtained. table 15.10 shows host address examples for ladr3 and registers, idr3, odr3, str3, twr0mw, twr0sw, and twr1 to twr15 when ladr3 = h'a24f and ladr3 = h'3fd0. table 15.10 host address example register host address when ladr3 = h'a24f host address when ladr3 = h'3fd0 idr3 h'a24a and h'a24e h'3fd0 and h'3fd4 odr3 h'a24a h'3fd0 str3 h'a24e h'3fd4 twr0mw h'a250 h'3fc0 twr0sw h'a250 h'3fc0 twr1 h'a251 h'3fc1 twr2 h'a252 h'3fc2 twr3 h'a253 h'3fc3 twr4 h'a254 h'3fc4 twr5 h'a255 h'3fc5 twr6 h'a256 h'3fc6 twr7 h'a257 h'3fc7 twr8 h'a258 h'3fc8 twr9 h'a259 h'3fc9 twr10 h'a25a h'3fca twr11 h'a25b h'3fcb twr12 h'a25c h'3fcc twr13 h'a25d h'3fcd twr14 h'a25e h'3fce twr15 h'a25f h'3fcf
rev. 1.0, 09/02, page 413 of 524 section 16 ram this lsi has an on-chip high-speed static ram. the ram is connected to the cpu by a 16-bit data bus, enabling one-state access by the cpu to both byte data and word data. the on-chip ram can be enabled or disabled by means of the rame bit in the system control register (syscr). for details on syscr, refer to section 3.2.2, system control register (syscr). product classification ram capacitance ram address flash memory version h8s/2110b 2 kbytes h e880 to h efff, h ff00 to h ff7f
rev. 1.0, 09/02, page 414 of 524
rev. 1.0, 09/02, page 415 of 524 section 17 rom this lsi has an on-chip rom (flash memory or masked rom). the features of the flash memory are summarized below. a block diagram of the flash memory is shown in figure 17.1. 17.1 features size product classification rom capacitance rom address h8s/2110b 64 kbytes h000000 to h00ffff (mode 2) h0000 to hdfff (mode 3) programming/erase methods the flash memory is programmed 128 bytes at a time. erase is performed in single-block units. the flash memory is configured as follows: ? 8 kbytes 2 blocks, 16 kbytes 1 block, 28 kbytes 1 block, and 1 kbyte 4 blocks to erase the entire flash memory, each block must be erased in turn. programming/erase time it takes 10 ms (typ.) to program the flash memory 128 bytes at a time; 80 s (typ.) per 1 byte. erasing one block takes 100 ms (typ.). reprogramming capability the flash memory can be reprogrammed up to 100 times. two flash memory on-board programming modes ? boot mode ? user program mode on-board programming/erasing can be done in boot mode in which the boot program built into the chip is started for erase or programming of the entire flash memory. in user program mode, individual blocks can be erased or programmed. automatic bit rate adjustment with data transfer in boot mode, this lsi's bit rate can be automatically adjusted to match the transfer bit rate of the host. programming/erasing protection sets protection against flash memory programming/erasing via hardware, software, or error protection. romf360a_000020020800
rev. 1.0, 09/02, page 416 of 524 programmer mode in addition to on-board programming mode, programmer mode is supported to program or erase the flash memory using a prom programmer. bus interface/controller flash memory (64 kbytes) operating mode internal address bus internal data bus (16 bits) mode pin flmcr2 ebr1 ebr2 flmcr1 legend flmcr1 : flash memory control register 1 flmcr2 : flash memory control register 2 ebr1 : erase block register 1 ebr2 : erase block register 2 module bus figure 17.1 block diagram of flash memory
rev. 1.0, 09/02, page 417 of 524 17.2 mode transitions when the mode pins are set in the reset state and a reset-start is executed, this lsi enters an operating mode as shown in figure 17.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program, and programmer modes are provided as modes to write and erase the flash memory. the differences between boot mode and user program mode are shown in table 17.1. figure 17.3 shows the boot mode and figure 17.4 shows the user program mode. = 0 = 0 flshe = 1 swe = 1 flshe = 0 swe = 0 * 1 * 2 = 0 md1 = 1 = 0 boot mode on-board programming mode user program mode user mode (on-chip rom enabled) reset state programmer mode notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. 1. md1 = md0 = 0, p92 = p91 = p90 = 1 2. md1 = md0 = 0, p92 = 0, p91 = p90 = 1 figure 17.2 flash memory state transitions table 17.1 differences between boot mode and user program mode boot mode user program mode total erase yes yes block erase no yes programming control program * program/program-verify program/program-verify erase/erase-verify note: * should be provided by the user, in accordance with the recommended algorithm.
rev. 1.0, 09/02, page 418 of 524      ! " programming control program sci application program (old version)    boot program new application program sci application program (old version) boot program area new application program sci flash memory erase boot program new application program program execution state sci new application program boot program programming control program     # boot program area       boot program 1. initial state the flash memory is erased at shipment. the following describes how to write over an old-version application program or data in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. sci communication check when boot mode is entered, the boot program in this lsi (originally incorporated in the chip) is started and sci communication is checked. then the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h'ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program transferred from the host to ram via sci communication is executed, and the new application program in the host is written into the flash memory. boot program area programming control program programming control program figure 17.3 boot mode
rev. 1.0, 09/02, page 419 of 524 programming/ erase control program sci boot program new application program sci new application program sci flash memory erase boot program new application program program execution state sci boot program programming/ erase control program      !     boot program transfer program application program (old version)      application program (old version) new application program transfer program transfer program programming/ erase control program     programming/ erase control program transfer program 1. initial state (1) the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. (2) the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer the transfer program in the flash memory is executed and the programming/erase control program is transferred to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h'ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. figure 17.4 user program mode (example)
rev. 1.0, 09/02, page 420 of 524 17.3 block configuration figure 17.5 shows the block configuration of flash memory. the thick lines indicate erasing units, the narrow lines indicate programming units, and the values are addresses. the flash memory is divided into 8 kbytes (2 blocks), 16 kbytes (1 block), 28 kbytes (1 block), and 1 kbyte (4 blocks). erasing is performed in these divided units. programming is performed in 128-byte units starting from an address whose lower bits are h'00 or h'80. eb0 erase unit: 1 kbyte eb1 erase unit: 1 kbyte eb2 erase unit: 1 kbyte eb3 erase unit: 1 kbyte eb4 erase unit: 28 kbytes eb5 erase unit: 16 kbytes eb6 erase unit: 8 kbytes eb7 erase unit: 8 kbytes h'000000 h'000001 h'000002 h'00007f h'0003ff h'00047f h'00087f h'000c7f h'00107f h'007fff h'00807f h'00bfff h'0007ff h'000bff h'000fff h'00c07f h'00dfff h'00e07f h'00ffff programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes programming unit: 128 bytes h'000400 h'000401 h'000402 h'000800 h'000801 h'000802 h'000c00 h'000c01 h'000c02 h'001000 h'001001 h'001002 h'008000 h'008001 h'008002 h'00c000 h'00c001 h'00c002 h'00e000 h'00e001 h'00e002 h'000380 h'000381 h'000382 h'000780 h'000781 h'000782 h'000b80 h'000b81 h'000b82 h'000f80 h'000f81 h'000f82 h'007f80 h'007f81 h'007f82 h'00bf80 h'00bf81 h'00bf82 h'00df80 h'00df81 h'00df82 h'00ff80 h'00ff81 h'00ff82 C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C figure 17.5 flash memory block configuration
rev. 1.0, 09/02, page 421 of 524 17.4 input/output pins the flash memory is controlled by means of the pins shown in table 17.2. table 17.2 pin configuration pin name i/o function res input reset md1 input sets this lsis operating mode md0 input sets this lsis operating mode p92 input sets this lsis operating mode p91 input sets this lsis operating mode p90 input sets this lsis operating mode txd1 output serial transmit data output rxd1 input serial receive data input 17.5 register descriptions the flash memory has the following registers. to access flmcr1, flmcr2, ebr1, or ebr2, the flshe bit in the serial/timer control register (stcr) should be set to 1. for details on the serial/timer control register, refer to section 3.2.3, serial timer control register (stcr). flash memory control register 1 (flmcr1) flash memory control register 2 (flmcr2) erase block register 1 (ebr1) erase block register 2 (ebr2)
rev. 1.0, 09/02, page 422 of 524 17.5.1 flash memory control register 1 (flmcr1) flmcr1, used together with flmcr2, makes the flash memory transit to program mode, program-verify mode, erase mode, or erase-verify mode. for details on register setting, refer to section 17.8, flash memory programming/erasing.flmcr1 is initialized to h'80 by a reset, or in hardware standby mode, software standby mode, sub-active mode, sub-sleep mode, or watch mode. bit bit name initial value r/w description 7 fwe 1 r flash write enable controls programming/erasing of on-chip flash memory. this bit is always read as 0, and cannot be modified. 6 swe 0 r/w software write enable when this bit is set to 1, flash memory programming/erasing is enabled. when this bit is cleared to 0, the ev, pv, e, and p bits in this register, the esu and psu bits in flmcr2, and all ebr1 and ebr2 bits cannot be set to 1. do not clear these bits and swe to 0 simultaneously. 5 4 0 0 r r reserved these bits are always read as 0 and cannot be modified. 3 ev 0 r/w erase-verify when this bit is set to 1 while swe = 1, the flash memory transits to erase-verify mode. when it is cleared to 0, erase-verify mode is cancelled. 2 pv 0 r/w program-verify when this bit is set to 1 while swe = 1, the flash memory transits to program-verify mode. when it is cleared to 0, program-verify mode is cancelled. 1 e 0 r/w erase when this bit is set to 1 while swe = 1 and esu = 1, the flash memory transits to erase mode. when it is cleared to 0, erase mode is cancelled. 0 p 0 r/w program when this bit is set to 1 while swe = 1 and psu = 1, the flash memory transits to program mode. when it is cleared to 0, program mode is cancelled.
rev. 1.0, 09/02, page 423 of 524 17.5.2 flash memory control register 2 (flmcr2) flmcr2 monitors the state of flash memory programming/erasing protection (error protection) and sets up the flash memory to transit to programming/erasing mode. flmcr2 is initialized to h00 by a reset or in hardware standby mode. the esu and psu bits are cleared to 0 in software standby mode, sub-active mode, sub-sleep mode, or watch mode, or when the swe bit in flmcr1 is cleared to 0. bit bit name initial value r/w description 7 fler 0 r flash memory error indicates that an error has occurred during flash memory programming/erasing. when this bit is set to 1, flash memory goes to the error-protection state. for details, see section 17.9.3, error protection. 6 to 2 all 0 r/(w) reserved the initial values should not be modified. 1 esu 0 r/w erase setup when this bit is set to 1 while swe = 1, the flash memory transits to the erase setup state. when it is cleared to 0, the erase setup state is cancelled. set this bit to 1 before setting the e bit in flmcr1 to 1. 0 psu 0 r/w program setup when this bit is set to 1 while swe = 1, the flash memory transits to the program setup state. when it is cleared to 0, the program setup state is cancelled. set this bit to 1 before setting the p bit in flmcr1 to 1.
rev. 1.0, 09/02, page 424 of 524 17.5.3 erase block registers 1 and 2 (ebr1, ebr2) ebr1 and ebr2 are used to specify the flash memory erase block. ebr1 and ebr2 are initialized to h00 by a reset, or in hardware standby mode, software standby mode, sub-active mode, sub-sleep mode, or watch mode, or when the swe bit in flmcr1 is cleared to 0. set only one bit to 1 at a time, otherwise all bits in ebr1 and ebr2 are automatically cleared to 0. ebr1 bit bit name initial value r/w description 7 to 0 all 0 r/(w) reserved the initial values should not be modified. ebr2 bit bit name initial value r/w description 7 eb7 0 r/w * when this bit is set to 1, 8 kbytes of eb7 (h'00e000 to h00ffff) are to be erased. 6 eb6 0 r/w when this bit is set to 1, 8 kbytes of eb6 (h'00c000 to h00dfff) are to be erased. 5 eb5 0 r/w when this bit is set to 1, 16 kbytes of eb5 (h'008000 to h'00bfff) are to be erased. 4 eb4 0 r/w when this bit is set to 1, 28 kbytes of eb4 (h'001000 to h'007fff) are to be erased. 3 eb3 0 r/w when this bit is set to 1, 1 kbyte of eb3 (h'000c00 to h'000fff) is to be erased. 2 eb2 0 r/w when this bit is set to 1, 1 kbyte of eb2 (h'000800 to h'000bff) is to be erased. 1 eb1 0 r/w when this bit is set to 1, 1 kbyte of eb1 (h'000400 to h'0007ff) is to be erased. 0 eb0 0 r/w when this bit is set to 1, 1 kbyte of eb0 (h'000000 to h'0003ff) is to be erased. note: * in normal mode, this bit is always read as 0 and cannot be modified.
rev. 1.0, 09/02, page 425 of 524 17.6 operating modes the flash memory is connected to the cpu via a 16-bit data bus, enabling byte data and word data to be accessed in a single state. even addresses are connected to the upper 8 bits and odd addresses are connected to the lower 8 bits. note that word data must start from an even address. in normal mode (mode 3), up to 56 kbytes of rom can be used. table 17.3 operating modes and rom operating modes mode pins mcu operating mode cpu operating mode mode md1 md0 on-chip rom mode 2 advanced single-chip mode 1 0 enabled (64 kbytes) mode 3 normal single-chip mode 1 1 enabled (56 kbytes) 17.7 on-board programming modes an on-board programming mode is used to perform on-chip flash memory programming, erasing, and verification. this lsi has two on-board programming modes: boot mode and user program mode. table 17.4 shows pin settings for boot mode. in user program mode, operation by software is enabled by setting control bits. for details on flash memory mode transitions, see figure 17.2. table 17.4 on-board programming mode settings mode setting md1 md0 p92 p91 p90 boot mode 0 0 1 * 1 * 1 * mode 2 (advanced mode) 1 0 ??? user program mode mode 3 (normal mode) 1 1 ??? note: * can be used as an i/o port after the boot mode activation.
rev. 1.0, 09/02, page 426 of 524 17.7.1 boot mode table 17.5 shows the boot mode operations between reset end and branching to the programming control program. 1. when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. prepare a programming control program in accordance with the description in section 17.8, flash memory programming/erasing. in boot mode, if any data exists in the flash memory (except in the case that all data are 1), all blocks in the flash memory are erased. use boot mode at initial writing in the on-board state, or forced recovery when user program mode cannot be executed because the program to be initiated in user program mode was mistakenly erased. 2. the sci_1 should be set to asynchronous mode, and the transfer format as follows: 8-bit data, 1 stop bit, and no parity. 3. when the boot program is initiated, this lsi measures the low-level period of asynchronous sci communication data (h'00) transmitted continuously from the host. this lsi then calculates the bit rate of transmission from the host, and adjusts the sci_1 bit rate to match that of the host. the reset should end with the rxd1 pin high. the rxd1 and txd1 pins should be pulled up on the board if necessary. after the reset ends, it takes approximately 100 states before this lsi is ready to measure the low-level period. 4. after matching the bit rates, this lsi transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to this lsi. if reception could not be performed normally, initiate boot mode again by a reset. depending on the hosts transfer bit rate and system clock frequency of this lsi, there will be a discrepancy between the bit rates of the host and this lsi. to operate the sci properly, set the hosts transfer bit rate and system clock frequency of this lsi within the ranges listed in table 17.6. 5. in boot mode, a part of the on-chip ram area is used by the boot program. addresses h'ffe080 to h'ffe87f* 1 is the area to which the programming control program is transferred from the host. note, however, that id codes are assigned to addresses h'ffe080 to h'ffe087. the boot program area cannot be used until the execution state in boot mode switches to the programming control program. figure 17.6 shows the on-chip ram area in boot mode. 6. before branching to the programming control program (h'ffe088 in the ram area), this lsi terminates transfer operations by the sci_1 (by clearing the re and te bits in scr to 0), but the adjusted bit rate value remains set in brr. therefore, the programming control program can still use it for transfer of write data or verify data with the host. the txd1 pin is in high- level output state. the contents of the cpu general registers are undefined immediately after branching to the programming control program. these registers must be initialized at the beginning of the programming control program, since the stack pointer (sp), in particular, is used implicitly in subroutine calls, etc.
rev. 1.0, 09/02, page 427 of 524 7. boot mode can be cleared by a reset. cancel the reset* 2 after driving the reset pin low, waiting at least 20 states, and then setting the mode pins. boot mode is also cleared when a wdt overflow occurs. 8. do not change the mode pin input levels in boot mode. 9. all interrupts are disabled during programming or erasing of the flash memory. notes: 1. this area is reserved for boot mode. do not use this area for any other purpose. 2. after reset is cancelled, mode pin input settings must satisfy the mode programming setup time (t mds = 4 states).
rev. 1.0, 09/02, page 428 of 524 table 17.5 boot mode operation communications contents processing contents host operation lsi operation processing contents continuously transmits data h'00 at specified bit rate. branches to boot program at reset-start. boot program start branches to programming control program transferred to on-chip ram and starts execution. h'00, h'00 . . . h'00 h'00 h'55 transmits data h'55 when data h'00 is received error-free. boot program erase error h'ff h'aa receives data h'aa. receives data h'aa. h'aa echobacks the 2-byte data received to host. echobacks received data to host and also transfers it to ram (repeated for n times). high-order byte and low-order byte echoback echoback h'xx transmits number of bytes (n) of programming control program to be transferred as 2-byte data (low-order byte following high-order byte). transmits 1-byte of programming control program (repeated for n times). item boot mode start ? measures low-level period of receive data h'00. ? calculates bit rate and sets it in brr of sci_1. ? transmits data h'00 to host as adjustment end indication. bit rate adjustment checks flash memory data, erases all flash memory blocks in case of written data existing, and transmits data h'aa to host. (if erase could not be done, transmits data h'ff to host and aborts operation.) flash memory erase transfer of programming control program after receiving data h'55, transmits data h'aa to host.
rev. 1.0, 09/02, page 429 of 524 table 17.6 system clock frequencies for which automatic adjustment of lsi bit rate is possible host bit rate system clock frequency range of lsi 19200 bps 8 to 10 mhz 9600 bps 4 to 10 mhz 4800 bps 2 to 10 mhz boot program area * 2 (128 bytes) h'ffff7f h'ffff00 h'ffefff h'ffe880 h'ffe088 h'ffe080 id code area programming control program area (2040 bytes) boot program area * 2 (1920 bytes) notes: 1. this area is reserved for boot mode. do not use this area for any other purpose. 2. the boot program area and area which is not used cannot be used until a transition is made to the execution state for the programming control program transferred to ram. note that the contents of the boot program area in ram are remained after a branch is made to the programming control program. * 1 * 1 figure 17.6 on-chip ram area in boot mode in boot mode, this lsi checks the contents of the 8-byte id code area as shown below to confirm that the programming control program corresponds with this lsi. to originally write a programming control program to be used in boot mode, the above 8-byte id code must be added at the beginning of the program. h'ffe080 h'ffe088 30 40 fe 64 66 32 31 31 ? instruction codes of the programming control program (product id) figure 17.7 id code area
rev. 1.0, 09/02, page 430 of 524 17.7.2 user program mode on-board programming/erasing of an individual flash memory block can also be performed in user program mode by branching to a user program/erase control program. the user must set branching conditions and provide on-board means of supplying programming data. the flash memory must contain the user program/erase control program or a program which provides the user program/erase control program from external memory. because the flash memory itself cannot be read during programming/erasing, transfer the user program/erase control program to on-chip ram, as like in boot mode. figure 17.8 shows a sample procedure for programming/erasing in user program mode. prepare a user program/erase control program in accordance with the description in section 17.8, flash memory programming/erasing. ye s no program/erase? reset-start branch to flash memory application program transfer user program/ erase control program to ram branch to flash memory application program branch to user program/ erase control program in ram execute user program/erase control program (flash memory rewrite) figure 17.8 programming/erasing flowchart example in user program mode
rev. 1.0, 09/02, page 431 of 524 17.8 flash memory programming/erasing a software method, using the cpu, is employed to program and erase flash memory in the on- board programming modes. depending on the flmcr1 and flmcr2 settings, the flash memory operates in one of the following four modes: program mode, program-verify mode, erase mode, and erase-verify mode. the programming control program in boot mode and the user program/erase control program in user program mode use these operating modes in combination to perform programming/erasing. flash memory programming and erasing should be performed in accordance with the descriptions in section 17.8.1, program/program-verify and section 17.8.2, erase/erase-verify, respectively. 17.8.1 program/program-verify when writing data or programs to the flash memory, the program/program-verify flowchart shown in figure 17.9 should be followed. performing programming operations according to this flowchart will enable data or programs to be written to the flash memory without subjecting this lsi to voltage stress or sacrificing program data reliability. 1. programming must be done to an empty address. do not reprogram an address to which programming has already been performed. 2. programming should be carried out 128 bytes at a time. a 128-byte data transfer must be performed even if writing fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. prepare the following data storage areas in ram: a 128-byte programming data area, a 128- byte reprogramming data area, and a 128-byte additional-programming data area. perform reprogramming data computation and additional programming data computation according to figure 17.9. 4. consecutively transfer 128 bytes of data in byte units from the reprogramming data area or additional-programming data area to the flash memory. the program address and 128-byte data are latched in the flash memory. the lower 8 bits of the start address in the flash memory destination area must be h'00 or h'80. 5. the time during which the p bit is set to 1 is the programming time. figure 17.9 shows the allowable programming times. 6. the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. the overflow cycle should be longer than (y + z2 + a + b ) m s. 7. for a dummy write to a verify address, write 1-byte data h'ff to an address whose lower 2 bits are b'00. verify data can be read in words from the address to which a dummy write was performed. 8. the maximum number of repetitions of the program/program-verify sequence to the same bit is (n).
rev. 1.0, 09/02, page 432 of 524 start end of programming set swe bit in flmcr1 start of programming write pulse application subroutine wait (x) m s sub-routine write pulse end sub set psu bit in flmcr2 wdt enable disable wdt number of writes n 1 2 3 4 5 6 7 8 9 10 11 12 13 998 999 1000 note 7: write pulse width write time (z) m s z1 z1 z1 z1 z1 z1 z2 z2 z2 z2 z2 z2 z2 z2 z2 z2 wait ( ) m s set p bit in flmcr1 wait (z1) m s, (z2) m s or (z3) m s clear p bit in flmcr1 wait ( ) m s clear psu bit in flmcr2 wait ( ) m s n = 1 m = 0 ng ng ng ng ng ok ok ok wait ( ) m s wait ( ) m s * 2 * 4 * 5 * 1 wait ( ) m s apply write pulse z1 m s or z2 m s sub-routine-call set pv bit in flmcr1 h'ff dummy write to verify address read verify data write data = verify data? * 4 * 3 * 3 * 1 transfer reprogram data to reprogram data area reprogram data computation * 4 transfer additional-programming data to additional-programming data area additional-programming data computation clear pv bit in flmcr1 clear swe bit in flmcr1 m = 1 see note 7 for pulse width m = 0 ? increment address programming failure ok clear swe bit in flmcr1 wait ( ) m s m s ok 6 3 n? ng ok 6 3 n ? wait ( ) m s n 3 (n)? n ? n + 1 original data (d) verify data (v) reprogram data (x) comments programming completed still in erased state; no action programming incomplete; reprogram note: use a z3 m s write pulse for additional programming. write 128-byte data in ram reprogram data area consecutively to flash memory ram program data storage area (128 bytes) reprogram data storage area (128 bytes) additional-programming data storage area (128 bytes) store 128-byte program data in program data area and reprogram data area apply write pulse (additional programming) 128-byte data verification completed? successively write 128-byte data from additional- programming data area in ram to flash memory reprogram data computation table reprogram data (x') verify data (v) additional- programming data (y) 1 1 1 1 0 1 0 0 0 0 1 1 comments additional programming to be executed additional programming not to be executed additional programming not to be executed 0 1 1 1 0 1 0 1 0 0 1 1 additional-programming data computation table perform programming in the erased state. do not perform additional programming on previously programmed addresses. notes: 1. data transfer is performed by byte transfer. the lower 8 bits of the first address written to must be h'00 or h'80. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. 2. verify data is read in 16-bit (word) units. 3. even bits for which programming has been completed will be subjected to programming once again if the result of the subseque nt verify operation is ng. 4. a 128-byte area for storing program data, a 128-byte area for storing reprogram data, and a 128-byte area for storing additi onal data must be provided in ram. the contents of the reprogram data area and additional data area are modified as programming proceeds. 5. a write pulse of z1 m s or z2 m s is applied according to the progress of the programming operation. see note7 for details of the pulse widths. when writing of additional-programming data is executed, a z3 m s write pulse should be applied. reprogram data x' means reprogram data when the write pulse is applied. 6. the values of x, y, z1, z2, z3, , , , , , , and n are shown in section 21.1.4, flash memory characteristics. figure 17.9 program/program-verify flowchart
rev. 1.0, 09/02, page 433 of 524 17.8.2 erase/erase-verify when erasing flash memory, the erase/erase-verify flowchart shown in figure 17.10 should be followed. 1. prewriting (setting erase block data to all 0) is not necessary. 2. erasing is performed in block units. make only a single-block specification in erase block registers 1 and 2 (ebr1 and ebr2). to erase multiple blocks, each block must be erased in turn. 3. the time during which the e bit is set to 1 is the flash memory erase time. 4. the watchdog timer (wdt) is set to prevent overprogramming due to program runaway, etc. an overflow cycle of approximately (y + z + a + b) ms is allowed. 5. for a dummy write to a verify address, write 1-byte data h'ff to an address whose lower two bits are b'00. verify data can be read in longwords from the address to which a dummy write was performed. 6. if the read data is unerased, set erase mode again, and repeat the erase/erase-verify sequence as before. the maximum number of repetitions of the erase/erase-verify sequence is n.
rev. 1.0, 09/02, page 434 of 524 end of erasing start set swe bit in flmcr1 set esu bit in flmcr2 set e bit in flmcr1 wait ( x ) m s wait ( y ) m s n = 1 set ebr1 and ebr2 enable wdt * 4 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 wait ( z ) ms wait ( a ) m s wait ( b ) m s wait ( g ) m s set block start address as verify address wait ( e ) m s wait ( h ) m s * 5 * 3 start of erasing clear e bit in flmcr1 clear esu bit in flmcr2 set ev bit in flmcr1 h'ff dummy write to verify address read verify data clear ev bit in flmcr1 wait ( h ) m s clear ev bit in flmcr1 clear swe bit in flmcr1 disable wdt end of erasing * 1 verify data = all "1"? last address of block? all erase blocks erased? erase failure clear swe bit in flmcr1 n 3 ( n ) ? ng ng ng ng ok ok ok ok increment address n ? n + 1 wait ( q ) m s wait ( q ) m s notes: 1. prewriting (writing 0 to all data in erased block) is not necessary. 2. the values of x, y, z, a , b , g, e , h , q , and n are shown in section 21.1.4, flash memory characteristics. 3. verify data is read in 16-bit (word) units. 4. set only a single bit in ebr1 and ebr2. do not set more than one bit. 5. erasing is performed in block units. to erase multiple blocks, each block must be erased in turn. figure 17.10 erase/erase-verify flowchart
rev. 1.0, 09/02, page 435 of 524 17.9 program/erase protection there are three kinds of flash memory program/erase protection: hardware protection, software protection, and error protection. 17.9.1 hardware protection hardware protection is a state in which programming/erasing of flash memory is forcibly disabled or aborted by a reset (including wdt overflow reset), or a transition to hardware standby mode, software standby mode, sub-active mode, sub-sleep mode or watch mode. flash memory control registers 1 and 2 (flmcr1 and flmcr2) and erase block registers 1 and 2 (ebr1 and ebr2) are initialized. in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in the ac characteristics section. 17.9.2 software protection software protection can be implemented against programming/erasing of all flash memory blocks by clearing the swe bit in flmcr1 to 0. when software protection is in effect, setting the p or e bit in flmcr1 does not cause a transition to program mode or erase mode. by setting the erase block registers 1 and 2 (ebr1 and ebr2), erase protection can be set for individual blocks. when ebr1 and ebr2 are set to h'00, erase protection is set for all blocks. 17.9.3 error protection in error protection, an error is detected when the cpus runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. when the following errors are detected during programming/erasing of flash memory, the fler bit in flmcr2 is set to 1, and the error protection state is entered. when the flash memory of is read during programming/erasing (including vector read and instruction fetch) immediately after exception handling (excluding a reset) during programming/erasing when a sleep instruction is executed (transits to software standby mode, sleep mode, sub- active mode, sub-sleep mode, or watch mode) during programming/erasing the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be entered by setting the p or e bit to 1. however, because the pv and ev bit settings are retained, a
rev. 1.0, 09/02, page 436 of 524 transition to verify mode can be made. the error protection state can be cancelled by a reset or in hardware standby mode. 17.10 interrupts during flash memory programming/erasing in order to give the highest priority to programming/erasing operations, disable all interrupts including nmi input during flash memory programming/erasing (the p or e bit in flmcr1 is set to 1) or boot program execution* 1 . 1. if an interrupt is generated during programming/erasing, operation in accordance with the program/erase algorithm is not guaranteed. 2. cpu runaway may occur because normal vector reading cannot be performed in interrupt exception handling during programming/erasing* 2 . 3. if an interrupt occurs during boot program execution, the normal boot mode sequence cannot be executed. notes: 1. interrupt requests must be disabled inside and outside the cpu until the programming control program has completed programming. 2. the vector may not be read correctly for the following two reasons: if flash memory is read while being programmed or erased (while the p or e bit in flmcr1 is set to 1), correct read data will not be obtained (undefined values will be returned). if the interrupt entry in the vector table has not been programmed yet, interrupt exception handling will not be executed correctly.
rev. 1.0, 09/02, page 437 of 524 17.11 programmer mode in programmer mode, the on-chip flash memory can be programmed/erased by a prom programmer via a socket adapter, just like for a discrete flash memory. use a prom programmer that supports the hitachi 64-kbyte flash memory on-chip mcu device*. figure 17.11 shows a memory map in programmer mode. note: set the programming voltage of the prom programmer to 3.3v. on-chip rom area mcu mode h'000000 programmer mode h'00000 h'00ffff h'0ffff undefined value output h'1ffff figure 17.11 memory map in programmer mode
rev. 1.0, 09/02, page 438 of 524 17.12 usage notes the following lists notes on the use of on-board programming modes and programmer mode. 1. perform programming/erasing with the specified voltage and timing. if a voltage higher than the rated voltage is applied, the product may be fatally damaged. use a prom programmer that supports the hitachi 64-kbyte flash memory on-chip mcu device at 3.3 v. do not set the programmer to hn28f101 or the programming voltage to 5.0 v. 2. notes on power on/off at powering on or off the vcc power supply, fix the res pin to low and set the flash memory to hardware protection state. this power on/off timing must also be satisfied at a power-off and power-on caused by a power failure and other factors. 3. perform flash memory programming/erasing in accordance with the recommended algorithm in the recommended algorithm, flash memory programming/erasing can be performed without subjecting this lsi to voltage stress or sacrificing program data reliability. when setting the p or e bit in flmcr1 to 1, set the watchdog timer against program runaway. 4. do not set/clear the swe bit during program execution in the flash memory. do not set/clear the swe bit during program execution in the flash memory. an interval of at least 100 m s is necessary between program execution or data reading in flash memory and swe bit clearing. when the swe bit is set to 1, flash memory data can be modified, however, flash memory data can be read only in program-verify or erase-verify mode. do not access the flash memory for a purpose other than verification during programming/erasing. do not clear the swe bit during programming, erasing, or verifying. 5. do not use interrupts during flash memory programming/erasing in order to give the highest priority to programming/erasing operation, disable all interrupts including nmi input when the flash memory is programmed or erased. 6. do not perform additional programming. programming must be performed in the erased state. program the area with 128-byte programming-unit blocks in on-board programming or programmer mode only once. perform programming in the state where the programming-unit block is fully erased. 7. ensure that the prom programmer is correctly attached before programming. if the socket, socket adapter, or product index does not match the specifications, too much current flows and the product may be damaged. 8. do not touch the socket adapter or lsi while programming. touching either of these can cause contact faults and write errors.
rev. 1.0, 09/02, page 439 of 524 section 18 clock pulse generator this lsi incorporates a clock pulse generator, which generates the system clock ( f ), bus master clock, and internal clock. the clock pulse generator consists of an oscillator, duty correction circuit, clock select circuit, medium-speed clock divider, bus master clock select circuit, subclock input circuit, and waveform forming circuit. figure 18.1 shows a block diagram of the clock pulse generator. oscillator duty correction circuit clock select circuit medium- speed clock divider bus master clock select circuit subclock input circuit waveform forming circuit extal xtal excl /2 to /32 sub wdt_1 count clock system clock to pin internal clock to peripheral modules bus master clock to cpu figure 18.1 block diagram of clock pulse generator the bus master clock is selected as either high-speed mode or medium-speed mode by software according to the settings of the sck2 to sck0 bits in the standby control register. for details on the standby control register, refer to section 19.1.1, standby control register (sbycr). the subclock input is controlled by software according to the excle bit setting in the low power control register. for details on the low power control register, refer to section 19.1.2, low power control register (lpwrcr).
rev. 1.0, 09/02, page 440 of 524 18.1 oscillator clock pulses can be supplied either by connecting a crystal resonator, or by providing external clock input. 18.1.1 connecting crystal resonator figure 18.2 shows a typical method of connecting a crystal resonator. an appropriate damping resistance r d , given in table 18.1, should be used. an at-cut parallel-resonance crystal resonator should be used. figure 18.3 shows the equivalent circuit of a crystal resonator. a resonator having the characteristics given in table 18.2 should be used. a crystal resonator with frequency identical to that of the system clock ( f ) should be used. extal xtal r d c l2 c l1 c l1 = c l2 = 10 to 22 pf figure 18.2 typical connection to crystal resonator table 18.1 damping resistance values frequency (mhz) 24810 r d ( w ) 1 k 500 200 0 xtal c l at-cut parallel-resonance crystal resonator extal c 0 lr s figure 18.3 equivalent circuit of crystal resonator
rev. 1.0, 09/02, page 441 of 524 table 18.2 crystal resonator parameters frequency (mhz) 24810 r s (max) ( w ) 500 120 80 70 c 0 (max) (pf) 7 18.1.2 external clock input method figure 18.4 shows a typical method of connecting an external clock signal. to leave the xtal pin open, incidental capacitance should be 10 pf or less. to input an inverted clock to the xtal pin, the external clock should be set to high in standby mode, subactive mode, subsleep mode, and watch mode. external clock input conditions are shown in table 18.3. the frequency of the external clock should be the same as that of the system clock ( f ). extal xtal external clock input open (a) example of external clock input when xtal pin left open extal xtal external clock input (b) example of external clock input when an inverted clock is input to xtal pin figure 18.4 example of external clock input
rev. 1.0, 09/02, page 442 of 524 table 18.3 external clock input conditions v cc = 2.7 to 3.6 v item symbol min max unit test conditions external clock input pulse width low level t exl 40 ns external clock input pulse width high level t exh 40 ns external clock rising time t exr 10ns external clock falling time t exf 10ns figure 18.5 0.4 0.6 t cyc f 3 5 mhz clock pulse width low level t cl 80 ns f < 5 mhz 0.4 0.6 t cyc f 3 5 mhz clock pulse width high level t ch 80 ns f < 5 mhz figure 21.5 t exh t exl t exr t exf v cc 0.5 extal figure 18.5 external clock input timing the oscillator and duty correction circuit have a function to adjust the waveform of the external clock input that is input to the extal pin. when a specified clock signal is input to the extal pin, internal clock signal output is determined after the external clock output stabilization delay time (t dext ) has passed. as the clock signal output is not determined during the t dext cycle, a reset signal should be set to low to hold it in reset state. table 18.4 shows the external clock output stabilization delay time. figure 18.6 shows the timing of the external clock output stabilization delay time.
rev. 1.0, 09/02, page 443 of 524 table 18.4 external clock output stabilization delay time condition: v cc = 2.7 v to 3.6 v, v ss = 0 v item symbol min. max. unit remarks external clock output stabilization delay time t dext * 500 m s figure 18.6 note: * t dext includes a res pulse width (t resw ). t dext * (internal and external) extal v cc 2.7 v v ih note: * the external clock output stabilization delay time (t dext ) includes a pulse width (t resw ). figure 18.6 timing of external clock output stabilization delay time 18.2 duty correction circuit the duty correction circuit is valid when the oscillating frequency is 5 mhz or more. it corrects the duty of a clock that is output from the oscillator, and generates the system clock ( f ). 18.3 medium-speed clock divider the medium-speed clock divider divides the system clock ( f ), and generates f /2, f /4, f /8, f /16, and f /32 clocks.
rev. 1.0, 09/02, page 444 of 524 18.4 bus master clock select circuit the bus master clock select circuit selects a clock to supply the bus master with either the system clock ( f ) or medium-speed clock ( f /2, f /4, f /8, f /16, or f /32) by the sck2 to sck0 bits in sbycr. 18.5 subclock input circuit the subclock input circuit controls subclock input from the excl pin. to use the subclock, a 32.768-khz external clock should be input from the excl pin. at this time, the p96ddr bit in p9ddr should be cleared to 0, and the excle bit in lpwrcr should be set to 1. subclock input conditions are shown in table 18.5. when the subclock is not used, subclock input should not be enabled. table 18.5 subclock input conditions vcc = 2.7 to 3.6 v item symbol min typ max unit measurement condition subclock input pulse width low level t excll 15.26 m s subclock input pulse width high level t exclh 15.26 m s subclock input rising time t exclr 10ns subclock input falling time t exclf 10ns figure 18.7 t exclh t excll t exclr t exclf v cc 0.5 excl figure 18.7 subclock input timing 18.6 waveform forming circuit to remove noise from the subclock input at the excl pin, the subclock is sampled by a divided f clock. the sampling frequency is set by the nesel bit in lpwrcr. the subclock is not sampled in subactive mode, subsleep mode, or watch mode.
rev. 1.0, 09/02, page 445 of 524 18.7 clock select circuit the clock select circuit selects the system clock that is used in this lsi. a clock generated by an oscillator to which the extal and xtal pins are input is selected as a system clock when returning from high-speed mode, medium-speed mode, sleep mode, reset state, or standby mode. a subclock input from the excl pin is selected as a system clock in subactive mode, subsleep mode, or watch mode. at this time, modules such as the cpu, tmr_0, tmr_1, wdt_0, wdt_1, ports, and interrupt controller and their functions operate depending on the f sub. the count clock and sampling clock for each timer are divided f sub clocks. 18.8 usage notes 18.8.1 note on resonator since all kinds of characteristics of the resonator are closely related to the board design by the user, use the example of resonator connection in this document for only reference; be sure to use an resonator that has been sufficiently evaluated by the user. consult with the resonator manufacturer about the resonator circuit ratings which vary depending on the stray capacitances of the resonator and installation circuit. make sure the voltage applied to the oscillator pins does not exceed the maximum rating. 18.8.2 notes on board design when using a crystal resonator, the crystal resonator and its load capacitors should be placed as close as possible to the xtal and extal pins. other signal lines should be routed away from the oscillator circuit to prevent inductive interference with the correct oscillation as shown in figure 18.8. c l2 signal a signal b c l1 this lsi xtal extal avoid figure 18.8 note on board design of oscillator circuit section
rev. 1.0, 09/02, page 446 of 524
rev. 1.0, 09/02, page 447 of 524 section 19 power-down modes for operating modes after the reset state is cancelled, this lsi has not only the normal program execution state but also seven power-down modes in which power consumption is significantly reduced. in addition, there is also module stop mode in which reduced power consumption can be achieved by individually stopping on-chip peripheral modules. medium-speed mode system clock frequency for the cpu operation can be selected as f /2, f /4, f /8, f /16, or f /32. subactive mode the cpu operates based on the subclock and on-chip peripheral modules other than tmr_0, tmr_1, wdt_0, and wdt_1 stop operating. sleep mode the cpu stops but on-chip peripheral modules continue operating. subsleep mode the cpu and on-chip peripheral modules other than tmr_0, tmr_1, wdt_0, and wdt_1 stop operating. watch mode the cpu and on-chip peripheral modules other than wdt_1 stop operating. software standby mode clock oscillation stops, and the cpu and on-chip peripheral modules stop operating. hardware standby mode clock oscillation stops, and the cpu and on-chip peripheral modules enter reset state. module stop mode independently of above operating modes, on-chip peripheral modules that are not used can be stopped individually. 19.1 register descriptions power-down modes are controlled by the following registers. to access sbycr, lpwrcr, mstpcrh, and mstpcrl, the flshe bit in the serial timer control register (stcr) must be cleared to 0. for details on stcr, see section 3.2.3, serial timer control register (stcr). standby control register (sbycr) low power control register (lpwrcr) module stop control register h (mstpcrh) module stop control register l (mstpcrl)
rev. 1.0, 09/02, page 448 of 524 19.1.1 standby control register (sbycr) sbycr controls power-down modes. bit bit name initial value r/w description 7 ssby 0 r/w software standby specifies the operating mode to be entered after executing the sleep instruction. when the sleep instruction is executed in high-speed mode or medium-speed mode: 0: shifts to sleep mode 1: shifts to software standby mode, subactive mode, or watch mode when the sleep instruction is executed in subactive mode: 0: shifts to subsleep mode 1: shifts to watch mode or high-speed mode note that the ssby bit is not changed even if a mode transition occurs by an interrupt. 6 5 4 sts2 sts1 sts0 0 0 0 r/w r/w r/w standby timer select 2 to 0 selects the wait time for clock stabilization from clock oscillation start when canceling software standby mode, watch mode, or subactive mode. select a wait time of 8 ms (oscillation stabilization time) or more, depending on the operating frequency. table 19.1 shows the relationship between the sts2 to sts0 values and wait time. with an external clock, there are no specific wait requirements. normally the minimum value is recommended. 3 ? 0rreserved this bit is always read as 0, and cannot be modified.
rev. 1.0, 09/02, page 449 of 524 bit bit name initial value r/w description 2 1 0 sck2 sck1 sck0 0 0 0 r/w r/w r/w system clock select 2 to 0 selects a clock for the bus master in high-speed mode or medium-speed mode. when making a transition to subactive mode or watch mode, sck2 to sck0 must be cleared to 0. 000: high-speed mode 001: medium-speed clock: f /2 010: medium-speed clock: f /4 011: medium-speed clock: f /8 100: medium-speed clock: f /16 101: medium-speed clock: f /32 11x: legend x: don't care table 19.1 operating frequency and wait time sts2 sts1 sts0 wait time 10 mhz 8 mhz 6 mhz 4 mhz 2 mhz unit 0 0 0 8192 states 0.8 1.0 1.3 20. 4.1 0 0 1 16384 states 1.6 2.0 2.7 4.1 8.2 0 1 0 32768 states 3.3 4.1 5.5 8.2 16.4 0 1 1 65536 states 6.6 8.2 10.9 16.4 32.8 1 0 0 131072 states 13.1 16.4 21.8 32.8 65.5 1 0 1 262144 states 26.2 32.8 43.6 65.6 131.2 ms 1 1 0 reserved ?????? 1 1 1 reserved ?????? shaded cells indicate the recommended specification.
rev. 1.0, 09/02, page 450 of 524 19.1.2 low-power control register (lpwrcr) lpwrcr controls power-down modes. bit bit name initial value r/w description 7 dton 0 r/w direct transfer on flag specifies the operating mode to be entered after executing the sleep instruction. when the sleep instruction is executed in high-speed mode or medium-speed mode: 0: shifts to sleep mode, software standby mode, or watch mode 1: shifts directly to subactive mode, or shifts to sleep mode or software standby mode when the sleep instruction is executed in subactive mode: 0: shifts to subsleep mode or watch mode 1: shifts directly to high-speed mode, or shifts to subsleep mode 6 lson 0 r/w low-speed on flag specifies the operating mode to be entered after executing the sleep instruction. this bit also controls whether to shift to high-speed mode or subactive mode when watch mode is cancelled. when the sleep instruction is executed in high-speed mode or medium-speed mode: 0: shifts to sleep mode, software standby mode, or watch mode 1: shifts to watch mode or subactive mode when the sleep instruction is executed in subactive mode: 0: shifts directly to watch mode or high-speed mode 1: shifts to subsleep mode or watch mode when watch mode is cancelled: 0: shifts to high-speed mode 1: shifts to subactive mode
rev. 1.0, 09/02, page 451 of 524 bit bit name initial value r/w description 5 nesel 0 r/w noise elimination sampling frequency select selects the frequency by which the subclock ( f sub) input from the excl pin is sampled using the clock ( f ) generated by the system clock pulse generator. clear this bit to 0 when ? is 5 mhz or more. 0: sampling using f /32 clock 1: sampling using f /4 clock 4 excle 0 r/w subclock input enable enables/disables subclock input from the excl pin. 0: disables subclock input from the excl pin 1: enables subclock input from the excl pin 3 ? 0r/wreserved an undefined value is read from this bit. this bit should not be set to 1. 2 to 0 ? all 0 r reserved these bits are always read as 0 and cannot be modified. 19.1.3 module stop control registers h and l (mstpcrh, mstpcrl) mstpcrh and mstpcrl specify on-chip peripheral modules to shift to module stop mode in module units. each module can enter module stop mode by setting the corresponding bit to 1. mstpcrh bit bit name initial value r/w corresponding module 7 mstp15 0 * 1 r/w ? 6 mstp14 0 * 1 r/w ? 5 mstp13 1 r/w 16-bit free-running timer (frt) 4 mstp12 1 r/w 8-bit timers (tmr_0, tmr_1) 3 mstp11 1 r/w 14-bit pwm timer (pwmx) 2 mstp10 1 * 2 r/w ? 1 mstp9 1 * 2 r/w ? 0 mstp8 1 r/w 8-bit timers (tmr_x, tmr_y) notes: 1. do not set this bit to 1. 2. do not clear this bit to 0.
rev. 1.0, 09/02, page 452 of 524 mstpcrl bit bit name initial value r/w corresponding module 7 mstp7 1 * 1 r/w ? 6 mstp6 1 r/w serial communication interface_1 (sci_1) 5 mstp5 1 * 1 r/w ? 4 mstp4 1 r/w i 2 c bus interface_0 (iic_0) 3 mstp3 1 r/w i 2 c bus interface_1 (iic_1) 2 mstp2 1 r/w keyboard buffer controller, keyboard matrix interrupt mask register (kmimr), keyboard matrix interrupt mask register a (kmimra), port 6 pull-up mos control register (kmpcr) 1 mstp1 1 * 2 r/w ? 0 mstp0 1 r/w host interface (lpc), wake-up event interrupt mask register b (wuemrb) notes: 1. do not clear this bit to 0. 2. this bit can be read from or written to, however, operation is not affected. 19.2 mode transitions and lsi states figure 19.1 shows the enabled mode transition diagram. the mode transition from program execution state to program halt state is performed by the sleep instruction. the mode transition from program halt state to program execution state is performed by an interrupt. the stby input causes a mode transition from any state to hardware standby mode. the res input causes a mode transition from a state other than hardware standby mode to the reset state. table 19.2 shows the lsi internal states in each operating mode.
rev. 1.0, 09/02, page 453 of 524 program halt state program execution state sck2 to sck0 are 0 sck2 to sck0 are not 0 sleep instruction ssby = 1, pss = 1, dton = 1, lson = 1 clock switching exception handling sleep instruction ssby = 1, pss = 1, dton = 1, lson = 0 after the oscillation stabilization time (sts2 to sts0), clock switching exception handling sleep instruction sleep instruction external interrupt * 3 any interrupt sleep instruction sleep instruction sleep instruction interrupt * 1 lson bit = 0 interrupt * 2 interrupt * 1 lson bit = 1 stby pin = high res pin = low stby pin = low ssby = 0, lson = 0 ssby = 1, pss = 0, lson = 0 ssby = 0, pss = 1, lson = 1 ssby = 1, pss = 1, dton = 0 res pin = high : transition after exception processing : power-down mode reset state high-speed mode (main clock) medium-speed mode (main clock) subactive mode (subclock) subsleep mode (subclock) hardware standby mode software standby mode sleep mode (main clock) watch mode (subclock) notes: 1. 2. 3. nmi, irq0 to irq2, irq6, irq7, and wdt1 interrupts nmi, irq0 to irq7, wdt0, wdt1, tmr0, and tmr1 interrupts nmi, irq0 to irq2, irq6, and irq7 interrupts ? when a transition is made between modes by means of an interrupt, the transition cannot be made on interrupt source generation alone. ensure that interrupt handling is performed after accepting the interrupt request. ? always select high-speed mode before making a transition to watch mode or sub-active mode. figure 19.1 mode transition diagram
rev. 1.0, 09/02, page 454 of 524 table 19.2 lsi internal states in each operating mode function high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby system clock pulse generator function- ing function- ing function- ing function- ing halted halted halted halted halted subclock pulse generator function- ing function- ing function- ing function- ing function- ing function- ing function- ing halted halted instruction execution halted halted halted halted halted cpu registers function- ing medium- speed operation retained function- ing retained subclock operation retained retained undefined nmi irq0 to irq7 kin0 to kin15 external interrupts wue0 to wue7 function- ing function- ing function- ing function- ing function- ing function- ing function- ing function- ing halted wdt_1 subclock operation wdt_0 function- ing tmr_0, tmr_1 subclock operation subclock operation frt tmr_x, tmr_y iic_0 iic_1 lpc function- ing/halted (retained) halted (retained) halted (retained) halted (retained) halted (retained) peripheral modules sci_1 function- ing function- ing function- ing function- ing/halted (reset) halted (reset) halted (reset) halted (reset) halted (reset) halted (reset)
rev. 1.0, 09/02, page 455 of 524 function high- speed medium- speed sleep module stop watch sub- active sub- sleep software standby hardware standby pwmx keyboard buffer controller function- ing/halted (reset) halted (reset) halted (reset) halted (reset) halted (reset) halted (reset) ram function- ing retained function- ing retained retained retained peripheral modules i/o function- ing function- ing function- ing function- ing retained function- ing function- ing retained high impedance notes: halted (retained) means that internal register values are retained. the internal state is operation suspended. halted (reset) means that internal register values and internal states are initialized. in module stop mode, only mo dules for which a stop setting has been m ade are halted (reset or retained). 19.3 medium-speed mode the cpu makes a transition to medium-speed mode as soon as the current bus cycle ends according to the setting of the sck2 to sck0 bits in sbycr. in medium-speed mode, the cpu operates on the operating clock ( f /2, f /4, f /8, f /16, or f /32). on-chip peripheral modules other than the bus masters always operate on the system clock ( f ). in medium-speed mode, a bus access is executed in the specified number of states with respect to the bus master operating clock. for example, if f /4 is selected as the operating clock, on-chip memory is accessed in 4 states, and internal i/o registers in 8 states. by clearing all of bits sck2 to sck0 to 0, a transition is made to high-speed mode at the end of the current bus cycle. if a sleep instruction is executed when the ssby bit in sbycr is cleared to 0, and the lson bit in lpwrcr is cleared to 0, a transition is made to sleep mode. when sleep mode is cleared by an interrupt, medium-speed mode is restored. when the sleep instruction is executed with the ssby bit set to 1, the lson bit cleared to 0, and the pss bit in tcsr (wdt_1) cleared to 0, operation shifts to software standby mode. when software standby mode is cleared by an external interrupt, medium-speed mode is restored. when the res pin is set low and medium-speed mode is cancelled, operation shifts to the reset state. the same applies in the case of a reset caused by overflow of the watchdog timer. when the stby pin is driven low, medium-speed mode is cancelled and a transition is made to hardware standby mode. figure 19.2 shows an example of medium-speed mode timing.
rev. 1.0, 09/02, page 456 of 524 , bus master clock peripheral module clock internal address bus internal write signal medium-speed mode sbycr sbycr figure 19.2 medium-speed mode timing 19.4 sleep mode the cpu makes a transition to sleep mode if the sleep instruction is executed when the ssby bit in sbycr is cleared to 0 and the lson bit in lpwrcr is cleared to 0. in sleep mode, cpu operation stops but the peripheral modules do not stop. the contents of the cpus internal registers are retained. sleep mode is exited by any interrupt, the res pin, or the stby pin. when an interrupt occurs, sleep mode is exited and interrupt exception handling starts. sleep mode is not exited if the interrupt is disabled, or interrupts other than nmi are masked by the cpu. setting the res pin level low cancels sleep mode and selects the reset state. after the oscillation stabilization time has passed, driving the res pin high causes the cpu to start reset exception handling. when the stby pin level is driven low, sleep mode is cancelled and a transition is made to hardware standby mode.
rev. 1.0, 09/02, page 457 of 524 19.5 software standby mode the cpu makes a transition to software standby mode when the sleep instruction is executed while the ssby bit in sbycr is set to 1, the lson bit in lpwrcr is cleared to 0, and the pss bit in tcsr (wdt_1) is cleared to 0. in software standby mode, the cpu, on-chip peripheral modules, and clock pulse generator all stop. however, the contents of the cpus internal registers, on-chip ram data, i/o ports, and the states of on-chip peripheral modules other than the sci and pwmx, are retained as long as the prescribed voltage is supplied. software standby mode is cleared by an external interrupt (nmi, irq0 to irq2, irq6, or irq7 ), the res pin input, or stby pin input. when an external interrupt request signal is input, system clock oscillation starts, and after the elapse of the time set in bits sts2 to sts0 in sbycr, software standby mode is cleared, and interrupt exception handling is started. when clearing software standby mode with an irq0 to irq2, irq6, or irq7 interrupt, set the corresponding enable bit to 1 and ensure that no interrupt with a higher priority than interrupts irq0 to irq2, irq6, and irq7 is generated. software standby mode cannot be cleared if an interrupt enable bit corresponding to an irq0 to irq2, irq6, or irq7 interrupt is cleared to 0 or if the interrupt has been masked on the cpu side. when the res pin is driven low, system clock oscillation is started. at the same time as system clock oscillation starts, the system clock is supplied to the entire lsi. note that the res pin must be held low until clock oscillation stabilizes. when the res pin goes high after clock oscillation stabilizes, the cpu begins reset exception handling. when the stby pin is driven low, software standby mode is cancelled and a transition is made to hardware standby mode. figure 19.3 shows an example in which a transition is made to software standby mode at the falling edge of the nmi pin, and software standby mode is cleared at the rising edge of the nmi pin. in this example, an nmi interrupt is accepted with the nmieg bit in syscr cleared to 0 (falling edge specification), then the nmieg bit is set to 1 (rising edge specification), the ssby bit is set to 1, and a sleep instruction is executed, causing a transition to software standby mode. software standby mode is then cleared at the rising edge of the nmi pin.
rev. 1.0, 09/02, page 458 of 524 oscillator nmi nmieg ssby nmi exception handling nmieg = 1 ssby = 1 sleep instruction software standby mode (power-down mode) oscillation stabilization time t osc2 nmi exception handling figure 19.3 application example in software standby mode 19.6 hardware standby mode the cpu makes a transition to hardware standby mode from any mode when the stby pin is driven low. in hardware standby mode, all functions enter the reset state. as long as the prescribed voltage is supplied, on-chip ram data is retained. the i/o ports are set to the high-impedance state. in order to retain on-chip ram data, the rame bit in syscr should be cleared to 0 before driving the stby pin low. do not change the state of the mode pins (md1 and md0) while this lsi is in hardware standby mode. hardware standby mode is cleared by the stby pin input or the res pin input. when the stby pin is driven high while the res pin is low, clock oscillation is started. ensure that the res pin is held low until system clock oscillation stabilizes. when the res pin is subsequently driven high after the clock oscillation stabilization time has passed, reset exception handling starts.
rev. 1.0, 09/02, page 459 of 524 figure 19.4 shows an example of hardware standby mode timing. oscillator res stby oscillation stabilization time reset exception handling figure 19.4 hardware standby mode timing 19.7 watch mode the cpu makes a transition to watch mode when the sleep instruction is executed in high-speed mode or subactive mode with the ssby bit in sbycr set to 1, the dton bit in lpwrcr cleared to 0, and the pss bit in tcsr (wdt_1) set to 1. in watch mode, the cpu is stopped and peripheral modules other than wdt_1 are also stopped. the contents of the cpus internal registers, several on-chip peripheral module registers, and on- chip ram data are retained and the i/o ports retain their values before transition as long as the prescribed voltage is supplied. watch mode is exited by an interrupt (wovi1, nmi, irq0 to irq2 , irq6, or irq7), res pin input, or stby pin input. when an interrupt occurs, watch mode is exited and a transition is made to high-speed mode or medium-speed mode when the lson bit in lpwrcr cleared to 0 or to subactive mode when the lson bit is set to 1. when a transition is made to high-speed mode, a stable clock is supplied to the entire lsi and interrupt exception handling starts after the time set in the sts2 to sts0 bits in sbycr has elapsed. in the case of an irq0 to irq2 , irq6, or irq7 interrupt, watch mode is not exited if the corresponding enable bit has been cleared to 0. in the case of interrupts from the on- chip peripheral modules, watch mode is not exited if the interrupt enable register has been set to disable the reception of that interrupt, or the interrupt is masked by the cpu. when the res pin is driven low, system clock oscillation starts. simultaneously with the start of system clock oscillation, the system clock is supplied to the entire lsi. note that the res pin must
rev. 1.0, 09/02, page 460 of 524 be held low until clock oscillation is stabilized. if the res pin is driven high after the clock oscillation stabilization time has passed, the cpu begins reset exception handling. if the stby pin is driven low, the lsi enters hardware standby mode. 19.8 subsleep mode the cpu makes a transition to subsleep mode when the sleep instruction is executed in subactive mode with the ssby bit in sbycr cleared to 0, the lson bit in lpwrcr set to 1, and the pss bit in tcsr (wdt_1) set to 1. in subsleep mode, the cpu is stopped. peripheral modules other than tmr_0, tmr_1, wdt_0, and wdt_1 are also stopped. the contents of the cpus internal registers, several on-chip peripheral module registers, and on-chip ram data are retained and the i/o ports retain their values before transition as long as the prescribed voltage is supplied. subsleep mode is exited by an interrupt (interrupts by on-chip peripheral modules, nmi, irq0 to irq7 ), the res pin input, or the stby pin input. when an interrupt occurs, subsleep mode is exited and interrupt exception handling starts. in the case of an irq0 to irq7 interrupt, subsleep mode is not exited if the corresponding enable bit has been cleared to 0. in the case of interrupts from the on-chip peripheral modules, subsleep mode is not exited if the interrupt enable register has been set to disable the reception of that interrupt, or the interrupt is masked by the cpu. when the res pin is driven low, system clock oscillation starts. simultaneously with the start of system clock oscillation, the system clock is supplied to the entire lsi. note that the res pin must be held low until clock oscillation is stabilized. if the res pin is driven high after the clock oscillation stabilization time has passed, the cpu begins reset exception handling. if the stby pin is driven low, the lsi enters hardware standby mode.
rev. 1.0, 09/02, page 461 of 524 19.9 subactive mode the cpu makes a transition to subactive mode when the sleep instruction is executed in high- speed mode with the ssby bit in sbycr set to 1, the dton bit and lson bit in lpwrcr set to 1, and the pss bit in tcsr (wdt_1) set to 1. when an interrupt occurs in watch mode, and if the lson bit in lpwrcr is 1, a direct transition is made to subactive mode. similarly, if an interrupt occurs in subsleep mode, a transition is made to subactive mode. in subactive mode, the cpu operates at a low speed based on the subclock and sequentially executes programs. peripheral modules other than tmr_0, tmr_1, wdt_0, and wdt_1 are also stopped. when operating the cpu in subactive mode, the sck2 to sck0 bits in sbycr must be cleared to 0. subactive mode is exited by the sleep instruction, res pin input, or stby pin input. when the sleep instruction is executed with the ssby bit in sbycr set to 1, the dton bit in lpwrcr cleared to 0, and the pss bit in tcsr (wdt_1) set to 1, the cpu exits subactive mode and a transition is made to watch mode. when the sleep instruction is executed with the ssby bit in sbycr cleared to 0, the lson bit in lpwrcr set to 1, and the pss bit in tcsr (wdt_1) set to 1, a transition is made to subsleep mode. when the sleep instruction is executed with the ssby bit in sbycr set to 1, the dton bit and lson bit in lpwrcr set to 10, and the pss bit in tcsr (wdt_1) set to 1, a direct transition is made to high-speed mode. for details of direct transitions, see section 19.11, direct transitions. when the res pin is driven low, system clock oscillation starts. simultaneously with the start of system clock oscillation, the system clock is supplied to the entire lsi. note that the res pin must be held low until the clock oscillation is stabilized. if the res pin is driven high after the clock oscillation stabilization time has passed, the cpu begins reset exception handling. if the stby pin is driven low, the lsi enters hardware standby mode.
rev. 1.0, 09/02, page 462 of 524 19.10 module stop mode module stop mode can be individually set for each on-chip peripheral module. when the corresponding mstp bit in mstpcr is set to 1, module operation stops at the end of the bus cycle and a transition is made to module stop mode. in turn, when the corresponding mstp bit is cleared to 0, module stop mode is cancelled and the module operation resumes at the end of the bus cycle. in module stop mode, the internal states of modules other than the sci and pwmx are retained. after the reset state is cancelled, all modules are in module stop mode. while an on-chip peripheral module is in module stop mode, read/write access to its registers is disabled. 19.11 direct transitions the cpu executes programs in three modes: high-speed, medium-speed, and subactive. when a direct transition is made from high-speed mode to subactive mode, there is no interruption of program execution. a direct transition is enabled by setting the dton bit in lpwrcr to 1 and then executing the sleep instruction. after a transition, direct transition exception handling starts. the cpu makes a transition to subactive mode when the sleep instruction is executed in high- speed mode with the ssby bit in sbycr set to 1, the lson bit and dton bit in lpwrcr set to 11, and the pss bit in tscr (wdt_1) set to 1. to make a direct transition to high-speed mode after the time set in the sts2 to sts0 bits in sbycr has elapsed, execute the sleep instruction in subactive mode with the ssby bit in sbycr set to 1, the lson bit and dton bit in lpwrcr set to 01, and the pss bit in tscr (wdt_1) set to 1.
rev. 1.0, 09/02, page 463 of 524 19.12 usage notes 19.12.1 i/o port status the status of the i/o ports is retained in software standby mode. therefore, when a high level is output, the current consumption is not reduced by the amount of current to support the high level output. 19.12.2 current consumption when waiting for oscillation stabilization the current consumption increases during oscillation stabilization.
rev. 1.0, 09/02, page 464 of 524
rev. 1.0, 09/02, page 465 of 524 section 20 list of registers the register list gives information on the on-chip i/o register addresses, how the register bits are configured, and the register states in each operating mode. the information is given as shown below. 1. register addresses (address order) registers are listed from the lower allocation addresses. the msb-side address is indicated for 16-bit addresses. registers are classified by functional modules. the access size is indicated. 2. register bits bit configurations of the registers are described in the same order as the register addresses (address order) above. reserved bits are indicated by ? in the bit name column. the bit number in the bit-name column indicates that the whole register is allocated as a counter or for holding data. 16-bit registers are indicated from the bit on the msb side. 3. register states in each operating mode register states are described in the same order as the register addresses (address order) above. the register states described here are for the basic operating modes. if there is a specific reset for an on-chip peripheral module, refer to the section on that on-chip peripheral module. 4. register select conditions register states are described in the same order as the register addresses (address order) above. for details on the register select conditions, refer to section 3.2.2, system control register (syscr), 3.2.3, serial timer control register (stcr), 19.1.3, module stop control registers h and l (mstpcrh, mstpcrl), and the register descriptions for each module. 20.1 register addresses (address order) the data bus width indicates the numbers of bits by which the register is accessed. the number of access states indicates the number of states based on the specified reference clock.
rev. 1.0, 09/02, page 466 of 524 register name abbreviation number of bits address module data bus width number of access states timer xy control register * tcrxy 8 h'fe00 tmr_x, tmr_y 83 port 7 output data register * p7odr 8 h'fe02 port 8 3 port 7 data direction register * p7ddr 8 h'fe03 port 8 3 serial pin select register * spsr 8 h'fe0f sci_1 8 3 bidirectional data register 0mw twr0mw 8 h'fe20 lpc 8 3 bidirectional data register 0sw twr0sw 8 h'fe20 lpc 8 3 bidirectional data register 1 twr1 8 h'fe21 lpc 8 3 bidirectional data register 2 twr2 8 h'fe22 lpc 8 3 bidirectional data register 3 twr3 8 h'fe23 lpc 8 3 bidirectional data register 4 twr4 8 h'fe24 lpc 8 3 bidirectional data register 5 twr5 8 h'fe25 lpc 8 3 bidirectional data register 6 twr6 8 h'fe26 lpc 8 3 bidirectional data register 7 twr7 8 h'fe27 lpc 8 3 bidirectional data register 8 twr8 8 h'fe28 lpc 8 3 bidirectional data register 9 twr9 8 h'fe29 lpc 8 3 bidirectional data register 10 twr10 8 h'fe2a lpc 8 3 bidirectional data register 11 twr11 8 h'fe2b lpc 8 3 bidirectional data register 12 twr12 8 h'fe2c lpc 8 3 bidirectional data register 13 twr13 8 h'fe2d lpc 8 3 bidirectional data register 14 twr14 8 h'fe2e lpc 8 3 bidirectional data register 15 twr15 8 h'fe2f lpc 8 3 input data register 3 idr3 8 h'fe30 lpc 8 3 output data register 3 odr3 8 h'fe31 lpc 8 3 status register 3 str3 8 h'fe32 lpc 8 3 lpc channel address register h ladr3h 8 h'fe34 lpc 8 3 lpc channel address register l ladr3l 8 h'fe35 lpc 8 3 serirq control register 0 sirqcr0 8 h'fe36 lpc 8 3 serirq control register 1 sirqcr1 8 h'fe37 lpc 8 3 input data register 1 idr1 8 h'fe38 lpc 8 3 output data register 1 odr1 8 h'fe39 lpc 8 3 status register 1 str1 8 h'fe3a lpc 8 3
rev. 1.0, 09/02, page 467 of 524 register name abbreviation number of bits address module data bus width number of access states input data register 2 idr2 8 h'fe3c lpc 8 3 output data register 2 odr2 8 h'fe3d lpc 8 3 status register 2 str2 8 h'fe3e lpc 8 3 host interface select register hisel 8 h'fe3f lpc 8 3 host interface control register 0 hicr0 8 h'fe40 lpc 8 3 host interface control register 1 hicr1 8 h'fe41 lpc 8 3 host interface control register 2 hicr2 8 h'fe42 lpc 8 3 host interface control register 3 hicr3 8 h'fe43 lpc 8 3 wakeup event interrupt mask register b wuemrb 8 h'fe44 int 8 3 i 2 c bus extended control register_0 icxr_0 8 h'fed4 iic_0 8 2 i 2 c bus extended control register_1 icxr_1 8 h'fed5 iic_1 8 2 keyboard control register h_0 kbcrh_0 8 h'fed8 keyboard buffer controller _0 82 keyboard control register l_0 kbcrl_0 8 h'fed9 keyboard buffer controller _0 82 keyboard data buffer register_0 kbbr_0 8 h'feda keyboard buffer controller _0 82 keyboard control register h_1 kbcrh_1 8 h'fedc keyboard buffer controller _1 82 keyboard control register l_1 kbcrl_1 8 h'fedd keyboard buffer controller _1 82 keyboard data buffer register_1 kbbr_1 8 h'fede keyboard buffer controller _1 82
rev. 1.0, 09/02, page 468 of 524 register name abbreviation number of bits address module data bus width number of access states keyboard control register h_2 kbcrh_2 8 h'fee0 keyboard buffer controller_ 2 82 keyboard control register l_2 kbcrl_2 8 h'fee1 keyboard buffer controller_ 2 82 keyboard data buffer register_2 kbbr_2 8 h'fee2 keyboard buffer controller_ 2 82 ddc switch register ddcswr 8 h'fee6 iic_0 8 2 interrupt control register a icra 8 h'fee8 int 8 2 interrupt control register b icrb 8 h'fee9 int 8 2 interrupt control register c icrc 8 h'feea int 8 2 irq status register isr 8 h'feeb int 8 2 irq sense control register h iscrh 8 h'feec int 8 2 irq sense control register l iscrl 8 h'feed int 8 2 address break control register abrkcr 8 h'fef4 int 8 2 break address register a bara 8 h'fef5 int 8 2 break address register b barb 8 h'fef6 int 8 2 break address register c barc 8 h'fef7 int 8 2 flash memory control register 1 flmcr1 8 h'ff80 flash 8 2 flash memory control register 2 flmcr2 8 h'ff81 flash 8 2 erase block register 1 ebr1 8 h'ff82 flash 8 2 system control register 2 syscr2 8 h'ff83 system 8 2 erase block register 2 ebr2 8 h'ff83 flash 8 2 standby control register sbycr 8 h'ff84 system 8 2 low power control register lpwrcr 8 h'ff85 system 8 2 module stop control register h mstpcrh 8 h'ff86 system 8 2 module stop control register l mstpcrl 8 h'ff87 system 8 2 serial mode register_1 smr_1 8 h'ff88 sci_1 8 2 i 2 c bus control register_1 iccr_1 8 h'ff88 iic_1 8 2
rev. 1.0, 09/02, page 469 of 524 register name abbreviation number of bits address module data bus width number of access states bit rate register_1 brr_1 8 h'ff89 sci_1 8 2 i 2 c bus status register_1 icsr_1 8 h'ff89 iic_1 8 2 serial control register_1 scr_1 8 h'ff8a sci_1 8 2 transmit data register_1 tdr_1 8 h'ff8b sci_1 8 2 serial status register_1 ssr_1 8 h'ff8c sci_1 8 2 receive data register_1 rdr_1 8 h'ff8d sci_1 8 2 smart card mode register_1 scmr_1 8 h'ff8e sci_1 8 2 i 2 c bus data register_1 icdr_1 8 h'ff8e iic_1 8 2 second slave address register_1 sarx_1 8 h'ff8e iic_1 8 2 i 2 c bus mode register_1 icmr_1 8 h'ff8f iic_1 8 2 slave address register_1 sar_1 8 h'ff8f iic_1 8 2 timer interrupt enable register tier 8 h'ff90 frt 8 2 timer control/status register tcsr 8 h'ff91 frt 8 2 free running counter h frch 8 h'ff92 frt 8 2 free running counter l frcl 8 h'ff93 frt 8 2 output control register ah ocrah 8 h'ff94 frt 8 2 output control register bh ocrbh 8 h'ff94 frt 8 2 output control register al ocral 8 h'ff95 frt 8 2 output control register bl ocrbl 8 h'ff95 frt 8 2 timer control register tcr 8 h'ff96 frt 8 2 timer output compare control register tocr 8 h'ff97 frt 8 2 input capture register ah icrah 8 h'ff98 frt 8 2 output control register arh ocrarh 8 h'ff98 frt 8 2 input capture register al icral 8 h'ff99 frt 8 2 output control register arl ocrarl 8 h'ff99 frt 8 2 input capture register bh icrbh 8 h'ff9a frt 8 2 output control register afh ocrafh 8 h'ff9a frt 8 2 input capture register bl icrbl 8 h'ff9b frt 8 2 output control register afl ocrafl 8 h'ff9b frt 8 2 input capture register ch icrch 8 h'ff9c frt 8 2 output compare register dmh ocrdmh 8 h'ff9c frt 8 2 input capture register cl icrcl 8 h'ff9d frt 8 2
rev. 1.0, 09/02, page 470 of 524 register name abbreviation number of bits address module data bus width number of access states output compare register dml ocrdml 8 h'ff9d frt 8 2 input capture register dh icrdh 8 h'ff9e frt 8 2 input capture register dl icrdl 8 h'ff9f frt 8 2 pwm (d/a) control register dacr 8 h'ffa0 pwmx 8 2 pwm (d/a) data register ah dadrah 8 h'ffa0 pwmx 8 2 pwm (d/a) data register al dadral 8 h'ffa1 pwmx 8 2 pwm (d/a) counter h dacnth 8 h'ffa6 pwmx 8 2 pwm (d/a) data register bh dadrbh 8 h'ffa6 pwmx 8 2 pwm (d/a) counter l dacntl 8 h'ffa7 pwmx 8 2 pwm (d/a) data register bl dadrbl 8 h'ffa7 pwmx 8 2 timer control/status register_0 tcsr_0 8 h'ffa8 wdt_0 8 2 timer counter_0 tcnt_0 8 h'ffa8 (write) wdt_0 8 2 timer counter_0 tcnt_0 8 h'ffa9 (read) wdt_0 8 2 port a output data register paodr 8 h'ffaa port 8 2 port a input data register papin 8 h'ffab port 8 2 port a data direction register paddr 8 h'ffab port 8 2 port 1 pull-up mos control register p1pcr 8 h'ffac port 8 2 port 2 pull-up mos control register p2pcr 8 h'ffad port 8 2 port 3 pull-up mos control register p3pcr 8 h'ffae port 8 2 port 1 data direction register p1ddr 8 h'ffb0 port 8 2 port 2 data direction register p2ddr 8 h'ffb1 port 8 2 port 1 data register p1dr 8 h'ffb2 port 8 2 port 2 data register p2dr 8 h'ffb3 port 8 2 port 3 data direction register p3ddr 8 h'ffb4 port 8 2 port 4 data direction register p4ddr 8 h'ffb5 port 8 2 port 3 data register p3dr 8 h'ffb6 port 8 2 port 4 data register p4dr 8 h'ffb7 port 8 2 port 5 data direction register p5ddr 8 h'ffb8 port 8 2 port 6 data direction register p6ddr 8 h'ffb9 port 8 2 port 5 data register p5dr 8 h'ffba port 8 2
rev. 1.0, 09/02, page 471 of 524 register name abbreviation number of bits address module data bus width number of access states port 6 data register p6dr 8 h'ffbb port 8 2 port b output data register pbodr 8 h'ffbc port 8 2 port b input data register pbpin 8 h'ffbd (read) port 8 2 port 8 data direction register p8ddr 8 h'ffbd (write) port 8 2 port 7 input data register p7pin 8 h'ffbe (read) port 8 2 port b data direction register pbddr 8 h'ffbe (write) port 8 2 port 8 data register p8dr 8 h'ffbf port 8 2 port 9 data direction register p9ddr 8 h'ffc0 port 8 2 port 9 data register p9dr 8 h'ffc1 port 8 2 interrupt enable register ier 8 h'ffc2 int 8 2 serial timer control register stcr 8 h'ffc3 system 8 2 system control register syscr 8 h'ffc4 system 8 2 mode control register mdcr 8 h'ffc5 system 8 2 bus control register bcr 8 h'ffc6 bsc 8 2 wait state control register wscr 8 h'ffc7 bsc 8 2 timer control register_0 tcr_0 8 h'ffc8 tmr_0 8 2 timer control register_1 tcr_1 8 h'ffc9 tmr_1 8 2 timer control/status register_0 tcsr_0 8 h'ffca tmr_0 8 2 timer control/status register_1 tcsr_1 8 h'ffcb tmr_1 16 2 time constant register a_0 tcora_0 8 h'ffcc tmr_0 16 2 time constant register a_1 tcora_1 8 h'ffcd tmr_1 16 2 time constant register b_0 tcorb_0 8 h'ffce tmr_0 16 2 time constant register b_1 tcorb_1 8 h'ffcf tmr_1 16 2 timer counter_0 tcnt_0 8 h'ffd0 tmr_0 16 2 timer counter_1 tcnt_1 8 h'ffd1 tmr_1 16 2 i 2 c bus control register_0 iccr_0 8 h'ffd8 iic_0 8 2 i 2 c bus status register_0 icsr_0 8 h'ffd9 iic_0 8 2 i 2 c bus data register_0 icdr_0 8 h'ffde iic_0 8 2 second slave address register_0 sarx_0 8 h'ffde iic_0 8 2
rev. 1.0, 09/02, page 472 of 524 register name abbreviation number of bits address module data bus width number of access states i 2 c bus mode register_0 icmr_0 8 h'ffdf iic_0 8 2 slave address register_0 sar_0 8 h'ffdf iic_0 8 2 timer control/status register_1 tcsr_1 8 h'ffea wdt_1 8 2 timer counter_1 tcnt_1 8 h'ffea (write) wdt_1 8 2 timer counter_1 tcnt_1 8 h'ffeb (read) wdt_1 8 2 timer control register_x tcr_x 8 h'fff0 tmr_x 16 2 timer control register_y tcr_y 8 h'fff0 tmr_y 16 2 keyboard matrix interrupt register 6 kmimr 8 h'fff1 int 8 2 timer control/status register_x tcsr_x 8 h'fff1 tmr_x 16 2 timer control/status register_y tcsr_y 8 h'fff1 tmr_y 16 2 pull-up mos control register kmpcr 8 h'fff2 port 8 2 input capture register r ticrr 8 h'fff2 tmr_x 16 2 time constant register a_y tcora_y 8 h'fff2 tmr_y 16 2 keyboard matrix interrupt register a kmimra 8 h'fff3 int 8 2 input capture register f ticrf 8 h'fff3 tmr_x 16 2 time constant register b_y tcorb_y 8 h'fff3 tmr_y 16 2 timer counter_x tcnt_x 8 h'fff4 tmr_x 16 2 timer counter_y tcnt_y 8 h'fff4 tmr_y 16 2 timer constant register c tcorc 8 h'fff5 tmr_x 16 2 timer input select register tisr 8 h'fff5 tmr_y 16 2 timer constant register a_x tcora_x 8 h'fff6 tmr_x 16 2 timer constant register b_x tcorb_x 8 h'fff7 tmr_x 16 2 timer connection register i tconri 8 h'fffc tmr_x 8 2 timer connection register s tconrs 8 h'fffe tmr_y 8 2 note: * the program development tool (emulator) does not support this register.
rev. 1.0, 09/02, page 473 of 524 20.2 register bits register addresses and bit names of the on-chip peripheral modules are described below. 16-bit registers are shown as 2 lines. register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcrxy * 3 osx oey cksx cksy tmr_x, tmr_y p7odr * 3 p77odr p76odr p75odr p74odr p73odr p72odr p71odr p70odr p7ddr * 3 p77ddr p76ddr p75ddr p74ddr p73ddr p72ddr p71ddr p70ddr port spsr * 3 sps1 sci_1 twr0mw bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr0sw bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr4 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr5 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr6 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr7 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr9 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr10 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr11 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr12 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr13 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr14 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 twr15 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 idr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr3 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str3 * 1 ibf3b obf3b mwmf swmf c/ d 3 dbu32 ibf3a obf3a str3 * 2 dbu37 dbu36 dbu35 dbu34 c/ d 3 dbu32 ibf3a obf3a ladr3h bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ladr3l bit 7 bit 6 bit 5 bit 4 bit 3 ? bit 1 twre lpc
rev. 1.0, 09/02, page 474 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sirqcr0 q/ c selreq iedir smie3b smie3a smie2 irq12e1 irq1e1 sirqcr1 irq11e3 irq10e3 irq9e3 irq6e3 irq11e2 irq10e2 irq9e2 irq6e2 idr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str1 dbu17 dbu16 dbu15 dbu14 c/ d 1 dbu12 ibf1 obf1 idr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 odr2 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 str2 dbu27 dbu26 dbu25 dbu24 c/ d 2 dbu22 ibf2 obf2 hisel selstr3 selirq11 selirq10 selirq9 selirq6 selsmi selirq12 selirq1 hicr0 lpc3e lpc2e lpc1e fga20e sdwne pmee lsmie lscie hicr1 lpcbsy clkreq irqbsy lrstb sdwnb pmeb lsmib lscib hicr2 ga20 lrst sdwn abrt ibfie3 ibfie2 ibfie1 errie hicr3 lframe clkrun serirq lreset lpcpd pme lsmi lsci lpc wuemrb wuemr7 wuemr6 wuemr5 wuemr4 wuemr3 wuemr2 wuemr1 wuemr0 int icxr_0 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_0 icxr_1 stopim hnds icdrf icdre alie alsl fnc1 fnc0 iic_1 kbcrh_0 kbioe kclki kdi kbfsel kbie kbf per kbs kbcrl_0 kbe kclko kdo rxcr3 rxcr2 rxcr1 rxcr0 kbbr_0 kb7 kb6 kb5 kb4 kb3 kb2 kb1 kb0 keyboard buffer controller _0 kbcrh_1 kbioe kclki kdi kbfsel kbie kbf per kbs kbcrl_1 kbe kclko kdo rxcr3 rxcr2 rxcr1 rxcr0 kbbr_1 kb7 kb6 kb5 kb4 kb3 kb2 kb1 kb0 keyboard buffer controller _1 kbcrh_2 kbioe kclki kdi kbfsel kbie kbf per kbs kbcrl_2 kbe kclko kdo rxcr3 rxcr2 rxcr1 rxcr0 kbbr_2 kb7 kb6 kb5 kb4 kb3 kb2 kb1 kb0 keyboard buffer controller _2
rev. 1.0, 09/02, page 475 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ddcswr clr3 clr2 clr1 clr0 iic_0 icra icra7 icra6 icra5 icra4 icra3 icra2 icra1 icra0 icrb icrb7 icrb6 icrb5 icrb4 icrb3 icrb2 icrb1 icrb0 icrc icrc7 icrc6 icrc5 icrc4 icrc3 icrc2 icrc1 icrc0 isr irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f iscrh irq7scb irq7sca irq6scb irq6sca irq5scb irq5sca irq4scb irq4sca iscrl irq3scb irq3sca irq2scb irq2sca irq1scb irq1sca irq0scb irq0sca abrkcr cmf bie bara a23 a22 a21 a20 a19 a18 a17 a16 barb a15 a14 a13 a12 a11 a10 a9 a8 barca7a6a5a4a3 a2a1 int flmcr1 fwe swe ev pv e p flmcr2 fler esu psu ebr1 flash syscr2 kwul1 kwul0 p6pue sde cs4e cs3e hi12e system ebr2 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 flash sbycr ssby sts2 sts1 sts0 sck2 sck1 sck0 lpwrcr dton lson nesel excle mstpcrh mstp15 mstp14 mstp13 mstp12 mstp11 mstp10 mstp9 mstp8 mstpcrl mstp7 mstp6 mstp5 mstp4 mstp3 mstp2 mstp1 mstp0 system smr_1 c/ a chr pe o/ e stop mp cks1 cks0 sci_1 iccr_1 ice ieic mst trs acke bbsy iric scp iic_1 brr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sci_1 icsr_1 estp stop irtr aasx al aas adz ackb iic_1 scr_1 tie rie te re mpie teie cke1 cke0 tdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ssr_1 tdre rdrf orer fer per tend mpb mpbt rdr_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scmr_1 sdir sinv smif sci_1 icdr_1 icdr7 icdr6 icdr5 icdr4 icdr3 icdr2 icdr1 icdr0 sarx_1 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_1 mls wait cks2 cks1 cks0 bc2 bc1 bc0 sar_1 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_1
rev. 1.0, 09/02, page 476 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tier iciae icibe icice icide ociae ocibe ovie tcsr icfa icfb icfc icfd ocfa ocfb ovf cclra frch bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 frcl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrah bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ocrbh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ocral bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrbl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcr iedga iedgb iedgc iedgd bufea bufeb cks1 cks0 tocr icrdms ocrams icrs ocrs oea oeb olvla olvlb icrah bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ocrarh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 icral bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrarl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icrbh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ocrafh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 icrbl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrafl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icrch bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 ocrdmh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 icrcl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ocrdml bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 icrdh bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 icrdl bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 frt dacr test pwme oeb oea os cks dadrah da13 da12 da11 da10 da9 da8 da7 da6 dadral da5 da4 da3 da2 da1 da0 cfs dacnth uc7 uc6 uc5 uc4 uc3 uc2 uc1 uc0 dadrbh da13 da12 da11 da10 da9 da8 da7 da6 dacntl uc8 uc9 uc10 uc11 uc12 uc13 regs dadrbl da5 da4 da3 da2 da1 da0 cfs regs pwmx
rev. 1.0, 09/02, page 477 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcsr_0 ovf wt/ it tme rst/ nmi cks2 cks1 cks0 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 wdt_0 paodr pa7odr pa6odr pa5odr pa4odr pa3odr pa2odr pa1odr pa0odr papin pa7pin pa6pin pa5pin pa4pin pa3pin pa2pin pa1pin pa0pin paddr pa7ddr pa6ddr pa5ddr pa4ddr pa3ddr pa2ddr pa1ddr pa0ddr p1pcr p17pcr p16pcr p15pcr p14pcr p13pcr p12pcr p11pcr p10pcr p2pcr p27pcr p26pcr p25pcr p24pcr p23pcr p22pcr p21pcr p20pcr p3pcr p37pcr p36pcr p35pcr p34pcr p33pcr p32pcr p31pcr p30pcr p1ddr p17ddr p16ddr p15ddr p14ddr p13ddr p12ddr p11ddr p10ddr p2ddr p27ddr p26ddr p25ddr p24ddr p23ddr p22ddr p21ddr p20ddr p1dr p17dr p16dr p15dr p14dr p13dr p12dr p11dr p10dr p2dr p27dr p26dr p25dr p24dr p23dr p22dr p21dr p20dr p3ddr p37ddr p36ddr p35ddr p34ddr p33ddr p32ddr p31ddr p30ddr p4ddr p47ddr p46ddr p45ddr p44ddr p43ddr p42ddr p41ddr p40ddr p3dr p37dr p36dr p35dr p34dr p33dr p32dr p31dr p30dr p4dr p47dr p46dr p45dr p44dr p43dr p42dr p41dr p40dr p5ddr p52ddr p51ddr p50ddr p6ddr p67ddr p66ddr p65ddr p64ddr p63ddr p62ddr p61ddr p60ddr p5dr p52dr p51dr p50dr p6dr p67dr p66dr p65dr p64dr p63dr p62dr p61dr p60dr pbodr pb7odr pb6odr pb5odr pb4odr pb3odr pb2odr pb1odr pb0odr pbpin pb7pin pb6pin pb5pin pb4pin pb3pin pb2pin pb1pin pb0pin p8ddr p86ddr p85ddr p84ddr p83ddr p82ddr p81ddr p80ddr p7pin p77pin p76pin p75pin p74pin p73pin p72pin p71pin p70pin pbddr pb7ddr pb6ddr pb5ddr pb4ddr pb3ddr pb2ddr pb1ddr pb0ddr p8dr p86dr p85dr p84dr p83dr p82dr p81dr p80dr p9ddr p97ddr p96ddr p95ddr p94ddr p93ddr p92ddr p91ddr p90ddr p9dr p97dr p96dr p95dr p94dr p93dr p92dr p91dr p90dr port ier irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e int stcr iics iicx1 iicx0 iice flshe icks1 icks0 syscr intm1 intm0 xrst nmieg hie rame mdcr expe mds1 mds0 system bcr icis0 brstrm brsts1 brsts0 ios1 ios0 wscr abw ast wms1 wms0 wc1 wc0 bsc
rev. 1.0, 09/02, page 478 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcr_0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tcr_1 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tcsr_0 cmfb cmfa ovf adte os3 os2 os1 os0 tcsr_1 cmfb cmfa ovf os3 os2 os1 os0 tcora_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcora_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcnt_0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_0, tmr_1 iccr_0 ice ieic mst trs acke bbsy iric scp icsr_0 estp stop irtr aasx al aas adz ackb icdr_0 icdr7 icdr6 icdr5 icdr4 icdr3 icdr2 icdr1 icdr0 sarx_0 svax6 svax5 svax4 svax3 svax2 svax1 svax0 fsx icmr_0 mls wait cks2 cks1 cks0 bc2 bc1 bc0 sar_0 sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs iic_0 tcsr_1 ovf wt/ it tme pss rst/ nmi cks2 cks1 cks0 tcnt_1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 wdt_1 tcr_x cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_x tcr_y cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 tmr_y kmimr kmimr7 kmimr6 kmimr5 kmimr4 kmimr3 kmimr2 kmimr1 kmimr0 int tcsr_x cmfb cmfa ovf icf os3 os2 os1 os0 tmr_x tcsr_y cmfb cmfa ovf icie os3 os2 os1 os0 tmr_y kmpcr kmimr7 kmimr6 kmimr5 kmimr4 kmimr3 kmimr2 kmimr1 kmimr0 port ticrr bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_x tcora_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_y kmimra kmimr1 5 kmimr14 kmimr13 kmimr12 kmimr1 1 kmimr10 kmimr9 kmimr8 int ticrf bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_x tcorb_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_y tcnt_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_x tcnt_y bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_y tcorc bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr_x tisr is tmr_y
rev. 1.0, 09/02, page 479 of 524 register abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcora_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tcorb_x bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tconriicst tmr_x tconrs tmrx/y tmr_y notes: 1. when twre = 1 or selstr3 = 0 in ladr3l 2. when twre = 0 and selstr3 = 1 in ladr3l 3. the program development tool (emulator) does not support this register.
rev. 1.0, 09/02, page 480 of 524 20.3 register states in each operating mode register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module tcrxy * initialized initialized tmr_x, tmr_y p7odr * initialized initialized p7ddr * initialized initialized port spsr * initialized initialized sci_1 twr0mw twr0sw twr1 twr2 twr3 twr4 twr5 twr6 twr7 twr8 twr9 twr10 twr11 twr12 twr13 twr14 twr15 idr3 odr3 str3 initialized initialized ladr3h initialized initialized ladr3l initialized initialized sirqcr0 initialized initialized sirqcr1 initialized initialized idr1 odr1 lpc
rev. 1.0, 09/02, page 481 of 524 register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module str1 initialized initialized idr2 odr2 str2 initialized initialized hisel initialized initialized hicr0 initialized initialized hicr1 initialized initialized hicr2 initialized initialized hicr3 lpc wuemrb initialized initialized int icxr_0 initialized initialized iic_0 icxr_1 initialized initialized iic_1 kbcrh_0 initialized initialized initialized initialized initialized initialized initialized kbcrl_0 initialized initialized initialized initialized initialized initialized initialized kbbr_0 initialized initialized initialized initialized initialized initialized initialized keyboard buffer controller_0 kbcrh_1 initialized initialized initialized initialized initialized initialized initialized kbcrl_1 initialized initialized initialized initialized initialized initialized initialized kbbr_1 initialized initialized initialized initialized initialized initialized initialized keyboard buffer controller_1 kbcrh_2 initialized initialized initialized initialized initialized initialized initialized kbcrl_2 initialized initialized initialized initialized initialized initialized initialized kbbr_2 initialized initialized initialized initialized initialized initialized initialized keyboard buffer controller_2 ddcswr initialized initialized iic_0 icra initialized initialized icrb initialized initialized icrc initialized initialized isr initialized initialized iscrh initialized initialized iscrl initialized initialized abrkcr initialized initialized bara initialized initialized barb initialized initialized barc initialized initialized int
rev. 1.0, 09/02, page 482 of 524 register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module flmcr1 initialized initialized initialized initialized initialized initialized flmcr2 initialized initialized initialized initialized initialized initialized flash ebr1 initialized initialized initialized initialized initialized initialized flash syscr2 initialized initialized system ebr2 initialized initialized initialized initialized initialized initialized flash sbycr initialized initialized lpwrcr initialized initialized mstpcrh initialized initialized mstpcrl initialized initialized system smr_1 initialized initialized initialized initialized initialized initialized initialized sci_1 iccr_1 initialized initialized iic_1 brr_1 initialized initialized initialized initialized initialized initialized initialized sci_1 icsr_1 initialized initialized iic_1 scr_1 initialized initialized initialized initialized initialized initialized initialized tdr_1 initialized initialized initialized initialized initialized initialized initialized ssr_1 initialized initialized initialized initialized initialized initialized initialized rdr_1 initialized initialized initialized initialized initialized initialized initialized scmr_1 initialized initialized initialized initialized initialized initialized initialized sci_1 icdr_1 sarx_1 initialized initialized icmr_1 initialized initialized sar_1 initialized initialized iic_1 tier initialized initialized tcsr initialized initialized frch initialized initialized frcl initialized initialized ocrah initialized initialized ocrbh initialized initialized ocral initialized initialized ocrbl initialized initialized tcr initialized initialized tocr initialized initialized icrah initialized initialized frt
rev. 1.0, 09/02, page 483 of 524 register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module ocrarh initialized initialized icral initialized initialized ocrarl initialized initialized icrbh initialized initialized ocrafh initialized initialized icrbl initialized initialized ocrafl initialized initialized icrch initialized initialized ocrdmh initialized initialized icrcl initialized initialized ocrdml initialized initialized icrdh initialized initialized icrdl initialized initialized frt dacr initialized initialized initialized initialized initialized initialized initialized dadrah initialized initialized initialized initialized initialized initialized initialized dadral initialized initialized initialized initialized initialized initialized initialized dacnth initialized initialized initialized initialized initialized initialized initialized dadrbh initialized initialized initialized initialized initialized initialized initialized dacntl initialized initialized initialized initialized initialized initialized initialized dadrbl initialized initialized initialized initialized initialized initialized initialized pwmx tcsr_0 initialized initialized tcnt_0 initialized initialized wdt_0 paodr initialized initialized papin paddr initialized initialized p1pcr initialized initialized p2pcr initialized initialized port p3pcr initialized initialized p1ddr initialized initialized p2ddr initialized initialized p1dr initialized initialized p2dr initialized initialized port
rev. 1.0, 09/02, page 484 of 524 register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module p3ddr initialized initialized p4ddr initialized initialized p3dr initialized initialized p4dr initialized initialized p5ddr initialized initialized p6ddr initialized initialized p5dr initialized initialized p6dr initialized initialized pbodr initialized initialized pbpin p8ddr initialized initialized p7pin pbddr initialized initialized p8dr initialized initialized p9ddr initialized initialized p9dr initialized initialized port ier initialized initialized int stcr initialized initialized syscr initialized initialized mdcr initialized initialized system bcr initialized initialized wscr initialized initialized bsc tcr_0 initialized initialized tcr_1 initialized initialized tcsr_0 initialized initialized tcsr_1 initialized initialized tcora_0 initialized initialized tcora_1 initialized initialized tmr_0, tmr_1 tcorb_0 initialized initialized tcorb_1 initialized initialized tcnt_0 initialized initialized tcnt_1 initialized initialized tmr_0, tmr_1
rev. 1.0, 09/02, page 485 of 524 register abbrevia- tion reset high-speed/ medium- speed watch sleep sub- active sub-sleep module stop software standby hardware standby module iccr_0 initialized initialized icsr_0 initialized initialized icdr _ 0 sarx _ 0 initialized initialized icmr _ 0 initialized initialized sar _ 0 initialized initialized iic_0 tcsr_1 initialized initialized tcnt_1 initialized initialized wdt_1 tcr_x initialized initialized tmr_x tcr_y initialized initialized tmr_y kmimr initialized initialized int tcsr_x initialized initialized tmr_x tcsr_y initialized initialized tmr_y kmpcr initialized initialized port ticrr initialized initialized tmr_x tcora_y initialized initialized tmr_y kmimra initialized initialized int ticrf initialized initialized tmr_x tcorb_y initialized initialized tmr_y tcnt_x initialized initialized tmr_x tcnt_y initialized initialized tmr_y tcorc initialized initialized tmr_x tisr initialized initialized tmr_y tcora_x initialized initialized tcorb_x initialized initialized tconri initialized initialized tmr_x tconrs initialized initialized tmr_y note: * the program development tool (emulator) does not support this register.
rev. 1.0, 09/02, page 486 of 524 20.4 register select conditions lower address register name register select condition module name h'fe00 * 2 tcrxy no condition tmr_x, tmr_y h'fe02 * 2 p7odr h'fe03 * 2 p7ddr no condition port h'fe0f * 2 spsr no condition sci_1 twr0mw h'fe20 twr0sw h'fe21 twr1 h'fe22 twr2 h'fe23 twr3 h'fe24 twr4 h'fe25 twr5 h'fe26 twr6 h'fe27 twr7 h'fe28 twr8 h'fe29 twr9 h'fe2a twr10 h'fe2b twr11 h'fe2c twr12 h'fe2d twr13 h'fe2e twr14 h'fe2f twr15 h'fe30 idr3 h'fe31 odr3 h'fe32 str3 h'fe34 ladr3h h'fe35 ladr3l h'fe36 sirqcr0 h'fe37 sirqcr1 h'fe38 idr1 h'fe39 odr1 h'fe3a str1 h'fe3c idr2 mstp = 0, (hi12e = 0) * 1 lpc
rev. 1.0, 09/02, page 487 of 524 lower address register name register select condition module name h'fe3d odr2 h'fe3e str2 h'fe3f hisel h'fe40 hicr0 h'fe41 hicr1 h'fe42 hicr2 h'fe43 hicr3 mstp = 0, (hi12e = 0) * 1 lpc h'fe44 wuemrb no condition int h'fed4 icxr_0 iic_0 h'fed5 icxr_1 no condition iic_1 h'fed8 kbcrh_0 h'fed9 kbcrl_0 h'feda kbbr_0 h'fedc kbcrh_1 h'fedd kbcrl_1 h'fede kbbr_1 h'fee0 kbcrh_2 h'fee1 kbcrl_2 h'fee2 kbbr_2 mstp2 = 0 keyboard buffer controller h'fee6 ddcswr mstp4 = 0 iic_0 h'fee8 icra h'fee9 icrb h'feea icrc h'feeb isr h'feec iscrh h'feed iscrl h'fef4 abrkcr h'fef5 bara h'fef6 barb h'fef7 barc no condition int
rev. 1.0, 09/02, page 488 of 524 lower address register name register select condition module name h'ff80 flmcr1 h'ff81 flmcr2 h'ff82 ebr1 flshe = 1 in stcr flash syscr2 flshe = 0 in stcr system h'ff83 ebr2 flshe = 1 in stcr flash h'ff84 sbycr h'ff85 lpwrcr h'ff86 mstpcrh h'ff87 mstpcrl flshe = 0 in stcr system smr_1 mstp6 = 0, iice = 0 in stcr sci_1 h'ff88 iccr_1 mstp3 = 0, iice = 1 in stcr iic_1 brr_1 mstp6 = 0, iice = 0 in stcr sci_1 h'ff89 icsr_1 mstp3 = 0, iice = 1 in stcr iic_1 h'ff8a scr_1 h'ff8b tdr_1 h'ff8c ssr_1 h'ff8d rdr_1 mstp6 = 0 scmr_1 mstp6 = 0, iice = 0 in stcr sci_1 icdr_1 ice = 1 in iccr1 h'ff8e sarx_1 ice = 0 in iccr1 icmr_1 ice = 1 in iccr1 h'ff8f sar_1 mstp3 = 0, iice = 1 in stcr ice = 0 in iccr1 iic_1 h'ff90 tier h'ff91 tcsr h'ff92 frch h'ff93 frcl ocrah ocrs = 0 in tocr h'ff94 ocrbh ocrs = 1 in tocr ocral ocrs = 0 in tocr h'ff95 ocrbl ocrs = 1 in tocr h'ff96 tcr mstp13 = 0 frt h'ff97 tocr h'ff98 icrah icrs = 0 in tocr ocrarh icrs = 1 in tocr
rev. 1.0, 09/02, page 489 of 524 lower address register name register select condition module name icral icrs = 0 in tocr h'ff99 ocrarl icrs = 1 in tocr icrbh icrs = 0 in tocr h'ff9a ocrafh icrs = 1 in tocr icrbl icrs = 0 in tocr h'ff9b ocrafl icrs = 1 in tocr icrch icrs = 0 in tocr h'ff9c ocrdmh icrs = 1 in tocr icrcl icrs = 0 in tocr h'ff9d ocrdml icrs = 1 in tocr h'ff9e icrdh h'ff9f icrdl mstp13 = 0 frt dacr regs = 1 in dacnt/ dadrb h'ffa0 dadrah mstp11 = 0, iice = 1 in stcr regs = 0 in dacnt/ dadrb h'ffa1 dadral mstp11 = 0, iice = 1 in stcr regs = 0 in dacnt/ dadrb pwmx dacnth regs = 1 in dacnt/ dadrb h'ffa6 dadrbh regs = 0 in dacnt/ dadrb dacntl regs = 1 in dacnt/ dadrb h'ffa7 dadrbl mstp11 = 0, iice = 1 in stcr regs = 0 in dacnt/ dadrb pwmx tcsr_0 h'ffa8 tcnt_0 (write) h'ffa9 tcnt_0 (read) no condition wdt_0
rev. 1.0, 09/02, page 490 of 524 lower address register name register select condition module name h'ffaa paodr papin (read) h'ffab paddr (write) h'ffac p1pcr h'ffad p2pcr h'ffae p3pcr h'ffb0 p1ddr h'ffb1 p2ddr h'ffb2 p1dr h'ffb3 p2dr h'ffb4 p3ddr h'ffb5 p4ddr h'ffb6 p3dr h'ffb7 p4dr h'ffb8 p5ddr h'ffb9 p6ddr h'ffba p5dr h'ffbb p6dr h'ffbc pbodr pbpin (read) h'ffbd p8ddr (write) p7pin (read) h'ffbe pbddr (write) h'ffbf p8dr h'ffc0 p9ddr h'ffc1 p9dr no condition port h'ffc2 ier no condition int h'ffc3 stcr h'ffc4 syscr h'ffc5 mdcr no condition system h'ffc6 bcr h'ffc7 wscr no condition bsc
rev. 1.0, 09/02, page 491 of 524 lower address register name register select condition module name h'ffc8 tcr_0 h'ffc9 tcr_1 h'ffca tcsr_0 h'ffcb tcsr_1 h'ffcc tcora_0 h'ffcd tcora_1 h'ffce tcorb_0 h'ffcf tcorb_1 h'ffd0 tcnt_0 h'ffd1 tcnt_1 mstp12 = 0 tmr_0, tmr_1 h'ffd8 iccr_0 h'ffd9 icsr_0 mstp4 = 0, iice = 1 in stcr icdr_0 ice = 1 in iccr0 h'ffde sarx_0 ice = 0 in iccr0 icmr_0 ice = 1 in iccr0 h'ffdf sar_0 mstp4 = 0, iice = 1 in stcr ice = 0 in iccr0 iic_0 tcsr_1 h'ffea tcnt_1 (write) h'ffeb tcnt_1 (read) no condition wdt_1 tcr_x tmrx/y = 0 in tconrs tmr_x h'fff0 tcr_y mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y kmimr mstp2 = 0, hie = 1 in syscr int tcsr_x tmrx/y = 0 in tconrs tmr_x h'fff1 tcsr_y mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y kmpcr mstp2 = 0, hie = 1 in syscr port ticrr tmrx/y = 0 in tconrs tmr_x h'fff2 tcora_y mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y
rev. 1.0, 09/02, page 492 of 524 lower address register name register select condition module name kmimra mstp2 = 0, hie = 1 in syscr int ticrf tmrx/y = 0 in tconrs tmr_x h'fff3 tcorb_y mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y tcnt_x tmrx/y = 0 in tconrs tmr_x h'fff4 tcnt_y mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y tcorc tmrx/y = 0 in tconrs tmr_x h'fff5 tisr mstp8 = 0, hie = 0 in syscr tmrx/y = 1 in tconrs tmr_y h'fff6 tcora_x h'fff7 tcorb_x mstp8 = 0, hie = 0 in syscr tmrx/y = 0 in tconrs tmr_x h'fffc tconri mstp8 = 0, hie = 0 in syscr tmr_x h'fffe tconrs mstp8 = 0, hie = 0 in syscr tmr_y notes: 1. although the settings of the hi12e bit in syscr2 do not affect the lpc operation, this bit must not be set to 1 according to the limitation depending on the program development tool (emulator) configuration. 2. the program development tool (emulator) does not support this register.
rev. 1.0, 09/02, page 493 of 524 section 21 electrical characteristics 21.1 electrical characteristics 21.1.1 absolute maximum ratings table 21.1 lists the absolute maximum ratings. table 21.1 absolute maximum ratings item symbol value unit power supply voltage v cc , v cl C0.3 to +4.3 v i/o buffer power supply voltage v cc b C0.3 to +7.0 v input voltage (except ports a, p97, p86, p52, and p42) v in C0.3 to v cc +0.3 v input voltage (port a) v in C0.3 to v cc b +0.3 v input voltage (p97, p86, p52, p42) v in C0.3 to +7.0 v operating temperature t opr C20 to +75 c operating temperature (flash memory programming/erasing) t opr C20 to +75 c storage temperature t stg C55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded. ensure so that the impressed voltage does not exceed 4.3 v for pins for which the maximum rating is determined by the voltage on the v cc and v cl pins, or 7.0 v for pins for which the maximum rating is determined by v cc b. the v cc and v cl pins must be connected to the v cc power supply.
rev. 1.0, 09/02, page 494 of 524 21.1.2 dc characteristics table 21.2 lists the dc characteristics. permitted output current values and bus drive characteristics are shown in tables 21.3 and 21.4, respectively. table 21.2 dc characteristics (1) conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, t a = C20 to +75c item symbol min typ max unit test conditions v t C v cc 0.2 v cc b 0.2 v t + v cc 0.7 v cc b 0.7 schmitt trigger input voltage p67 to p60 * 1 , kin15 to kin8 , irq2 to irq0 , irq5 to irq3 v t + C v t C v cc 0.05 v cc b 0.05 v v t C v cc 0.2 v t + v cc 0.7 p67 to p60 (kwul = 00) v t + C v t C v cc 0.05 v t C v cc 0.3 v t + v cc 0.7 p67 to p60 (kwul = 01) v t + C v t C v cc 0.05 v t C v cc 0.4 v t + v cc 0.8 p67 to p60 (kwul = 10) v t + C v t C v cc 0.03 v t C v cc 0.45 v t + v cc 0.9 schmitt trigger input voltage (in level switching) * 6 p67 to p60 (kwul = 11) (1) * 4 v t + C v t C 0.05 v res , stby , nmi, md1, md0 v cc 0.9 v cc +0.3 extal v cc 0.7 v cc +0.3 input high voltage pa7 to pa0 (2) v ih v cc b 0.7 v cc b + 0.3 v
rev. 1.0, 09/02, page 495 of 524 item symbol min typ max unit test conditions p97, p86, p52, p42 (2) v cc 0.7 5.5 input high voltage input pins except (1) and (2) above v ih v cc 0.7 v cc + 0.3 v res , stby , md1, md0 (3) v il C0.3 v cc 0.1 v cc b 0.2 v cc b = 3.0 v to 4.0 v pa7 to pa0 C0.3 0.8 v cc b = 4.0 v to 5.5 v input low voltage nmi, extal, input pins except (1) and (3) above C0.3 v cc 0.2 v v cc = 3.0 v to 3.6 v v cc C 0.5 v cc b C 0.5 vi oh = C200 a all output pins (except p97, p86, p52, and p42) * 2 , * 3 , * 4 v cc C 1.0 v cc b C 1.0 vi oh = C1 ma, (v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 4.5 v) output high voltage p97, p86, p52, and p42 * 2 v oh 0.5 v i oh = C200 a
rev. 1.0, 09/02, page 496 of 524 item symbol min typ max unit test conditions all output pins (except reso ) * 3 0.4vi ol = 1.6 ma ports 1 to 3 1.0 v i ol = 5 ma output low voltage reso v ol 0.4vi ol = 1.6 ma notes: 1. p67 to p60 include peripheral module inputs multiplexed on those pins. 2. p52/exsck1/scl0, p97/sda0, p86/sck1/scl1, and p42/sda1 are nmos push-pull outputs. when the scl0, sda0, scl1, or sda1 (ice = 1) pin is used as an output, it is nmos open-drain output. therefore, an external pull-up resistor must be connected in order to output high level. p52/exsck1, p97, p86/sck1, and p42 (ice = 0) high levels are driven by nmos. an external pull-up resistor is necessary to provide high-level output from sck1 and exsck1. 3. when iics = 0, ice = 0, and kbioe = 0. low-level output when the bus drive function is selected is determined separately. 4. the port a characteristics depend on v cc b, and the other pins characteristics depend on v cc .
rev. 1.0, 09/02, page 497 of 524 table 21.2 dc characteristics (2) conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, t a = C20 to +75c item symbol min typ max unit test conditions res 10.0 input leakage current stby , nmi, md1, md0 ? i in ? 1.0 a v in = 0.5 to v cc C 0.5 v three-state leakage current (off state) ports 1 to 9, a * 3 , and b ? i tsi ? 1.0av in = 0.5 to v cc C 0.5 v, v in = 0.5 to v cc b C 0.5 v ports 1 to 3 5 150 ports 6 (p6pue = 0) and b 30 300 port a * 3 30 600 input pull-up mos current port 6 (p6pue = 1) Ci p 3 100 a v in = 0 v, v cc = 3.0 v to 3.6 v v cc b = 3.0 v to 5.5 v res 80 pf nmi 50 pf p52, p97, p42, p86, pa7 to pa2 (4) 8 20 pf input capacitance input pins except (4) above c in 15 pf v in = 0 v, f = 1 mhz, t a = 25c normal operation 30 40 ma f = 10 mhz sleep mode 20 32 ma f = 10 mhz 15.0 t a 50c current dissipation * 1 standby mode * 2 i cc 20.0 a 50c < t a ram standby voltage v ram 2.0 v notes: 1. current dissipation values are for v ih min = v cc C 0.2 v, v cc b C 0.2 v, and v il max = 0.2 v with all output pins unloaded and the on-chip pull-up moss in the off state. 2. the values are for v ram v cc < 3.0 v, v ih min = v cc C 0.2 v, v cc b C 0.2 v, and v il max = 0.2 v. 3. the port a characteristics depend on v cc b, and the other pins characteristics depend on v cc .
rev. 1.0, 09/02, page 498 of 524 table 21.2 dc characteristics (3) when lpc function is used conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, t a = C20 to +75c item symbol min max unit test conditions input high voltage p37 to p30, p83 to p80, pb1, pb0 v ih v cc 0.5 v input low voltage p37 to p30, p83 to p80, pb1, pb0 v il v cc 0.3 v output high voltage p37, p33 to p30, p82 to p80, pb1, pb0 v oh v cc 0.9 v i oh = C0.5 ma output low voltage p37, p33 to p30, p82 to p80, pb1, pb0 v ol v cc 0.1 v i ol = 1.5 ma table 21.3 permissible output currents conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, t a = C20 to +75c item symbol min typ max unit scl1, scl0, sda1, sda0, ps2ac to ps2cc, ps2ad to ps2cd, pa7 to pa4 (bus drive function selected) 10 ports 1, 2, 3 2 reso 1 permissible output low current (per pin) other output pins i ol 1 ma total of ports 1, 2, and 3 40 permissible output low current (total) total of all output pins, including the above ? i ol 60 ma permissible output high current (per pin) all output pins Ci oh 2 ma permissible output high current (total) total of all output pins ? Ci oh 30ma notes: 1. to protect chip reliability, do not exceed the output current values in table 21.3. 2. when driving a darlington pair or led, always insert a current-limiting resistor in the output line, as show in figures 21.1 and 21.2.
rev. 1.0, 09/02, page 499 of 524 2 k w this lsi port darlington pair figure 21.1 darlington pair drive circuit (example) 600 w this lsi ports 1 to 3 led figure 21.2 led drive circuit (example)
rev. 1.0, 09/02, page 500 of 524 table 21.4 bus drive characteristics conditions: v cc = 3.0 v to 3.6 v, v ss = 0 v, ta = C20 to +75c applicable pins: scl1, scl0, sda1, sda0 (bus drive function selected) item symbol min typ max unit test conditions v t C v cc 0.3 v cc = 3.0 v to 3.6 v v t + v cc 0.7 v cc = 3.0 v to 3.6 v schmitt trigger input voltage v t + C v t C v cc 0.05 v v cc = 3.0 v to 3.6 v input high voltage v ih v cc 0.7 5.5 v v cc = 3.0 v to 3.6 v input low voltage v il C0.5 v cc 0.3 v cc = 3.0 v to 3.6 v v ol 0.5vi ol = 8 ma output low voltage 0.4 i ol = 3 ma input capacitance c in 20 pf v in = 0 v, f = 1 mhz, t a = 25c three-state leakage current (off state) | i tsi | 1.0 a v in = 0.5 to v cc C 0.5 v scl, sda output fall time t of 20 + 0.1cb 250 ns v cc = 3.0 v to 3.6 v conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, ta = C20 to +75c applicable pins: ps2ac, ps2ad, ps2bc, ps2bd, ps2cc, ps2cd, pa7 to pa4 (bus drive function selected) item symbol min typ max unit test conditions 0.8 i ol = 16 ma, v cc b = 4.5 v to 5.5 v 0.5 i ol = 8 ma output low voltage v ol 0.4 v i ol = 3 ma 21.1.3 ac characteristics figure 21.3 shows the test conditions for the ac characteristics.
rev. 1.0, 09/02, page 501 of 524 c chip output pin r h r l c = 30 pf: all output ports r l = 2.4 k w r h = 12 k w i/o timing test levels ? low level: 0.8 v ? high level: 2.0 v v cc figure 21.3 output load circuit clock timing: table 21.5 shows the clock timing. the clock timing specified here covers clock ( f ) output and clock pulse generator (crystal) and external clock input (extal pin) oscillation settling times. for details on external clock input (extal pin and excl pin) timing, see section 18, clock pulse generator. table 21.5 clock timing condition: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, f = 2 mhz to maximum operating frequency, t a = C20 to +75c condition 10 mhz item symbol min max unit reference clock cycle time t cyc 100 500 ns clock high pulse width t ch 30 ns clock low pulse width t cl 30 ns clock rise time t cr 20ns clock fall time t cf 20ns figure 21.5 oscillation settling time at reset (crystal) t osc1 20 ms oscillation settling time in software standby (crystal) t osc2 8ms external clock output stabilization delay time t dext 500 s figure 21.6 figure 21.7
rev. 1.0, 09/02, page 502 of 524 control signal timing: table 21.6 shows the control signal timing. the only external interrupts that can operate on the subclock ( f = 32.768 khz) are nmi and irq0, 1, 2, 6, and 7. table 21.6 control signal timing conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, f = 32.768 khz, 2 mhz to maximum operating frequency, t a = C20 to +75c condition 10 mhz item symbol min max unit test conditions res setup time t ress 300 ns res pulse width t resw 20 t cyc figure 21.8 nmi setup time (nmi) t nmis 250 ns nmi hold time (nmi) t nmih 10 ns nmi pulse width (exiting software standby mode) t nmiw 200 ns irq setup time ( irq7 to irq0 )t irqs 250 ns irq hold time( irq7 to irq0 )t irqh 10 ns irq pulse width ( irq7 , irq6 , irq2 to irq0 ) (exiting software standby mode) t irqw 200 ns figure 21.9
rev. 1.0, 09/02, page 503 of 524 timing of on-chip peripheral modules: tables 21.7 to 21.10 show the on-chip peripheral module timing. the only on-chip peripheral modules that can operate in subclock operation (? = 32.768 khz) are the i/o ports, external interrupts (nmi and irq0, 1, 2, 6, and 7), the watchdog timer, and the 8-bit timer (channels 0 and 1). table 21.7 timing of on-chip peripheral modules conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, f = 32.768 khz * , 2 mhz to maximum operating frequency, t a = C20 to +75c condition 10 mhz item symbol min max unit test conditions output data delay time t pwd 100 input data setup time t prs 50 i/o ports input data hold time t prh 50 ns figure 21.10 timer output delay time t ftod 100 timer input setup time t ftis 50 figure 21.11 timer clock input setup time t ftcs 50 ns single edge t ftcwh 1.5 frt timer clock pulse width both edges t ftcwl 2.5 t cyc figure 21.12 timer output delay time t tmod 100 figure 21.13 timer reset input setup time t tmrs 50 figure 21.15 timer clock input setup time t tmcs 50 ns single edge t tmcwh 1.5 tmr timer clock pulse width both edges t tmcwl 2.5 t cyc figure 21.14 pwmx pulse output delay time t pwod 100 ns figure 21.16 asynchronous t scyc 4 input clock cycle synchronous 6 t cyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr 1.5 sci input clock fall time t sckf 1.5 t cyc figure 21.17
rev. 1.0, 09/02, page 504 of 524 condition 10 mhz item symbol min max unit test conditions transmit data delay time (synchronous) t txd 100 ns receive data setup time (synchronous) t rxs 100 ns sci receive data hold time (synchronous) t rxh 100 ns figure 21.18 reso output delay time t resd 200 ns wdt reso output pulse width t resow 132 t cyc figure 21.19 note: * only peripheral modules that can be used in subclock operation table 21.8 keyboard buffer controller timing conditions: v cc = 3.0 v to 3.6 v, v cc b = 3.0 v to 5.5 v, v ss = 0 v, f = 2 mhz to maximum operating frequency, t a = C20 to +75c ratings item symbol min typ max unit test conditions notes kclk, kd output fall time t kbf 20 + 0.1cb 250 ns kclk, kd input data hold time t kbih 150 ns kclk, kd input data setup time t kbis 150 ns kclk, kd output delay time t kbod 450 ns kclk, kd capacitive load c b 400 pf figure 21.19
rev. 1.0, 09/02, page 505 of 524 table 21.9 i 2 c bus timing conditions: v cc = 3.0 v to 3.6 v, v ss = 0 v, f = 5 mhz to maximum operating frequency, t a = C20 to +75c ratings item symbol min typ max unit test conditions notes scl input cycle time t scl 12 t cyc scl input high pulse width t sclh 3t cyc scl input low pulse width t scll 5t cyc scl, sda input rise time t sr 7.5 * t cyc scl, sda input fall time t sf 300 ns scl, sda input spike pulse elimination time t sp 1 t cyc sda input bus free time t buf 5t cyc start condition input hold time t stah 3t cyc retransmission start condition input setup time t stas 3t cyc stop condition input setup time t stos 3t cyc data input setup time t sdas 0.5 t cyc data input hold time t sdah 0ns scl, sda capacitive load c b 400 pf figure 21.21 note: * 17.5 t cyc can be set according to the clock selected for use by the i 2 c module. for details, see section 13.6, usage notes. table 21.10 lpc module timing conditions: v cc = 3.0 v to 3.6 v, v ss = 0 v, f = 2 mhz to maximum operating frequency, t a = C20 to +75c item symbol min typ max unit test conditions input clock cycle t lcyc 30 input clock pulse width (h) t lckh 11 input clock pulse width (l) t lckl 11 transmit signal delay time t txd 211 transmit signal floating delay time t off 28 receive signal setup time t rxs 7 receive signal hold time t rxh 0 ns figure 21.22
rev. 1.0, 09/02, page 506 of 524 21.1.4 flash memory characteristics table 21.11 shows the flash memory characteristics. table 21.11 flash memory characteristics conditions: v cc = 3.0 v to 3.6 v, v ss = 0 v, t a = C20 to +75c item symbol min typ max unit test condition programming time * 1 , * 2 , * 4 t p 10 200 ms/ 128 bytes erase time * 1 , * 3 , * 6 t e 100 1200 ms/ block reprogramming count n wec 100 times wait time after swe-bit setting * 1 x1s wait time after psu-bit setting * 1 y50s z1 28 30 32 s 1 n 6 z2 198 200 202 s 7 n 1000 wait time after p-bit setting * 1 , * 4 z3 8 10 12 s additional write wait time after p-bit clear * 1 a 5s wait time after psu-bit clear * 1 b 5s wait time after pv-bit setting * 1 g 4s wait time after dummy write * 1 e 2s wait time after pv-bit clear * 1 h 2s wait time after swe-bit clear * 1 q 100 s programming maximum programming count * 1 , * 4 , * 5 n 1000 times
rev. 1.0, 09/02, page 507 of 524 item symbol min typ max unit test conditions wait time after swe-bit setting * 1 x1s wait time after esu-bit setting * 1 y 100 s wait time after e-bit setting * 1 , * 6 z 10 100 ms wait time after e-bit clear * 1 a 10 s wait time after esu-bit clear * 1 b 10 s wait time after ev-bit setting * 1 g 20 s wait time after dummy write * 1 e 2s wait time after ev-bit clear * 1 h 4s wait time after swe-bit clear * 1 q 100 s erase maximum erase count * 1 , * 6 , * 7 n 120 times notes: 1. set the times according to the program/erase algorithms. 2. programming time per 128 bytes (shows the total period for which the p-bit in flmcr1 is set. it does not include the programming verification time.) 3. block erase time (shows the total period for which the e-bit in flmcr1 is set. it does not include the erase verification time.) 4. maximum programming time (t p (max)) t p (max) = (wait time after p-bit setting (z1) + (z3)) 6 + wait time after p-bit setting (z2) ((n) C 6) 5. the maximum number of writes (n) should be set according to the actual set value of z1, z2 and z3 to allow programming within the maximum programming time (t p (max)). the wait time after p-bit setting (z1, z2, and z3) should be alternated according to the number of writes (n) as follows: 1 n 6 z1 = 30s, z3 = 10s 7 n 1000 z2 = 200s 6. maximum erase time (t e (max)) t e (max) = wait time after e-bit setting (z) maximum erase count (n) 7. the maximum number of erases (n) should be set according to the actual set value of z to allow erasing within the maximum erase time (t e (max)).
rev. 1.0, 09/02, page 508 of 524 21.1.5 usage note the method of connecting an external capacitor is shown in figure 21.4. connect the system power supply to the vcl pin together with the vcc pins. vcl vss 0.01 f 10 f bypass capacitor vcc power supply < vcc = 3.0 v to 3.6 v > connect the vcc power supply to the chip's vcl pin in the same way as the vcc pins. it is recommended that a bypass capacitor be connected to the power supply pins. (values are reference values.) figure 21.4 connection of vcl capacitor 21.2 timing chart 21.2.1 clock timing the clock timings are shown below. t ch t cyc t cf t cl t cr figure 21.5 system clock timing
rev. 1.0, 09/02, page 509 of 524 t osc1 t osc1 extal v cc t dext t dext figure 21.6 oscillation settling timing nmi (i = 0, 1, 2, 6, 7) t osc2 figure 21.7 oscillation setting timing (exiting software standby mode)
rev. 1.0, 09/02, page 510 of 524 21.2.2 control signal timing the control signal timings are shown below. t resw t ress t ress figure 21.8 reset input timing t irqs t nmis t nmih edge input (i = 7 to 0) nmi t irqs t irqh (i = 7 to 0) level input (i = 7 to 0) t nmiw t irqw figure 21.9 interrupt input timing
rev. 1.0, 09/02, page 511 of 524 21.2.3 on-chip peripheral module timing the on-chip peripheral module timings are shown below. ports 1 to 9, a, and b (read) t 2 t 1 t pwd t prh t prs ports 1 to 9, a, and b (write) figure 21.10 i/o port input/output timing t ftis t ftod ftoa, ftob ftia, ftib, ftic, ftid figure 21.11 frt input/output timing t ftcs ftci t ftcwh t ftcwl figure 21.12 frt clock input timing
rev. 1.0, 09/02, page 512 of 524 tmo0, tmo1 tmox, extmox tmoy t tmod figure 21.13 8-bit timer output timing tmci0, tmci1 tmix, tmiy t tmcs t tmcs t tmcwh t tmcwl figure 21.14 8-bit timer clock input timing tmri0, tmri1 tmix, tmiy t tmrs figure 21.15 8-bit timer reset input timing pwx1, pwx0 t pwod figure 21.16 pwmx output timing
rev. 1.0, 09/02, page 513 of 524 sck1, exsck1 t sckw t sckr t sckf t scyc figure 21.17 sck clock input timing txd1, extxd1 (transmit data) rxd1, exrxd1 (receive data) sck1, exsck1 t rxs t rxh t txd figure 21.18 sci input/output timing (synchronous mode) t trgs figure 21.19 wdt output timing ( r e s o )
rev. 1.0, 09/02, page 514 of 524 1. reception kclk/ kd * kclk/ kd * t kbis t kbih transmission (b) t kbf 2. transmission (a) kclk/ kd * t 1 t 2 t kbod note: shown here is the clock scaled by 1/n when the operating mode is active medium-speed mode. * kclk: ps2ac to ps2cc kd: ps2ad to ps2cd figure 21.20 keyboard buffer controller timing
rev. 1.0, 09/02, page 515 of 524 sda0, sda1 v il v ih t buf p * p * s * t stah t sclh t sr t scll t scl t sf t sdah sr * t sdas t stas t sp t stos note: * s, p, and sr indicate the following conditions. s: p: sr: start condition stop condition retransmission start condition scl0, scl1 figure 21.21 i 2 c bus interface input/output timing lclk lad3 to lad0, serirq, (transmit signal) lad3 to lad0, serirq, (receive signal) t txd t rxh t rxs t off lad3 to lad0, serirq, (transmit signal) t lcyc t lckh lclk t lckl figure 21.22 host interface (lpc) timing
rev. 1.0, 09/02, page 516 of 524 testing voltage: 0.4vcc 50pf figure 21.23 tester measurement condition
rev. 1.0, 09/02, page 517 of 524 appendix a i/o port states in each processing state table a.1 i/o port states in each processing state port name pin name reset hardware standby mode software standby mode watch mode sleep mode sub- sleep mode subactive mode program execution state port 1 t t keep keep keep keep i/o port i/o port port 2 t t keep keep keep keep i/o port i/o port port 3 t t keep keep keep keep i/o port i/o port port 4 t t keep keep keep keep i/o port i/o port port 5 t t keep keep keep keep i/o port i/o port port 6 t t keep keep keep keep i/o port i/o port port 7 t t keep keep keep keep i/o port * i/o port * port 8 t t keep keep keep keep i/o port i/o port port 97 t t keep keep keep keep i/o port i/o port port 96 f excl t t [ddr = 1] h [ddr = 0] t excl input [ddr = 1] clock output [ddr = 0] t excl input excl input clock output/ excl input/ input port ports 95 to 90 t t keep keep keep keep i/o port i/o port port a t t keep keep keep keep i/o port i/o port port b t t keep keep keep keep i/o port i/o port legend h: high l: low t: high-impedance state keep: input ports are in the high-impedance state (when ddr = 0 and pcr = 1, input pull-up moss remain on). output ports maintain their previous state. depending on the pins, the on-chip peripheral modules may be initialized and the i/o port function determined by ddr and dr used. ddr: data direction register note: * the program development tool (emulator) does not support the output.
rev. 1.0, 09/02, page 518 of 524 appendix b product codes product type product code mark code package (hitachi package code) f2110bvfa10 100-pin qfp (fp-100b) h8s/2110b flash memory version (3-v version) HD64F2110BV f2110bvte10 100-pin tqfp (tfp-100b)
rev. 1.0, 09/02, page 519 of 524 appendix c package dimensions hitachi code jedec eiaj weight (reference value) fp-100b conforms 1.2 g unit: mm * dimension including the plating thickness base material dimension 0.10 16.0 0.3 1.0 0.5 0.2 16.0 0.3 3.05 max 75 51 50 26 1 25 76 100 14 0? C 8? 0.5 0.08 m * 0.22 0.05 2.70 * 0.17 0.05 0.12 +0.13 C0.12 1.0 0.20 0.04 0.15 0.04 figure c.1 package dimensions (fp-100b)
rev. 1.0, 09/02, page 520 of 524 hitachi code jedec jeita mass (reference value) tfp-100b conforms 0.5 g * dimension including the plating thickness base material dimension 16.0 0.2 14 0.08 0.10 0.5 0.1 16.0 0.2 0.5 0.10 0.10 1.20 max * 0.17 0.05 0? C 8? 75 51 125 76 100 26 50 m * 0.22 0.05 1.0 1.00 1.0 0.20 0.04 0.15 0.04 unit: mm figure c.2 package dimensions (tfp-100b)
rev. 1.0, 09/02, page 521 of 524 index 14-bit pwm timer (pwmx)................. 135 16-bit count mode ................................. 201 16-bit free-running timer (frt) ......... 153 8-bit timer (tmr) ................................. 179 a20 gate................................................. 399 abrkcr.................. 71, 468, 475, 481, 487 absolute address...................................... 41 address map ............................................. 58 address space........................................... 21 addressing modes .................................... 40 arithmetic operations instructions........... 32 asynchronous mode ............................... 242 bar .......................... 71, 468, 475, 481, 487 bcc ............................................................ 37 bcr .......................... 93, 471, 477, 484, 490 bit manipulation instructions ................... 35 bit rate ..................................................... 236 block data transfer instructions .............. 39 boot mode .............................................. 426 branch instructions ................................... 37 break....................................................... 269 brr ........................................................ 236 buffered input capture input.................. 168 cascaded connection.............................. 201 clear timing........................................... 167 clock pulse generator ............................ 439 clocked synchronous mode ................... 260 cmi......................................................... 205 cmia...................................................... 204 cmiay ................................................... 205 cmib ...................................................... 204 cmiby ................................................... 205 compare-match count mode ................. 201 condition field .......................................... 39 condition-code register (ccr)............... 24 crystal resonator.................................... 440 dacnt................... 136, 470, 476, 483, 489 dacr ..................... 140, 470, 476, 483, 489 data transfer instructions.........................31 ddcswr ............... 298, 468, 475, 481, 487 direct transitions....................................462 ebr1....................... 424, 468, 475, 482, 488 ebr2....................... 424, 468, 475, 482, 488 eepmov instruction ................................50 effective address ......................................44 effective address extension.......................39 erase/erase-verify ..................................433 erasing units ............................................420 erri .......................................................408 error protection.......................................435 exception handling...................................61 exception vector table ............................62 extended control register (exr).............24 flash memory...........................................415 flmcr1 ................. 422, 468, 475, 482, 488 flmcr2 ................. 423, 468, 475, 482, 488 fov.........................................................172 framing error ...........................................249 frc ......................... 156, 469, 476, 482, 488 general registers ......................................23 hardware protection ...............................435 hardware standby mode.........................458 hicr0 ..................... 367, 467, 474, 481, 487 hicr1 ..................... 367, 467, 474, 481, 487 hicr2 ..................... 374, 467, 474, 481, 487 hicr3 ..................... 374, 467, 474, 481, 487 hisel ..................... 395, 467, 474, 481, 487 host interface lpc interface (lpc)........363 i 2 c bus data format ...............................303 i 2 c bus interface (iic) ............................275 iccr ....................... 285, 471, 478, 485, 491
rev. 1.0, 09/02, page 522 of 524 icdr....................... 279, 471, 478, 485, 491 ici........................................................... 172 icix........................................................ 205 icmr ...................... 282, 472, 478, 485, 491 icr .......................... 70, 156, 468, 469, 475, 476, 481, 482, 487, 488 icsr ....................... 294, 471, 478, 485, 491 icxr....................... 299, 467, 474, 481, 487 idr ......................... 378, 466, 474, 480, 486 ier............................ 73, 471, 477, 484, 490 iici ......................................................... 333 immediate ................................................. 42 increment timing ................................... 165 input capture input................................. 167 input capture operation ......................... 203 instruction set........................................... 29 interrupt control modes ........................... 81 interrupt controller................................... 67 interrupt exception handling ................... 64 interrupt exception handling vector table .................................................................. 78 interrupt mask bit..................................... 25 interval timer mode............................... 220 iscr ......................... 72, 468, 475, 481, 487 isr............................ 74, 468, 475, 481, 487 kbbr ..................... 350, 467, 474, 481, 487 kbcr ..................... 347, 467, 474, 481, 487 keyboard buffer controller.................... 345 kmimr .................... 74, 472, 478, 485, 491 kmimra ................. 74, 472, 478, 485, 492 kmpcr .................. 113, 472, 478, 485, 491 ladr3 ................... 377, 466, 473, 480, 486 logic operations instructions................... 34 lpwrcr................ 450, 468, 475, 482, 488 mark state............................................... 269 mcu operating mode selection .............. 51 mdcr ...................... 52, 471, 477, 484, 490 medium-speed mode ............................. 455 memory indirect ....................................... 43 module stop mode ................................. 462 mstpcr................. 451, 468, 475, 482, 488 multiprocessor communication function ................................................................ 253 nmi interrupt ............................................ 77 noise canceler ........................................ 330 oci.......................................................... 172 ocr ........................ 156, 469, 476, 483, 488 ocrdm.................................................. 157 odr ........................ 379, 466, 474, 480, 486 on-board programming modes.............. 425 operation field .......................................... 39 output compare output.......................... 166 overrun error ........................................... 249 ovi ................................................. 204, 205 oviy ...................................................... 205 p1ddr.................... 100, 470, 477, 483, 490 p1dr....................... 100, 470, 477, 483, 490 p1pcr..................... 101, 470, 477, 483, 490 p2ddr.................... 102, 470, 477, 483, 490 p2dr....................... 102, 470, 477, 483, 490 p2pcr..................... 103, 470, 477, 483, 490 p3ddr.................... 104, 470, 477, 484, 490 p3dr....................... 104, 470, 477, 484, 490 p3pcr..................... 105, 470, 477, 483, 490 p4ddr.................... 106, 470, 477, 484, 490 p4dr....................... 107, 470, 477, 484, 490 p5ddr.................... 109, 470, 477, 484, 490 p5dr....................... 110, 470, 477, 484, 490 p6ddr.................... 112, 470, 477, 484, 490 p6dr....................... 112, 471, 477, 484, 490 p7ddr.................... 118, 466, 473, 480, 486 p7odr.................... 119, 466, 473, 480, 486 p7pin...................... 118, 471, 477, 484, 490 p8ddr.................... 120, 471, 477, 484, 490 p8dr....................... 121, 471, 477, 484, 490 p9ddr.................... 124, 471, 477, 484, 490 p9dr....................... 124, 471, 477, 484, 490 paddr ................... 127, 470, 477, 483, 490 paodr ................... 127, 470, 477, 483, 490 papin..................... 128, 470, 477, 483, 490
rev. 1.0, 09/02, page 523 of 524 parity error .............................................. 249 pbddr................... 131, 471, 477, 484, 490 pbodr................... 132, 471, 477, 484, 490 pbpin..................... 132, 471, 477, 484, 490 power-down modes ............................... 447 program counter (pc) .............................. 24 program/erase protection ....................... 435 program/program-verify ........................ 431 program-counter relative ........................ 42 programmer mode .................................. 437 pulse output............................................ 165 rdr ........................................................ 228 register direct .......................................... 41 register field............................................. 39 register indirect........................................ 41 register indirect with displacement......... 41 register indirect with post-increment ...... 41 register indirect with pre-decrement....... 41 reset ......................................................... 63 reset exception handling......................... 63 rsr......................................................... 228 sar ........................ 280, 472, 478, 485, 491 sarx...................... 281, 471, 478, 485, 491 sbycr ................... 448, 468, 475, 482, 488 scmr ..................... 235, 469, 475, 482, 488 scr......................................................... 231 serial communication interface (sci) ... 225 serial formats ......................................... 303 shift instructions....................................... 34 sirqcr.................. 387, 466, 474, 480, 486 sleep mode ............................................. 456 smi ......................................................... 410 smr........................ 229, 468, 475, 482, 488 software protection................................. 435 software standby mode.......................... 457 spsr....................... 241, 466, 473, 480, 486 ssr ......................... 233, 469, 475, 482, 488 stack pointer (sp)...................................... 23 stack status............................................... 65 stcr......................... 55, 471, 477, 484, 490 str ......................... 380, 466, 474, 481, 486 subactive mode.......................................461 subsleep mode........................................460 syscr...................... 53, 471, 477, 484, 490 syscr2.................. 114, 468, 475, 482, 488 system control instructions ......................38 tcnt ..................... 183, 213, 470, 471, 477, 478, 483, 484, 489, 491 tconri.................. 195, 472, 479, 485, 492 tconrs................. 195, 472, 479, 485, 492 tcor.............................. 471, 478, 484, 491 tcora ...................................................184 tcorb ...................................................184 tcorc ................... 194, 472, 478, 485, 492 tcr........................ 162, 184, 469, 471, 476, 478, 482, 484, 488, 491 tcrxy ................... 196, 466, 473, 480, 486 tcsr...................... 159, 189, 214, 469, 470, 471, 476, 477, 478, 482, 483, 484, 488, 489, 491 tdr ........................................................228 ticrf ..................... 194, 472, 478, 485, 492 ticrr..................... 194, 472, 478, 485, 491 tier........................ 158, 469, 476, 482, 488 tisr........................ 194, 472, 478, 485, 492 tocr...................... 163, 469, 476, 482, 488 trap instruction exception handling ........64 tsr .........................................................228 twr........................ 379, 466, 473, 480, 486 user program mode ................................430 watch mode............................................459 watchdog timer (wdt).........................211 watchdog timer mode ...........................218 wovi......................................................221 wscr ....................... 94, 471, 477, 484, 490 wuemrb................. 74, 467, 474, 481, 487
rev. 1.0, 09/02, page 524 of 524
h8s/2110b hardware manual publication date: 1st edition, september 2002 published by: business operation division semiconductor & integrated circuits hitachi, ltd. edited by: technical documentation group hitachi kodaira semiconductor co., ltd. copyright ? hitachi, ltd., 2002. all rights reserved. printed in japan.


▲Up To Search▲   

 
Price & Availability of HD64F2110BV

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X