Part Number Hot Search : 
MBT3904 UZ810 CMOZ13VC HI5710A FAMILY KBJ6005G 4410B BFP65010
Product Description
Full Text Search
 

To Download 38C3 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 mitsubishi electric and mitsubishi xx, to renesas technology corp. the semiconductor operations of hitachi and mitsubishi electric 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 mitsubishi electric, mitsubishi electric corporation, mitsubishi semiconductors, and other mitsubishi 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. note : mitsubishi electric will continue the business operations of high frequency & optical devices and power devices. renesas technology corp. customer support dept. april 1, 2003 to all our customers
mitsubishi 8-bit single-chip microcomputer 740 family / 38000 series 38C3 group users manual
keep safety first in your circuit designs ! l mitsubishi electric 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 non-flammable material or (iii) prevention against any malfunction or mishap. notes regarding these materials l these materials are intended as a reference to assist our customers in the selection of the mitsubishi semiconductor product best suited to the customers application; they do not convey any license under any intellectual property rights, or any other rights, belonging to mitsubishi electric corporation or a third party. l mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third-partys rights, originating in the use of any product data, diagrams, charts or circuit application examples contained in these materials. l all information contained in these materials, including product data, diagrams and charts, represent information on products at the time of publication of these materials, and are subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. l mitsubishi electric 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 mitsubishi electric corporation or an authorized mitsubishi semiconductor 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. l the prior written approval of mitsubishi electric corporation is necessary to reprint or reproduce in whole or in part these materials. l 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. l please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for further details on these materials or the products contained therein.
rev. rev. no. date 1.0 first edition 990412 revision description list 38C3 group user?s manual (1/1) revision description
preface this users manual describes mitsubishis cmos 8- bit microcomputers 38C3 group. after reading this manual, the user should have a through knowledge of the functions and features of the 38C3 group, and should be able to fully utilize the product. the manual starts with specifications and ends with application examples. for details of software, refer to the 740 family software manual. for details of development support tools, refer to the development support tools for microcomputers data book.
before using this users manual this users manual consists of the following three chapters. refer to the chapter appropriate to your conditions, such as hardware design or software development. 1. organization l chapter 1 hardware this chapter describes features of the microcomputer and operation of each peripheral function. l chapter 2 application this chapter describes usage and application examples of peripheral functions, based mainly on setting examples of relevant registers. l chapter 3 appendix this chapter includes a list of registers, and necessary information for systems development using the microcomputer, the mask rom confirmation (for mask rom version), rom programming confirmation, and the mark specifications which are to be submitted when ordering. 2. structure of register the figure of each register structure describes its functions, contents at reset, and attributes as follows: 2: bit attributesthe attributes of control register bits are classified into 3 bytes : read-only, write-only and read and write. in the figure, these attributes are represented as follows : : bit in which nothing is arranged name functions at reset rw b 0 1 2 3 4 0 0 0 0 0 5 5 5 6 7 0 b0 b1 b2 b3 b4 b5 b6 b7 contents immediately after reset release bit attributes (note 1) 0 0 : single-chip mode 0 1 : 1 0 : 1 1 : processor mode bits stack page selection bit nothing arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?. fix this bit to ?. main clock division ratio selection bits not available b1 b0 0 : 0 page 1 : 1 page 0 0 : f = x in /2 (high-speed mode) 0 1 : f = x in /8 (middle-speed mode) 1 0 : f = x in /8 (middle-speed mode) 1 1 : f = x in (double-speed mode) : bit that is not used for control of the corresponding function 0 notes 1: contents immediately after reset release 0??at reset release 1??at reset release undefinedundefined or reset release contents determined by option at reset release [ rread read enabled 5 read disabled wwrite write enabled 5 write disabled (note 2) cpu mode register (cpum) [address : 3b 16 ] bits 1 b7 b6 0
1 38C3 group users manual table of contents table of contents chapter 1 hardware description ............................................................................................................................... . 1-2 features ............................................................................................................................... ..... 1-2 application ............................................................................................................................... . 1-2 pin configuration .................................................................................................................. 1-2 functional block .................................................................................................................. 1-3 pin description ........................................................................................................................ 1-4 part numbering ....................................................................................................................... 1-6 group expansion .................................................................................................................... 1-7 memory type ............................................................................................................................ 1-7 memory size ............................................................................................................................. 1- 7 package ............................................................................................................................... ...... 1-7 functional description ...................................................................................................... 1-8 central processing unit (cpu) .............................................................................................. 1-8 memory ............................................................................................................................... ..... 1-12 i/o ports ............................................................................................................................... ... 1-14 interrupts ............................................................................................................................... .. 1-19 timers ............................................................................................................................... ....... 1-23 serial i/o ............................................................................................................................... .. 1-28 a-d converter ......................................................................................................................... 1-30 lcd drive control circuit ....................................................................................................... 1-31 f clock output function ....................................................................................................... 1-37 rom correction function (mask rom version only) ........................................................ 1-38 reset circuit ........................................................................................................................... 1-39 clock generating circuit ....................................................................................................... 1-41 notes on programming ..................................................................................................... 1-44 notes on use .......................................................................................................................... 1-44 data required for mask orders ................................................................................ 1-45 data required for rom writing orders ................................................................. 1-45 rom programming method .............................................................................................. 1-45 functional description supplement ......................................................................... 1-46 chapter 2 application 2.1 i/o port ............................................................................................................................... ...... 2-2 2.1.1 memory map ................................................................................................................... 2-2 2.1.2 relevant registers .......................................................................................................... 2-3 2.1.3 terminate unused pins .................................................................................................. 2-7 2.1.4 notes on i/o port ........................................................................................................... 2-8 2.1.5 termination of unused pins .......................................................................................... 2-9 2.2 timer ............................................................................................................................... ........ 2-10 2.2.1 memory map ................................................................................................................. 2-10 2.2.2 relevant registers ........................................................................................................ 2-11 2.2.3 timer application examples ........................................................................................ 2-19 2.2.4 notes on timer a (pwm mode and igbt output mode) ...................................... 2-31 2.3 serial i/o ............................................................................................................................... . 2-33 2.3.1 memory map ................................................................................................................. 2-33 2.3.2 relevant registers ........................................................................................................ 2-33 2.3.3 serial i/o connection examples ................................................................................. 2-36
2 38C3 group users manual table of contents 2.3.4 serial i/os modes ....................................................................................................... 2-38 2.3.5 serial i/o application examples ................................................................................. 2-38 2.3.6 notes on serial i/o ...................................................................................................... 2-51 2.4 lcd controller ...................................................................................................................... 2-52 2.4.1 memory map ................................................................................................................. 2-52 2.4.2 relevant registers ........................................................................................................ 2-53 2.4.3 lcd controller application examples ......................................................................... 2-54 2.4.4 notes on lcd controller ............................................................................................. 2-58 2.5 a-d converter ....................................................................................................................... 2-59 2.5.1 memory map ................................................................................................................. 2-59 2.5.2 relevant registers ........................................................................................................ 2-59 2.5.3 a-d converter application examples .......................................................................... 2-62 2.5.4 notes on a-d converter .............................................................................................. 2-64 2.6 rom correct function ......................................................................................................... 2-65 2.6.1 memory map ................................................................................................................. 2-65 2.6.2 relevant registers ........................................................................................................ 2-66 2.6.3 rom correct function application examples ............................................................. 2-67 2.7 reset circuit ......................................................................................................................... 2-69 2.7.1 connection example of reset ic ................................................................................ 2-69 2.7.2 notes on reset circuit .................................................................................................. 2-70 2.8 clock generating circuit .................................................................................................... 2-71 2.8.1 relevant register .......................................................................................................... 2-71 2.8.2 clock generating circuit application examples ......................................................... 2-72 chapter 3 appendix 3.1 electrical characteristics ..................................................................................................... 3-2 3.1.1 absolute maximum ratings ............................................................................................ 3-2 3.1.2 recommended operating conditions ............................................................................ 3-2 3.1.3 electrical characteristics ................................................................................................ 3-5 3.1.4 a-d converter characteristics ....................................................................................... 3-7 3.1.5 timing requirements and switching characteristics ................................................... 3-8 3.1.6 absolute maximum ratings (m version) ..................................................................... 3-10 3.1.7 recommended operating conditions (m version) ..................................................... 3-10 3.1.8 electrical characteristics (m version) ......................................................................... 3-14 3.1.9 a-d converter characteristics (m version) ................................................................ 3-16 3.1.10 timing requirements and switching characteristics (m version) .......................... 3-17 3.2 standard characteristics .................................................................................................... 3-20 3.2.1 power source current standard characteristics ........................................................ 3-20 3.2.2 port standard characteristics ...................................................................................... 3-21 3.3 notes on use ........................................................................................................................ 3-26 3.3.1 notes on interrupts ...................................................................................................... 3-26 3.3.2 notes on timer a (pwm mode and igbt output mode) ...................................... 3-27 3.3.3 notes on serial i/o ...................................................................................................... 3-29 3.3.4 notes on lcd controller ............................................................................................. 3-29 3.3.5 notes on a-d converter .............................................................................................. 3-30 3.3.6 notes on reset circuit .................................................................................................. 3-30 3.4 countermeasures against noise ...................................................................................... 3-31 3.4.1 shortest wiring length .................................................................................................. 3-31 3.4.2 connection of bypass capacitor across v ss line and v cc line ............................... 3-33 3.4.3 wiring to analog input pins ........................................................................................ 3-34 3.4.4 oscillator concerns ....................................................................................................... 3-34 3.4.5 setup for i/o ports ....................................................................................................... 3-36
3 38C3 group users manual table of contents 3.4.6 providing of watchdog timer function by software .................................................. 3-37 3.5 control registers .................................................................................................................. 3-38 3.6 mask rom confirmation form ........................................................................................... 3-58 3.7 rom programming confirmation form ............................................................................ 3-62 3.8 mark specification form ..................................................................................................... 3-66 3.9 package outline ................................................................................................................... 3-67 3.10 machine instructions ........................................................................................................ 3-68 3.11 list of instruction code ................................................................................................... 3-79 3.12 sfr memory map .............................................................................................................. 3-80 3.13 pin configuration ............................................................................................................... 3-81
4 38C3 group users manual list of figures list of figures chapter 1 hardware fig. 1 m38C34m6axxxfp pin configuration .............................................................................. 1-2 fig. 2 functional block diagram ................................................................................................... 1-3 fig. 3 part numbering .................................................................................................................... 1-6 fig. 4 memory expansion plan ..................................................................................................... 1-7 fig. 5 740 family cpu register structure ................................................................................... 1-8 fig. 6 register push and pop at interrupt generation and subroutine call ........................... 1-9 fig. 7 structure of cpu mode register ..................................................................................... 1-11 fig. 8 memory map diagram ...................................................................................................... 1-12 fig. 9 memory map of special function register (sfr) .......................................................... 1-13 fig. 10 structure of pull register a and pull register b ................................................... 1-14 fig. 11 structure of port p8 output selection register ............................................................ 1-14 fig. 12 port block diagram (1) ................................................................................................... 1-16 fig. 13 port block diagram (2) ................................................................................................... 1-17 fig. 14 port block diagram (3) ................................................................................................... 1-18 fig. 15 interrupt control ............................................................................................................... 1-21 fig. 16 structure of interrupt-related registers ......................................................................... 1-21 fig. 17 connection example when using key input interrupt and port p8 block diagram 1-22 fig. 18 structure of timer related register ................................................................................ 1-23 fig. 19 block diagram of timer .................................................................................................. 1-24 fig. 20 timing chart of timer 6 pwm 1 mode ........................................................................... 1-25 fig. 21 block diagram of timer a .............................................................................................. 1-26 fig. 22 structure of timer a related registers .......................................................................... 1-26 fig. 23 timing chart of timer a pwm, igbt output modes .................................................. 1-27 fig. 24 block diagram of serial i/o ........................................................................................... 1-28 fig. 25 structure of serial i/o control register ......................................................................... 1-29 fig. 26 serial i/o timing (for lsb first) .................................................................................... 1-29 fig. 27 structure of a-d control register .................................................................................. 1-30 fig. 28 black diagram of a-d converter ................................................................................... 1-30 fig. 29 structure of lcd related registers ............................................................................... 1-31 fig. 30 block diagram of lcd controller/driver ....................................................................... 1-32 fig. 31 example of circuit at each bias .................................................................................... 1-33 fig. 32 lcd display ram map .................................................................................................. 1-34 fig. 33 lcd drive waveform (1/2 bias) .................................................................................... 1-35 fig. 34 lcd drive waveform (1/3 bias) .................................................................................... 1-36 fig. 35 structure of f output control register .......................................................................... 1-37 fig. 36 structure of rom correct address register ................................................................. 1-38 fig. 37 structure of rom correct data .................................................................................... 1-38 fig. 38 structure of rom correct enable register 1 ............................................................... 1-38 fig. 39 reset circuit example .................................................................................................... 1-39 fig. 40 reset sequence .............................................................................................................. 1-39 fig. 41 internal status at reset .................................................................................................. 1-40 fig. 42 ceramic resonator circuit .............................................................................................. 1-41 fig. 43 external clock input circuit ............................................................................................ 1-41 fig. 44 clock generating circuit block diagram ....................................................................... 1-42 fig. 45 state transitions of system clock ................................................................................. 1-43 fig. 46 programming and testing of one time prom version ............................................ 1-45 fig. 47 timing chart after interrupt occurs ............................................................................... 1-47
5 38C3 group users manual list of figures fig. 48 time up to execution of interrupt processing routine ............................................... 1-47 fig. 49 a-d conversion equivalent circuit ................................................................................. 1-49 fig. 50 a-d conversion timing chart .......................................................................................... 1-49 chapter 2 application fig. 2.1.1 memory map of i/o port relevant registers .............................................................. 2-2 fig. 2.1.2 structure of port pi (i = 0, 1, 2, 3, 4, 5, 6, 8) ........................................................ 2-3 fig. 2.1.3 structure of port p7 ..................................................................................................... 2-3 fig. 2.1.4 structure of port p0 direction register and port p1 direction register ................. 2-4 fig. 2.1.5 structure of port pi direction register (i = 2, 4, 5, 6, 8) ....................................... 2-4 fig. 2.1.6 structure of port p7 direction register ...................................................................... 2-5 fig. 2.1.7 structure of pull register a ...................................................................................... 2-5 fig. 2.1.8 structure of pull register b ...................................................................................... 2-6 fig. 2.1.9 structure of port p8 output selection register ......................................................... 2-6 fig. 2.2.1 memory map of registers relevant to timers .......................................................... 2-10 fig. 2.2.2 structure of timer i (i=1, 3, 4, 5, 6) ....................................................................... 2-11 fig. 2.2.3 structure of timer 2 .................................................................................................. 2-11 fig. 2.2.4 structure of timer 6 pwm register ......................................................................... 2-12 fig. 2.2.5 structure of timer 12 mode register ....................................................................... 2-12 fig. 2.2.6 structure of timer 34 mode register ....................................................................... 2-13 fig. 2.2.7 structure of timer 56 mode register ....................................................................... 2-13 fig. 2.2.8 structure of timer a register (low-order, high-order) ........................................... 2-14 fig. 2.2.9 structure of compare register (low-order, high-order) .......................................... 2-14 fig. 2.2.10 structure of timer a mode register ...................................................................... 2-15 fig. 2.2.11 structure of timer a control register .................................................................... 2-15 fig. 2.2.12 structure of interrupt request register 1 ............................................................... 2-16 fig. 2.2.13 structure of interrupt request register 2 ............................................................... 2-17 fig. 2.2.14 structure of interrupt control register 1 ................................................................ 2-18 fig. 2.2.15 structure of interrupt control register 2 ................................................................ 2-18 fig. 2.2.16 timers connection and setting of division ratios ................................................. 2-20 fig. 2.2.17 relevant registers setting ....................................................................................... 2-21 fig. 2.2.18 control procedure ..................................................................................................... 2-22 fig. 2.2.19 peripheral circuit example ....................................................................................... 2-23 fig. 2.2.20 timers connection and setting of division ratios ................................................. 2-23 fig. 2.2.21 relevant registers setting ....................................................................................... 2-24 fig. 2.2.22 control procedure ..................................................................................................... 2-24 fig. 2.2.23 judgment method of valid/invalid of input pulses ............................................... 2-25 fig. 2.2.24 relevant registers setting ....................................................................................... 2-26 fig. 2.2.25 control procedure ..................................................................................................... 2-27 fig. 2.2.26 timers connection and setting of division ratios ................................................. 2-28 fig. 2.2.27 relevant registers setting ....................................................................................... 2-29 fig. 2.2.28 control procedure ..................................................................................................... 2-30 fig. 2.2.29 pwm output and igbt output (1) ......................................................................... 2-31 fig. 2.2.30 pwm output and igbt output (2) ......................................................................... 2-31 fig. 2.2.31 pwm output and igbt output (3) ......................................................................... 2-32 fig. 2.3.1 memory map of registers relevant to serial i/o .................................................... 2-33 fig. 2.3.2 structure of serial i/o control register 1 ................................................................ 2-33 fig. 2.3.3 structure of serial i/o control register 2 ................................................................ 2-34 fig. 2.3.4 structure of interrupt request register 1 ................................................................. 2-34 fig. 2.3.5 structure of interrupt control register 1 .................................................................. 2-35 fig. 2.3.6 serial i/o connection examples (1) ......................................................................... 2-36 fig. 2.3.7 serial i/o connection examples (2) ......................................................................... 2-37
6 38C3 group users manual list of figures fig. 2.3.8 serial i/os modes ..................................................................................................... 2-38 fig. 2.3.9 connection diagram ................................................................................................... 2-38 fig. 2.3.10 timing chart .............................................................................................................. 2-39 fig. 2.3.11 registers setting relevant to transmission side ................................................... 2-40 fig. 2.3.12 registers setting relevant to reception side ......................................................... 2-41 fig. 2.3.13 control procedure of transmission side ................................................................ 2-41 fig. 2.3.14 control procedure of reception side ...................................................................... 2-42 fig. 2.3.15 connection diagram ................................................................................................. 2-43 fig. 2.3.16 timing chart .............................................................................................................. 2-43 fig. 2.3.17 relevant registers setting ....................................................................................... 2-44 fig. 2.3.18 setting of transmission data ................................................................................... 2-44 fig. 2.3.19 control procedure ..................................................................................................... 2-45 fig. 2.3.20 connection diagram ................................................................................................. 2-46 fig. 2.3.21 timing chart .............................................................................................................. 2-47 fig. 2.3.22 relevant registers setting in master unit .............................................................. 2-48 fig. 2.3.23 relevant registers setting in slave unit ................................................................ 2-48 fig. 2.3.24 control procedure of master unit ........................................................................... 2-49 fig. 2.3.25 control procedure of slave unit ............................................................................. 2-50 fig. 2.4.1 memory map of registers relevant to lcd controller ............................................ 2-52 fig. 2.4.2 structure of segment output enable register ......................................................... 2-53 fig. 2.4.3 structure of lcd mode register ............................................................................... 2-53 fig. 2.4.4 lcd panel ................................................................................................................... 2-54 fig. 2.4.5 segment allocation example ..................................................................................... 2-54 fig. 2.4.6 lcd display ram map .............................................................................................. 2-55 fig. 2.4.7 lcd display ram setting .......................................................................................... 2-55 fig. 2.4.8 relevant registers setting ......................................................................................... 2-56 fig. 2.4.9 control procedure ....................................................................................................... 2-57 fig. 2.5.1 memory map of a-d converter relevant registers ................................................. 2-59 fig. 2.5.2 structure of a-d control register .............................................................................. 2-59 fig. 2.5.3 structure of a-d conversion register (low-order) ................................................... 2-60 fig. 2.5.4 structure of a-d conversion register (high-order) ................................................. 2-60 fig. 2.5.5 structure of interrupt request register 2 ................................................................. 2-61 fig. 2.5.6 structure of interrupt control register 2 .................................................................. 2-61 fig. 2.5.7 connection diagram ................................................................................................... 2-62 fig. 2.5.8 setting of relevant registers ..................................................................................... 2-62 fig. 2.5.9 control procedure ....................................................................................................... 2-63 fig. 2.6.1 memory map of rom correct function relevant registers .................................... 2-65 fig. 2.6.2 structure of rom correct enable register 1 ........................................................... 2-66 fig. 2.6.3 connection diagram ................................................................................................... 2-67 fig. 2.6.4 setting of relevant registers ..................................................................................... 2-67 fig. 2.6.5 control procedure ....................................................................................................... 2-68 fig. 2.7.1 example of power-on reset circuit ........................................................................... 2-69 fig. 2.7.2 ram backup system example .................................................................................. 2-69 fig. 2.8.1 structure of cpu mode register .............................................................................. 2-71 fig. 2.8.2 connection diagram ................................................................................................... 2-72 fig. 2.8.3 status transition diagram during power failure ...................................................... 2-73 fig. 2.8.4 setting of relevant registers ..................................................................................... 2-74 fig. 2.8.5 control procedure ....................................................................................................... 2-75 fig. 2.8.6 structure of clock counter ......................................................................................... 2-76 fig. 2.8.7 initial setting of relevant registers ........................................................................... 2-77 fig. 2.8.8 setting of relevant registers after detecting power failure ................................... 2-78 fig. 2.8.9 control procedure ....................................................................................................... 2-79
7 38C3 group users manual list of figures chapter 3 appendix fig. 3.1.1 circuit for measuring output switching characteristics .......................................... 3-18 fig. 3.1.2 timing chart ................................................................................................................ 3-19 fig. 3.2.1 power source current standard characteristics ...................................................... 3-20 fig. 3.2.2 power source current standard characteristics (in wait mode) ........................... 3-20 fig. 3.2.3 cmos output port (p0, p1, p2, p3) p-channel side characteristics (25 c) .... 3-21 fig. 3.2.4 cmos output port (p0, p1, p2, p3) p-channel side characteristics (90 c) .... 3-21 fig. 3.2.5 cmos output port (p0, p1, p2, p3) p-channel side characteristics (25 c) .... 3-22 fig. 3.2.6 cmos output port (p0, p1, p2, p3) n-channel side characteristics (90 c) ... 3-22 fig. 3.2.7 cmos output port (p4, p5 0 , p5 2 Cp5 7 , p6, p7 0 , p7 1 , p8) p-channel side characteristics (25 c) .......................................................................................................................... 3-23 fig. 3.2.8 cmos output port (p4, p5 0 , p5 2 Cp5 7 , p6, p7 0 , p7 1 , p8) p-channel side characteristics (90 c) .......................................................................................................................... 3-23 fig. 3.2.9 cmos output port (p4, p5 2 Cp5 7 , p6, p7 0 , p7 1 ) n-channel side characteristics (25 c) ............................................................................................................................... ......................... 3-24 fig. 3.2.10 cmos output port (p4, p5 2 Cp5 7 , p6, p7 0 , p7 1 ) n-channel side characteristics (90 c) ....................................................................................................................... 3-24 fig. 3.2.11 cmos output port (p5 0 , p8) n-channel side characteristics (25 c) ............... 3-25 fig. 3.2.12 cmos output port (p5 0 , p8) n-channel side characteristics (90 c) ............... 3-25 fig. 3.3.1 sequence of switch detection edge ......................................................................... 3-26 fig. 3.3.2 sequence of check of interrupt request bit ............................................................ 3-26 fig. 3.3.3 structure of interrupt control register 2 .................................................................. 3-27 fig. 3.3.4 pwm output and igbt output (1) ............................................................................ 3-27 fig. 3.3.5 pwm output and igbt output (2) ............................................................................ 3-28 fig. 3.3.6 pwm output and igbt output (3) ............................................................................ 3-28 fig. 3.4.1 selection of packages ............................................................................................... 3-31 fig. 3.4.2 wiring for the reset pin ......................................................................................... 3-31 fig. 3.4.3 wiring for clock i/o pins ........................................................................................... 3-32 fig. 3.4.4 wiring for the v pp pin of the one time prom and the eprom version ......... 3-33 fig. 3.4.5 bypass capacitor across the v ss line and the v cc line ........................................ 3-33 fig. 3.4.6 analog signal line and a resistor and a capacitor ................................................ 3-34 fig. 3.4.7 wiring for a large current signal line ...................................................................... 3-34 fig. 3.4.8 wiring of signal lines where potential levels change frequently ......................... 3-35 fig. 3.4.9 v ss pattern on the underside of an oscillator ........................................................ 3-35 fig. 3.4.10 setup for i/o ports ................................................................................................... 3-36 fig. 3.4.11 watchdog timer by software ................................................................................... 3-37 fig. 3.5.1 structure of port pi .................................................................................................... 3-38 fig. 3.5.2 structure of port p0 direction register and port p1 direction register ............... 3-38 fig. 3.5.3 structure of port pi direction register ..................................................................... 3-39 fig. 3.5.4 structure of port p7 ................................................................................................... 3-39 fig. 3.5.5 structure of port p7 direction register .................................................................... 3-40 fig. 3.5.6 structure of pull register a .................................................................................... 3-40 fig. 3.5.7 structure of pull register b .................................................................................... 3-41 fig. 3.5.8 structure of port p8 output selection register ....................................................... 3-42 fig. 3.5.9 structure of serial i/o control register 1 ................................................................ 3-43 fig. 3.5.10 structure of serial i/o control register 2 .............................................................. 3-44 fig. 3.5.11 structure of serial i/o register ............................................................................... 3-44 fig. 3.5.12 structure of timer i ................................................................................................. 3-45 fig. 3.5.13 structure of timer 2 ................................................................................................ 3-45 fig. 3.5.14 structure of timer 6 pwm register ....................................................................... 3-46 fig. 3.5.15 structure of timer 12 mode register ..................................................................... 3-46
8 38C3 group users manual list of figures fig. 3.5.16 structure of timer 34 mode register ..................................................................... 3-47 fig. 3.5.17 structure of timer 56 mode register ..................................................................... 3-47 fig. 3.5.18 structure of f output control register .................................................................... 3-48 fig. 3.5.19 structure of timer a register (low-order, high-order) ......................................... 3-48 fig. 3.5.20 structure of compare register (low-order, high-order) ........................................ 3-49 fig. 3.5.21 structure of timer a mode register ...................................................................... 3-49 fig. 3.5.22 structure of timer a control register .................................................................... 3-50 fig. 3.5.23 structure of a-d control register ............................................................................ 3-50 fig. 3.5.24 structure of a-d conversion register (low-order) ................................................. 3-51 fig. 3.5.25 structure of a-d conversion register (high-order) ............................................... 3-51 fig. 3.5.26 structure of segment output enable register ....................................................... 3-52 fig. 3.5.27 structure of lcd mode register ............................................................................. 3-52 fig. 3.5.28 structure of interrupt edge selection register ...................................................... 3-53 fig. 3.5.29 structure of cpu mode register ............................................................................ 3-53 fig. 3.5.30 structure of interrupt reqeust register 1 ............................................................... 3-54 fig. 3.5.31 structure of interrupt request register 2 ............................................................... 3-55 fig. 3.5.32 structure of interrupt control register 1 ................................................................ 3-56 fig. 3.5.33 structure of interrupt control register 2 ................................................................ 3-56 fig. 3.5.34 structure of rom correct enable register 1 ......................................................... 3-57
9 38C3 group users manual list of tables list of tables chapter 1 hardware table 1 pin description (1) ........................................................................................................... 1-4 table 2 pin description (2) ........................................................................................................... 1-5 table 3 support products ............................................................................................................. 1-7 table 4 push and pop instructions of accumulator or processor status register ................. 1-9 table 5 set and clear instructions of each bit of processor status register ....................... 1-10 table 6 list of i/o port function (1) .......................................................................................... 1-14 table 7 list of i/o port function (2) .......................................................................................... 1-15 table 8 interrupt vector addresses and priority ...................................................................... 1-20 table 9 function of p4 6 /s clk1 and p4 0 /s clk2 ............................................................................................................................... ...... 1-28 table 10 maximum number of display pixels at each duty ratio .......................................... 1-31 table 11 bias control and applied voltage to v l1 Cv l3 .......................................................................................................... 1-33 table 12 duty ratio control and common pins used ............................................................... 1-33 table 13 programming adapter .................................................................................................. 1-45 table 14 interrupt sources, vector addresses and interrupt priority ..................................... 1-46 table 15 relative formula for a reference voltage v ref of a-d converter and v ref ..................... 1-48 table 16 change of a-d conversion register during a-d conversion .................................. 1-48 chapter 2 application table 2.1.1 termination of unused pins ..................................................................................... 2-7 chapter 3 appendix table 3.1.1 absolute maximum ratings ....................................................................................... 3-2 table 3.1.2 recommended operating conditions ....................................................................... 3-2 table 3.1.3 recommended operating conditions ....................................................................... 3-3 table 3.1.4 recommended operating conditions ....................................................................... 3-4 table 3.1.5 electrical characteristics ........................................................................................... 3-5 table 3.1.6 electrical characteristics ........................................................................................... 3-6 table 3.1.7 a-d converter characteristics .................................................................................. 3-7 table 3.1.8 timing requirements 1 .............................................................................................. 3-8 table 3.1.9 timing requirements 2 .............................................................................................. 3-8 table 3.1.10 switching characteristics 1 .................................................................................... 3-9 table 3.1.11 switching characteristics 2 .................................................................................... 3-9 table 3.1.12 absolute maximum ratings (m version) ............................................................. 3-10 table 3.1.13 recommended operating conditions (m version) ............................................. 3-10 table 3.1.14 recommended operating conditions (m version) ............................................. 3-11 table 3.1.15 recommended operating conditions (m version) ............................................. 3-11 table 3.1.16 recommended operating conditions (m version) ............................................. 3-12 table 3.1.17 recommended operating conditions (m version) ............................................. 3-13 table 3.1.18 electrical characteristics (m version) .................................................................. 3-14 table 3.1.19 electrical characteristics (m version) .................................................................. 3-15 table 3.1.20 a-d converter characteristics (m version) ......................................................... 3-16 table 3.1.21 timing requirements 1 (m version) .................................................................... 3-17 table 3.1.22 timing requirements 2 (m version) .................................................................... 3-17 table 3.1.23 switching characteristics 1 (m version) ............................................................. 3-18 table 3.1.24 switching characteristics 2 (m version) ............................................................. 3-18
chapter 1 chapter 1 hardware description features application pin configuration functional block pin description part numbering group expansion functional description notes on programming notes on use data required for mask orders data required for rom writing orders rom programming method functional description supplement
38C3 group users manual hardware 1-2 1 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 4 /an 4 p6 5 /an 5 p6 6 /an 6 p6 7 /an 7 av ss v ref p6 0 /an 0 p6 1 /an 1 p6 2 /an 2 p6 3 /an 3 v cc v ss x out p7 0 /xc in p7 1 /xc out x in reset vl 1 com 3 com 2 com 1 com 0 vl 3 vl 2 p4 0 /s clk2 p4 2 /t3 out p4 3 / f p4 4 /s in p4 5 /s out p4 6 /s clk1 p4 7 /s rdy p4 1 /t1 out p8 0 p8 1 p8 2 p8 3 p8 4 p8 5 p8 6 p8 7 p3 0 /seg 24 p3 3 /seg 27 p3 4 /seg 28 p3 5 /seg 29 p3 6 /seg 30 p3 7 /seg 31 p3 1 /seg 25 p3 2 /seg 26 m38C34m6axxxfp p5 1 p5 2 /pwm 1 p5 5 /int 0 p5 6 /int 1 p5 7 /int 2 p1 0 /seg 16 p1 1 /seg 17 p1 2 /seg 18 p1 3 /seg 19 p1 4 /seg 20 p1 5 /seg 21 p1 6 /seg 22 p1 7 /seg 23 p0 0 /seg 8 p0 1 /seg 9 p0 2 /seg 10 p0 3 /seg 11 p0 4 /seg 12 p0 5 /seg 13 p0 6 /seg 14 p0 7 /seg 15 p2 7 /seg 7 p2 6 /seg 6 p2 5 /seg 5 p2 4 /seg 4 p2 3 /seg 3 p2 2 /seg 2 p2 1 /seg 1 p2 0 /seg 0 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 p5 3 /cntr 0 p5 4 /cntr 1 p5 0 /ta out pin configuration (top view) package type : 80p6n-a 80-pin plastic-molded qfp description the 38C3 group is the 8-bit microcomputer based on the 740 family core technology. the 38C3 group has a lcd drive control circuit, a 10-channel a-d converter, and a serial i/o as additional functions. the various microcomputers in the 38C3 group include variations of internal memory size and packaging. for details, refer to the section on part numbering. for details on availability of microcomputers in the 38C3 group, refer to the section on group expansion. features l basic machine-language instructions ....................................... 71 l the minimum instruction execution time ............................. 0.5 m s (at 8mhz oscillation frequency) l memory size rom .................................................................. 4 k to 48 k bytes ram ................................................................. 192 to 1024 bytes l programmable input/output ports ............................................. 57 l software pull-up/pull-down resistors ..................................................... (ports p0Cp8 except port p5 1 ) l interrupts ................................................... 16 sources, 16 vectors (includes key input interrupt) l timers ............................................................ 8-bit 5 6, 16-bit 5 1 l a-d converter ................................................. 10-bit 5 8 channels l serial i/o ....................................... 8-bit 5 1 (clock-synchronized) l lcd drive control circuit bias ............................................................................ 1/1, 1/2, 1/3 duty .................................................................... 1/1, 1/2, 1/3, 1/4 common output .......................................................................... 4 segment output ........................................................................ 32 l 2 clock generating circuit (connect to external ceramic resonator or quartz-crystal oscillator) l power source voltage in high-speed mode .................................................... 4.0 to 5.5 v in middle-speed mode ................................................ 2.5 to 5.5 v (m version is 2.2 ] to 5.5 v) in low-speed mode ..................................................... 2.5 to 5.5 v (m version is 2.2 ] to 5.5 v) l power dissipation in high-speed mode ........................................................... 32 mw (at 8 mhz oscillation frequency) in low-speed mode .............................................................. 45 m w (at 32 khz oscillation frequency, at 3 v power source voltage) l operating temperature range ................................... C 20 to 85c ] mask rom version only application camera, household appliances, consumer electronics, etc. fig. 1 m38C34m6axxxfp pin configuration description/features/application/pin configuration
38C3 group users manual hardware 1-3 functional block diagram fig. 2 functional block diagram key-on wake-up int 0 ?nt 2 cntr 0 ,cntr 1 t1 out, t3 out f data bus c p u a x y s pc h pc l ps reset v cc v ss reset input ( 5 v ) ( 0 v ) r o m r a m lcd display ram (16 bytes) 10 16 13 i/o port p5 p4(8) i/o port p4 i/o port p2 p2(8) i/o port p1 p1(8) p6(8) output port p3 i/o port p6 p5(8) i/o port p7 p7(2) 28 27 26 32 31 30 29 i/o port p0 p0(8) 49 50 51 52 53 54 55 56 41 42 43 44 45 46 47 48 57 58 59 60 61 62 63 64 67 68 69 70 71 72 65 66 12 11 1 2 75 76 77 78 79 80 73 74 456789 17 3 clock generating circuit main clock input x in main clock output x out x cout sub- clock output x cin sub- clock input si/o(8) v ref av ss ( 0 v ) a-d converter(10) timer 1(8) timer 2(8) lcd drive control circuit v l1 v l2 v l3 com 0 com 1 com 2 com 3 f x cin x cout 14 15 timer 3(8) timer 4(8) timer 5(8) timer 6(8) p3(8) 33 34 35 36 37 38 39 40 r o m corrective circuit rom corrective ram (8 bytes) i/o port p8 p8(8) 18 19 20 21 22 23 24 25 pwm 0, pwm 1 timer a(16) ] ] this is valid only in mask rom version. functional block
38C3 group users manual hardware 1-4 ? apply voltage of 2.5 ] v to 5.5 v to v cc , and 0 v to v ss . ? reference voltage input pin for a-d converter. ? gnd input pin for a-d converter. ? connect to v ss . ? reset input pin for active l. ? input and output pins for the main clock generating circuit. ? feedback resistor is built in between x in pin and x out pin. ? connect a ceramic resonator or a quartz-crystal oscillator between the x in and x out pins to set the oscillation frequency. ? if an external clock is used, connect the clock source to the x in pin and leave the x out pin open. ? input 0 v l1 v l2 v l3 v cc voltage. ? input 0 C v l3 voltage to lcd. ? lcd common output pins. ? com 1 , com 2 , and com 3 are not used at 1/1 duty ratio. ? com 2 and com 3 are not used at 1/2 duty ratio. ? com 3 is not used at 1/3 duty ratio. ? 8-bit i/o port. ? cmos compatible input level. ? cmos 3-state output structure. ? i/o direction register allows each port to be individually programmed as either input or output. ? pull-down control is enabled. ? 8-bit output port. ? cmos state output. ? pull-down control is enabled. ? 8-bit i/o port. ? cmos compatible input level. ? cmos 3-state output structure. ? i/o direction register allows each pin to be individually programmed as either input or output. ? pull-up control is enabled. ? lcd segment pins ? serial i/o function pin ? timer output pin ? timer output pin ? f output pin ? serial i/o function pins pin v cc , v ss v ref av ss reset x in x out v l1 C v l3 com 0 C com 3 p0 0 /seg 8 C p0 7 /seg 15 p1 0 /seg 16 C p1 7 /seg 23 p2 0 /seg 0 C p2 7 /seg 7 p3 0 /seg 24 C p3 7 /seg 31 p4 0 /s clk2 p4 1 /t 1out p4 2 /t 3out p4 3 / f p4 4 /s in , p4 5 /s out , p4 6 /s clk1, p4 7 /s rdy name power source analog reference voltage analog power source reset input clock input clock output lcd power source common output i/o port p0 i/o port p1 i/o port p2 output port p3 i/o port p4 function except a port function pin description table 1 pin description (1) function pin description ] mask rom version of m version is 2.2 v to 5.5 v.
38C3 group users manual hardware 1-5 ? 1-bit input pin. ? cmos compatible input level. ? 7-bit i/o port. ? cmos compatible input level. ? cmos 3-state output structure. ? i/o direction register allows each pin to be individually programmed as either input or output. ? pull-up control is enabled. ? 8-bit i/o port. ? cmos compatible input level. ? cmos 3-state output structure. ? i/o direction register allows each pin to be individually programmed as either input or output. ? pull-up control is enabled. ? 2-bit i/o port. ? cmos compatible input level. ? cmos 3-state output structure. ? i/o direction register allows each pin to be individually programmed as either input or output. ? pull-up control is enabled. ? 8-bit i/o port. ? ttl input level. ? cmos 3-state output structure. ? i/o direction register allows each pin to be individually programmed as either input or output. ? pull-up control is enabled. pin p5 1 p5 0 /ta out p5 2 /pwm 1 p5 3 /cntr 0 , p5 4 /cntr 1 p5 5 /int 0 , p5 6 /int 1 , p5 7 /int 2 p6 0 /an 0 C p6 7 /an 7 p7 0 /x cin, p7 1 /x cout p8 0 C p8 7 table 2 pin description (2) name input port p5 i/o port p5 i/o port p6 i/o port p7 i/o port p8 function except a port function ? timer a output pin ? pwm 1 output (timer output) pin ? external count i/o pins ? external interrupt input pins ? a-d conversion input pins ? sub-clock generating circuit i/o pins ? key input (key-on wake-up) interrupt input pins function pin description
38C3 group users manual hardware 1-6 m38C3 4 m 6 a xxx fp product rom/prom size 1 2 3 4 5 6 7 8 : 4096 bytes : 8192 bytes : 12288 bytes : 16384 bytes : 20480 bytes : 24576 bytes : 28672 bytes : 32768 bytes the first 128 bytes and the last 2 bytes of rom are reserved areas ; they cannot be used. memory type m e : mask rom version : eprom or one time prom version ram size 0 1 2 3 4 5 6 7 : 192 bytes : 256 bytes : 384 bytes : 512 bytes : 640 bytes : 768 bytes : 896 bytes : 1024 bytes package type fp fs rom number omitted in one time prom version shipped in blank and eprom version. a : standard (note) m : m version : 80p6n-a package : 80d0 package 9 a b c : 36864 bytes : 40960 bytes : 45056 bytes : 49152 bytes note : difference between standard and m version ?standard : ?m version : port p5 0 /ta out pin remains set to the input mode until the direction register is set to the output mode during reset and after reset. port p5 0 /ta out pin remains set to the output mode (??output) until the direction register is set to the input mode during reset and after reset. part numbering fig. 3 part numbering part numbering
38C3 group users manual hardware 1-7 rom size (bytes) 32k 28k 24k 20k 16k 12k 8k 4k 256 384 512 640 768 896 1024 192 ram size (bytes) 36k 40k 44k 48k under development m38C34m6a/m6m m38C37eca/ecm planning m38C33m4 products under development or planning : the development schedule and specification may be revised without notice. planning products may be stopped the development. m38C34m8 group expansion mitsubishi plans to expand the 38C3 group as follows. memory type support for mask rom, one time prom, and eprom versions memory size rom/prom size ................................................ 16 k to 48 k bytes ram size ............................................................. 512 to 1024 bytes memory expansion plan fig. 4 memory expansion plan currently supported products are listed below. as of december 1998 package 80p6n-a 80d0 80p6n-a 80d0 product name m38C34m6axxxfp m38C37ecaxxxfp m38C37ecafp m38C37ecafs m38C34m6mxxxfp m38C37ecmxxxfp m38C37ecmfp m38C37ecmfs (p) rom size (bytes) rom size for user in ( ) 24576 (24446) 49152 (49022) 24576 (24446) 49152 (49022) ram size (bytes) 640 1024 640 1024 table 3 support products mask rom version one time prom version one time prom version (blank) eprom version mask rom version one time prom version one time prom version (blank) eprom version remarks packages 80p6n-a ..................................... 0.8 mm-pitch plastic molded qfp 80d0 ........................ 0.8 mm-pitch ceramic lcc (eprom version) group expansion
38C3 group users manual hardware 1-8 functional description central processing unit (cpu) the 38C3 group uses the standard 740 family instruction set. refer to the table of 740 family addressing modes and machine instruc- tions or the 740 family software manual for details on the instruction set. machine-resident 740 family instructions are as follows: the fst and slw instructions cannot be used. the stp, wit, mul, and div instructions can be used. [accumulator (a)] the accumulator is an 8-bit register. data operations such as data transfer, etc., are executed mainly through the accumulator. [index register x (x)] the index register x is an 8-bit register. in the index addressing modes, the value of the operand is added to the contents of register x and specifies the real address. [index register y (y)] the index register y is an 8-bit register. in partial instruction, the value of the operand is added to the contents of register y and specifies the real address. [stack pointer (s)] the stack pointer is an 8-bit register used during subroutine calls and interrupts. this register indicates start address of stored area (stack) for storing registers during subroutine calls and interrupts. the low-order 8 bits of the stack address are determined by the con- tents of the stack pointer. the high-order 8 bits of the stack address are determined by the stack page selection bit. if the stack page selection bit is 0 , the high-order 8 bits becomes 00 16 . if the stack page selection bit is 1, the high-order 8 bits becomes 01 16 . the operations of pushing register contents onto the stack and pop- ping them from the stack are shown in figure 6. store registers other than those described in figure 6 with program when the user needs them during interrupts or subroutine calls. [program counter (pc)] the program counter is a 16-bit counter consisting of two 8-bit regis- ters pc h and pc l . it is used to indicate the address of the next in- struction to be executed. fig. 5 740 family cpu register structure functional description a accumulator b7 b7 b7 b7 b0 b7 b15 b0 b7 b0 b0 b0 b0 x index register x y index register y s stack pointer pc l program counter pc h n v t b d i z c processor status register (ps) carry flag zero flag interrupt disable flag decimal mode flag break flag index x mode flag overflow flag negative flag
38C3 group users manual hardware 1-9 table 4 push and pop instructions of accumulator or processor status register accumulator processor status register push instruction to stack pha php pop instruction from stack pla plp fig. 6 register push and pop at interrupt generation and subroutine call functional description n o t e : c o n d i t i o n f o r a c c e p t a n c e o f a n i n t e r r u p t i n t e r r u p t e n a b l e f l a g i s 1 e x e c u t e j s r o n - g o i n g r o u t i n e m ( s )( p c h ) ( s ) ( s ) 1 m ( s )( p c l ) e x e c u t e r t s ( p c l )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) s u b r o u t i n e p o p re t u r n a d d r e s s f r o m s t a c k p u s h r e t u r n a d d r e s s o n s t a c k m ( s )( p s ) e x e c u t e r t i ( p s )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 i n t e r r u p t s e r v i c e r o u t i n e p o p c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r f r o m s t a c k m ( s )( p c h ) ( s ) ( s ) 1 m ( s )( p c l ) ( s ) ( s ) 1 ( p c l )m ( s ) ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) p o p r e t u r n a d d r e s s f r o m s t a c k i f l a g i s s e t f r o m 0 t o 1 f e t c h t h e j u m p v e c t o r p u s h r e t u r n a d d r e s s o n s t a c k p u s h c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r o n s t a c k i n t e r r u p t r e q u e s t ( n o t e ) i n t e r r u p t d i s a b l e f l a g i s 0
38C3 group users manual hardware 1-10 [processor status register (ps)] the processor status register is an 8-bit register consisting of 5 flags which indicate the status of the processor after an arithmetic operation and 3 flags which decide mcu operation. branch operations can be performed by testing the carry (c) flag , zero (z) flag, overflow (v) flag, or the negative (n) flag. in decimal mode, the z, v, n flags are not valid. ?bit 0: carry flag (c) the c flag contains a carry or borrow generated by the arithmetic logic unit (alu) immediately after an arithmetic operation. it can also be changed by a shift or rotate instruction. ?bit 1: zero flag (z) the z flag is set if the result of an immediate arithmetic operation or a data transfer is 0, and cleared if the result is anything other than 0. ?bit 2: interrupt disable flag (i) the i flag disables all interrupts except for the interrupt generated by the brk instruction. interrupts are disabled when the i flag is 1. ?bit 3: decimal mode flag (d) the d flag determines whether additions and subtractions are executed in binary or decimal. binary arithmetic is executed when this flag is 0; decimal arithmetic is executed when it is 1. decimal correction is automatic in decimal mode. only the adc and sbc instructions can be used for decimal arithmetic. ?bit 4: break flag (b) the b flag is used to indicate that the current interrupt was generated by the brk instruction. the brk flag in the processor status register is always 0. when the brk instruction is used to generate an interrupt, the processor status register is pushed onto the stack with the break flag set to 1. ?bit 5: index x mode flag (t) when the t flag is 0, arithmetic operations are performed between accumulator and memory. when the t flag is 1, direct arithmetic operations and direct data transfers are enabled between memory locations. ?bit 6: overflow flag (v) the v flag is used during the addition or subtraction of one byte of signed data. it is set if the result exceeds +127 to -128. when the bit instruction is executed, bit 6 of the memory location operated on by the bit instruction is stored in the overflow flag. ?bit 7: negative flag (n) the n flag is set if the result of an arithmetic operation or data transfer is negative. when the bit instruction is executed, bit 7 of the memory location operated on by the bit instruction is stored in the negative flag. table 5 set and clear instructions of each bit of processor status register set instruction clear instruction c flag z flag i flag d flag b flag t flag v flag n flag sec clc _ _ sei cli sed cld _ _ set clt clv _ _ _ functional description
38C3 group users manual hardware 1-11 [cpu mode register (cpum)] 003b 16 the cpu mode register contains the stack page selection bit and the internal system clock selection bit etc. the cpu mode register is allocated at address 003b 16 . fig. 7 structure of cpu mode register functional description not available processor mode bits b1 b0 0 0 : single-chip mode 0 1 : 1 0 : 1 1 : stack page selection bit 0 : ram in the zero page is used as stack area 1 : ram in page 1 is used as stack area not used (returns ??when read) (do not write ??to this bit.) port x c switch bit 0 : i/o port 1 : x cin , x cout main clock ( x in ? out ) stop bit 0 : operating 1 : stopped main clock division ratio selection bit 0 : f(x in )/2 (high-speed mode) 1 : f(x in )/8 (middle-speed mode) internal system clock selection bit 0 : x in -x out selected (middle-/high-speed mode) 1 : x cin -x cout selected (low-speed mode) cpu mode register (cpum (cm) : address 003b 16 ) b7 b0
38C3 group users manual hardware 1-12 memory special function register (sfr) area the special function register area in the zero page contains control registers such as i/o ports and timers. ram ram is used for data storage and for stack area of subroutine calls and interrupts. rom the first 128 bytes and the last 2 bytes of rom are reserved for device testing and the rest is user area for storing programs. interrupt vector area the interrupt vector area contains reset and interrupt vectors. zero page access to this area with only 2 bytes is possible in the zero page addressing mode. special page access to this area with only 2 bytes is possible in the special page addressing mode. fig. 8 memory map diagram functional description 192 256 384 512 640 768 896 1024 00ff 16 013f 16 01bf 16 023f 16 02bf 16 033f 16 03bf 16 043f 16 ram area ram size (bytes) address xxxx 16 4096 8192 12288 16384 20480 24576 28672 32768 36864 40960 45056 49152 f000 16 e000 16 d000 16 c000 16 b000 16 a000 16 9000 16 8000 16 7000 16 6000 16 5000 16 4000 16 f080 16 e080 16 d080 16 c080 16 b080 16 a080 16 9080 16 8080 16 7080 16 6080 16 5080 16 4080 16 rom area rom size (bytes) address yyyy 16 address zzzz 16 0058 16 0000 16 0040 16 0440 16 ff00 16 ffdc 16 fffe 16 ffff 16 xxxx 16 yyyy 16 zzzz 16 ram rom 0050 16 reserved area sfr area 1 not used interrupt vector area reserved rom area (128 bytes) zero page special page lcd display ram area reserved rom area rom corrective ram area 0100 16 (note 1) sfr area 2 (note 1) 0f00 16 0fff 16 note 1 : this is valid only in mask rom version.
38C3 group users manual hardware 1-13 fig. 9 memory map of special function register (sfr) functional description rom correct high-order address register 1 (note) rom correct high-order address register 2 (note) rom correct high-order address register 3 (note) rom correct high-order address register 4 (note) port p8 output selection register (p8sel) 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 port p0 (p0) port p0 direction register (p0d) port p1 (p1) port p1 direction register (p1d) port p2 (p2) port p2 direction register (p2d) port p3 (p3) port p4 (p4) port p4 direction register (p4d) port p5 (p5) port p5 direction register (p5d) port p6 (p6) port p6 direction register (p6d) port p7 (p7) port p7 direction register (p7d) serial i/o control register 1 (siocon1) serial i/o control register 2 (siocon2) serial i/o register (sio) interrupt control register 2 (icon2) timer 6 pwm register (t6pwm) interrupt edge selection register (intedge) cpu mode register (cpum) interrupt request register 1 (ireq1) interrupt request register 2 (ireq2) interrupt control register 1 (icon1) timer 1 (t1) timer 3 (t3) timer 5 (t5) timer 6 (t6) timer 2 (t2) timer 4 (t4) pull register a (pulla) pull register b (pullb) timer 12 mode register (t12m) timer 34 mode register (t34m) timer 56 mode register (t56m) segment output enable register (seg) lcd mode register (lm) a-d control register (adcon) a-d conversion register (low) (adl) port p8 (p8) port p8 direction register (p8d) f output control register (ckout) timer a register (low) (tal) timer a register (high) (tah) compare register (low) (conal) compare register (high) (conah) timer a mode register (tam) timer a control register (tacon) a-d conversion register (high) (adh) 0f0a 16 0f0b 16 0f0c 16 0f0d 16 0f0e 16 0f0f 16 0f10 16 0f11 16 rom correct enable register 1 (note) rom correct low-order address register 1 (note) rom correct high-order address register 5 (note) rom correct low-order address register 5 (note) rom correct high-order address register 6 (note) rom correct low-order address register 6 (note) rom correct high-order address register 7 (note) rom correct low-order address register 7 (note) rom correct high-order address register 8 (note) rom correct low-order address register 8 (note) 0f01 16 0f02 16 0f03 16 0f07 16 0f08 16 0f09 16 0f04 16 0f05 16 0f06 16 rom correct low-order address register 2 (note) rom correct low-order address register 3 (note) rom correct low-order address register 4 (note) note: this register is valid only in mask rom version.
38C3 group users manual hardware 1-14 i/o ports [direction registers (ports p2, p4, p5 0 , p5 2 Cp5 7 , and p6Cp8)] the i/o ports p2, p4, p5 0 , p5 2 Cp5 7 , and p6Cp8 have direction reg- isters which determine the input/output direction of each individual pin. each bit in a direction register corresponds to one pin, each pin can be set to be input port or output port. when 0 is written to the bit corresponding to a pin, that pin be- comes an input pin. when 1 is written to that bit, that pin becomes an output pin. if data is read from a pin set to output, the value of the port output latch is read, not the value of the pin itself. pins set to input are float- ing. if a pin set to input is written to, only the port output latch is written to and the pin remains floating. [direction registers (ports p0 and p1)] ports p0 and p1 have direction registers which determine the input/ output direction of each individual port. each port in a direction register corresponds to one port, each port can be set to be input or output. when 0 is written to the bit 0 of a direction register, that port be- comes an input port. when 1 is written to that port, that port be- comes an output port. bits 1 to 7 of ports p0 and p1 direction regis- ters are not used. pull-up/pull-down control by setting the pull register a (address 0016 16 ) or the pull register b (address 0017 16 ), ports except for ports p3 and p5 1 can control either pull-down or pull-up (pins that are shared with the segment output pins for lcd are pull-down; all other pins are pull-up) with a program. however, the contents of pull register a and pull register b do not affect ports programmed as the output ports. port p8 output selection ports p8 0 to p8 7 can be switched to n-channel open-drain output by setting 1 to the port p8 output selection register. fig. 10 structure of pull register a and pull register b pin p0 0 /seg 8 C p0 7 /seg 15 p1 0 /seg 16 C p1 7 /seg 23 p2 0 /seg 0 C p2 7 /seg 7 p3 0 /seg 24 C p3 7 /seg 31 name port p0 port p1 port p2 port p3 input/output input/output, port unit input/output, port unit input/output, individual bits output, individual bits i/o format cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input cmos 3-state output cmos 3-state output non-port function lcd segment output lcd segment output lcd segment output lcd segment output related sfrs pull register a segment output enable reg- ister pull register a segment output enable reg- ister pull register a segment output enable reg- ister segment output enable reg- ister ref. no. (1) (2) table 6 list of i/o port function (1) fig. 11 structure of port p8 output selection register functional description p0 0 ?0 7 pull-down p1 0 ?1 7 pull-down p2 0 ?2 7 pull-down not used p7 0 , p7 1 pull-up p8 0 ?8 7 pull-up pull register a (pulla : address 0016 16 ) b7 b0 p4 0 ?4 3 pull-up p4 4 ?4 7 pull-up p5 0 , p5 2 , p5 3 pull-up p5 4 ?5 7 pull-up p6 0 ?6 3 pull-up p6 4 ?6 7 pull-up not used (return ??when read) 0 : disable 1 : enable pull register b (pullb : address 0017 16 ) b7 b0 note: the contents of pull register a and pull register b do not affect ports programmed as the output ports. not used (return ??when read) 0 : cmos output (in output mode) 1 : n-channel open-drain output (in output mode) port p8 output selection register (p8sel : address 0018 16 ) b7 b0
38C3 group users manual hardware 1-15 pin p4 0 /s clk2 p4 1 /t 1out p4 2 /t 3out p4 3 / f p4 4 /s in p4 5 /s out p4 6 /s clk1 p4 7 /s rdy p5 0 /ta out p5 1 p5 2 /pwm 1 p5 3 /cntr 0 p5 4 /cntr 1 p5 5 /int 0 p5 6 /int 1 p5 7 /int 2 p6 0 /an 0 C p6 7 /an 7 p7 0 /x cin p7 1 /x cout p8 0 C p8 7 com 0 C com 3 name port p4 port p5 port p6 port p7 port p8 common input/output input/output, individual bits input/output, individual bits input input/output, individual bits input/output, individual bits input/output, individual bits input/output, individual bits output i/o format cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output lcd common output non-port function serial i/o function i/o timer output timer output f clock output serial i/o function i/o timer a output pwm output external count i/o external interrupt in- put a-d converter input sub-clock generating circuit i/o key input (key-on wake-up) interrupt in- put related sfrs serial i/o control registers 1, 2 pull register b timer 12 mode register pull register b timer 34 mode register pull register b f output control register pull register b serial i/o control registers 1, 2 pull register b timer a mode register timer a control register pull register b timer 56 mode register pull register b interrupt edge selection reg- ister pull register b interrupt edge selection reg- ister pull register b a-d control register pull register b cpu mode register pull register a interrupt control register 2 pull register a lcd mode register ref. no. (3) (4) (4) (5) (6) (7) (8) (9) (10) (11) (4) (12) (12) (13) (14) (15) (17) (16) table 7 list of i/o port function (2) notes 1: make sure that the input level at each pin is either 0 v or v cc during execution of the stp instruction. when an input level is at an intermediate potential, a current will flow from v cc to v ss through the input-stage gate. 2: for details of how to use double function ports as function i/o ports, refer to the applicable sections. functional description
38C3 group users manual hardware 1-16 fig. 12 port block diagram (1) functional description (6)port p4 4 serial i/o input (1)ports p0, p1, p2 segment output enable bit pull-down control segment output enable bit direction register data bus port latch v l2 /v l3 v l1 /v ss (5)port p4 3 f f output control bit (2)port p3 segment output enable bit pull-down control segment output enable bit data bus port latch v l2 /v l3 v l1 /v ss (4)ports p4 1 , p4 2 , p5 2 timer 1 output selection bit timer 3 output selection bit timer 6 output selection bit direction register pull-up control timer 1 output timer 3 output timer 6 output (3)port p4 0 data bus serial i/o clock output serial i/o mode selection bit port latch direction register pull-up control p-channel output disable bit (note) note : port p0, p1 direction registers are only bit 0. data bus port latch port latch direction register data bus pull-up control data bus port latch direction register pull-up control
38C3 group users manual hardware 1-17 fig. 13 port block diagram (2) functional description (7)port p4 5 data bus serial i/o port selection bit serial i/o output p-channel output disable bit port latch direction register pull-up control (9)port p4 7 data bus serial i/o ready output port latch s rdy output enable bit direction register pull-up control (8)port p4 6 serial i/o clock output serial i/o clock input serial i/o mode selection bit port latch direction register pull-up control p-channel output disable bit (10)port p5 0 data bus port latch direction register pull-up control timer a output enable bit timer a output (12)ports p5 3 ?5 7 int 0 ?nt 2 interrupt input data bus direction register port latch pull-up control (11)port p5 1 data bus (note) note: the initial value of m version becomes ??(output). data bus cntr 0 ,cntr 1 interrupt input
38C3 group users manual hardware 1-18 fig. 14 port block diagram (3) functional description (14)port p7 0 direction register data bus port latch port selection ?pull-up control oscillator port p7 0 (15)port p7 1 direction register data bus port xc switch bit port latch port selection ?pull-up control sub-clock generating circuit input (16)com 0 ?om 3 v l3 v l2 v l1 the gate input signal of each transistor is controlled by the lcd duty ratio and the bias value. (13)port p6 analog input pin selection bit a-d conversion input data bus port latch direction register pull-up control (17)port p8 key input (key-on wake-up) interrupt input data bus direction register port latch pull-up control p-channel output disable bit port xc switch bit port xc switch bit
38C3 group users manual hardware 1-19 interrupts interrupts occur by sixteen sources: six external, nine internal, and one software. interrupt control each interrupt except the brk instruction interrupt have both an in- terrupt request bit and an interrupt enable bit, and is controlled by the interrupt disable flag. an interrupt occurs if the corresponding inter- rupt request and enable bits are 1 and the interrupt disable flag is 0. interrupt enable bits can be set or cleared by software. interrupt re- quest bits can be cleared by software, but cannot be set by software. the brk instruction interrupt and reset cannot be disabled with any flag or bit. the i flag disables all interrupts except the brk instruction interrupt and reset. if several interrupts requests occurs at the same time the interrupt with highest priority is accepted first. interrupt operation by acceptance of an interrupt, the following operations are automati- cally performed: 1. the processing being executed is stopped. 2. the contents of the program counter and processor status reg- ister are automatically pushed onto the stack. 3. the interrupt disable flag is set and the corresponding interrupt request bit is cleared. 4. the interrupt jump destination address is read from the vector table into the program counter. n notes on interrupts when the active edge of an external interrupt (int 0 C int 2 , cntr 0 or cntr 1 ) is set or an vector interrupt source where several interrupt source is assigned to the same vector address is switched, the cor- responding interrupt request bit may also be set. therefore, take fol- lowing sequence: (1) disable the interrupt. (2) change the active edge in interrupt edge selection register. (3) clear the set interrupt request bit to 0. (4) enable the interrupt. functional description
38C3 group users manual hardware 1-20 interrupt source reset (note 2) int 0 int 1 int 2 serial i/o timer a timer 1 timer 2 timer 3 timer 4 timer 5 timer 6 cntr 0 cntr 1 key input (key- on wake-up) a-d conversion brk instruction priority 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 vector addresses (note 1) high fffd 16 fffb 16 fff9 16 fff7 16 fff5 16 fff3 16 fff1 16 ffef 16 ffed 16 ffeb 16 ffe9 16 ffe7 16 ffe5 16 ffe3 16 ffe1 16 ffdf 16 ffdd 16 interrupt request generating conditions at reset at detection of either rising or falling edge of int 0 input at detection of either rising or falling edge of int 1 input at detection of either rising or falling edge of int 2 input at completion of serial i/o data transmit/re- ceive at timer a underflow at timer 1 underflow at timer 2 underflow at timer 3 underflow at timer 4 underflow at timer 5 underflow at timer 6 underflow at detection of either rising or falling edge of cntr 0 input at detection of either rising or falling edge of cntr 1 input at falling of port p8 (at input) input logical level and at completion of a-d conversion at brk instruction execution remarks non-maskable external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (active edge selectable) valid when serial i/o is selected stp release timer underflow external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (falling valid) valid when a-d conversion interrupt is selected non-maskable software interrupt low fffc 16 fffa 16 fff8 16 fff6 16 fff4 16 fff2 16 fff0 16 ffee 16 ffec 16 ffea 16 ffe8 16 ffe6 16 ffe4 16 ffe2 16 ffe0 16 ffde 16 ffdc 16 notes 1: vector addresses contain interrupt jump destination addresses. 2: reset function in the same way as an interrupt with the highest priority. table 8 interrupt vector addresses and priority functional description
38C3 group users manual hardware 1-21 fig. 15 interrupt control fig. 16 structure of interrupt-related registers functional description interrupt request bit interrupt enable bit interrupt disable flag (i) brk instruction reset interrupt request b7 b0 interrupt edge selection register int 0 interrupt edge selection bit int 1 interrupt edge selection bit int 2 interrupt edge selection bit not used (return ??when read) cntr 0 active edge switch bit cntr 1 active edge switch bit (intedge : address 003a 16 ) interrupt request register 1 int 0 interrupt request bit int 1 interrupt request bit int 2 interrupt request bit serial i/o interrupt request bit timer a interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit timer 3 interrupt request bit interrupt control register 1 int 0 interrupt enable bit int 1 interrupt enable bit int 2 interrupt enable bit serial i/o interrupt enable bit timer a interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit timer 3 interrupt enable bit 0 : no interrupt request issued 1 : interrupt request issued (ireq1 : address 003c 16 ) (icon1 : address 003e 16 ) interrupt request register 2 timer 4 interrupt request bit timer 5 interrupt request bit timer 6 interrupt request bit cntr 0 interrupt request bit cntr 1 interrupt request bit key input interrupt request bit ad conversion interrupt request bit not used (returns ??when read) (ireq2 : address 003d 16 ) interrupt control register 2 timer 4 interrupt enable bit timer 5 interrupt enable bit timer 6 interrupt enable bit cntr 0 interrupt enable bit cntr 1 interrupt enable bit key input interrupt enable bit ad conversion interrupt enable bit not used (returns ??when read) (do not write ??to this bit) 0 : interrupts disabled 1 : interrupts enabled (icon2 : address 003f 16 ) 0 : falling edge active 1 : rising edge active b7 b0 b7 b0 b7 b0 b7 b0 0 : falling edge active, rising edge count 1 : rising edge active, falling edge count
38C3 group users manual hardware 1-22 key input interrupt (key-on wake-up) a key input interrupt request is generated by applying l level to any pin of port p8 that have been set to input mode. in other words, it is generated when and of input level goes from 1 to 0. an example of using a key input interrupt is shown in figure 17, where an inter- rupt request is generated by pressing one of the keys consisted as an active-low key matrix which inputs to ports p8 0 Cp8 3 . fig. 17 connection example when using key input interrupt and port p8 block diagram functional description ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] port p8 0 latch port p8 0 direction register = ? port p8 1 latch port p8 1 direction register = ? port p8 2 latch port p8 2 direction register = ? port p8 3 latch port p8 3 direction register = ? port p8 4 latch port p8 4 direction register = ? port p8 5 latch port p8 5 direction register = ? port p8 6 latch port p8 6 direction register = ? port p8 7 latch port p8 7 direction register = ? p8 0 input p8 1 input p8 2 input p8 3 input p8 4 output p8 5 output p8 6 output p8 7 output pull register a bit 5 = ? port p8 input reading circuit port pxx ??level output ] p-channel transistor for pull-up ] ] cmos output buffer key input interrupt request
38C3 group users manual hardware 1-23 timers 8-bit timer the 38C3 group has six built-in timers : timer 1, timer 2, timer 3, timer 4, timer 5, and timer 6. each timer has the 8-bit timer latch. all timers are down-counters. when the timer reaches 00 16 , an underflow occurs with the next count pulse. then the contents of the timer latch is reloaded into the timer and the timer continues down-counting. when a timer underflows, the interrupt request bit corresponding to that timer is set to 1. the count can be stopped by setting the stop bit of each timer to 1. the system clock f can be set to either the high-speed mode or low- speed mode with the cpu mode register. at the same time, timer internal count source is switched to either f(x in ) or f(x cin ). l timer 1, timer 2 the count sources of timer 1 and timer 2 can be selected by setting the timer 12 mode register. a rectangular waveform of timer 1 under- flow signal divided by 2 is output from the p4 1 /t1 out pin. the wave- form polarity changes each time timer 1 overflows. the active edge of the external clock cntr 0 can be switched with the bit 6 of the interrupt edge selection register. at reset or when executing the stp instruction, all bits of the timer 12 mode register are cleared to 0, timer 1 is set to ff 16 , and timer 2 is set to 01 16 . l timer 3, timer 4 the count sources of timer 3 and timer 4 can be selected by setting the timer 34 mode register. a rectangular waveform of timer 3 under- flow signal divided by 2 is output from the p4 2 /t3 out pin. the wave- form polarity changes each time timer 3 overflows. the active edge of the external clock cntr 1 can be switched with the bit 7 of the interrupt edge selection register. l timer 5, timer 6 the count sources of timer 5 and timer 6 can be selected by setting the timer 56 mode register. a rectangular waveform of timer 6 under- flow signal divided by 2 can be output from the p5 2 /pwm 1 pin. l timer 6 pwm 1 mode timer 6 can output a rectangular waveform with h duty cycle n/ (n+m) from the p5 2 /pwm 1 pin by setting the timer 56 mode register (refer to figure 20). the n is the value set in timer 6 latch (address 0025 16 ) and m is the value in the timer 6 pwm register (address 0027 16 ). if n is 0, the pwm output is l, if m is 0, the pwm output is h (n = 0 is prior than m = 0). in the pwm mode, interrupts occur at the rising edge of the pwm output. fig. 18 structure of timer related register functional description timer 12 mode register (t12m: address 0028 16 ) timer 1 count stop bit 0 : count operation 1 : count stop timer 2 count stop bit 0 : count operation 1 : count stop timer 1 count source selection bits 00 : f(x in )/16 or f(x cin )/16 01 : f(x cin ) 10 : f(x in )/32 or f(x cin )/32 11 : f(x in )/128 or f(x cin )/128 timer 2 count source selection bits 00 : underflow of timer 1 01 : f(x cin ) 10 : external count input cntr 0 11 : not available timer 1 output selection bit (p4 1 ) 0 : i/o port 1 : timer 1 output not used (returns ??when read) (do not write ??to this bit.) timer 34 mode register (t34m: address 0029 16 ) timer 3 count stop bit 0 : count operation 1 : count stop timer 4 count stop bit 0 : count operation 1 : count stop timer 3 count source selection bits 00 : f(x in )/16 or f(x cin )/16 01 : underflow of timer 2 10 : f(x in )/32 or f(x cin )/32 11 : f(x in )/128 or f(x cin )/128 timer 4 count source selection bits 00 : f(x in )/16 or f(x cin )/16 01 : underflow of timer 3 10 : external count input cntr 1 11 : not available timer 3 output selection bit (p4 2 ) 0 : i/o port 1 : timer 3 output not used (returns ??when read) (do not write ??to this bit.) timer 56 mode register (t56m: address 002a 16 ) timer 5 count stop bit 0 : count operation 1 : count stop timer 6 count stop bit 0 : count operation 1 : count stop timer 5 count source selection bit 0 : f(x in )/16 or f(x cin )/16 1 : underflow of timer 4 timer 6 operation mode selection bit 0 : timer mode 1 : pwm mode timer 6 count source selection bits 00 : f(x in )/16 or f(x cin )/16 01 : underflow of timer 5 10 : underflow of timer 4 11 : not available timer 6 (pwm) output selection bit (p5 2 ) 0 : i/o port 1 : timer 6 output not used (returns ??when read) (do not write ??to this bit.) b7 b0 b7 b0 b7 b0
38C3 group users manual hardware 1-24 fig. 19 block diagram of timer functional description x in p4 2 /t3 out 1/2 x cin ? ? ?1 ?0 ?1 ?0 ?1 ?0 ?0 ? ? ?1 ?0 ?0 ?0 ?1 p4 1 /t1 out 1/2 p5 3 /cntr 0 ?0 1/2 pwm p5 2 /pwm 1 ? ? p5 4 /cntr 1 1/2 ?1 ?1 ?0 ?0 internal system clock selection bit timer 1 count source selection bit timer 1 interrupt request data bus timer 1 latch (8) timer 1 (8) ff 16 timer 1 count stop bit reset stp instruction p4 1 latch timer 1 output selection bit p4 1 direction register timer 2 count source selection bit timer 2 latch (8) timer 2 (8) timer 2 count stop bit 01 16 timer 3 count source selection bit timer 3 latch (8) timer 3 (8) timer 3 count stop bit timer 2 interrupt request timer 3 interrupt request p4 2 latch rising/falling active edge switch timer 3 output selection bit p4 2 direction register timer 4 count source selection bit timer 4 latch (8) timer 4 (8) timer 4 count stop bit rising/falling active edge switch timer 4 interrupt request timer 5 count source selection bit timer 5 latch (8) timer 5 (8) timer 5 count stop bit timer 5 interrupt request p5 2 latch timer 6 output selection bit p5 2 direction register timer 6 count source selection bit timer 6 latch (8) timer 6 (8) timer 6 count stop bit timer 6 pwm register (8) timer 6 operation mode selection bit timer 6 interrupt request 1/16 1/128 1/32 cntr 1 interrupt request cntr 0 interrupt request
38C3 group users manual hardware 1-25 fig. 20 timing chart of timer 6 pwm 1 mode 16-bit timer timer a is a 16-bit timer that can be selected in one of four modes by the timer a mode register and the timer a control register. l timer a the timer a operates as down-count. when the timer contents reach 0000 16 , an underflow occurs at the next count pulse and the timer latch contents are reloaded. after that, the timer continues count- down. when the timer underflows, the interrupt request bit correspond- ing to the timer a is set to 1. (1) timer mode the count source can be selected by setting the timer a mode regis- ter. (2) pulse output mode pulses of which polarity is inverted each time the timer underflows are output from the ta out pin. except for that, this mode operates just as in the timer mode. when using this mode, set port p5 0 sharing the ta out pin to output mode. (3) igbt output mode after dummy output from the ta out pin, count starts with the int 0 pin input as a trigger. when the trigger is detected or the timer a underflows, h is output from the the ta out pin. when the count value corresponds with the compare register value, the ta out output becomes l. when the int 0 signal becomes h, the ta out output is forced to become l. after noise is cleared by noise filters, judging continuous 4-time same levels with sampling clocks to be signals, the int 0 signal can use 4 types of delay time by a delay circuit. when using this mode, set port p5 5 sharing the int 0 pin to input mode and set port p5 0 sharing the ta out pin to output mode. it is possible to force the timer a output to be l using pins int 1 and int 2 by the timer a control register. (4) pwm mode igbt dummy output, an external trigger with the int 0 pin and output control with pins int 1 and int 2 are not used. except for those, this mode operates just as in the igbt output mode. the period of pwm waveform is specified by the timer a set value. the h term is specified by the compare register set value. when using this mode, set port p5 0 sharing the ta out pin to output mode. functional description t s timer 6 count source n 5 ts m 5 ts (n+m) 5 ts note: pwm waveform (duty : n/(n+m) and period : (n+m) 5 ts) is output. n: setting value of timer 6 m: setting value of timer 6 pwm register ts: period of timer 6 count source timer 6 interrupt request timer 6 interrupt request timer 6 pwm mode
38C3 group users manual hardware 1-26 fig. 21 block diagram of timer a fig. 22 structure of timer a related registers functional description timer a underflow interrupt request timer a (high-order) (8) timer a (low-order) (8) timer a (high-order) latch (8) timer a (low-order) latch (8) timer a operating mode bits timer a write control bit data bus x in 1/1 1/2 1/4 timer a count source selection bits 1/8 output selection bit p5 0 latch timer a output active edge switch bit p5 0 /ta out p5 0 direction register s ? ? q q d compare register (high-order) (8) compare register (low-order) (8) 1/2 1/4 divider noise filter sampling clock selection bit int 0 0 m s delay circuit external trigger delay time selection bits 4/f(x in ) timer a output control bit 1 timer a output control bit 2 ? ? ? ? ?0 r timer a start signal int 1 int 2 00 01 10 11 internal trigger start ?0? ?1? ?1 ?0 match ?0? ?1? ?1 timer a operating mode bits timer a output active edge switch bit s ? ? q q t s pulse output mode igbt output mode pwm mode 8/f(x in ) 16/f(x in ) note: the initial value of m version becomes ??(output). (note) noise filter (4-time same levels judgement) divider b7 b0 timer a control register (tacon : address 0031 16 ) noise filter sampling clock selection bit 0 : f(x in )/2 1 : f(x in )/4 external trigger delay time selection bits 0 0 : no delay 0 1 : ( 4/f(x in )) m s 1 0 : ( 8/f(x in )) m s 1 1 : (16/f(x in )) m s timer a output control bit 1 (p5 6 ) 0 : not used 1 : int1 interrupt used timer a output control bit 2 (p5 7 ) 0 : not used 1 : int2 interrupt used not used (returns 0 when read) b7 b0 timer a mode register (tam : address 0030 16 ) timer a operating mode bits 00 : timer mode 01 : pulse output mode 10 : igbt output mode 11 : pwm mode timer a write control bit 0 : write data to both timer latch and timer 1 : write data to timer latch onl y timer a count source selection bits 0 0 : f(x in ) 0 1 : f(x in )/2 1 0 : f(x in )/4 1 1 : f(x in )/8 timer a output active edge switch bit 0 : output starts with l level 1 : output starts with h level timer a count stop bit 0 : count operating 1 : count stop timer a output selection bit (p5 0 ) 0 : i/o port 1 : timer a output
38C3 group users manual hardware 1-27 fig. 23 timing chart of timer a pwm, igbt output modes n notes on timer a (1) write order to timer a ? in the timer and pulse output modes, write to the timer a register (low-order) first and to the timer a register (high-order) next. do not write to only one side. ? in the igbt and pwm modes, write to the registers as follows: the compare register (high- and low-order) the timer a register (low-order) the timer a register (high-order). it is possible to use whichever order to write to the compare register (high- and low-order). however, write both the compare register and the timer a register at the same time. (2) read order to timer a ? in all modes, read to the timer a register (high-order) first and to the timer a register (low-order) next. read order to the compare regis- ter is not specified. ? if reading to the timer a register during write operation or writing to it during read operation, normal operation will not be performed. (3) write to timer a ? when writing a value to the timer a address to write to the latch only, the value is set into the reload latch and the timer is updated at the next underflow. normally, when writing a value to the timer a address, the value is set into the timer and the timer latch at the same time, because they are written at the same time. when writing to the latch only, if the write timing to the high-order reload latch and the underflow timing are almost the same, an ex- pected value may be set in the high-order counter. ? do not switch the timer count source during timer count operation. stop the timer count before switching it. additionally, when perform- ing write to the latch and the timer at the same time, the timer count value may change large. (4) set of timer a mode register set the write control bit to 1 (write to the latch only) when setting the igbt and pwm modes. output waveform simultaneously reflects the contents of both regis- ters at the next underflow after writing to the timer a register (high- order). (5) output control function of timer a when using the output control function (int 1 and int 2 ) in the igbt mode, set the levels of int 1 and int 2 to h in the falling edge active or to l in the rising edge active before switching to the igbt mode. functional description t s timer a count source timer a pwm mode igbt output mode (n-m+1) 5 ts m 5 ts (n+1) 5 ts note: pwm waveform (duty : (n-m+1)/(n+1) and period : (n+1) 5 ts) is output. n : setting value of timer a m : setting value of compare register ts : period of timer a count source
38C3 group users manual hardware 1-28 serial i/o the 38C3 group has a built-in 8-bit clock synchronous serial i/o. the i/o pins of serial i/o also operate as i/o port p4, and their function is selected by the serial i/o control register 1 (address 0019 16 ). fig. 24 block diagram of serial i/o functional description data bus x cin x in serial i/o interrupt request p4 6 latch p4 5 latch serial i/o port selection bit p4 7 latch serial i/o counter (3) serial i/o shift register (8) synchronous circuit internal system clock selection bit serial i/o port selection bit ? ? s clk s rdy output selection bit external clock synchronous clock selection bit divider 1/8 1/16 1/32 1/64 1/128 1/256 internal synchronous clock selection bits p4 6 /s clk1 p4 5 /s out p4 4 /s in s rdy p4 7 /s rdy p4 0 latch serial i/o port selection bit p4 0 /s clk2 ? ? ? ? ? ? ? ? ? ? [serial i/o control registers 1, 2 (siocon1, siocon2)] 0019 16 , 001a 16 each of the serial i/o control registers 1, 2 contains 8 bits that select various control parameters of serial i/o. l operation in serial i/o mode either an internal clock or an external clock can be selected as the synchronous clock for serial i/o transfer. a dedicated divider is built- in as the internal clock, giving a choice of six clocks. when internal clock is selected, serial i/o starts to transfer by a write signal to the serial i/o register (address 001b 16 ). after 8 bits have been transferred, the s out pin goes to high impedance. when external clock is selected, the clock must be controlled exter- nally because the contents of the serial i/o register continue to shift while the transfer clock is input. in this case, the s out pin does not go to high impedance at the completion of data transfer. the interrupt request bit is set at the end of the transfer of 8 bits, regardless of whether the internal or external clock is selected. when selecting internal clock and setting 1 to siocon2 0 , the p4 0 pin can be also used as synchronous clock output pin sclk 2 . at this time, the sclk 1 pin can be used as i/o port. table 9 function of p4 6 /s clk1 and p4 0 /s clk2 siocon1 6 1 siocon1 3 1 siocon2 0 0 1 p4 6 /sclk 1 sclk 1 p4 6 p4 0 /sclk 2 p4 0 sclk 2 siocon1 3 : serial i/o port selection bit siocon1 6 : synchronous clock selection bit siocon2 0 : synchronous clock output pin selection bit
38C3 group users manual hardware 1-29 fig. 25 structure of serial i/o control register fig. 26 serial i/o timing (for lsb first) functional description serial i/o control register 1 (siocon1 : address 0019 16 ) internal synchronous clock selection bits b2 b1 b0 0 0 0 : f(x in )/8 or f(x cin )/8 0 0 1 : f(x in )/16 or f(x cin )/16 0 1 0 : f(x in )32 or f(x cin )/32 0 1 1 : f(x in )/64 or f(x cin )/64 1 1 0 : f(x in )/128 or f(x cin )/128 1 1 1 : f(x in )/256 or f(x cin )/256 serial i/o port selection bit (p4 0 , p4 5 , p4 6 ) 0 : i/o port 1 : s out , s clk1 , s clk2 signal pin s rdy output selection bit (p4 7 ) 0 : i/o port 1 : s rdy signal pin transfer direction selection bit 0 : lsb first 1 : msb first synchronous clock selection bit 0 : external clock 1 : internal clock p-channel output disable bit (p4 0 , p4 5 , p4 6 ) 0 : cmos output (in output mode) 1 : n-channel open-drain (in output mode) b7 b0 serial i/o control register 2 (siocon2: address 001a 16 ) synchronous clock output pin selection bit 0 : s clk1 1 : s clk2 not used (returns ??when read) b7 b0 interrupt request bit set synchronous clock transfer clock serial i/o register write signal serial i/o output s out serial i/o input s in receive enable signal s rdy d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 note: when internal clock is selected, the s out pin goes to high impedance after transfer ends. (note)
38C3 group users manual hardware 1-30 a-d converter the 38C3 group has a 10-bit a-d converter. the a-d converter per- forms successive approximation conversion. [a-d conversion register (ad)] 0033 16 , 0034 16 one of these registers is a high-order register, and the other is a low- order register. the high-order 8 bits of a conversion result is stored in the a-d conversion register (high-order) (address 0034 16 ), and the low-order 2 bits of the same result are stored in bit 7 and bit 6 of the a-d conversion register (low-order) (address 0033 16 ). during a-d conversion, do not read these registers. [a-d control register (adcon)] 0032 16 this register controls a-d converter. bits 2 to 0 are analog input pin selection bits. bit 4 is an ad conversion completion bit and 0 during a-d conversion. this bit is set to 1 upon completion of a-d conver- sion. a-d conversion is started by setting 0 in this bit. [comparison voltage generator] the comparison voltage generator divides the voltage between av ss and v ref , and outputs the divided voltages. [channel selector] the channel selector selects one of the input ports p6 7 /an 7 Cp6 0 / an 0 and inputs it to the comparator. [comparator and control circuit] the comparator and control circuit compares an analog input volt- age with the comparison voltage and stores the result in the a-d conversion register. when an a-d conversion is completed, the con- trol circuit sets the ad conversion completion bit and the ad conver- sion interrupt request bit to 1. fig. 28 block diagram of a-d converter note that the comparator is constructed linked to a capacitor, so set f(x in ) to at least 500 khz during a-d conversion. use a cpu system clock dividing the main clock x in as the internal system clock. fig. 27 structure of a-d control register functional description ad conversion result stored bits a-d conversion register (high-order) (adh: address 0034 16 ) b7 b0 analog input pin selection bits 000: p6 0 /an 0 001: p6 1 /an 1 010: p6 2 /an 2 011: p6 3 /an 3 100: p6 4 /an 4 101: p6 5 /an 5 110: p6 6 /an 6 111: p6 7 /an 7 a-d control register (adcon: address 0032 16 ) ad conversion completion bit 0: conversion in progress 1: conversion completed not used (returns ??when read) b7 b0 not used (returns ??when read) ad conversion result stored bits a-d conversion register (low-order) (adl: address 0033 16 ) b7 b0 not used (returns ??when read) data bus av ss a-d interrupt request b7 b0 3 p6 0 /an 0 p6 1 /an 1 p6 2 /an 2 p6 3 /an 3 p6 4 /an 4 p6 5 /an 5 p6 6 /an 6 p6 7 /an 7 a-d control register channel selector comparator a-d control circuit a-d conversion register (h) a-d conversion register (l) (address 0034 16 ) (address 0033 16 ) resistor ladder v ref
38C3 group users manual hardware 1-31 lcd drive control circuit the 38C3 group has the built-in liquid crystal display (lcd) drive control circuit consisting of the following. ? lcd display ram ? segment output enable register ? lcd mode register ? selector ? timing controller ? common driver ? segment driver ? bias control circuit a maximum of 32 segment output pins and 4 common output pins can be used. up to 128 pixels can be controlled for a lcd display. when the lcd enable bit is set to 1 after data is set in the lcd mode register, the fig. 29 structure of lcd related registers segment output enable register, and the lcd display ram, the lcd drive control circuit starts reading the display data automatically, per- forms the bias control and the duty ratio control, and displays the data on the lcd panel. table 10 maximum number of display pixels at each duty ratio duty ratio 1 2 3 4 maximum number of display pixels 32 dots or 8 segment lcd 4 digits 64 dots or 8 segment lcd 8 digits 96 dots or 8 segment lcd 12 digits 128 dots or 8 segment lcd 16 digits functional description segment output enable bit 0 0 : i/o ports p2 0 ?2 3 1 : segment output seg 0 ?eg 3 segment output enable bit 1 0 : i/o ports p2 4 ?2 7 1 : segment output seg 4 ?eg 7 segment output enable bit 2 0 : i/o ports p0 0 ?0 3 1 : segment output seg 8 ?eg 11 segment output enable bit 3 0 : i/o ports p0 4 ?0 7 1 : segment output seg 12 ?eg 15 segment output enable bit 4 0 : i/o ports p1 0 ?1 3 1 : segment output seg 16 ?eg 19 segment output enable bit 5 0 : i/o ports p1 4 ?1 7 1 : segment output seg 20 ?eg 23 segment output enable bit 6 0 : output ports p3 0 ?3 3 1 : segment output seg 24 ?eg 27 segment output enable bit 7 0 : output ports p3 4 ?3 7 1 : segment output seg 28 ?eg 31 segment output enable register (seg : address 0038 16 ) b7 b0 lcd mode register (lm : address 0039 16 ) duty ratio selection bits 0 0 : 1 (use com 0 ) 0 1 : 2 (use com 0 ,com 1 ) 1 0 : 3 (use com 0 ?om 2 ) 1 1 : 4 (use com 0 ?om 3 ) bias control bit 0 : 1/3 bias 1 : 1/2 bias lcd enable bit 0 : lcd off 1 : lcd on not used (returns ??when read) (do not write ??to this bit.) lcd circuit divider division ratio selection bits 0 0 : clock input 0 1 : 2 division of clock input 1 0 : 4 division of clock input 1 1 : 8 division of clock input lcdck count source selection bit (note) 0 : f(x cin )/32 1 : f(x in )/8192 (f(x cin )/8192 in low-speed mode) note : lcdck is a clock for a lcd timing controller. b7 b0
38C3 group users manual hardware 1-32 fig. 30 block diagram of lcd controller/driver functional description data bus timing controller lcd divider f(x cin )/32 f(x in )/8192 (f(x cin )/8192 in low-speed mode) common driver bias control com 0 com 1 com 2 com 3 v ss v l1 v l2 v l3 p2 3 /seg 3 p2 2 /seg 2 p2 1 /seg 1 p2 0 /seg 0 address 0040 16 address 0041 16 ? ? lcdck lcdck count source selection bit lcd circuit divider division ratio selection bits bias control bit lcd enable bit duty ratio selection bits 2 2 selector selector selector selector selector selector lcd display ram address 004f 16 p3 6 /seg 30 p0 4 /seg 12 p3 7 /seg 31 segment driver segment driver segment driver segment driver segment driver segment driver common driver common driver common driver
38C3 group users manual hardware 1-33 duty ratio 1 2 3 4 voltage value v l3 =v lcd v l2 =2/3 v lcd v l1 =1/3 v lcd v l3 =v lcd v l2 =v l1 =1/2 v lcd v l3 =v lcd v l2 =v l1 =v ss bias control and applied voltage to lcd power input pins to the lcd power input pins (v l1 Cv l3 ), apply the voltage value shown in table 11 according to the bias value. select a bias value by the bias control bit (bit 2 of the lcd mode register). common pin and duty ratio control the common pins (com 0 Ccom 3 ) to be used are determined by duty ratio. select duty ratio by the duty ratio selection bits (bits 0 and 1 of the lcd mode register). when selecting 1-duty ratio, 1/1 bias can be used. fig. 31 example of circuit at each bias table 11 bias control and applied voltage to v l1 Cv l3 bias value 1/3 bias 1/2 bias 1/1 bias (1-duty ratio) note 1: v lcd is the maximum value of supplied voltage for the lcd panel. table 12 duty ratio control and common pins used notes 1: com 1 , com 2 , and com 3 are open. 2: com 2 and com 3 are open. 3: com 3 is open. common pins used com 0 (note 1) com 0 , com 1 (note 2) com 0 Ccom 2 (note 3) com 0 Ccom 3 bit 1 0 0 1 1 bit 0 0 1 0 1 duty ratio selection bit functional description r4 r5 r4 = r5 contrast control 1/2 bias v l3 contrast control r1 r2 r3 r1 = r2 = r3 1/3 bias r6 contrast control 1/1 bias v l1 v l2 v l3 v l1 v l2 v l3 v l1 v l2
38C3 group users manual hardware 1-34 lcd display ram address 0040 16 to 004f 16 is the designated ram for the lcd dis- play. when 1 are written to these addresses, the corresponding seg- ments of the lcd display panel are turned on. lcd drive timing the lcdck timing frequency (lcd drive timing) is generated inter- nally and the frame frequency can be determined with the following equation; (frequency of count source for lcdck) (divider division ratio for lcd) f(lcdck)= f(lcdck) duty ratio frame frequency= fig. 32 lcd display ram map functional description bit address 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 seg 13 seg 15 seg 17 seg 19 seg 21 seg 23 seg 25 seg 27 seg 29 seg 31 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 seg 1 seg 3 seg 5 seg 7 seg 9 seg 11 76543210 seg 12 seg 14 seg 16 seg 18 seg 20 seg 22 seg 24 seg 26 seg 28 seg 30 seg 0 seg 2 seg 4 seg 6 seg 8 seg 10 com 3 com 0 com 2 com 1 com 0 com 3 com 2 com 1
38C3 group users manual hardware 1-35 fig. 33 lcd drive waveform (1/2 bias) functional description internal signal lcdck timing 1/4 duty voltage level v l3 v l2 =v l1 v ss v l3 v ss com 0 com 1 com 2 com 3 seg 0 off on off on com 3 com 2 com 1 com 0 com 3 com 2 com 1 com 0 1/3 duty v l3 v l2 =v l1 v ss v l3 v ss off on on off on off 1/2 duty com 0 com 1 com 2 seg 0 com 0 com 1 seg 0 v l3 v l2 =v l1 v ss v l3 v ss off on off on off on off on com 0 com 2 com 1 com 0 com 2 com 1 com 0 com 2 com 1 com 0 com 1 com 0 com 1 com 0 com 1 com 0 1/1 duty (1/1 bias) com 0 seg 0 v l3 v l2 =v l1 =v ss v l3 v ss on off
38C3 group users manual hardware 1-36 fig. 34 lcd drive waveform (1/3 bias) functional description internal signal lcdck timing 1/4 duty voltage level v l3 v ss com 0 com 1 com 2 com 3 seg 0 off on off on com 3 com 2 com 1 com 0 com 3 com 2 com 1 com 0 1/3 duty off on on off on off 1/2 duty com 0 com 1 com 2 seg 0 com 0 com 1 seg 0 off on off on off on off on v l3 v l2 v ss v l1 v l3 v l2 v ss v l1 v l3 v ss v l3 v l2 v ss v l1 v l3 v ss com 0 com 2 com 1 com 0 com 2 com 1 com 0 com 2 com 1 com 0 com 1 com 0 com 1 com 0 com 1 com 0
38C3 group users manual hardware 1-37 f clock output function the internal system clock f can be output from port p4 3 by setting the f output control register. set 1 to bit 3 of the port p4 direction register when outputting f clock. fig. 35 structure of f output control register functional description f output control bit 0 : port function 1 : f clock output f output control register (ckout : address 002b 16 ) b7 b0 not used (return ??when read)
38C3 group users manual hardware 1-38 rom correction function (mask rom version only) the 38C3 group has the rom correction function correcting data at the arbitrary addresses in the rom area. [rom correct address register] 0f02 16 C 0f11 16 this is the register to store the address performing rom correction. there are two types of registers to correct up to 8 addresses: one is the register to store the high-order address and the other is to store the low-order address. [rom correct enable register 1 (rc1)] 0f01 16 this is the register to enable the rom correction function. when set- ting the bit corresponding to the rom correction address to 1, the rom correction function is enabled. it becomes invalid to the addresses of which corresponding bit is 0. all bits are 0 at the initial state. [rom correct data] this is the register to store a correct data for the address specified by the rom correct address register. n notes on rom correction function 1. to use the rom correction function, transfer data to each rom correct data register in the initial setting. 2. do not specify the same addresses in the rom correct address register. fig. 36 structure of rom correct address register fig. 37 structure of rom correct data fig. 38 structure of rom correct enable register 1 functional description 0f02 16 0f03 16 0f04 16 0f05 16 0f06 16 0f07 16 0f08 16 0f09 16 0f0a 16 0f0b 16 0f0c 16 0f0d 16 0f0e 16 0f0f 16 0f10 16 0f11 16 rom correct high-order address register 1 rom correct low-order address register 1 rom correct high-order address register 2 rom correct low-order address register 2 rom correct high-order address register 3 rom correct low-order address register 3 rom correct high-order address register 4 rom correct low-order address register 4 rom correct high-order address register 5 rom correct low-order address register 5 rom correct high-order address register 6 rom correct low-order address register 6 rom correct high-order address register 7 rom correct low-order address register 7 rom correct high-order address register 8 rom correct low-order address register 8 rom correct data 1 rom correct data 2 rom correct data 3 rom correct data 4 rom correct data 5 rom correct data 6 rom correct data 7 rom correct data 8 0050 16 0051 16 0052 16 0053 16 0054 16 0055 16 0056 16 0057 16 rom correct enable register 1(address 0f01 16 ) rc1 b7 b0 rom correct address 1 enable bit 0 : disabled 1 : enabled rom correct address 2 enable bit 0 : disabled 1 : enabled rom correct address 3 enable bit 0 : disabled 1 : enabled rom correct address 4 enable bit 0 : disabled 1 : enabled rom correct address 5 enable bit 0 : disabled 1 : enabled rom correct address 6 enable bit 0 : disabled 1 : enabled rom correct address 7 enable bit 0 : disabled 1 : enabled rom correct address 8 enable bit 0 : disabled 1 : enabled
38C3 group users manual hardware 1-39 reset circuit ______ to reset the microcomputer, reset pin should be held at an l level ______ for 2 m s or more. then the reset pin is returned to an h level (the power source voltage should be between 2.5 v and 5.5 v (m version: 2.2 ] v to 5.5 v), and the oscillation should be stable), reset is re- leased. after the reset is completed, the program starts from the ad- dress contained in address fffd 16 (high-order byte) and address fffc 16 (low-order byte). make sure that the reset input voltage is less than 0.5 v for v cc of 2.5 v (m version: less than 0.44 v for vcc of 2.2 ] v) when switching to the high-speed mode, a power source voltage must be between 4.0 v and 5.5 v. fig. 40 reset sequence fig. 39 reset circuit example functional description (note) 0.2v cc 0v 0v poweron v cc reset v cc reset power source voltage detection circuit power source voltage reset input voltage note : reset release voltage ; vcc=2.5 v (m version is 2.2 v.) reset internal reset address data sync f x in fffc fffd ad h, ad l ad l ???? x in : about 8000 cycles note reset address from vector table 1: the frequency relation of f(x in ) and f( f ) is f(x in ) = 8 ?f( f ). 2: the question marks (?) indicate an undefined state that depends on the previous state. ad h
38C3 group users manual hardware 1-40 fig. 41 internal status at reset functional description 00 16 00 16 ff 16 ff 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0031 16 x: not fixed since the initial values for other than above mentioned registers and ram contents are indefinite at reset, they must be set. in the m version, bit 0 of the port p5 direction register becomes ?. address register contents address register contents 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 00 16 ff 16 ff 16 ff 16 00 16 00 16 0000 16 0001 16 0002 16 0004 16 0005 16 0006 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0016 16 0017 16 0018 16 0019 16 001a 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0028 16 timer 4 port p0 port p0 direction register port p1 port p2 port p2 direction register port p3 port p4 port p4 direction register port p5 port p5 direction register port p6 port p6 direction register port p7 port p7 direction register port p8 port p8 direction register port p8 output selection register serial i/o control register 1 serial i/o control register 2 timer 1 timer 2 timer 3 timer 5 timer 6 timer 12 mode register (1) (2) (3) (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) 00 16 0029 16 timer 34 mode register (30) (32) (33) (34) (35) (36) (37) (38) timer 56 mode register f output control register timer a register (low-order) timer a register (high-order) compare register (low-order) compare register (high-order) timer a mode register timer a control register 10 16 00 16 00 16 00 16 00 16 0032 16 0038 16 003b 16 003c 16 003d 16 003e 16 003f 16 (39) (40) (43) (44) (45) (46) (47) a-d control register segment output enable register cpu mode register interrupt request register 1 interrupt request register 2 interrupt control register 1 interrupt control register 2 00 16 00 16 00 16 00 16 pull register a pull register b (31) fffc 16 contents (ps) (pc h ) (pc l ) (65) (66) program counter processor status register fffd 16 contents 1 5 0030 16 00 16 00 16 0f 16 00 16 00 16 00 16 00 16 ff 16 01 16 ff 16 010010 0 0 00 16 5 5 5 55 5 00 16 0003 16 port p1 direction register (4) 003a 16 (41) (42) lcd mode register interrupt edge selection register 00 16 00 16 0039 16 00 16 ff 16 ff 16 0f01 16 0f02 16 0f03 16 0f04 16 (48) (49) (50) (51) rom correct enable register 1 rom correct high-order address register 1 rom correct low-order address register 1 rom correct high-order address register 2 ff 16 ff 16 0f05 16 0f06 16 0f07 16 (52) (53) (54) rom correct low-order address register 2 ff 16 ff 16 rom correct high-order address register 3 rom correct low-order address register 3 ff 16 ff 16 0f08 16 0f09 16 0f0a 16 (55) (56) (57) rom correct high-order address register 4 rom correct low-order address register 4 rom correct high-order address register 5 ff 16 ff 16 0f0b 16 0f0c 16 0f0d 16 (58) (59) (60) rom correct low-order address register 5 ff 16 ff 16 rom correct high-order address register 6 rom correct low-order address register 6 ff 16 ff 16 0f0e 16 0f0f 16 0f10 16 (61) (62) (63) rom correct high-order address register 7 rom correct low-order address register 7 rom correct high-order address register 8 ff 16 ff 16 0f11 16 (64) rom correct low-order address register 8
38C3 group users manual hardware 1-41 clock generating circuit the 38C3 group has two built-in oscillation circuits. an oscillation circuit can be formed by connecting a resonator between x in and x out (x cin and x cout ). use the circuit constants in accordance with the resonator manufacturer's recommended values. no external re- sistor is needed between x in and x out since a feedback resistor exists on-chip. however, an external feedback resistor is needed be- tween x cin and x cout . immediately after power on, only the x in oscillation circuit starts os- cillating, and x cin and x cout pins function as i/o ports. frequency control (1) middle-speed mode the internal system clock is the frequency of x in divided by 8. after reset, this mode is selected. (2) high-speed mode the internal system clock is the frequency of x in divided by 2. (3) low-speed mode the internal system clock is the frequency of x cin divided by 2. n notes on clock generating circuit if you switch the mode between middle/high-speed and low-speed, stabilize both x in and x cin oscillations. the sufficient time is required for the sub clock to stabilize, especially immediately after power on and at returning from stop mode. when switching the mode between middle/high-speed and low-speed, set the frequency on condition that f(x in ) > 3f(x cin ). oscillation control (1) stop mode if the stp instruction is executed, the internal system clock stops at an h level, and x in and x cin oscillators stop. timer 1 is set to ff 16 and timer 2 is set to 01 16 . either x in divided by 16 or x cin divided by 16 is input to timer 1 as count source, and the output of timer 1 is connected to timer 2. the bits of the timer 12 mode register are cleared to 0. set the interrupt enable bits of the timer 1 and timer 2 to disabled (0) before execut- ing the stp instruction. oscillator restarts when an external interrupt is received, but the internal system clock is not supplied to the cpu until timer 2 underflows. this allows time for the clock circuit oscilla- tion to stabilize. (2) wait mode if the wit instruction is executed, the internal system clock stops at an h level. the states of x in and x cin are the same as the state before executing the wit instruction. the internal system clock re- starts at reset or when an interrupt is received. since the oscillator does not stop, normal operation can be started immediately after the clock is restarted. fig. 42 ceramic resonator circuit fig. 43 external clock input circuit functional description x cin x cout x in x out c in c out c cin c cout rf rd x in x out external oscillation circuit v cc v ss open x cin x cout c cin c cout rf rd
38C3 group users manual hardware 1-42 fig. 44 clock generating circuit block diagram functional description wit instruction stp instruction timing f (internal system clock) s r q stp instruction s r q main clock stop bit s r q timer 2 timer 1 1/2 1/4 x in x out interrupt request reset port x c switch bit ? ? low-speed mode middle-/high-speed mode internal system clock selection bit (note) middle-speed mode high-speed mode or low-speed mode note : when using the low-speed mode, set the port x c switch bit to ??. main clock division ratio selection bit ? ? interrupt disable flag i 1/2 x cout x cin ? ?
38C3 group users manual hardware 1-43 fig. 45 state transitions of system clock functional description cm 4 : port xc switch bit 0: i/o port function 1: x cin -x cout oscillating function cm 5 : main clock (x in - x out ) stop bit 0: oscillating 1: stopped cm 6 : main clock division ratio selection bit 0: f(x in )/2(high-speed mode) 1: f(x in )/8 (middle-speed mode) cm 7 : internal system clock selection bit 0: x in ? out selected (middle-/high-speed mode) 1: x cin ? cout selected (low-speed mode) reset cm 4 cm 7 cm 4 cm 5 cm 6 cm 6 cpu mode register (cpum : address 003b 16 ) b7 b4 cm 7 cm 5 cm 6 cm 6 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cm 4 ? ? cm 4 ? ? ? ? cm 5 ? ? ? ? cm 5 ? ? ? ? ? ? cm 6 cm 6 cm 6 cm 6 cm 7 =0(8 mhz selected) cm 6 =1(middle-speed) cm 5 =0(8 mhz oscillating) cm 4 =0(32 khz stopped) 1: switch the mode by the allows shown between the mode blocks. (do not switch between the mode directly without an allow.) 2: the all modes can be switched to the stop mode or the wait mode and return to the source mode when the stop mode or the wait m ode is ended. 3: timer,lcd operate in the wait mode. 4: when the stop mode is ended, a delay of approximately 1 ms occurs by connecting timer 1 and timer 2 in middle-/high-speed mode . 5: when the stop mode is ended, a delay of approximately 0.25 s occurs in low-speed mode. 6: wait until oscillation stabilizes after oscillating the main clock x in before the switching from the low-speed mode to middle/high-speed mode. 7: the example assumes that 8 mhz is being applied to the x in pin and 32 khz to the x cin pin. f indicates the internal system clock. middle-speed mode (f( f )=1 mhz) middle-speed mode ((f( f )=1 mhz) cm 7 =0(8 mhz selected) cm 6 =0(high-speed) cm 5 =0(8 mhz oscillating) cm 4 =0(32 khz stopped) high-speed mode (f( f ) =4 mhz) cm 7 =0(8 mhz selected) cm 6 =0(high-speed) cm 5 =0(8 mhz oscillating) cm 4 =1(32 khz oscillating) high-speed mode (f( f ) =4 mhz) cm 7 =1(32 khz selected) cm 6 =0(high-speed) cm 5 =0(8 mhz oscillating) cm 4 =1(32 khz oscillating) low-speed mode (f( f ) =16 khz) cm 7 =1(32 khz selected) cm 6 =0(high-speed) cm 5 =1(8 mhz stopped) cm 4 =1(32 khz oscillating) cm 7 =0(8 mhz selected) cm 6 =1(middle-speed) cm 5 =0(8 mhz oscillating) cm 4 =1(32 khz oscillating) cm 7 =1(32 khz selected) cm 6 =1(middle-speed) cm 5 =0(8 mhz oscillating) cm 4 =1(32 khz oscillating) low-speed mode ((f( f )=16 khz) cm 7 =1(32 khz selected) cm 6 =1(middle-speed) cm 5 =1(8 mhz stopped) cm 4 =1(32 khz oscillating) low-speed mode (f( f ) =16 khz) low-speed mode ((f( f )=16 khz) notes
38C3 group users manual hardware 1-44 notes on programming processor status register the contents of the processor status register (ps) after a reset are undefined, except for the interrupt disable flag (i) which is 1. after a reset, initialize flags which affect program execution. in particular, it is essential to initialize the index x mode (t) and the decimal mode (d) flags because of their effect on calculations. interrupts the contents of the interrupt request bits do not change immediately after they have been written. after writing to an interrupt request reg- ister, execute at least one instruction before performing a bbc or bbs instruction. decimal calculations ? to calculate in decimal notation, set the decimal mode flag (d) to 1, then execute an adc or sbc instruction. after executing an adc or sbc instruction, execute at least one instruction before executing a sec, clc, or cld instruction. ? in decimal mode, the values of the negative (n), overflow (v), and zero (z) flags are invalid. timers if a value n (between 0 and 255) is written to a timer latch, the fre- quency division ratio is 1/(n+1). multiplication and division instructions ? the index x mode (t) and the decimal mode (d) flags do not affect the mul and div instruction. ? the execution of these instructions does not change the contents of the processor status register. ports the contents of the port direction registers cannot be read. the fol- lowing cannot be used: ? the data transfer instruction (lda, etc.) ? the operation instruction when the index x mode flag (t) is 1 ? the addressing mode which uses the value of a direction register as an index ? the bit-test instruction (bbc or bbs, etc.) to a direction register ? the read-modify-write instructions (ror, clb, or seb, etc.) to a direction register. use instructions such as ldm and sta, etc., to set the port direction registers. serial i/o ? using an external clock when using an external clock, input h to the external clock input pin and clear the serial i/o interrupt request bit before executing serial i/o transfer and serial i/o automatic transfer. ? using an internal clock when using an internal clock, set the synchronous clock to the in- ternal clock, then clear the serial i/o interrupt request bit before executing a serial i/o transfer and serial i/o automatic transfer. a-d converter the comparator uses internal capacitors whose charge will be lost if the clock frequency is too low. therefore, make sure that f(x in ) is at least on 500 khz during an a-d conversion. do not execute the stp or wit instruction during an a-d conversion. instruction execution time the instruction execution time is obtained by multiplying the frequency of the internal system clock by the number of cycles needed to ex- ecute an instruction. the number of cycles required to execute an instruction is shown in the list of machine instructions. the frequency of the internal system clock is the same half of the x in frequency in high-speed mode. at stp instruction release at the stp instruction release, all bits of the timer 12 mode register are cleared. notes on use notes on built-in eprom version the p5 1 pin of the one time prom version or the eprom version functions as the power source input pin of the internal eprom. therefore, this pin is set at low input impedance, thereby being af- fected easily by noise. to prevent a malfunction due to noise, insert a resistor (approx. 5 k w ) in series with the p5 1 pin. notes on programming/notes on use
38C3 group users manual hardware 1-45 name of programming adapter pca4738f-80a pca4738l-80a data required for mask orders the following are necessary when ordering a mask rom production: 1. mask rom order confirmation form 2. mark specification form 3. data to be written to rom, in eprom form (three identical copies) data required for rom writing orders the following are necessary when ordering a rom writing: 1. rom writing confirmation form 2. mark specification form 3. data to be written to rom, in eprom form (three identical copies) rom programming method the built-in prom of the blank one time prom version and built-in eprom version can be read or programmed with a general-purpose prom programmer using a special programming adapter. fig. 46 programming and testing of one time prom version table 13 programming adapter package 80p6n-a 80d0 the prom of the blank one time prom version is not tested or screened in the assembly process and following processes. to en- sure proper operation after programming, the procedure shown in figure 46 is recommended to verify programming. data required for mask orders and rom writing orders/rom programming method programming with prom programmer screening (caution) (150 c for 40 hours) verification with prom programmer functional check in target device the screening temperature is far higher than the storage temperature. never expose to 150 c exceeding 100 hours. caution :
1-46 38C3 group users manual hardware functional description supplement interrupt 38C3 group permits interrupts on the basis of 16 sources. it is vector interrupts with a fixed priority system. accordingly, when two or more interrupt requests occur during the same sampling, the table 14 interrupt sources, vector addresses and interrupt priority functional description supplement higher-priority interrupt is accepted first. this priority is determined by hardware, but various priority processing can be performed by software, using an interrupt enable bit and an interrupt disable flag. for interrupt sources, vector addresses and interrupt priority, refer to table 14. interrupt source reset (note 2) int 0 int 1 int 2 serial i/o timer a timer 1 timer 2 timer 3 timer 4 timer 5 timer 6 cntr 0 cntr 1 key input (key- on wake-up) a-d conversion brk instruction priority 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 vector addresses (note 1) high fffd 16 fffb 16 fff9 16 fff7 16 fff5 16 fff3 16 fff1 16 ffef 16 ffed 16 ffeb 16 ffe9 16 ffe7 16 ffe5 16 ffe3 16 ffe1 16 ffdf 16 ffdd 16 interrupt request generating conditions at reset at detection of either rising or falling edge of int 0 input at detection of either rising or falling edge of int 1 input at detection of either rising or falling edge of int 2 input at completion of serial i/o data transmit/re- ceive at timer a underflow at timer 1 underflow at timer 2 underflow at timer 3 underflow at timer 4 underflow at timer 5 underflow at timer 6 underflow at detection of either rising or falling edge of cntr 0 input at detection of either rising or falling edge of cntr 1 input at falling of port p8 (at input) input logical level and at completion of a-d conversion at brk instruction execution remarks non-maskable external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (active edge selectable) valid when serial i/o is selected stp release timer underflow external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (falling valid) valid when a-d conversion interrupt is selected non-maskable software interrupt low fffc 16 fffa 16 fff8 16 fff6 16 fff4 16 fff2 16 fff0 16 ffee 16 ffec 16 ffea 16 ffe8 16 ffe6 16 ffe4 16 ffe2 16 ffe0 16 ffde 16 ffdc 16 notes 1: vector addresses contain interrupt jump destination addresses. 2: reset function in the same way as an interrupt with the highest priority.
1-47 38C3 group users manual hardware functional description supplement timing after interrupt the interrupt processing routine begins with the machine cycle fol- lowing the completion of the instruction that is currently in execution. figure 47 shows a timing chart after an interrupt occurs, and figure 48 shows the time up to execution of the interrupt processing routine. fig. 47 timing chart after interrupt occurs fig. 48 time up to execution of interrupt processing routine p c h p c l p sa l a h s , s p ss - 2 , s p s s - 1 , s p s p c b l b h a l , a h a d d r e s s b u s d a t a b u s n o t u s e d : c p u o p e r a t i o n c o d e f e t c h c y c l e ( t h i s i s a n i n t e r n a l s i g n a l w h i c h c a n n o t b e o b s e r v e d f r o m t h e e x t e r n a l u n i t . ) : v e c t o r a d d r e s s o f e a c h i n t e r r u p t : j u m p d e s t i n a t i o n a d d r e s s o f e a c h i n t e r r u p t : 0 0 1 6 o r 0 1 1 6 s y n c b l , b h a l , a h s p s w r r d s y n c f 7 t o 2 3 c y c l e s ( 4 m h z , 1 . 7 5 m s t o 5 . 7 5 m s ) i n t e r r u p t r e q u e s t o c c u r s m a i n r o u t i n e i n t e r r u p t p r o c e s s i n g r o u t i n e 2 c y c l e s5 c y c l e s w a i t i n g t i m e f o r p i p e l i n e p o s t - p r o c e s s i n g p u s h o n t o s t a c k v e c t o r f e t c h i n t e r r u p t o p e r a t i o n s t a r t s 0 t o 1 6 c y c l e s
1-48 38C3 group users manual hardware functional description supplement a-d converter a-d conversion is started by setting ad conversion completion bit to 0. during a-d conversion, internal operations are performed as fol- lows. 1. after the start of a-d conversion, a-d conversion register goes to 00 16 . 2. the highest-order bit of a-d conversion register is set to 1, and the comparison voltage vref is input to the comparator. then, v ref is compared with analog input voltage v in . 3. as a result of comparison, when v ref < v in , the highest-order bit of a-d conversion register becomes 1. when v ref > v in , the high- est-order bit becomes 0. by repeating the above operations up to the lowest-order bit of the a-d conversion register, an analog value converts into a digital value. a-d conversion completes at 61 clock cycles (15.25 m s at f(x in ) = 8 mhz) after it is started, and the result of the conversion is stored into the a-d conversion register. concurrently with the completion of a-d conversion, a-d conversion interrupt request occurs, so that the ad conversion interrupt request bit is set to 1. table 15 relative formula for a reference voltage v ref of a-d converter and v ref v ref 1024 ] 1C ] 10: a result of the first comparison to the tenth comparison table 16 change of a-d conversion register during a-d conversion at start of conversion first comparison second comparison third comparison after completion of tenth comparison 0 a result of a-d conversion ] 1 change of a-d conversion register 0 value of comparison voltage (v ref ) v ref 2 v ref 2 v ref 4 v ref 2 v ref 4 v ref 8 when n = 0 v ref = 0 when n = 1 to 1023 v ref = 5 n n: value of a-d converter (decimal numeral) v ref 2 v ref 4 v ref 1024 ? ? ? ? 0 0 000 0 000 1 0 0 00 0 0 0 0 0 1 0 0 0 0 0 0 0 0 ] 1 ] 2 00 0 0 00 0 1 ] 1 ] 2 ] 3 ] 4 ] 5 ] 6 ] 7 ] 8 ] 9 ] 10 ~ ~ ~ ~
1-49 38C3 group users manual hardware functional description supplement figures 49 shows the a-d conversion equivalent circuit, and figure 50 shows the a-d conversion timing chart. fig. 49 a-d conversion equivalent circuit fig. 50 a-d conversion timing chart v s s v c c v s s v c c a n 0 a n 1 a n 2 a n 3 a n 4 a n 5 a n 6 a n 7 v r e f a v s s v r e f v i n a b o u t 2 k w c b 1 b 2b 0 a - d c o n t r o l r e g i s t e r b u i l t - i n d - a c o n v e r t e r r e f e r e n c e c l o c k a - d c o n v e r s i o n r e g i s t e r ( h i g h - o r d e r ) a d c o n v e r s i o n i n t e r r u p t r e q u e s t c h o p p e r a m p l i f i e r s a m p l i n g c l o c k a - d c o n v e r s i o n r e g i s t e r ( l o w - o r d e r ) w r i t e s i g n a l f o r a - d c o n t r o l r e g i s t e r a d c o n v e r s i o n c o m p l e t i o n b i t s a m p l i n g c l o c k f 6 1 c y c l e s
1-50 38C3 group users manual hardware functional description supplement memorandum
chapter 2 chapter 2 application 2.1 i/o port 2.2 timer 2.3 serial i/o 2.4 lcd controller 2.5 a-d converter 2.6 rom correct function 2.7 reset circuit 2.8 clock generating circuit
2-2 38C3 group users manual application 2.1 i/o port 2.1 i/o port this paragraph describes the setting method of i/o port relevant registers, notes etc. 2.1.1 memory map fig. 2.1.1 memory map of i/o port relevant registers pull register a (pulla) pull register b (pullb) port p7 (p7) port p6 direction register (p6d) port p6 (p6) 0016 16 0017 16 000e 16 000d 16 port p7 direction register (p7d) 000f 16 port p8 (p8) 0010 16 port p8 direction register (p8d) 0011 16 000c 16 port p8 output selection register (p8sel) 0018 16 port p5 direction register (p5d) port p5 (p5) port p4 direction register (p4d) 000b 16 000a 16 0009 16 port p4 (p4) 0008 16 0007 16 port p3 (p3) port p2 direction register (p2d) port p2 (p2) 0006 16 0005 16 0004 16 0003 16 port p1 (p1) port p0 direction register (p0d) port p1 direction register (p1d) port p0 (p0) 0002 16 0001 16 0000 16 address
2-3 application 2.1 i/o port 38C3 group users manual 2.1.2 relevant registers fig. 2.1.2 structure of port pi (i = 0, 1, 2, 3, 4, 5, 6, 8) fig. 2.1.3 structure of port p7 port pi b7 b6 b5 b4 b3 b2 b1 b0 port pi (i = 0, 1, 2, 3, 4, 5, 6, 8) (pi: addresses 00 16 , 02 16 , 04 16 , 06 16 , 08 16 , 0a 16 , 0c 16 , 10 16 ) b 0 0 port pi 0 l in output mode write port latch read port latch l in input mode write port latch read value of pin port pi 1 port pi 2 port pi 3 port pi 4 port pi 5 port pi 6 port pi 7 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 port p7 b7 b6 b5 b4 b3 b2 b1 b0 port p7 (p7: address 0e 16 ) b 0 0 port p7 0 l in output mode write port latch read port latch l in input mode write port latch read value of pin port p7 1 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 55 55 55 55 55 55 nothing is arranged for these bits. when these bits are read out, the contents are undefined.
2-4 38C3 group users manual application 2.1 i/o port fig. 2.1.5 structure of port pi direction register (i = 2, 4, 5, 6, 8) fig. 2.1.4 structure of port p0 direction register and port p1 direction register port p0 direction register, port p1 direction register b7 b6 b5 b4 b3 b2 b1 b0 port p0 direction register (p0d: address 01 16 ) port p1 direction register (p1d: address 03 16 ) b 0 name 0 functions at reset r w 0 0 0 0 0 ports p0/p1 direction register 0 0 55 55 0 55 55 55 55 5 5 5 nothing is arranged for these bits. when these bits are read out, the contents are undefined. 2 3 4 5 6 7 1 0 : all bits of ports p0/p1 input mode 1 : all bits of ports p0/p1 output mode note: ports p0 and p1 are switched to input and output by each port. when b0 of corresponding port direction register is set to ?? all 8 bits of port become input port. when b0 of corresponding port direction register is set to ?? all 8 bits of port become output port. nothing is arranged for b1 to b7 of port p0 and port p1 direction registers. these are write disabled bits. port pi direction register b7 b6 b5 b4 b3 b2 b1 b0 port pi direction register (i = 2, 4, 5, 6, 8) (pid: addresses 05 16 , 09 16 , 0b 16 , 0d 16 , 11 16 ) 0 : port pi 0 input mode 1 : port pi 0 output mode b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 : port pi 2 input mode 1 : port pi 2 output mode 0 0 : port pi 3 input mode 1 : port pi 3 output mode 0 0 : port pi 4 input mode 1 : port pi 4 output mode 0 0 : port pi 5 input mode 1 : port pi 5 output mode 0 0 : port pi 6 input mode 1 : port pi 6 output mode 0 0 : port pi 7 input mode 1 : port pi 7 output mode 0 port pi direction register note: bit 1 of the port p5 direction register (address 0b 16 ) does not have direction register function, because p5 1 is an input port. when writing to bit 1 of the port p5 direction register, write ??to the bit. 0 : port pi 1 input mode 1 : port pi 1 output mode (note)
2-5 application 2.1 i/o port 38C3 group users manual fig. 2.1.7 structure of pull register a fig. 2.1.6 structure of port p7 direction register port p7 direction register b7 b6 b5 b4 b3 b2 b1 b0 port p7 direction register (p7d: address 0f 16 ) 0 : port p7 0 input mode 1 : port p7 0 output mode b 0 1 2 3 4 5 name 0 functions at reset r w 0 : port p7 1 input mode 1 : port p7 1 output mode 0 0 0 0 0 port p7 direction register 6 0 7 0 55 55 55 55 55 5 5 5 5 nothing is arranged for these bits. when these bits are read out, the contents are undefined. b7 b6 b5 b4 b3 b2 b1 b0 pull register a (pulla: address 16 16 ) 0: no pull-down control 1: pull-down control b 0 1 2 3 4 7 name functions at reset r w 0: no pull-down control 1: pull-down control 0: no pull-down control 1: pull-down control 0 0 1 1 1 1 port p0 0 ?0 7 pull-down control port p1 0 ?1 7 pull-down control port p2 0 ?2 7 pull-down control port p7 0 , p7 1 pull-up control port p8 0 ?8 7 pull-up control nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 0 0 5 6 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control note: the pin which is set to output port is cut off from pull-up control. pull register a
2-6 38C3 group users manual application 2.1 i/o port fig. 2.1.8 structure of pull register b fig. 2.1.9 structure of port p8 output selection register pull register b b7 b6 b5 b4 b3 b2 b1 b0 pull register b (pullb: address 17 16 ) 0: no pull-up control 1: pull-up control b 0 1 2 3 4 7 name functions at reset r w 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control 0 0 0 0 0 0 port p4 0 ?4 3 pull-up control port p4 4 ?4 7 pull-up control port p6 0 ?6 3 pull-up control port p5 4 ?5 7 pull-up control port p5 0 , p5 2 , p5 3 pull-up control port p6 4 ?6 7 pull-up control nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 0 0 5 6 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control note: the pin which is set to output port is cut off from pull-up control. 0: no pull-up control 1: pull-up control port p8 output selection register b7 b6 b5 b4 b3 b2 b1 b0 port p8 output selection register (p8sel: address 18 16 ) b 0 name functions at reset r w 0 port p8 output selection register 0 0 0 0 0 0 0 1 2 3 4 7 5 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 6
2-7 application 2.1 i/o port 38C3 group users manual 2.1.3 terminate unused pins table 2.1.1 termination of unused pins pins p3 p0, p1, p2, p4, p5 0 , p5 2 Cp5 7 , p6, p7, p8 p5 1 vl 1 Cvl 3 com 0 Ccom 3 v ref x out av ss termination open at h output state. ? set to the input mode and connect each to v cc or v ss through a resistor of 1 k w to 10 k w . ? set to the output mode and open at l or h output state. connect to v cc or v ss through a resistor of 1 k w to 10 k w . connect to vss (gnd). open open open (only when using external clock) connect to v ss (gnd).
2-8 38C3 group user s manual applica tion 2.1 i/o port 2.1.4 notes on i/o port (1) notes in standby state in standby state ] 1 for low-power dissipation, do not make input levels of an input port and an i/o port undefined . pull-up (connect the port to v cc ) or pull-down (connect the port to v ss ) these ports through a resistor. when determining a resistance value, note the following points: external circuit variation of output levels during the ordinary operation when using built-in pull-up resistor, note on varied current values: when setting as an input port : fix its input level when setting as an output port : prevent current from flowing out to external l r eason the potential which is input to the input buffer in a microcomputer is unstable in the state that input levels of a input port and an i/o port are undefined . this may cause power source current. ] 1 standby state: stop mode by executing stp instruction wait mode by executing wit instruction (2) modifying port latch of i/o port with bit managing instruction when the port latch of an i/o port is modified with the bit managing instruction ] 2 , the value of the unspecified bit may be changed. l reason the bit managing instructions are read-modify-write form instructions for reading and writing data by a byte unit. accordingly, when these instructions are executed on a bit of the port latch of an i/o port, the following is executed to all bits of the port latch. as for bit which is set for input port: the pin state is read in the cpu, and is written to this bit after bit managing. as for bit which is set for output port: the bit value is read in the cpu, and is written to this bit after bit managing. note the following: even when a port which is set as an output port is changed for an input port, its port latch holds the output data. as for a bit of which is set for an input port, its value may be changed even when not specified with a bit managing instruction in case where the pin state differs from its port latch contents. ] 2 bit managing instructions: seb and clb instructions (3) pull-up/pull-down control when each port which has built-in pull-up/pull-down resistor (p0, p1, p2, p4, p5 0 , p5 2 p5 7 , p6, p7, p8) is set to output port, pull-up/pull-down control of corresponding port become invalid. (pull-up/pull- down cannot be set.) l reason pull-up control is valid only when each direction register is set to the input mode.
2-9 application 2.1 i/o port 38C3 group users manual 2.1.5 termination of unused pins (1) terminate unused pins output ports : open input ports : connect each pin to v cc or v ss through each resistor of 1 k w to 10 k w . as for pins whose potential affects to operation modes such as pin int or others, select the v cc pin or the v ss pin according to their operation mode. a i/o ports : ? set the i/o ports for the input mode and connect them to v cc or v ss through each resistor of 1 k w to 10 k w . ports that permit the selecting of a built-in pull-up resistor can also use this resistor. set the i/o ports for the output mode and open them at l or h. ? when opening them in the output mode, the input mode of the initial status remains until the mode of the ports is switched over to the output mode by the program after reset. thus, the potential at these pins is undefined and the power source current may increase in the input mode. with regard to an effects on the system, thoroughly perform system evaluation on the user side. ? since the direction register setup may be changed because of a program runaway or noise, set direction registers by program periodically to increase the reliability of program. (2) termination remarks input ports and i/o ports : do not open in the input mode. l reason ? the power source current may increase depending on the first-stage circuit. ? an effect due to noise may be easily produced as compared with proper termination and a shown on the above. i/o ports : when setting for the input mode, do not connect to v cc or v ss directly. l reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between a port and v cc (or v ss ). a i/o ports : when setting for the input mode, do not connect multiple ports in a lump to v cc or v ss through a resistor. l reason if the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between ports. ? at the termination of unused pins, perform wiring at the shortest possible distance (20 mm or less) from microcomputer pins.
2-10 38C3 group users manual application 2.2 timer 2.2 timer this paragraph explains the registers setting method and the notes relevant to the timers. 2.2.1 memory map fig. 2.2.1 memory map of registers relevant to timers 0 0 2 2 1 6 0 0 2 3 1 6 0 0 2 5 1 6 0 0 2 7 1 6 0 0 2 8 1 6 0 0 2 c 1 6 t i m e r 1 ( t 1 ) t i m e r 4 ( t 4 ) t i m e r 6 ( t 6 ) t i m e r 6 p w m r e g i s t e r ( t 6 p w m ) t i m e r 1 2 m o d e r e g i s t e r ( t 1 2 m ) t i m e r a r e g i s t e r ( l o w - o r d e r ) ( t a l ) 0 0 3 e 1 6 0 0 3 f 1 6 i n t e r r u p t c o n t r o l r e g i s t e r 1 ( i c o n 1 ) i n t e r r u p t c o n t r o l r e g i s t e r 2 ( i c o n 2 ) i n t e r r u p t r e q u e s t r e g i s t e r 1 ( i r e q 1 ) 0 0 2 0 1 6 0 0 2 1 1 6 t i m e r 2 ( t 2 ) t i m e r 3 ( t 3 ) 0 0 2 4 1 6 t i m e r 5 ( t 5 ) t i m e r 3 4 m o d e r e g i s t e r ( t 3 4 m ) 0 0 2 9 1 6 t i m e r 5 6 m o d e r e g i s t e r ( t 5 6 m ) 0 0 2 a 1 6 0 0 2 d 1 6 t i m e r a r e g i s t e r ( h i g h - o r d e r ) ( t a h ) 0 0 2 e 1 6 c o m p a r e r e g i s t e r ( l o w - o r d e r ) ( c o n a l ) 0 0 2 f 1 6 c o m p a r e r e g i s t e r ( h i g h - o r d e r ) ( c o n a h ) i n t e r r u p t r e q u e s t r e g i s t e r 2 ( i r e q 2 ) 0 0 3 d 1 6 0 0 3 c 1 6 t i m e r a m o d e r e g i s t e r ( t a m ) t i m e r a c o n t r o l r e g i s t e r ( t a c o n ) 0 0 3 1 1 6 0 0 3 0 1 6
38C3 group users manual application 2-11 2.2 timer fig. 2.2.3 structure of timer 2 fig. 2.2.2 structure of timer i (i=1, 3, 4, 5, 6) 2.2.2 relevant registers (1) 8-bit timer timer i b7 b6 b5 b4 b3 b2 b1 b0 timer i (i = 1, 3, 4, 5, 6) (ti: addresses 20 16 , 22 16 , 23 16 , 24 16 , 25 16 ) b 0 1 at reset r w 1 2 3 4 5 6 7 functions ?set timer i count value. ?the value set in this register is written to both the timer i and the timer i latch at one time. ?when the timer i is read out, the count value of the timer i is read out. 1 1 1 1 1 1 1 timer 2 b7 b6 b5 b4 b3 b2 b1 b0 timer 2 (t2: address 21 16 ) b 0 1 at reset r w 1 2 3 4 5 6 7 functions ?set timer 2 count value. ?the value set in this register is written to both the timer 2 and the timer 2 latch at one time. ?when the timer 2 is read out, the count value of the timer 2 is read out. 0 0 0 0 0 0 0
2-12 38C3 group users manual application 2.2 timer fig. 2.2.4 structure of timer 6 pwm register fig. 2.2.5 structure of timer 12 mode register timer 6 pwm register b7 b6 b5 b4 b3 b2 b1 b0 timer 6 pwm register (t6pwm: address 27 16 ) b 0 1 2 3 4 5 6 7 undefined functions at reset r w undefined undefined undefined undefined undefined undefined undefined ?in timer 6 pwm 1 mode ??level width of pwm rectangular waveform is set. ?duty of pwm rectangular waveform: n/(n + m) period: (n + m) ts n = timer 6 set value m = timer 6 pwm register set value ts = timer 6 count source period at n = 0, all pwm output ?? at m = 0, all pwm output ?? (however, n = 0 has priority.) ?selection of timer 6 pwm 1 mode set ??to the timer 6 operation mode selection bit. timer 12 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 12 mode register (t12m: address 28 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0 0: f(x in )/16 or f(x cin )/16 0 1: f(x cin ) 1 0: f(x in )/32 or f(x cin )/32 1 1: f(x in )/128 or f(x cin )/128 0 0 0 0: i/o port 1: timer 1 output 0 0 0 timer 1 count stop bit timer 2 count stop bit timer 2 count source selection bits timer 1 output selection bit (p4 1 ) timer 1 count source selection bits nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b3 b2 b5 b4 0 0: timer 1 underflow 0 1: f(x cin ) 1 0: external count input cntr 0 1 1: not available
38C3 group users manual application 2-13 2.2 timer fig. 2.2.6 structure of timer 34 mode register fig. 2.2.7 structure of timer 56 mode register timer 34 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 34 mode register (t34m: address 29 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 2 underflow 1 0: f(x in )/32 or f(x cin )/32 1 1: f(x in )/128 or f(x cin )/128 0 0 0 0: i/o port 1: timer 3 output 0 0 timer 3 count stop bit timer 4 count stop bit timer 4 count source selection bits timer 3 output selection bit (p4 2 ) timer 3 count source selection bits nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b3 b2 b5 b4 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 3 underflow 1 0: external count input cntr 1 1 1: not available timer 56 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 56 mode register (t56m: address 2a 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0: f(x in )/16 or f(x cin )/16 1: timer 4 underflow 0: timer mode 1: pwm mode 0 0 0 0: i/o port 1: timer 6 output 0 0 0 timer 5 count stop bit timer 6 count stop bit timer 6 count source selection bits timer 6 (pwm) output selection bit (p5 2 ) timer 5 count source selection bit timer 6 operation mode selection bit nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b5 b4 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 5 underflow 1 0: timer 4 underflow 1 1: not available
2-14 38C3 group users manual application 2.2 timer fig. 2.2.8 structure of timer a register (low-order, high-order) (2) 16-bit timer timer a register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 timer a register (low-order, high-order) (tal, tah: addresses 2c 16 , 2d 16 ) b 0 1 2 3 4 5 6 7 1 functions at reset r w 1 1 1 1 1 1 1 ?set timer a count value. ?when the timer a write control bit of the timer a mode register is ?? the value is written to timer a and the latch at one time. when the timer a write control bit of the timer a mode register is ?? the value is written only to the latch. ?the timer a count value is read out by reading this register. notes 1: when reading and writing, perform them to both the high- order and low-order bytes. 2: read both registers in order of tah and tal following. 3: write both registers in order of tal and tah following. 4: do not read both registers during a write, and do not write to both registers during a read. fig. 2.2.9 structure of compare register (low-order, high-order) compare register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 compare register (low-order, high-order) (conal, conah: addresses 2e 16 , 2f 16 ) b 0 1 2 3 4 5 6 7 0 functions at reset r w 0 0 0 0 0 0 0 ?set compare register value. note: write registers in order of conah, conal, tal, and tah following.
38C3 group users manual application 2-15 2.2 timer fig. 2.2.10 structure of timer a mode register fig. 2.2.11 structure of timer a control register timer a mode register b7 b6 b5 b4 b3 b2 b1 b0 timer a mode register (tam: address 30 16 ) b 0 4 name 0 functions at reset r w timer a operating mode bits timer a write control bit 0 0: timer mode 0 1: pulse output mode 1 0: igbt output mode 1 1: pwm mode 0 0: f(x in ) 0 1: f(x in )/2 1 0: f(x in )/4 1 1: f(x in )/8 0 0 0: write data to both timer latch and timer 1: write data to timer latch 1 timer a count source selection bits 3 0 0 0 0 0 timer a output active edge switch bit timer a count stop bit 0: output starts with ??level 1: output starts with ??level 0: count operating 1: count stop timer a output selection bit (p5 0 ) 0: i/o port 1: timer a output 5 6 7 b1b0 2 b4b3 timer a control register b7 b6 b5 b4 b3 b2 b1 b0 timer a control register (tacon: address 31 16 ) b 0 4 name 0 functions at reset r w noise filter sampling clock selection bit external trigger delay time selection bits 0: f(x in )/2 1: f(x in )/4 0: not used 1: int1 interrupt used 0 0: no delay 0 1: (4/f(x in )) m s 1 0: (8/f(x in )) m s 1 1: (16/f(x in )) m s 0 0 1 timer a output control bit 1 (p5 6 ) 0: not used 1: int2 interrupt used timer a output control bit 2 (p5 7 ) 3 0 0 0 5 6 7 2 b2b1 0 0 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ??
2-16 38C3 group users manual application 2.2 timer fig. 2.2.12 structure of interrupt request register 1 (3) 8-bit timer, 16-bit timer interrupt request register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 1 (ireq1 : address 3c 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 int 0 interrupt request bit int 1 interrupt request bit serial i/o interrupt request bit timer a interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit int 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued timer 3 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 ] ] ] ] ] ] ] ] ] : ??can be set by software, but ??cannot be set.
38C3 group users manual application 2-17 2.2 timer fig. 2.2.13 structure of interrupt request register 2 interrupt request register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 2 (ireq2 : address 3d 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 timer 4 interrupt request bit timer 5 interrupt request bit cntr 0 interrupt request bit cntr1 interrupt request bit key input interrupt request bit ad conversion interrupt request bit timer 6 interrupt request bit 0 ] ] ] ] ] ] ] nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? ] : ??can be set by software, but ??cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued
2-18 38C3 group users manual application 2.2 timer fig. 2.2.14 structure of interrupt control register 1 fig. 2.2.15 structure of interrupt control register 2 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 1 (icon1 : address 3e 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 int 0 interrupt enable bit int 1 interrupt enable bit serial i/o interrupt enable bit timer a interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit int 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled timer 3 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 0 0 interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 2 (icon2 : address 3f 16 ) b 0 1 2 4 name 0 functions at reset r w 0 0 0 0 timer 5 interrupt enable bit cntr 0 interrupt enable bit cntr 1 interrupt enable bit timer 6 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 5 0 key input interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 6 7 0 ad conversion interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 timer 4 interrupt enable bit nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 3
38C3 group users manual application 2-19 2.2 timer 2.2.3 timer application examples (1) basic functions and uses [function 1] control of event interval (timer 1 to timer 6, timer a: timer mode) when a certain time, by setting a count value to each timer, has passed, the timer interrupt request occurs. ?generating of an output signal timing ?generating of a wait time [function 2] control of cyclic operation (timer 1 to timer 6, timer a: timer mode) the value of the timer latch is automatically written to the corresponding timer each time the timer underflows, and each timer interrupt request occurs in cycles. ?generating of cyclic interrupts ?clock function (measurement of 1 s); see (2) timer application example 1 ?control of a main routine cycle [function 3] output of rectangular waveform (timer 1, timer 3, timer 6, timer a: pulse output mode) the output level of the t1 out pin, t3 out pin, pwm 1 pin or ta out pin is inverted each time the timer underflows. ?piezoelectric buzzer output; see (3) timer application example 2 ?generating of the remote control carrier waveforms [function 4] count of external pulses (timer 2, timer 4) external pulses input to the cntr 0 pin, cntr 1 pin are counted as the timer count source (in the event counter mode). ?frequency measurement; see (4) timer application example 3 ?division of external pulses ?generating of interrupts due to a cycle using external pulses as the count source; count of a reel pulse [function 5] output of pwm signal (timer 6) h interval and l interval are specified, respectively, and the output of pulses from p5 2 /pwm 1 pin is repeated. ?control of electric volume [function 6] output of igbt control signal (timer a: igbt output mode) the external signal which is input to int 0 pin is used as trigger, and the period and h interval are specified, respectively, and the output of pulses from p5 0 /ta out pin is repeated. ?igbt control of ih heat equipment; see (5) timer application example 4 ?igbt control to magnetron [function 7] output of pwm signal (timer a: pwm mode) the cycle and h interval are specified, respectively, and the output of pulses from p5 0 /ta out pin is repeated. ?control of electric volume ?igbt control of ih heat equipment
2-20 38C3 group users manual application 2.2 timer (2) timer application example 1: clock function (measurement of 1 s) outline : the input clock is divided by the timer so that the clock can count up at 1 s intervals. specifications : ?the clock f(x in ) = 4.19 mhz (2 22 hz) is divided by the timer. ?the timer 3 interrupt request bit is checked in main routine, and if the interrupt request is issued, the clock is counted up. ? the timer 1 interrupt occurs every 244 m s to execute processing of other interrupts. figure 2.2.16 shows the timers connection and setting of division ratios; figure 2.2.17 shows the relevant registers setting; figure 2.2.18 shows the control procedure. fig. 2.2.16 timers connection and setting of division ratios f ( x i n ) 4 . 1 9 m h z 2 4 4 m s 1 / 1 6 1 / 6 4 1 / 2 5 6 1 / 1 60 / 1 0 / 1 0 : n o i n t e r r u p t r e q u e s t i s s u e d 1 : i n t e r r u p t r e q u e s t i s s u e d 1 s e c o n d t i m e r 1 t i m e r 1 i n t e r r u p t r e q u e s t b i t t i m e r 2t i m e r 3 t i m e r 3 i n t e r r u p t r e q u e s t b i t t i m e r 1 c o u n t s o u r c e s e l e c t i o n b i t
38C3 group users manual application 2-21 2.2 timer fig. 2.2.17 relevant registers setting i c o n 1 1 t 13 f 1 6 t 2 f f 1 6 b 0 b 7 b 0 b 7 b 0 b 7 t 1 2 m b 0 b 7 000 001 0 t 3 4 m b 0 b 7 010 0 0 0 t 30 f 1 6 b 0 b 7 0 0 i r e q 1 b 0 b 7 t i m e r 1 2 m o d e r e g i s t e r ( a d d r e s s 2 8 1 6 ) t i m e r 1 c o u n t s t o p ; c l e a r t o 0 w h e n s t a r t i n g c o u n t . t i m e r 2 c o u n t : i n p r o g r e s s t i m e r 1 c o u n t s o u r c e : f ( x i n ) / 1 6 t i m e r 2 c o u n t s o u r c e : t i m e r 1 s u n d e r f l o w t i m e r 1 o u t p u t s e l e c t i o n : i / o p o r t s e t d i v i s i o n r a t i o 1 . [ t 1 = 6 3 ( 3 f 1 6 ) , t 2 = 2 5 5 ( f f 1 6 ) , t 3 = 1 5 ( 0 f 1 6 ) ] i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 3 e 1 6 ) t i m e r 3 4 m o d e r e g i s t e r ( a d d r e s s 2 9 1 6 ) t i m e r 3 c o u n t : i n p r o g r e s s t i m e r 3 c o u n t s o u r c e : t i m e r 2 s u n d e r f l o w t i m e r 3 o u t p u t s e l e c t i o n : i / o p o r t t i m e r 1 ( a d d r e s s 2 0 1 6 ) t i m e r 2 ( a d d r e s s 2 1 1 6 ) t i m e r 3 ( a d d r e s s 2 2 1 6 ) t i m e r 1 i n t e r r u p t : e n a b l e d t i m e r 2 i n t e r r u p t : d i s a b l e d t i m e r 3 i n t e r r u p t : d i s a b l e d i n t e r r u p t r e q u e s t r e g i s t e r 1 ( a d d r e s s 3 c 1 6 ) t i m e r 1 i n t e r r u p t r e q u e s t ( b e c o m e s 1 a t 2 4 4 m s i n t e r v a l s ) t i m e r 2 i n t e r r u p t r e q u e s t t i m e r 3 i n t e r r u p t r e q u e s t ( b e c o m e s 1 a t 1 s i n t e r v a l s )
2-22 38C3 group users manual application 2.2 timer fig. 2.2.18 control procedure r e s e t s e i t 1 2 m t 3 4 m i r e q 1 i c o n 1 t 1 t 2 t 3 t 1 2 m c l i 0 0 0 0 0 0 0 1 2 0 0 x x 0 1 x 0 2 0 0 0 x x x x x 2 0 0 1 x x x x x 2 . . . . .. . . . .. . . . . 3 f 1 6 f f 1 6 0 f 1 6 t 2 t 3 i r e q 1 . . . . . f f 1 6 0 f 1 6 0 1 0 ( a d d r e s s 2 1 1 6 ) ( a d d r e s s 2 2 1 6 ) ( a d d r e s s 3 c 1 6 ) , b i t 7 ( a d d r e s s 2 8 1 6 ) ( a d d r e s s 2 9 1 6 ) ( a d d r e s s 3 c 1 6 ) ( a d d r e s s 3 e 1 6 ) ( a d d r e s s 2 0 1 6 ) ( a d d r e s s 2 1 1 6 ) ( a d d r e s s 2 2 1 6 ) ( a d d r e s s 2 8 1 6 ) , b i t 0 0 . . . . . n y c l o c k i s s t o p p e d ? i r e q 1 ( a d d r e s s 3 c 1 6 ) , b i t 7 ? 0 i n i t i a l i z a t i o n a l l i n t e r r u p t s d i s a b l e d t i m e r c o u n t s t a r t i n t e r r u p t s e n a b l e d l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . c o n n e c t i o n o f t i m e r s 1 t o 3 s e t t i n g o f i n t e r r u p t r e q u e s t b i t s o f t i m e r s 1 t o 3 t o 0 t i m e r 1 i n t e r r u p t e n a b l e d , t i m e r s 2 a n d 3 i n t e r r u p t s d i s a b l e d s e t t i n g d i v i s i o n r a t i o 1 t o t i m e r s 1 t o 3 i r e q 1 ( a d d r e s s 3 c 1 6 ) , b i t 7 ] c l o c k c o u n t u p s e c o n d t o y e a r m a i n p r o c e s s i n g j u d g m e n t w h e t h e r t i m e i s n o t s e t o r t i m e i s b e i n g s e t c o n f i r m a t i o n t h a t 1 s e c . h a s p a s s e d ( c h e c k o f t i m e r 3 i n t e r r u p t r e q u e s t b i t ) i n t e r r u p t r e q u e s t b i t c l e a r e d ( c l e a r i t b y s o f t w a r e w h e n n o t u s i n g t h e i n t e r r u p t . ) c l o c k c o u n t u p a d j u s t t h e m a i n p r o c e s s i n g s o t h a t a l l p r o c e s s i n g i n t h e l o o p ] w i l l b e p r o c e s s e d w i t h i n 1 s e c o n d p e r i o d . s e t t i m e r s a g a i n w h e n s t a r t i n g c l o c k f r o m 0 s e c o n d a f t e r e n d o f c l o c k s e t t i n g . t h e p r o c e d u r e i s t i m e r 2 s e t t i n g f o l l o w e d b y t i m e r 3 s e t t i n g . d o n o t s e t t i m e r 1 a g a i n b e c a u s e t i m e r 1 i s u s e d t o g e n e r a t e t h e i n t e r r u p t a t 2 4 4 m s i n t e r v a l s . n o t e : p e r f o r m pr o c e d u r e f o r e n d o f c l o c k s e t t i n g o n l y w h e n e n d o f c l o c k s e t t i n g .

( n o t e )
38C3 group users manual application 2-23 2.2 timer (3) timer application example 2: piezoelectric buzzer output outline : the rectangular waveform output function of the timer is applied for a piezoelectric buzzer output. specifications : ?the rectangular waveform, dividing the clock f(x in ) = 4.19 mhz (2 22 hz) into about 2 khz (2048 hz), is output from the p4 2 /t3 out pin. ?the level of the p4 2 /t3 out pin is fixed to h while a piezoelectric buzzer output stops. figure 2.2.19 shows a peripheral circuit example, and figure 2.2.20 shows the timers connection and setting of division ratios. figures 2.2.21 shows the relevant registers setting, and figure 2.2.22 shows the control procedure. fig. 2.2.19 peripheral circuit example fig. 2.2.20 timers connection and setting of division ratios 3 8 c 3 g r o u p t 3 o u t p i p i p i . . . . . 2 4 4 m s t 3 o u t o u t p u t t h e h l e v e l i s o u t p u t w h i l e a p i e z o e l e c t r i c b u z z e r o u t p u t s t o p s . 2 4 4 m s s e t a d i v i s i o n r a t i o s o t h a t t h e u n d e r f l o w o u t p u t p e r i o d o f t h e t i m e r 3 c a n b e 2 4 4 m s . f ( x i n ) 4 . 1 9 m h z 1 / 1 61 / 6 4 1 / 2 t 3 o u t t i m e r 3f i x e d t i m e r 3 c o u n t s o u r c e s e l e c t i o n b i t
2-24 38C3 group users manual application 2.2 timer fig. 2.2.22 control procedure fig. 2.2.21 relevant registers setting t 3 4 m b 0 b 7 100 0 0 t 3 3 f 1 6 b 0 b 7 i c o n 1 b 0 b 7 0 t i m e r 3 4 m o d e r e g i s t e r ( a d d r e s s 2 9 1 6 ) t i m e r 3 c o u n t : i n p r o g r e s s t i m e r 3 c o u n t s o u r c e : f ( x i n ) / 1 6 t i m e r 3 o u t p u t s e l e c t i o n : b u z z e r o u t p u t i n p r o g r e s s = 1 b u z z e r o u t p u t s t o p p e d = 0 s e t d i v i s i o n r a t i o 1 ; 6 3 ( 3 f 1 6 ) . i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 3 e 1 6 ) t i m e r 3 ( a d d r e s s 2 2 1 6 ) t i m e r 3 i n t e r r u p t : d i s a b l e d r e s e t s e i p 4 d p 4 i c o n 1 t 3 4 m t 3 c l i 1 1 . . . . . . . . . . 0 3 f 1 6 ( a d d r e s s 0 9 1 6 ) , b i t 6 ( a d d r e s s 0 8 1 6 ) , b i t 6 ( a d d r e s s 3 e 1 6 ) , b i t 7 ( a d d r e s s 2 9 1 6 ) ( a d d r e s s 2 2 1 6 ) . . . . . t 3 4 m t 3 ( a d d r e s s 2 9 1 6 ) , b i t 6 ( a d d r e s s 2 2 1 6 ) 0 3 f 1 6 t 3 4 m( a d d r e s s 2 9 1 6 ) , b i t 6 1 m a i n p r o c e s s i n g . . . . . i n i t i a l i z a t i o n l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . a l l i n t e r r u p t s d i s a b l e d 0 0 x x 0 0 x 0 2 o u t p u t u n i t bu z z e r r e q u e s t ? y e s s t o p o f p i e z o e l e c t r i c b u z z e r o u t p u t n o s t a r t o f p i e z o e l e c t r i c b u z z e r o u t p u t t i m e r 3 i n t e r r u p t d i s a b l e d t 3 o u t o u t p u t s t o p p e d ; b u z z e r o u t p u t s t o p p e d p o r t s t a t e s e t t i n g a t b u z z e r o u t p u t s t o p p e d ; h l e v e l o u t p u t i n t e r r u p t s e n a b l e d p r o c e s s i n g b u z z e r r e q u e s t , g e n e r a t e d d u r i n g m a i n p r o c e s s i n g , i n o u t p u t u n i t
38C3 group users manual application 2-25 2.2 timer (4) timer application example 3: frequency measurement outline : the following two values are compared to judge whether the frequency is within a valid range. ?a value by counting pulses input to p5 4 /cntr 1 pin with the timer. ?a reference value specifications : ?the pulse is input to the p5 4 /cntr 1 pin and counted by the timer 4. ?a count value of timer 4 is read out at about 2 ms intervals, the timer 1 interrupt interval. when the count value is 28 to 40, it is judged that the input pulse is valid. ?because the timer is a down-counter, the count value is compared with 227 to 215 ( note ). note: 227 to 215 = {255 (initial value of counter) C 28} to {255 C 40}; 28 to 40 means the number of valid count. figure 2.2.23 shows the judgment method of valid/invalid of input pulses; figure 2.2.24 shows the relevant registers setting; figure 2.2.25 shows the control procedure. fig. 2.2.23 judgment method of valid/invalid of input pulses i n p u t p u l s e 2 m s 7 1 . 4 m s = 2 8 c o u n t s @ @ @ @ @ @ @ @ @ @ @ @ 7 1 . 4 m s o r m o r e ( l e s s t h a n 1 4 k h z ) 7 1 . 4 m s ( 1 4 k h z ) 5 0 m s ( 2 0 k h z ) 5 0 m s o r l e s s ( 2 0 k h z o r m o r e ) i n v a l i d v a l i d i n v a l i d 2 m s 5 0 m s = 4 0 c o u n t s
2-26 38C3 group users manual application 2.2 timer fig. 2.2.24 relevant registers setting i c o n 2 0 t 13 f 1 6 t 4 f f 1 6 b 0 b 7 b 0 b 7 b 0 b 7 t 1 2 m b 0 b 7 001 0 t 3 4 m b 0 b 7 00 1 0 0 i c o n 1 1 b 0 b 7 i r e q 2 0 b 0 b 7 t i m e r 1 2 m o d e r e g i s t e r ( a d d r e s s 2 8 1 6 ) t i m e r 1 c o u n t s t o p ; c l e a r t o 0 w h e n s t a r t i n g c o u n t . t i m e r 1 c o u n t s o u r c e : f ( x i n ) / 1 6 t i m e r 1 o u t p u t s e l e c t i o n : i / o p o r t t i m e r 4 c o u n t : i n p r o g r e s s t i m e r 4 c o u n t s o u r c e : e x t e r n a l c o u n t i n p u t c n t r 1 t i m e r 3 4 m o d e r e g i s t e r ( a d d r e s s 2 9 1 6 ) s e t d i v i s i o n r a t i o 1 ; 6 3 ( 3 f 1 6 ) . i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 3 e 1 6 ) t i m e r 1 ( a d d r e s s 2 0 1 6 ) t i m e r 1 i n t e r r u p t : e n a b l e d t i m e r 4 ( a d d r e s s 2 3 1 6 ) s e t 2 5 5 ( f f 1 6 ) j u s t b e f o r e c o u n t i n g p u l s e s . ( a f t e r a c e r t a i n t i m e h a s p a s s e d , t h e n u m b e r o f i n p u t p u l s e s i s d e c r e a s e d f r o m t h i s v a l u e . ) i n t e r r u p t c o n t r o l r e g i s t e r 2 ( a d d r e s s 3 f 1 6 ) t i m e r 4 i n t e r r u p t : d i s a b l e d i n t e r r u p t r e q u e s t r e g i s t e r 2 ( a d d r e s s 3 d 1 6 ) t i m e r 4 i n t e r r u p t r e q u e s t ( 1 o f t h i s b i t w h e n r e a d i n g t h e c o u n t v a l u e i n d i c a t e s t h e 2 5 6 o r m o r e p u l s e s i n p u t i n t h e c o n d i t i o n o f t i m e r 4 = 2 5 5 )
38C3 group users manual application 2-27 2.2 timer fig. 2.2.25 control procedure s e i t 1 2 m t 1 t 3 4 m t 4 i c o n 1 i c o n 2 t 1 2 m c l i 0 0 x x 0 0 x 1 2 3 f 1 6 0 x 1 0 x x 0 x 2 f f 1 6 1 0 . . . . .. . . . . 0 i r e q 2 ( a d d r e s s 3 d 1 6 ) , b i t 0 ? 1 r t i . . . . . t 4 ( a d d r e s s 2 3 1 6 ) ( a ) 2 1 4 < ( a ) < 2 2 8 0 f p u l s e 1 f p u l s e ( a d d r e s s 2 8 1 6 ) ( a d d r e s s 2 0 1 6 ) ( a d d r e s s 2 9 1 6 ) ( a d d r e s s 2 3 1 6 ) ( a d d r e s s 3 e 1 6 ) , b i t 5 ( a d d r e s s 3 f 1 6 ) , b i t 0 ( a d d r e s s 2 8 1 6 ) , b i t 0 t 4 i r e q 2 f f 1 6 0 ( a d d r e s s 2 3 1 6 ) ( a d d r e s s 3 d 1 6 ) , b i t 0 1 / 8 r e s e t l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r y . a l l i n t e r r u p t s d i s a b l e d i n i t i a l i z a t i o n t i m e r 1 i n t e r r u p t p r o c e s s r o u t i n e c l t ( n o t e 1 ) c l d ( n o t e 2 ) p u s h r e g i s t e r s t o s t a c k o u t o f r a n g e p r o c e s s j u d g m e n t r e s u l t p o p r e g i s t e r s s e t d i v i s i o n r a t i o s o t h a t t i m e r 1 i n t e r r u p t w i l l o c c u r a t 2 4 4 m s i n t e r v a l s . e x t e r n a l p u l s e s i n p u t f r o m c n t r 1 p i n s e l e c t e d a s t i m e r 4 s c o u n t s o u r c e s e t t i n g t i m e r 4 c o u n t v a l u e t i m e r 1 i n t e r r u p t e n a b l e d t i m e r 4 i n t e r r u p t d i s a b l e d t i m e r 1 c o u n t s t a r t i n t e r r u p ts e n a b l e d s e t s o t h a t p u l s e j u d g m e n t p r o c e s s w i l l b e p e r f o r m e d o n c e e a c h t i m e t i m e r 1 i n t e r r u p t o c c u r s 8 t i m e s , a t 2 m s i n t e r v a l s . n o t e s 1 : w h e n u s i n g i n d e x x m o d e f l a g ( t ) 2 : w h e n u s i n g d e c i m a l m o d e f l a g ( d ) p u s h i n g r e g i s t e r s u s e d i n i n t e r r u p t p r o c e s s r o u t i n e p o p p i n g r e g i s t e r s p u s h e d t o s t a c k i n i t i a l i z a t i o n o f c o u n t e r v a l u e t i m e r 4 i n t e r r u p t r e q u e s t b i t c l e a r e d p r o c e s s i n g a s o u t o f r a n g e w h e n t h e c o u n t v a l u e i s 2 5 6 o r m o r e c o u n t v a l u e r e a d s t o r i n g c o u n t v a l u e i n t o a c c u m u l a t o r ( a ) c o m p a r e t h e r e a d v a l u e w i t h r e f e r e n c e v a l u e . s t o r e t h e c o m p a r i s o n r e s u l t t o f l a g f p u l s e . i n r a n g e
2-28 38C3 group users manual application 2.2 timer (5) timer application example 4: output of igbt control signal outline : synchronized variable pwm signal is output in h term. when a signal is input to int 0 pin before timer underflow during l output, timer restarts. specifications : ?the signal, of which h level width is 5 m s and cycle is 20 m s, is output from the p5 0 /ta out pin. however, if h is input to int 0 pin during l output, timer restarts from h output. when f(x in ) = 8 mhz, the count source is 125 ns. figure 2.2.26 shows the timers connection and setting of division ratio; figure 2.2.27 shows the relevant registers setting; figure 2.2.28 shows the control procedure. fig. 2.2.26 timers connection and setting of division ratios f ( x i n ) = 8 m h z 2 0 m s 1 / 11 / 1 6 0 t i m e r a r e s t a r t t i m e r a c o u n t s o u r c e s e l e c t i o n b i t t i m e r a t i m e r a i n t e r r u p t r e q u e s t b i t 1 2 5 n s
38C3 group users manual application 2-29 2.2 timer fig. 2.2.27 relevant registers setting t a c o n b 0 b 7 0 0 t a l9 f 1 6 b 0 b 7 t a m b 0 b 7 110 11 0 0 i c o n 1 b 0 b 7 0 0 i r e q 1 b 0 b 7 c o n al 7 7 1 6 c o n a h 0 0 1 6 b 0 b 7 b 0 b 7 n o i s e f i l t e r : f ( x i n ) / 2 e x t e r n a l t r i g g e r d e l a y e d : n o d e l a y t i m e r a c o n t r o l r e g i s t e r ( a d d re s s 3 1 1 6 ) t i m e r a m o d e r e g i s t e r ( a d d re s s 3 0 1 6 ) i g b t o u t p u t m o d e w r i t i n g o f l a t c h o n l y t i m e r a c o u n t s o u r c e : f ( x i n ) t i m e r a o u t p u t a c t i v e e d g e : s t a r t i n g f r o m l o u t p u t ] 1 t i m e r a c o u n t s t o p ; c l e a r t o 0 w h e n c o u n t s t a r t s t i m e r a o u t p u t s e l e c t i o n : t i m e r a o u t p u t s e t 1 1 9 ( 0 0 7 7 1 6 ) b e f o r e s t a r t o f t i m e r a . c o m p a r e r e g i s t e r ( l o w - o r d e r ) ( a d d r e s s 2 e 1 6 ) c o m p a r e r e g i s t e r ( h i g h - o r d e r ) ( a d d r e s s 2 f 1 6 ) t i m e r a r e g i s t e r ( l o w - o r d e r ) ( a d d re s s 2 c 1 6 ) i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 3 e 1 6 ) i n t 0 i n t e r r u p t : d i s a b l e d t i m e r a i n t e r r u p t : d i s a b l e d i n t e r r u p t r e q u e s t r e g i s t e r 1 ( a d d r e s s 3 c 1 6 ) t i m e r a i n t e r r u p t r e q u e s t ( b e c o m e s 1 w h e n t i m e r a u n d e r f l o w s ) ] 2 0 0 t a h0 0 1 6 b 0 b 7 t i m e r a r e g i s t e r ( h i g h - o r d e r ) ( a d d re s s 2 d 1 6 ) s e t 1 5 9 ( 0 0 9 f 1 6 ) b e f o r e s t a r t o f t i m e r a . ] 1 u s e t h i s b i t w i t h 0 ( s t a r t f r o m l o u t p u t ) i n t h e i g b t o u t p u t m o d e . ] 2 t h i s b i t b e c o m e s 1 e v e n w h e n a s i g n a l i s i n p u t f r o m t h e i n t 0 p i n i n t h e i g b t o u t p u t m o d e .
2-30 38C3 group users manual application 2.2 timer fig. 2.2.28 control procedure ? i m e r a : i g b t o u t p u t m o d e n o i s e f i l t e r : f ( x i n ) ; e x t e r n a l t r i g g e r d e l a y e d : n o d e l a y s e t t i n g c o m p a r e r e g i s t e r v a l u e s e t t i n g t i m e r a c o u n t v a l u e t i m e r a , i n t 0 i n t e r r u p t : d i s a b l e d h w i d t h 5 m s c y c l e 2 0 m s s e t t i n g ( a d d r e s s 3 0 1 6 ) ( a d d r e s s 3 1 1 6 ) ( a d d r e s s 2 e 1 6 ) ( a d d r e s s 2 f 1 6 ) ( a d d r e s s 2 c 1 6 ) ( a d d r e s s 2 d 1 6 ) ( a d d r e s s 3 e 1 6 ) r e s e t s e i t a m t a c o n c o n a l c o n a h t a l t a h i c o n 1 c l i 1 1 0 0 0 1 1 0 2 x x x x x 0 0 0 2 7 7 1 6 0 0 1 6 9 f 1 6 0 0 1 6 x x x 0 x x x 0 2 . . . . .. . . . . . . . . . t a m ( a d d r e s s 3 0 1 6 ) , b i t 6 0 l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r y . a l l i n t e r r u p t s d i s a b l e d i n i t i a l i z a t i o n i n t e r r u p ts e n a b l e d t i m e r a c o u n t s t a r t t i m e r a s t a r t m a t c h w i t h c o m p a r e r e g i s t e r t i m e r a u n d e r f l o w i n p u t f r o m i n t 0 p i n [ ] 0 0 9 f 1 6 0 0 0 0 1 6 p 5 0 / t a o u t 0 0 7 7 1 6
38C3 group users manual application 2-31 2.2 timer 2.2.4 notes on timer a (pwm mode and igbt output mode) (1) when timer starts first or last value of compare register is 0000 16 after l level (timer a output active edge switch bit is 0; when starting from l output) is output during 2 cycles (until timer underflows two times), pwm output or igbt output starts. reason: when data is written to timer a and compare register, value of timer a and value of compare register are renewed at timer underflow. in case of this, compare register value and timer value are compared before renewal, so that they are judged to be equal, and ta out output becomes l. (timer a output active edge switch bit = 0: when starting from l output) timer a underflow should cause h output, but the match have the priority. (see figure 2.2.29 ) fig. 2.2.29 pwm output and igbt output (1) (2) when compare register is set to 0000 16 (last value is except 0000 16 ) next 1 cycle of the cycle in which data is written to timer a and compare register is output h, and l is output from the next cycle. (timer a output active edge switch bit = 0: when starting from l output) (see figure 2.2.30 ) fig. 2.2.30 pwm output and igbt output (2) t i m e r a s t a r tt i m e r a u n d e r f l o w c o m p a r e r e g i s t e r v a l u e i s 0 0 0 0 1 6 ( l a s t v a l u e o r i n i t i a l v a l u e ) c o m p a r e r e g i s t e r v a l u e i s v a l u e w h i c h i s w r i t t e n a t t i m e r a u n d e r f l o wt i m e r a u n d e r f l o w t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g t i m e r a u n d e r f l o w c o m p a r e r e g i s t e r v a l u e i s 0 0 0 0 1 6 t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g c o m p a r e r e g i s t e r v a l u e i s l a s t v a l u e t i m e r a u n d e r f l o wt i m e r a u n d e r f l o wt i m e r a u n d e r f l o w
2-32 38C3 group users manual application 2.2 timer (3) when timer a and compare register have same value ta out output becomes h with underflow immediately after data is written to timer a and compare register. ta out output becomes l when timer a is reloaded and the value matches with compare register. this h output width becomes 1 count of timer a count source. (timer a output active edge switch bit =0: when starting from l output) (see figure 2.2.31 ) fig. 2.2.31 pwm output and igbt output (3) t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e t i m e r a c o u n t s o u r c e 1 c o u n t w i d t h t i m e r a u n d e r f l o wt i m e r a u n d e r f l o w t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g
38C3 group users manual application 2-33 2.3 serial i/o 2.3 serial i/o this paragraph explains the registers setting method and the notes relevant to the serial i/o. 2.3.1 memory map fig. 2.3.1 memory map of registers relevant to serial i/o fig. 2.3.2 structure of serial i/o control register 1 2.3.2 relevant registers 0 0 1 b 1 6 0 0 3 c 1 6 0 0 3 d 1 6 0 0 3 e 1 6 s e r i a l i / o r e g i s t e r ( s i o ) i n t e r r u p t r e q u e s t r e g i s t e r 1 ( i r e q 1 ) i n t e r r u p t c o n t r o l r e g i s t e r 1 ( i c o n 1 ) 0 0 1 a 1 6 0 0 1 9 1 6 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( s i o c o n 1 ) s e r i a l i / o c o n t r o l r e g i s t e r 2 ( s i o c o n 2 ) serial i/o control register 1 b7 b6 b5 b4 b3 b2 b1 b0 serial i/o control register 1 (siocon1: address 19 16 ) b 0 name 0 functions at reset r w 0 0 1 2 0 3 serial i/o port selection bit (p4 0 , p4 5 , p4 6 ) 4 0 s rdy output selection bit (p4 7 ) 0: i/o port 1: s rdy signal pin 0: lsb first 1: msb first 0: external clock 1: internal clock 5 0 transfer direction selection bit 7 6 0 synchronous clock selection bit p-channel output disable bit (p4 0 , p4 5 , p4 6 ) 0: i/o port 1: s out , s clk1 , s clk2 signal pin 0 0 0: f(x in )/8 or f(x cin )/8 0 0 1: f(x in )/16 or f(x cin )/16 0 1 0: f(x in )/32 or f(x cin )/32 0 1 1: f(x in )/64 or f(x cin )/64 1 1 0: f(x in )/128 or f(x cin )/128 1 1 1: f(x in )/256 or f(x cin )/256 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) b2b1b0 internal synchronous clock selection bits 0
2-34 38C3 group users manual application 2.3 serial i/o fig. 2.3.3 structure of serial i/o control register 2 fig. 2.3.4 structure of interrupt request register 1 serial i/o control register 2 b7 b6 b5 b4 b3 b2 b1 b0 serial i/o control register 2 (siocon2: address 1a 16 ) b 0 0 synchronous clock output pin selection bit 0: s clk1 1: s clk2 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 5 5 5 5 5 5 5 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? interrupt request register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 1 (ireq1 : address 3c 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 int 0 interrupt request bit int 1 interrupt request bit serial i/o interrupt request bit timer a interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit int 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued timer 3 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 ] ] ] ] ] ] ] ] ] : ??can be set by software, but ??cannot be set.
38C3 group users manual application 2-35 2.3 serial i/o fig. 2.3.5 structure of interrupt control register 1 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 1 (icon1 : address 3e 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 int 0 interrupt enable bit int 1 interrupt enable bit serial i/o interrupt enable bit timer a interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit int 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled timer 3 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 0 0
2-36 38C3 group users manual application 2.3 serial i/o 2.3.3 serial i/o connection examples (1) control of peripheral ic equipped with cs pin figure 2.3.6 shows connection examples with peripheral ics equipped with the cs pin. fig. 2.3.6 serial i/o connection examples (1) p o r t s c l k 1 s o u t s i n c s c l k i n o u t p o r t s c l k 1 s o u t c s c l k d a t a ( 1 ) o n l y t r a n s m i s s i o n ( u s i n g s i n p i n a s i / o p o r t ) p o r t s c l k 1 s o u t s i n c s c l k i n o u t p o r t s c l k 1 s o u t s i n p o r t c s c l k i n o u t c s c l k i n o u t 3 8 c 3 g r o u p p e r i p h e r a l i c ( 2 ) t r a n s m i s s i o n a n d r e c e p t i o n 3 8 c 3 g r o u p p e r i p h e r a l i c ( e e p r o m e t c . ) ( 3 ) t r a n s m i s s i o n a n d r e c e p t i o n ( w h e n c o n n e c t i n g s i n 1 w i t h s o u t 1 ) ( w h e n c o n n e c t i n g i n w i t h o u t i n p e r i p h e r a l i c ) 3 8 c 3 g r o u p ] 1 p e r i p h e r a l i c ] 2 ( e e p r o m e t c . ) ( 4 ) c o n n e c t i o n o f p l u r a l i c 3 8 c 3 g r o u p p e r i p h e r a l i c 1 p e r i p h e r a l i c 2 ] 1 : s e l e c t a n n - c h a n n e l o p e n - d r a i n o u t p u t f o r s o u t p i n o u t p u t c o n t r o l . ] 2 : u s e t h e o u t p i n o f p e r i p h e r a l i c w h i c h i s a n n - c h a n n e l o p e n - d r a i n o u t p u t a n d b e c o m e s h i g h i m p e - d a n c e d u r i n g r e c e i v i n g d a t a . n o t e : p o r t m e a n s a n o u t p u t p o r t c o n t r o l l e d b y s o f t w a r e .
38C3 group users manual application 2-37 2.3 serial i/o (2) connection with microcomputer figure 2.3.7 shows connection examples with another microcomputer. fig. 2.3.7 serial i/o connection examples (2) s c l k 1 s o u t s i n s c l k 2 c l k i n o u t ( 4 ) u s i n g s w i t c h f u n c t i o n o f c l k s i g n a l o u t p u t p i n s , s c l k 2 ( s e l e c t i n g i n t e r n a l c l o c k ) c l k i n o u t s c l k 1 s o u t s i n c l k i n o u t s c l k 1 s o u t s i n c l k i n o u t s r d y s c l k 1 s o u t s i n r d y c l k i n o u t ( 1 ) s e l e c t i n g i n t e r n a l c l o c k 3 8 c 3 g r o u pm i c r o c o m p u t e r ( 2 ) s e l e c t i n g e x t e r n a l c l o c k ( 3 ) u s i n g s r d y s i g n a l o u t p u t f u n c t i o n ( s e l e c t i n g e x t e r n a l c l o c k ) p e r i p h e r a l i c 3 8 c 3 g r o u pm i c r o c o m p u t e r 3 8 c 3 g r o u pm i c r o c o m p u t e r m i c r o c o m p u t e r 3 8 c 3 g r o u p
2-38 38C3 group users manual application 2.3 serial i/o 2.3.4 serial i/os modes 38C3 group can use clock synchronous serial i/o. figure 2.3.8 shows the serial i/os modes. fig. 2.3.8 serial i/os modes 2.3.5 serial i/o application examples (1) communication (transmission/reception) using clock synchronous serial i/o outline : 2-byte data is transmitted and received, using the clock synchronous serial i/o. the s rdy signal is used for communication control. figure 2.3.9 shows a connection diagram, and figure 2.3.10 shows a timing chart. fig. 2.3.9 connection diagram specifications : ? use of serial i/o in clock synchronous serial i/o ? synchronous clock frequency : 125 khz (f(x in ) = 4 mhz is divided by 32) ? use of s rdy (receivable signal) ? the reception side outputs the s rdy signal at intervals of 2 ms (generated by the timer), and 2-byte data is transferred from the transmission side to the reception side. s e r i a l i / o c l o c k s y n c h r o n o u s s e r i a l i / o i n t e r n a l c l o c k e x t e r n a l c l o c k o u t p u t s r d y s i g n a l n o t o u t p u t s r d y s i g n a l s e l e c t s c l k 1 a s s y n c h r o n o u s c l o c k o u t p u t p i n s e l e c t s c l k 2 a s s y n c h r o n o u s c l o c k o u t p u t p i n p 5 5 / i n t 0 s c l k 1 s o u t 3 8 c 3 g r o u p s r d y s c l k 1 s i n 3 8 c 3 g r o u p
38C3 group users manual application 2-39 2.3 serial i/o fig. 2.3.10 timing chart s r d y s o u t d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 1 2 m s s c l k 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0
2-40 38C3 group users manual application 2.3 serial i/o fig. 2.3.11 registers setting relevant to transmission side figure 2.3.11 shows the registers setting relevant to the transmission side, and figure 2.3.12 shows the registers setting relevant to the reception side. s i o c o n 1 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) 0 1 0 0 1 0 1 0 s r d y o u t p u t n o t u s e d l s b f i r s t c m o s o u t p u t i n t e r n a l c l o c k i n t e r n a l s y n c h r o n o u s c l o c k : f ( x i n ) / 3 2 s i o c o n 2 0 n o t u s e d ( 0 a t r e a d i n g ) s y n c h r o n o u s c l o c k o u t p u t p i n s e l e c t i o n b i t : s c l k 1 s e l e c t e d i n t e d g e i n t 0 f a l l i n g e d g e a c t i v e s o u t , s c l k 1 , s c l k 2 s e l e c t e d s e r i a l i / o c o n t r o l r e g i s t e r 2 ( a d d r e s s 0 0 1 a 1 6 ) i n t e r r u p t e d g e s e l e c t i o n r e g i s t e r ( a d d r e s s 0 0 3 a 1 6 ) 0 t r a n s m i s s i o n s i d e
38C3 group users manual application 2-41 2.3 serial i/o fig. 2.3.12 registers setting relevant to reception side figure 2.3.13 shows a control procedure of the transmission side, and figure 2.3.14 shows a control procedure of the reception side. fig. 2.3.13 control procedure of transmission side s i o c o n 1 0 l s b f i r s t s r d y o u t p u t u s e d s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) 01 e x t e r n a l c l o c k r e c e p t i o n s i d e i n i t i a l i z a t i o n s i o c o n 1 ( a d d r e s s 0 0 1 9 1 6 ) s i o c o n 2 ( a d d r e s s 0 0 1 a 1 6 ) i n t e d g e ( a d d r e s s 0 0 3 a 1 6 ) , b i t 0 . . . . .. . . . . 0 1 0 0 1 0 1 0 2 x x x x x x x 0 2 0 i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 0 , b i t 3 0 i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 ? 0 1 r e s e t s i o ( a d d r e s s 0 0 1 b 1 6 ) i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 0 l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . c o n n e c t i o n o f c o m p l e t i o n o f t r a n s m i t t i n g ( s e r i a l i / o i n t e r r u p t r e q u e s t f l a g ) s e r i a l i / o s e t t i n g t r a n s m i s s i o n d a t a w r i t e t r a n s m i s s i o n o f t h e f i r s t b y t e d a t a i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 0 ? 0 1 s i o ( a d d r e s s 0 0 1 b 1 6 ) t r a n s m i s s i o n o f t h e s e c o n d b y t e d a t a i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 ? 0 1 t r a n s m i s s i o n d a t a w r i t e j u d g m e n t o f c o m p l e t i o n o f t r a n s m i t t i n g ( s e r i a l i / o i n t e r r u p t r e q u e s t f l a g ) i n t 0 f a l l i n g e d g e d e t e c t i o n
2-42 38C3 group users manual application 2.3 serial i/o fig. 2.3.14 control procedure of reception side s i o c o n 1 ( a d d r e s s 0 0 1 9 1 6 ) . . . . .. . . . . x 0 0 1 1 x x x 2 r e s e t 2 m s h a s p a s s e d ? 1 0 s i o ( a d d r e s s 0 0 1 b 1 6 ) i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 ? 1 0 d u m m y d a t a i n i t i a l i z a t i o n l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . s e r i a l i / o s e t t i n g r e a d o u t r e c e p t i o n d a t a f r o m s i o ( a d d r e s s 0 0 1 b 1 6 ) s r d y o u t p u t s r d y s i g n a l i s o u t p u t b y w r i t i n g d a t a t o s i o . w h e n u s i n g s r d y , s e t s r d y o u t p u t s e l e c t i o n b i t ( b i t 4 ) o f s i o c o n 1 t o 1 . a n i n t e r v a l o f 2 m s g e n e r a t e d b y t i m e r . j u d g m e n t o f c o m p l e t i o n o f r e c e i v i n g ( s e r i a l i / o i n t e r r u p t r e q u e s t ) r e c e p t i o n o f d a t a j u d g m e n t o f c o m p l e t i o n o f r e c e i v i n g ( s e r i a l i / o i n t e r r u p t r e q u e s t ) i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 ? 1 0 r e a d o u t r e c e p t i o n d a t a f r o m s i o ( a d d r e s s 0 0 1 b 1 6 ) r e c e p t i o n o f d a t a
38C3 group users manual application 2-43 2.3 serial i/o (2) output of serial data (control of peripheral ic) outline : serial communication is performed, connecting port p5 7 with the cs pin of a peripheral ic. figure 2.3.15 shows a connection diagram, and figure 2.3.16 shows a timing chart. fig. 2.3.15 connection diagram specifications : ? use of serial i/o in clock synchronous serial i/o ? synchronous clock frequency : 125 khz (f(x in ) = 4 mhz is divided by 32) ? transfer direction : lsb first ? not use of serial i/o interrupt ? port p5 7 is connected with the cs pin (l active) of the peripheral ic for transmission control; the output level of port p5 7 is controlled by software. fig. 2.3.16 timing chart p 5 7 s c l k 1 s o u t 3 8 c 3 g r o u pp e r i p h e r a l i c c s c l k d a t a c s c l k d a t a c s c l k d a t a d o 0 d o 1 d o 2 d o 3
2-44 38C3 group users manual application 2.3 serial i/o figure 2.3.17 shows the relevant registers setting and figure 2.3.18 shows the setting of transmission data. fig. 2.3.17 relevant registers setting fig. 2.3.18 setting of transmission data s y n c h r o n o u s c l o c k : f ( x i n ) / 3 2 s o u t , s c l k 1 , s c l k 2 s i g n a l p i n s r d y o u t p u t n o t u s e d l s b f i r s t i n t e r n a l c l o c k c m o s o u t p u t i c o n 1 i r e q i n t e r r u p t r e q u e s t r e g i s t e r 1 ( a d d r e s s 0 0 3 c 1 6 ) s i o c o n 1 0 1 0 0 1 0 1 0 s i o c o n 2 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) s e r i a l i / o c o n t r o l r e g i s t e r 2 ( a d d r e s s 0 0 1 a 1 6 ) s y n c h r o n o u s c l o c k o u t p u t p i n : s c l k 1 i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 3 e 1 6 ) s e r i a l i / o i n t e r r u p t : d i s a b l e d se r i a l i / o i n t e r r u p t r e q u e s t c l e a r e d c o n f i r m t r a n s m i s s i o n c o m p l e t i o n o f 1 - b y t e u n i t . 0 0 0 s i o s e r i a l i / o r e g i s t e r ( 0 0 1 b 1 6 ) s e t a t r a n s m i s s i o n d a t a . c o n f i r m t h a t t r a n s m i s s i o n o f t h e p r e v i o u s d a t a i s c o m p l e t e d , w h e r e b i t 3 , t h e s e r i a l i / o i n t e r r u p t r e q u e s t b i t o f t h e i n t e r r u p t r e q u e s t r e g i s t e r , i s 1 ; b e f o r e w r i t i n g d a t a .
38C3 group users manual application 2-45 2.3 serial i/o figure 2.3.19 shows a control procedure. fig. 2.3.19 control procedure s i o c o n 1 ( a d d r e s s 0 0 1 9 1 6 ) s i o c o n 2 ( a d d r e s s 0 0 1 a 1 6 ) i c o n 1 ( a d d r e s s 0 0 3 e 1 6 ) , b i t 3 p 5 ( a d d r e s s 0 0 0 a 1 6 ) , b i t 7 p 5 d ( a d d r e s s 0 0 0 b 1 6 ) , b i t 7 . . . . .. . . . . 0 10 0 1 0 1 0 2 x x x x x x x0 2 0 1 1 p 5 ( a d d r e s s 0 0 0 a 1 6 ) , b i t 7 0 i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 ? 1 0 r e s e t s i o ( a d d r e s s 0 0 1 b 1 6 ) i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 3 0 y p 5 ( a d d r e s s 0 0 0 a 1 6 ) , b i t 7 1 n i n i t i a l i z a t i o n t r a n s m i s s i o n d a t a a l l d a t a h a s b e e n t r a n s m i t t e d ? l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . j u d g m e n t o f c o m p l e t i o n o f t r a n s m i t t i n g 1 - b y t e d a t a u s e a n y o f r a m a r e a a s a c o u n t e r f o r c o u n t i n g t h e n u m b e r o f t r a n s m i t t e d b y t e s . j u d g m e n t o f c o m p l e t i o n o f t r a n s m i t t i n g t h e t a r g e t n u m b e r o f b y t e s r e t u r ni n g c s s i g n a l o u t p u t l e v e l t o h w h e n t r a n s m i s s i o n o f t h e t a r g e t n u m b e r o f b y t e s i s c o m p l e t e d s e r i a l i / o s e t t i n g s e r i a l i / o i n t e r r u p t : d i s a b l e d c s s i g n a l o u t p u t l e v e l t o h s e t t i n g c s s i g n a l o u t p u t p o r t s e t t i n g c s s i g n a l o u t p u t l e v e l t o l s e t t i n g t r a n s m i s s i o n d a t a w r i t e ( s t a r t o f 1 - b y t e d a t a t r a n s m i s s i o n ) s e r i a l i / o i n t e r r u p t r e q u e s t b i t t o 0 s e t t i n g
2-46 38C3 group users manual application 2.3 serial i/o (3) cyclic transmission or reception of block data (data of specified number of bytes) between two microcomputers outline : when the clock synchronous serial i/o is used for communication, synchronization of the clock and the data between the transmitting and receiving sides may be lost because of noise included in the synchronous clock. it is necessary to correct that constantly, using heading adjustment. this heading adjustment is carried out by using the interval between blocks in this example. figure 2.3.20 shows a connection diagram. fig. 2.3.20 connection diagram specifications: ? synchronous clock frequency : 131 khz (f(x in ) = 4.19 mhz is divided by 32.) ? byte cycle: 488 m s ? number of bytes for transmission or reception : 8 bytes/block each ? block transfer cycle : 16 ms ? block transfer term : 3.5 ms ? interval between blocks : 12.5 ms ? heading adjustment time : 8 ms ? transfer direction : lsb first limitations of the specifications: ? reading of the reception data and setting of the next transmission data must be completed within the time obtained from byte cycle C time for transferring 1-byte data (in this example, the time taken from generating of the serial i/o interrupt request to input of the next synchronous clock is 431 m s). ? heading adjustment time < interval between blocks must be satisfied. s c l k 1 s i n s o u t 3 8 c 3 g r o u p ( m a s t e r s i d e ) 3 8 c 3 g r o u p ( s l a v e s i d e ) s c l k 1 s o u t s i n
38C3 group users manual application 2-47 2.3 serial i/o the communication is performed according to the timing shown in figure 2.3.21. in the slave unit, when a synchronous clock is not input within a certain time (heading adjusment time), the next clock input is processed as the beginning (heading) of a block. when a clock is input again after one block (8 bytes) is received, the clock is ignored. figure 2.3.22 shows the relevant registers setting in the master unit and figure 2.3.23 shows the relevant registers setting in the slave unit. fig. 2.3.21 timing chart d 0 b y t e c y c l e b l o c k t r a n s f e r t e r m b l o c k t r a n s f e r c y c l e d 1 d 2 d 7 d 0 i n t e r v a l b e t w e e n b l o c k s p r o c e s s i n g f o r h e a d i n g a d j u s t m e n t h e a d i n g a d j u s t m e n t t i m e
2-48 38C3 group users manual application 2.3 serial i/o fig. 2.3.22 relevant registers setting in master unit fig. 2.3.23 relevant registers setting in slave unit 0 s y n c h r o n o u s c l o c k o u t p u t p i n: s c l k 1 s i o c o n 2 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) 0 1 0 0 1 0 1 0 s i o c o n 1 m a s t e r u n i t s y n c h r o n o u s c l o c k : f ( x i n ) / 3 2 s o u t , s c l k 1 , s c l k 2 s i g n a l p i n s r d y o u t p u t n o t u s e d l s b f i r s t i n t e r n a l c l o c k c m o s o u t p u t s e r i a l i / o c o n t r o l r e g i s t e r 2 ( a d d r e s s 0 0 1 a 1 6 ) 0 s i o c o n 2 0 0 0 0 1 s i o c o n 1 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) s l a v e u n i t s o u t , s c l k 1 , s c l k 2 s i g n a l p i n s r d y o u t p u t n o t u s e d l s b f i r s t s y n c h r o n o u s c l o c k : e x t e r n a l c l o c k c m o s o u t p u t s y n c h r o n o u s c l o c k i n p u t p i n : s c l k 1 s e r i a l i / o c o n t r o l r e g i s t e r 2 ( a d d r e s s 0 0 1 a 1 6 )
38C3 group users manual application 2-49 2.3 serial i/o control procedure by software: l control in the master unit after setting the relevant registers shown in figure 2.3.22, the master unit starts transmission or reception of 1-byte data by writing transmission data to the serial i/o register. to perform the communication in the timing shown in figure 2.3.21, take the timing into account and write transmission data. additionally, read out the reception data when the serial i/o interrupt request bit is set to 1, or before the next transmission data is written to the serial i/o register. figure 2.3.24 shows a control procedure of the master unit using timer interrupts. fig. 2.3.24 control procedure of master unit i n t e r r u p t p r o c e s s i n g r o u t i n e e x e c u t e d e v e r y 4 8 8 m s w r i t e a t r a n s m i s s i o n d a t a r e a d a r e c e p t i o n d a t a n w i t h i n a b l o c k t r a n s f e r p e r i o d ? y y c o m p l e t e t o t r a n s f e r a b l o c k ? n r t i w r i t e t h e f i r s t t r a n s m i s s i o n d a t a ( f i r s t b y t e ) i n a b l o c k c o u n t a b l o c k i n t e r v a l c o u n t e r n s t a r t a b l o c k t r a n s f e r ? y g e n e r a t i n g a c e r t a i n b l o c k i n t e r v a l b y u s i n g a t i m e r o r o t h e r f u n c t i o n s c h e c k o f t h e b l o c k i n t e r v a l c o u n t e r a n d d e t e r m i n a t i o n t o s t a r t a b l o c k t r a n s f e r l l c l t ( n o t e 1 ) c l d ( n o t e 2 ) p u s h r e g i s t e r t o s t a c k n o t e 1 : w h e n u s i n g t h e i n d e x x m o d e f l a g ( t ) . n o t e 2 : w h e n u s i n g t h e d e c i m a l m o d e f l a g ( d ) . p u s h i n g t h e r e g i s t e r u s e d i n t h e i n t e r r u p t p r o c e s s i n g r o u t i n e i n t o t h e s t a c k l p o p r e g i s t e r sp o p p i n g r e g i s t e r s w h i c h i s p u s h e d t o s t a c k l
2-50 38C3 group users manual application 2.3 serial i/o l control in the slave unit after setting the relevant registers as shown in figure 2.3.23, the slave unit becomes the state where a synchronous clock can be received at any time, and the serial i/o interrupt occurs each time an 8-bit synchronous clock is received. in the serial i/o interrupt processing routine, the data to be transmitted next is written to the serial i/o register after the received data is read out. however, if no serial i/o interrupt occurs for a certain time (heading adjustment time or more), the following processing will be performed. 1. the first 1-byte data of the transmission data in the block is written into the serial i/o register. 2. the data to be received next is processed as the first 1 byte of the received data in the block. figure 2.3.25 shows a control procedure of the slave unit using the serial i/o interrupt and any timer interrupt (for heading adjustment). fig. 2.3.25 control procedure of slave unit w r i t e a t r a n s m i s s i o n d a t a r e a d a r e c e p t i o n d a t a n w i t h i n a b l o c k t r a n s f e r t e r m ? y y a r e c e i v e d b y t e c o u n t e r 3 8 ? n r t i w r i t e d u m m y d a t a ( f f 1 6 ) a r e c e i v e d b y t e c o u n t e r + 1 h e a d i n g a d j u s t m e n t c o u n t e r i n i t i a l v a l u e ( n o t e 3 ) s e r i a l i / o r e c e p t i o n i n t e r r u p t p r o c e s s i n g r o u t i n e t i m e r i n t e r r u p t p r o c e s s i n g r o u t i n e h e a d i n g a d j u s t m e n t c o u n t e r 1 n h e a d i n g a d j u s t m e n t c o u n t e r = 0 ? y r t i w r i t e t h e f i r s t t r a n s m i s s i o n d a t a ( f i r s t b y t e ) i n a b l o c k a r e c e i v e d b y t e c o u n t e r 0 c o n f i r m a t i o n o f t h e r e c e i v e d b y t e c o u n t e r t o j u d g e t h e b l o c k t r a n s f e r t e r m i n t h i s e x a m p l e , s e t t h e v a l u e w h i c h i s e q u a l t o t h e h e a d i n g a d j u s t m e n t t i m e d i v i d e d b y t h e t i m e r i n t e r r u p t c y c l e a s t h e i n i t i a l v a l u e o f t h e h e a d i n g a d j u s t m e n t c o u n t e r . f o r e x a m p l e : w h e n t h e h e a d i n g a d j u s t m e n t t i m e i s 8 m s a n d t h e t i m e r i n t e r r u p t c y c l e i s 1 m s , s e t 8 a s t h e i n i t i a l v a l u e . 3 : l c l t ( n o t e 1 ) c l d ( n o t e 2 ) p u s h r e g i s t e r t o s t a c k p u s h i n g t h e r e g i s t e r u s e d i n t h e i n t e r r u p t p r o c e s s i n g r o u t i n e i n t o t h e s t a c k l c l t ( n o t e 1 ) c l d ( n o t e 2 ) p u s h r e g i s t e r t o s t a c k p u s h i n g t h e r e g i s t e r u s e d i n t h e i n t e r r u p t p r o c e s s i n g r o u t i n e i n t o t h e s t a c k . l p o p r e g i s t e r s p o p p i n g r e g i s t e r s w h i c h i s p u s h e d t o s t a c k l p o p r e g i s t e r s p o p p i n g r e g i s t e r s w h i c h i s p u s h e d t o s t a c k l n o t e s 1 : w h e n u s i n g t h e i n d e x x m o d e f l a g ( t ) . 2 : w h e n u s i n g t h e d e c i m a l m o d e f l a g ( d ) .
38C3 group users manual application 2-51 2.3 serial i/o 2.3.6 notes on serial i/o (1) selecting external synchronous clock when an external synchronous clock is selected, the contents of serial i/o register are being shifted continually while the transfer clock is input to the serial i/o1 clock pin. in this case, control the clock externally. (2) transmission data wiritng when an external clock is used as the synchronous clock, write the transmit data to the serial i/o shift register at h level of transfer clock input.
2-52 38C3 group users manual application 2.4 lcd controller 2.4 lcd controller this paragraph explains the registers setting method and the notes relevant to the lcd controller. 2.4.1 memory map fig. 2.4.1 memory map of registers relevant to lcd controller 0 0 3 9 1 6 l c d m o d e r e g i s t e r ( l m ) 0 0 3 8 1 6 s e g m e n t o u t p u t e n a b l e r e g i s t e r ( s e g )
38C3 group users manual application 2-53 2.4 lcd controller fig. 2.4.2 structure of segment output enable register 2.4.2 relevant registers fig. 2.4.3 structure of lcd mode register segment output enable register b7 b6 b5 b4 b3 b2 b1 b0 segment output enable register (seg: address 38 16 ) 0: i/o ports p2 0 ?2 3 1: segment output seg 0 ?eg 3 b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 0 segment output enable bit 0 0: i/o ports p2 4 ?2 7 1: segment output seg 4 ?eg 7 segment output enable bit 1 0: i/o ports p0 0 ?0 3 1: segment output seg 8 ?eg 11 segment output enable bit 2 0: i/o ports p0 4 ?0 7 1: segment output seg 12 ?eg 15 segment output enable bit 3 0: i/o ports p1 0 ?1 3 1: segment output seg 16 ?eg 19 segment output enable bit 4 0: i/o ports p1 4 ?1 7 1: segment output seg 20 ?eg 23 segment output enable bit 5 0: output ports p3 0 ?3 3 1: segment output seg 24 ?eg 27 segment output enable bit 6 0: output ports p3 4 ?3 7 1: segment output seg 28 ?eg 31 segment output enable bit 7 lcd mode register b7 b6 b5 b4 b3 b2 b1 b0 lcd mode register (lm: address 39 16 ) b 0 4 name 0 functions at reset r w duty ratio selection bits lcd circuit divider division ratio selection bits lcdck count source selection bit (note) bias control bit 0 0: 1 (use com 0 ) 0 1: 2 (use com 0 , com 1 ) 1 0: 3 (use com 0 ?om 2 ) 1 1: 4 (use com 0 ?om 3 ) 0 0: clock input 0 1: 2 division of clock input 1 0: 4 division of clock input 1 1: 8 division of clock input 0 0 0: 1/3 bias 1: 1/2 bias 0: f(x cin )/32 1: f(x in )/8192 (f(x cin )/8192 in low-speed mode) lcd enable bit fix ??to this bit. 0: lcd off 1: lcd on 1 3 0 0 0 0 0 5 6 7 b1b0 b6b5 2 note: lcdck is a clock for a lcd timing controller. 0
2-54 38C3 group users manual application 2.4 lcd controller fig. 2.4.4 lcd panel specifications: ?use of segment output seg 0 to seg 13 ?setting of port p1 to i/o port, setting of port p3 to output ?frame frequency = 61 hz ?duty ratio number = 4, bias value = 1/3 figure 2.4.5 shows the segment allocation example. fig. 2.4.5 segment allocation example 2.4.3 lcd controller application examples outline: a lcd panel display data by using the lcd controller. a u t o s l o w p r i n t a u t o s l o w 1 2 345 6 7 p r i n t
38C3 group users manual application 2-55 2.4 lcd controller fig. 2.4.6 lcd display ram map setting of lcd display ram: fig. 2.4.7 lcd display ram setting a b c d e f g b i t a d d r e s s 7 65 432 10 0 0 4 0 1 6 0 0 4 1 1 6 0 0 4 2 1 6 0 0 4 3 1 6 0 0 4 4 1 6 0 0 4 5 1 6 0 0 4 6 1 6 gfedc ba c o m 3 c o m 2 c o m 1 c o m 0 c o m 3 c o m 2 c o m 1 c o m 0 s l o wa u t o p r i n t 1 2 3 4 5 6 7 gfedc ba gfedc ba gfedc ba gfedc ba gfedc ba b i t a d d r e s s 76543210 0 0 4 0 1 6 0 0 4 1 1 6 0 0 4 2 1 6 0 0 4 3 1 6 0 0 4 4 1 6 0 0 4 5 1 6 0 0 4 6 1 6 c o m 3 c o m 2 c o m 1 c o m 0 c o m 3 c o m 2 c o m 1 c o m 0 0 0 4 7 1 6 0 0 4 8 1 6 0 0 4 9 1 6 0 0 4 a 1 6 0 0 4 b 1 6 0 0 4 c 1 6 0 0 4 d 1 6 0 0 4 e 1 6 0 0 4 f 1 6 s e g 1 s e g 0 s e g 3 s e g 2 s e g 5 s e g 4 s e g 7 s e g 6 s e g 9 s e g 8 s e g 1 1 s e g 1 0 s e g 1 3 s e g 1 2 s e g 1 5 s e g 1 4 s e g 1 7 s e g 1 6 s e g 1 9 s e g 1 8 s e g 2 1 s e g 2 0 s e g 2 3 s e g 2 2 s e g 2 5 s e g 2 4 s e g 2 7 s e g 2 6 s e g 2 9 s e g 2 8 s e g 3 1 s e g 3 0
2-56 38C3 group users manual application 2.4 lcd controller figure 2.4.8 shows the relevant registers setting. fig. 2.4.8 relevant registers setting s e g s eg m e n t o u t p u t e n a b l e r e g i s t e r ( a d d r e s s 0 0 3 8 1 6 ) 0 0 0 0 1 1 1 1 s e g m e n t o u t p u t : s e g 0 s e g 3 l m 1 1 / 3 b i a s 4 ( u s e c o m 0 c o m 3 ) l c d m o d e r e g i s t e r ( a d d r e s s 0 0 3 9 1 6 ) s e g m e n t o u t p u t : s e g 4 s e g 7 s e g m e n t o u t p u t : s e g 8 s e g 1 1 s e g m e n t o u t p u t : s e g 1 2 s e g 1 5 i / o p o r t: p 1 0 p 1 3 i / o p o r t: p 1 4 p 1 7 o u t p u t p o r t: p 3 0 p 3 3 o u t p u t p o r t: p 3 4 p 3 7 1 0 0 0 0 1 1 l c d o f f ( a f t e r s e t t i n g d a t a t o l c d r a m , t u r n o n ) n o t u s e d ( a l w a y s s e t 0 . ) 4 ( n o t e ) f ( x i n ) / 8 1 9 2 ( n o t e ) n o t e : f r a m e f r e q u e n c y = f ( l c d c k ) / d i v i s i o n r a t i o f ( l c d c k ) = c o u n t s o u r c e f r e q u e n c y f o r l c d c k / l c d c i r c u i t d i v i s i o n r a t i o f r o m t h e a b o v e , t h e f r a m e f r e q u e n c y a t f ( x i n ) = 8 m h z i s a s f o l l o w s : f r a m e f r e q u e n c y = { ( 8 5 1 0 6 / 8 1 9 2 ) / 4 } / 4 @ 6 1 . 0 3 5 h z
38C3 group users manual application 2-57 2.4 lcd controller control procedure: figure 2.4.9 shows the control procedure of relevant registers to turn on all the lcd display in figure 2.4.4. fig. 2.4.9 control procedure ( a d d r e s s 0 0 3 8 1 6 ) ( a d d r e s s 0 0 3 9 1 6 ) r e s e t s e i s e g l m l c d r a m 0 l c d r a m 1 l c d r a m 2 l c d r a m 3 l c d r a m 4 l c d r a m 5 l c d r a m 6 c l i 0 0 0 0 1 1 1 1 2 1 1 0 0 0 0 1 1 2 . . . 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 ( a d d r e s s 0 0 4 0 1 6 ) ( a d d r e s s 0 0 4 1 1 6 ) ( a d d r e s s 0 0 4 2 1 6 ) ( a d d r e s s 0 0 4 3 1 6 ) ( a d d r e s s 0 0 4 4 1 6 ) ( a d d r e s s 0 0 4 5 1 6 ) ( a d d r e s s 0 0 4 6 1 6 ) l c d r a m x ( a d d r e s s 0 0 4 x 1 6 ) x x x x x x x x 2 i n i t i a l i z a t i o n a l l i n t e r r u p t s d i s a b l e d s e t t i n g o f v a l u e t o l c d r a m ( s e t 1 t o t u r n o n b i t a n d s e t 0 t o t u r n o f f b i t . ) s e t t i n g o f s e g m e n t o u t p u t / p o r t s e t t i n g o f l c d m o d e r e g i s t e r l c d t u r n o n c l t c l d . . . l m ( a d d r e s s 0 0 3 9 1 6 ) , b i t 3 1 i n t e r r u p t e n a b l e d w h e n s w i t c h i n g l c d t u r n o n ( t u r n o f f ) s e g m e n t ? e w r i t i n g o f b i t s c o r r e s p o n d i n g t o l c d t u r n o n ( t u r n o f f ) s e g m e n t s
2-58 38C3 group users manual application 2.4 lcd controller 2.4.4 notes on lcd controller l when switching from the high-speed or middle-speed mode to the low-speed mode, switch the mode in the following order: (1) 32 khz oscillation selected (bit 4 of cpu mode register (address 003b 16 ) = 1) (2) count source for lcdck = f(x cin )/32 (bit 7 of lcd mode register (address 0039 16 ) = 0) (3) internal system clock: x cin -x cout selected (bit 7 of cpu mode register (address 003b 16 ) = 1) (4) main clock x in Cx out stopped (bit 5 of cpu mode register (address 003b 16 ) = 1) execute the setting (2) after the oscillation at 32 khz (setting (1)) becomes completely stable. l if the stp instruction is executed while the lcd is turned on by setting bit 3 of the lcd mode register (address 0039 16 ) to 1, a dc voltage is applied to the lcd. for this reason, do not execute the stp instruction while the lcd is lighting. l when the lcd is not used, open the segment and the common pins. connect v l1 Cv l3 to v ss . l for the following products, if the lcd enable bit of the lcd mode register (bit 3 of address 0039 16 ) is set to 0, all lcds cannot be turned off. to turn off all lcds, set 0 (turn off) to all corresponding lcd display ram. corresponding products: m38C34m6axxxfp, m38C34m6mxxxfp, m38C37ecaxxxfp, m38C37ecmxxxfp, m38C37ecafp, m38C37ecmfp, m38C37ecafs, m38C3ecmfs, m38C37rfs, m38C37rmfs
38C3 group users manual application 2-59 2.5 a-d converter 2.5 a-d converter this paragraph describes the setting method of a-d converter relevant registers, notes etc. 2.5.1 memory map fig. 2.5.1 memory map of a-d converter relevant registers 2.5.2 relevant registers fig. 2.5.2 structure of a-d control register a-d control register (adcon) a-d conversion register (low-order) (adl) 0032 16 0033 16 address a-d conversion register (high-order) (adh) 0034 16 interrupt request register 2 (ireq2) 003d 16 interrupt control register 2 (icon2) 003f 16 a-d control register b7 b6 b5 b4 b3 b2 b1 b0 a-d control register (adcon: address 32 16 ) b 0 1 2 name 0 functions at reset r w 0 0 0 analog input pin selection bits b2 b1 b0 0 0 0: p6 0 /an 0 0 0 1: p6 1 /an 1 0 1 0: p6 2 /an 2 0 1 1: p6 3 /an 3 1 0 0: p6 4 /an 4 1 0 1: p6 5 /an 5 1 1 0: p6 6 /an 6 1 1 1: p6 7 /an 7 3 1 ad conversion completion bit 0: conversion in progress 1: conversion completed 4 0 5 0 0 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? nothing is arranged for this bit. this is write disabled bit. when this bit is read out, the contents are ?? 6 7
2-60 38C3 group users manual application 2.5 a-d converter fig. 2.5.3 structure of a-d conversion register (low-order) fig. 2.5.4 structure of a-d conversion register (high-order) a-d conversion register (low-order) b7 b6 b5 b4 b3 b2 b1 b0 a-d conversion register (low-order) (adl: address 33 16 ) b 0 0 0 0 0 0 0 0 at reset r w 1 2 3 4 5 6 7 functions undefined undefined undefined undefined undefined undefined undefined undefined nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? these are a-d conversion result (low-order 2 bits) stored bits. this is read exclusive register. note: do not read this register during a-d conversion. a-d conversion register (high-order) b7 b6 b5 b4 b3 b2 b1 b0 a-d conversion register (high-order) (adh: address 34 16 ) b 0 0 0 0 0 0 0 0 at reset r w 1 2 3 4 5 6 7 functions undefined undefined undefined undefined undefined undefined undefined undefined this is a-d conversion result (high-order 8 bits) stored bits. this is read exclusive register. note: do not read this register during a-d conversion.
38C3 group users manual application 2-61 2.5 a-d converter fig. 2.5.5 structure of interrupt request register 2 interrupt request register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 2 (ireq2 : address 3d 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 timer 4 interrupt request bit timer 5 interrupt request bit cntr0 interrupt request bit cntr1 interrupt request bit key input interrupt request bit ad conversion interrupt request bit timer 6 interrupt request bit 0 ] ] ] ] ] ] ] nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? ] : ??can be set by software, but ??cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 2 (icon2 : address 3f 16 ) b 0 1 2 4 name 0 functions at reset r w 0 0 0 0 timer 5 interrupt enable bit cntr 0 interrupt enable bit cntr 1 interrupt enable bit timer 6 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 5 0 key input interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 6 7 0 ad conversion interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 timer 4 interrupt enable bit 3 nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? fig. 2.5.6 structure of interrupt control register 2
2-62 38C3 group users manual application 2.5 a-d converter 2.5.3 a-d converter application examples (1) read-in of analog signal outline: the analog input voltage from a sensor is converted to digital values. figure 2.5.7 shows a connection diagram, and figure 2.5.8 shows the setting of relevant registers. fig. 2.5.7 connection diagram specifications: ?conversion of analog input voltage input from sensor to digital values ?use of p6 0 /an 0 pin as analog input pin fig. 2.5.8 setting of relevant registers p 6 0 / a n 0 3 8 c 3 g r o u p s e n s o r 00 0 0 a d h a d l a - d c o n t r o l r e g i s t e r ( a d d r e s s 0 0 3 2 1 6 ) a d c o n a n a l o g i n p u t p i n : p 6 0 / a n 0 s e l e c t e d a - d c o n v e r s i o n s t a r t a - d c o n v e r s i o n r e g i s t e r ( h i g h - o r d e r ) ( a d d r e s s 0 0 3 4 1 6 ) ( r e a d - o n l y ) a - d c o n v e r s i o n r e g i s t e r ( l o w - o r d e r ) ( a d d r e s s 0 0 3 3 1 6 ) a r e s u l t o f a - d c o n v e r s i o n i s s t o r e d ( n o t e ) . n o t e : a f t e r b i t 4 o f a d c o n i s s e t t o 1 , r e a d o u t b o t h r e g i s t e r s i n o r d e r o f a d h ( a d d r e s s 0 0 3 4 1 6 ) a n d a d l ( a d d r e s s 0 0 3 3 1 6 ) f o l l o w i n g . ( r e a d - o n l y ) a r e s u l t o f a - d c o n v e r s i o n i s s t o r e d ( n o t e ) .
38C3 group users manual application 2-63 2.5 a-d converter control procedure: a-d converter is started by performing register setting shown figure 2.5.8. figure 2.5.9 shows the control procedure. fig. 2.5.9 control procedure p 6 0 / a n 0 p i n s e l e c t e d a s a n a l o g i n p u t p i n a - d c o n v e r s i o n s t a r t r e a d o u t a d l ( a d d r e s s 0 0 3 3 1 6 ) r e a d o u t a d h ( a d d r e s s 0 0 3 4 1 6 ) a d c o n ( a d d r e s s 0 0 3 2 1 6 ) , b i t 0 b i t 2 ? 0 0 0 2 a d c o n ( a d d r e s s 0 0 3 2 1 6 ) , b i t 4 ? 1 0 a d c o n ( a d d r e s s 0 0 3 2 1 6 ) , b i t 4 ? 0 j u d g m e n t o f a - d c o n v e r s i o n c o m p l e t i o n r e a d o u t o f h i g h - o r d e r ( b 9 b 2 ) c o n v e r s i o n r e s u l t r e a d o u t o f l o w - o r d e r ( b 1 , b 0 ) c o n v e r s i o n r e s u l t
2-64 38C3 group users manual application 2.5 a-d converter 2.5.4 notes on a-d converter (1) analog input pin n make the signal source impedance for analog input low, or equip an analog input pin with an external capacitor of 0.01 m f to 1 m f. further, be sure to verify the operation of application products on the user side. l reason an analog input pin includes the capacitor for analog voltage comparison. accordingly, when signals from signal source with high impedance are input to an analog input pin, charge and discharge noise generates. this may cause the a-d conversion precision to be worse. (2) a-d converter power source pin the av ss pin is a-d converter power source pin. regardless of using the a-d conversion function or not, connect it as following : ? av ss : connect to the v ss line. l reason if the av ss pin is opened, the microcomputer may have a failure because of noise or others. (3) clock frequency during a-d conversion the comparator consists of a capacity coupling, and a charge of the capacity will be lost if the clock frequency is too low. thus, make sure the following during an a-d conversion. ? f(x in ) is 500 khz or more. ? use clock divided by main clock (f(x in )) as internal system clock. ? do not execute the stp instruction and wit instruction.
38C3 group users manual application 2-65 2.6 rom correct function 2.6 rom correct function this paragraph describes the setting method of rom correct function relevant registers, notes etc. 2.6.1 memory map fig. 2.6.1 memory map of rom correct function relevant registers rom correct data 1 rom correct data 2 0050 16 0051 16 address rom correct data 3 0052 16 rom correct data 4 rom correct data 5 0053 16 0054 16 rom correct data 6 0055 16 rom correct data 7 0056 16 rom correct data 8 0057 16 rom correct enable register 1 (rc1) (note) rom correct high-order address register 1 (note) 0f01 16 0f02 16 rom correct low-order address register 1 (note) 0f03 16 rom correct high-order address register 2 (note) rom correct low-order address register 2 (note) 0f04 16 0f05 16 rom correct high-order address register 3 (note) 0f06 16 rom correct low-order address register 3 (note) 0f07 16 0f08 16 0f09 16 0f0a 16 0f0b 16 0f0c 16 0f0d 16 0f0e 16 0f0f 16 0f10 16 0f11 16 rom correct high-order address register 4 (note) rom correct low-order address register 4 (note) rom correct high-order address register 5 (note) rom correct low-order address register 5 (note) rom correct high-order address register 6 (note) rom correct low-order address register 6 (note) rom correct high-order address register 7 (note) rom correct low-order address register 7 (note) rom correct high-order address register 8 (note) rom correct low-order address register 8 (note) note: this register is valid only in mask rom version.
2-66 38C3 group users manual application 2.6 rom correct function 2.6.2 relevant registers fig. 2.6.2 structure of rom correct enable register 1 rom correct enable register 1 b7 b6 b5 b4 b3 b2 b1 b0 rom correct enable register 1 (rc1: address 0f01 16 ) 0: disabled 1: enabled b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 0 rom correct address 1 enable bit rom correct address 2 enable bit rom correct address 3 enable bit rom correct address 4 enable bit rom correct address 5 enable bit rom correct address 6 enable bit rom correct address 7 enable bit rom correct address 8 enable bit 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled
38C3 group users manual application 2-67 2.6 rom correct function 2.6.3 rom correct function application examples outline: when the contents of rom would be corrected, the contents of rom can be changed artificially by connecting e 2 prom to the externals and storing the contents (correct address, correct data) to the rom correct function relevant registers. fig. 2.6.3 connection diagram specifications: l if rom correct is necessary, make p5 1 pull-up. if rom correct is unnecessary, make p5 1 pull-down. l use of serial i/o as communication with e 2 prom l connection of clock and s clk1 , connection of cs pin and p4 7 fig. 2.6.4 setting of relevant registers p 4 6 p 4 4 p 4 7 p 5 1 3 8 c 3 g r o u p s c l k 1 s i n p 4 7 c l k d a t a c s 3 8 c 3 g r o u p e 2 p r o m l w h e n r o m c o r r e c t i s u n n e c e s s a r y l w h e n r o m c o r r e c t i s n e c e s s a r y p 5 1 c l k o u t c s s e r i a l i / o c o n t r o l r e g i s t e r 2 ( a d d r e s s 0 0 1 a 1 6 ) 0 s c l k 1 s i o c o n 2 s e r i a l i / o c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 1 9 1 6 ) s o u t , s c l k 1 , s c l k 2 s i g n a l p i n s s i o c o n 1 101 i / o p o r t i n t e r n a l c l o c k p o r t p 4 ( a d d r e s s 0 0 0 8 1 6 ) p 4 s e t c s s i g n a l t o e 2 p r o m p o r t p 4 d i r e c t i o n r e g i s t e r ( a d d r e s s 0 0 0 9 1 6 ) 1 p 4 d s e t p 4 4 , p 4 6 , p 4 7 t o o u t p u t p o r t s . 11 p o r t p 4 ( a d d r e s s 0 0 0 8 1 6 ) p 4 s e t l o u t p u t a s t e r m i n a t i o n o f u n u s e d p i n s 00 0 w h e n r o m c o r r e c t i s u n n e c e s s a r y w h e n r o m c o r r e c t i s n e c e s s a r y
2-68 38C3 group users manual application 2.6 rom correct function fig. 2.6.5 control procedure control procedure: i n i t i a l i z a t i o n . . . . . r e s e t s e t t i n g o f s e r i a l i / o s c l k 1 s e l e c t e d n o t e : ] s h o w s t h e i n t e r n a l o p e r a t i o n o f m i c r o c o m p u t e r . n . . . . . e 2 p r o m i s c o n n e c t e d ? ( p 5 1 = h ? ) y d a t a c o r r e s p o n d i n g t o t h e f o l l o w i n g r e g i s t e r s , w h i c h h a v e b e e n s e t t o e 2 p r o m b e f o r e h a n d , i s r e a d a n d t h e d a t a i s s t o r e d t o e a c h r e g i s t e r : r o m c o r r e c t e n a b l e r e g i s t e r 1 r o m c o r r e c t a d d r e s s r e g i s t e r s 1 8 r o m c o r r e c t d a t a 1 8 m a i n p r o c e s s i n g n y r o m c o r r e c t i s e n a b l e d ? ( r c 1 , x = h ? ) r o m c o r r e c t a d d r e s s x c o r r e c t d a t a x . . . . . p 4 ( a d d r e s s 0 0 0 8 1 6 ) , b i t 7 1 c s s i g n a l o u t p u t ] ( n o t e ) s i o c o n 1 ( a d d r e s s 0 0 1 9 1 6 ) s i o c o n 2 ( a d d r e s s 0 0 1 a 1 6 ) x 1 x 0 1 x x x 2 x x x x x x x 0 2 s e t t i n g o f p o r t d i r e c t i o n r e g i s t e r l o u t p u t a s t e r m i n a t i o n o f u n u s e d p i n s p 4 ( a d d r e s s 0 0 0 8 1 6 ) , b i t 7 0 p 4 d ( a d d r e s s 0 0 0 9 1 6 ) p 4 ( a d d r e s s 0 0 0 8 1 6 ) 1 1 x 1 x x x x 2 0 0 x 0 x x x x 2
38C3 group users manual application 2-69 2.7 reset circuit 2.7 reset circuit ____________ the reset state is caused by applying an l level to the reset pin. after that, the reset state is released ____________ by applying an h level to the reset pin, so that the program is executed in the middle-speed mode from the contents of the reset vector address. 2.7.1 connection example of reset ic figure 2.7.1 shows the example of power-on reset circuit. figure 2.7.2 shows the system example which switches to the ram backup mode by detecting a drop of the system power source voltage with the int interrupt. fig. 2.7.1 example of power-on reset circuit fig. 2.7.2 ram backup system example v c c r e s e t v s s m 6 2 0 2 2 l g n d 3 8 c 3 g r o u p p o w e r s o u r c e 0 . 1 m f o u t p u t d e l a y c a p a c i t y v c c r e s e t i n t r e s e t i n t c d v c c 1 v c c 2 v 1 g n d m 6 2 0 0 9 l , m 6 2 0 0 9 p , m 6 2 0 0 9 f p 3 8c 3 g r o u p v s s s y s t e m p o w e r s o u r c e v o l t a g e + 5 v
2-70 38C3 group users manual application 2.7 reset circuit 2.7.2 notes on reset circuit (1) reset input voltage control make sure that the reset input voltage is 0.5 v or less for vcc of 2.5 v (note) . perform switch to the high-speed mode when power source voltage is within 4.0 to 5.5 v. note: m version of mask rom version is 2.2 v. (2) countermeasure when reset signal rise time is long in case where the reset signal rise time is long, connect a ceramic capacitor or others across the reset pin and the v ss pin. and use a 1000 pf or more capacitor for high frequency use. when connecting the capacitor, note the following : ? make the length of the wiring which is connected to a capacitor as short as possible. ? be sure to verify the operation of application products on the user side. l reason if the several nanosecond or several ten nanosecond impulse noise enters the reset pin, it may cause a microcomputer failure.
38C3 group users manual application 2-71 2.8 clock generating circuit 2.8 clock generating circuit this paragraph describes the setting method of clock generating circuit relevant registers, application examples etc. 2.8.1 relevant register figure 2.8.1 shows the structure of the cpu mode register. fig. 2.8.1 structure of cpu mode register cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 cpu mode register (cpum, cm: address 3b 16 ) 00 : single-chip mode 01 : 10 : not available 11 : b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 : page 0 1 : page 1 0 1 0 0: oscillating 1: stopped 0 1 0 processor mode bits stack page selection bit port xc switch bit main clock (x in - x out ) stop bit main clock division ratio selection bit internal system clock selection bit b1 b0 0: f(x in )/2 (high-speed mode) 1: f(x in )/8 (middle-speed mode) 0: x in ? out selection (middle-/high-speed mode) 1: x cin ? cout selection (low-speed mode) 0: i/o port function 1: x cin -x cout oscillation function nothing is arranged for this bit. when this bit is read out, the contents are ?? do not write ??to this bit.
2-72 38C3 group users manual application 2.8 clock generating circuit 2.8.2 clock generating circuit application examples (1) status transition during power failure outline: the clock is counted up every one second by using the timer interrupt during a power failure. fig. 2.8.2 connection diagram specifications: ?reducing power dissipation as low as possible while maintaining clock function ?clock: f(x in ) = 8 mhz, f(x cin ) = 32.768 khz ?port processing input port: fixed to h or l level on the external output port: fixed to output level that does not cause current flow to the external (example) when a circuit turns on led at l output level, fix the output level to h. i/o port: input port ? fixed to h or l level on the external output port ? output of data that does not consume current v ref : stop to supply to reference voltage input pin by external circuit 3 8 c 3 g r o u p p o w e r f a i l u r e d e t e c t i o n s i g n a l i n p u t p o r t ( n o t e ) n o t e : s i g n a l i s d e t e c t e d b y i n p u t t i n g t o e a c h i n p u t p o r t , i n t e r r u p t i n p u t p i n , a n d a n a l o g i n p u t p i n .
38C3 group users manual application 2-73 2.8 clock generating circuit fig. 2.8.3 status transition diagram during power failure x i n x c i n i n t e r n a l s y s t e m c l o c k c h a n g e i n t e r n a l s y s t e m c l o c k t o h i g h - s p e e d m o d e a f t e r d e t e c t i n g , c h a n g e i n t e r n a l s y s t e m c l o c k t o l o w - s p e e d m o d e a n d s t o p o s c i l l a t i n g x i n - x o u t m i d d l e - s p e e d m o d e h i g h - s p e e d m o d e l o w - s p e e d m o d e x c i n - x c o u t o s c i l l a t i o n f u n c t i o n s e l e c t e d r e s e t r e l e a s e d p o w e r f a i l u r e d e t e c t e d figure 2.8.3 shows the status transition diagram during power failure and figure 2.8.4 shows the setting of relevant registers.
2-74 38C3 group users manual application 2.8 clock generating circuit fig. 2.8.4 setting of relevant registers c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 0 c p u m 000 m a i n c l o c k : h i g h - s p e e d m o d e ( f ( x i n ) ) ( n o t e 1 ) 00 c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 0 c p u m 001 p o r t x c : x c i n - x c o u t o s c i l l a t i o n f u n c t i o n 00 c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 1 c p u m 00 1 i n t e r n a l s y s t e m c l o c k : l o w - s p e e d m o d e ( f ( x c i n ) ) 00 c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 1 c p u m 01 1 m a i n c l o c k f ( x i n ) : s t o p p e d 00 ( n o t e 2 ) ( n o t e 2 ) ( n o t e 2 ) n o t e s 1 : t h i s s e t t i n g i s n e c e s s a r y o n l y w h e n s e l e c t i n g t h e h i g h - s p e e d m o d e . 2 : w h e n s e l e c t i n g t h e m i d d l e - s p e e d m o d e , b i t 6 i s 1 .
38C3 group users manual application 2-75 2.8 clock generating circuit control procedure: set the relevant registers in the order shown below to prepare for a power failure. fig. 2.8.5 control procedure i n i t i a l i z a t i o n c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 6 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 4 0 1 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 7 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 5 1 ( n o t e ) 1 ( n o t e ) r e s e t i n t e r n a l s y s t e m c l o c k : f ( x c i n ) ( l o w - s p e e d m o d e ) m a i n c l o c k f ( x i n ) o s c i l l a t i o n s t o p p e d n o t e : d o n o t s w i t c h a t o n e t i m e . r e t u r n p r o c e s s i n g f r o m p o w e r f a i l u r e s e t s o t h a t t i m e r i n t e r r u p t o c c u r s e v e r y o n e s e c o n d e x e c u t e w i t i n s t r u c t i o n a t a p o w e r f a i l u r e , c l o c k c o u n t i s p e r f o r m e d d u r i n g t i m e r i n t e r r u p t p r o c e s s i n g ( e v e r y s e c o n d ) . p o r t x c : x c i n - x c o u t o s c i l l a t i o n f u n c t i o n w h e n s e l e c t i n g m a i n c l o c k f ( x i n ) ( h i g h - s p e e d m o d e ) d e t e c t p o w e r f a i l u r e ? n y r e t u r n c o n d i t i o n f r o m p o w e r f a i l u r e c o n c l u d e d ? n y l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . ? ?
2-76 38C3 group users manual application 2.8 clock generating circuit (2) counting without clock error during power failure outline: it keeps counting without clock error during a power failure. specifications: ?reducing power consumption as low as possible while maintaining clock function ?clock: f(x in ) = 4.19 mhz ?sub clock: f(x cin ) = 32.768 khz ?use of timer 3 interrupt for the peripheral circuit and the status transition during a power failure, refer to figures 2.8.2 and 2.8.3 . figure 2.8.6 shows the structure of clock counter, figures 2.8.7 and 2.8.8 show the setting of relevant registers. fig. 2.8.6 structure of clock counter w h e n t h e s y s t e m r e t u r n s f r o m a p o w e r f a i l u r e , a d d t h e t i m e t a k e n f o r t h e s w i t c h i n g p r o c e s s i n g f o r t h e r e t u r n . t i m e r 1 i n t e r r u p t 1 / 2 5 6 t i m e r 2t i m e r 3 2 4 4 m s 1 / 1 6 f ( x c i n ) = 3 2 . 7 6 8 k h z 1 / 8 t i m e r 1 < a t p o w e r f a i l u r e > f ( x i n ) = 4 . 1 9 m h z t i m e r 1b a s e c o u n t e r1 s e c o n d c o u n t e r1 m i n u t e c o u n t e r 1 / 1 6 1 / 6 41 / 2 5 6 1 / 1 6 1 / 6 0 1 s e c o n d m i n u t e / t i m e / d a y / m o n t h / y e a r 2 4 4 m s t i m e r 3 i n t e r r u p t : s o f t w a r e t i m e r : h a r d w a r e t i m e r
38C3 group users manual application 2-77 2.8 clock generating circuit fig. 2.8.7 initial setting of relevant registers c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 0 c p u m 001 p o r t x c : x c i n - x c o u t o s c i l l a t i o n f u n c t i o n 00 c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) 1 c p u m001 00 i n t e r n a l s y s t e m c l o c k : f ( x i n ) ( h i g h - s p e e d m o d e ) t i m e r 1 ( a d d r e s s 0 0 2 0 1 6 ) t 13 f 1 6 s e t ( d i v i s i o n r a t i o - 1 ) ; 6 3 ( 3 f 1 6 ) t i m e r 1 2 m o d e r e g i s t e r ( a d d r e s s 0 0 2 8 1 6 ) 0 t 1 2 m000 t i m e r 1 c o u n t : o p e r a t i n g 00 t i m e r 2 c o u n t : o p e r a t i n g 00 t i m e r 1 c o u n t s o u r c e : f ( x i n ) / 1 6 t i m e r 2 c o u n t s o u r c e : t i m e r 1 u n d e r f l o w p 4 1 i / o p o r t t i m e r 3 4 m o d e r e g i s t e r ( a d d r e s s 0 0 2 9 1 6 ) 0 t 3 4 m 0 t i m e r 3 c o u n t : o p e r a t i n g 0 t i m e r 3 c o u n t s o u r c e : t i m e r 2 u n d e r f l o w 01 p 4 2 i / o p o r t i n t e r r u p t r e q u e s t r e g i s t e r 1 ( a d d r e s s 0 0 3 c 1 6 ) 0 i r e q 10 s e t 0 t o t i m e r 1 i n t e r r u p t r e q u e s t b i t s e t 0 t o t i m e r 3 i n t e r r u p t r e q u e s t b i t i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 3 e 1 6 ) i c o n 11 t i m e r 1 i n t e r r u p t : e n a b l e d
2-78 38C3 group users manual application 2.8 clock generating circuit fig. 2.8.8 setting of relevant registers after detecting power failure 1 c p u m 001 00 1 c p u m 01 1 00 t 1 2 m 01 1 i c o n 1 0 t 10 7 1 6 t 2f f 1 6 t 30 f 1 6 t i m e r 1 2 m o d e r e g i s t e r ( a d d r e s s 0 0 2 8 1 6 ) t i m e r 1 c o u n t s o u r c e : f ( x c i n ) c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) i n t e r n a l s y s t e m c l o c k : f ( x c i n ) ( l o w - s p e e d m o d e ) c p u m o d e r e g i s t e r ( a d d r e s s 0 0 3 b 1 6 ) m a i n c l o c k : f ( x i n ) : s t o p p e d i n t e r r u p t c o n t r o l r e g i s t e r 1 ( a d d r e s s 0 0 3 e 1 6 ) t i m e r 1 i n t e r r u p t : d i s a b l e d t i m e r 3 i n t e r r u p t : e n a b l e d t i m e r 1 ( a d d r e s s 0 0 2 0 1 6 ) t i m e r 2 ( a d d r e s s 0 0 2 1 1 6 ) t i m e r 3 ( a d d r e s s 0 0 2 2 1 6 ) s e t ( d i v i s i o n r a t i o 1 ) ( t 1 = 7 ( 0 7 1 6 ) , t 2 = 2 5 5 ( f f 1 6 ) , t 3 = 1 5 ( 0 f 1 6 ) )
38C3 group users manual application 2-79 2.8 clock generating circuit control procedure: set the relevant registers in the order shown below to prepare for a power failure. fig. 2.8.9 control procedure i n i t i a l i z a t i o n t 1 2 m ( a d d r e s s 0 0 2 8 1 6 ) , b i t 3 , b i t 2 i c o n 1 ( a d d r e s s 0 0 3 e 1 6 ) , b i t 5 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 7 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 5 i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 7 , b i t 5 t 1 ( a d d r e s s 0 0 2 0 1 6 ) t 2 ( a d d r e s s 0 0 2 1 1 6 ) t 3 ( a d d r e s s 0 0 2 2 1 6 ) 0 , 1 0 1 ( n o t e ) 1 ( n o t e ) 0 , 0 0 7 1 6 3 f 1 6 0 f 1 6 r e s e t t i m e r 1 c o u n t s o u r c e : f ( x c i n ) t i m e r 1 i n t e r r u p t : d i s a b l e d i n t e r n a l s y s t e m c l o c k : f ( x c i n ) ( l o w - s p e e d m o d e ) m a i n c l o c k f ( x i n ) : o s c i l l a t i o n s t o p p e d s e t t i n g f o r g e n e r a t i n g t i m e r 3 i n t e r r u p t e v e r y s e c o n d g e n e r a t i o n o f o n e s e c o n d b y h a r d w a r e t i m e r d u r i n g p o w e r f a i l u r e n o t e : d o n o t s w i t c h a t o n e t i m e . r e t u r n p r o c e s s i n g f r o m p o w e r f a i l u r e e x e c u t e w i t i n s t r u c t i o n t i m e r 3 i n t e r r u p t o c c u r s e v e r y s e c o n d ( r e t u r n f r o m w a i t m o d e ) p o r t x c : x c i n - x c o u t o s c i l l a t i o n f u n c t i o n w h e n s e l e c t i n g m a i n c l o c k f ( x i n ) ( h i g h - s p e e d m o d e ) s e t t i n g f o r m a k i n g b a s e a n d o n e s e c o n d c o u n t e r s a c t i v a t e d u r i n g t i m e r 1 i n t e r r u p t i n t h e n o r m a l p o w e r s t a t e , t h e s e s o f t w a r e c o u n t e r s g e n e r a t e o n e s e c o n d . d e t e c t p o w e r f a i l u r e ? n y re t u r n c o n d i t i o n f o r p o w e r f a i l u r e i s s a t i s f i e d ? n y i c o n 1 ( a d d r e s s 0 0 3 e 1 6 ) , b i t 7 1 t i m e r 3 i n t e r r u p t : e n a b l e d l x : t h i s b i t i s n o t u s e d h e r e . s e t i t t o 0 o r 1 a r b i t r a r i l y . 1 0 3 f 1 6 0 0 0 0 1 0 0 0 2 0 0 x x 0 1 x 0 2 0 , 0 f f 1 6 0 f 1 6 1 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 4 c p u m ( a d d r e s s 0 0 3 b 1 6 ) , b i t 6 t 1 ( a d d r e s s 0 0 2 0 1 6 ) t 1 2 m ( a d d r e s s 0 0 2 8 1 6 ) t 3 4 m ( a d d r e s s 0 0 2 9 1 6 ) i r e q 1 ( a d d r e s s 0 0 3 c 1 6 ) , b i t 7 , b i t 5 b a s e c o u n t e r ( i n t e r n a l r a m ) 1 s e c o n d c o u n t e r ( i n t e r n a l r a m ) i c o n 1 ( a d d r e s s 0 0 3 e 1 6 ) , b i t 5 ? ? p u s h r e g i s t e r s t o s t a c k e t c . t i m e r 3 i n t e r r u p t r o u t i n e m o d i f y t i m e , d a y , m o n t h , y e a r c o u n t 1 m i n u t e ( i n t e r n a l r a m ) c o u n t e r 1 m i n u t e c o u n t e r o v e r f l o w ? n y r t i ?
2-80 38C3 group users manual application 2.8 clock generating circuit memorandum
chapter 3 chapter 3 appendix 3.1 electrical characteristics 3.2 standard characteristics 3.3 notes on use 3.4 countermeasures against noise 3.5 control registers 3.6 mask rom confirmation form 3.7 rom programming confirmation form 3.8 mark specification form 3.9 package outline 3.10 machine instructions 3.11 list of instruction code 3.12 sfr memory map 3.13 pin configuration
3-2 38C3 group users manual appendix 3.1 electrical characteristics 3.1 electrical characteristics 3.1.1 absolute maximum ratings table 3.1.1 absolute maximum ratings parameter power source voltage input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7, p4 0 Cp4 7 , p5 0 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 input voltage v l1 input voltage v l2 input voltage v l3 input voltage reset, x in output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 output voltage com 0 Ccom 3 output voltage p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 output voltage x out power dissipation operating temperature storage temperature symbol v cc v i v i v i v i v i v o v o v o v o p d t opr t stg conditions ratings C0.3 to 7.0 C0.3 to v cc +0.3 C0.3 to v l2 v l1 to v l3 v l2 to v cc +0.3 C0.3 to v cc +0.3 C0.3 to v cc +0.3 C0.3 to v l3 +0.3 C0.3 to v l3 +0.3 C0.3 to v cc +0.3 C0.3 to v cc +0.3 300 C20 to 85 C40 to 125 unit v v v v v v v v v v v mw c c all voltages are based on vss. output transistors are cut off. at output port at segment output ta = 25c 3.1.2 recommended operating conditions table 3.1.2 recommended operating conditions (vcc = 2.5 to 5.5 v, ta = C20 to 85c, unless otherwise noted) power source voltage high-speed mode f(x in ) = 8 mhz middle-speed mode f(x in ) = 8 mhz low-speed mode power source voltage a-d converter reference voltage analog power source voltage analog input voltage an 0 Can 7 h input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 h input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) h input voltage p8 0 Cp8 7 h input voltage reset h input voltage x in l input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 l input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) l input voltage p8 0 Cp8 7 l input voltage reset l input voltage x in v cc v ss v ref av ss v ia v ih v ih v ih v ih v ih v il v il v il v il v il limits v v v v v v v v v v v v v v v v v parameter min. 4.0 2.5 2.5 2.0 av ss 0.7v cc 0.8v cc 0.4v cc 0.8v cc 0.8v cc 0 0 0 0 0 ty p. 5.0 5.0 5.0 0 0 max. 5.5 5.5 5.5 v cc v cc v cc v cc v cc v cc v cc 0.3v cc 0.2v cc 0.16v cc 0.2v cc 0.2v cc symbol unit
3-3 appendix 3.1 electrical characteristics 38C3 group users manual h total peak output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 p8 0 Cp8 7 , p5 0 h total peak output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l total peak output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l total peak output current (note 1) p8 0 Cp8 7 , p5 0 l total peak output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 h total average output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 p8 0 Cp8 7 , p5 0 h total average output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l total average output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l total average output current (note 1) p8 0 Cp8 7 , p5 0 l total average output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 h peak output current (note 2) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h peak output current (note 2) p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 p8 0 Cp8 7 l peak output current (note 2) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l peak output current (note 2) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l peak output current (note 2) p8 0 Cp8 7 , p5 0 h average output current (note 3) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h average output current (note 3) p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 p8 0 Cp8 7 l average output current (note 3) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l average output current (note 3) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l average output current (note 3) p8 0 Cp8 7 , p5 0 s i oh(peak) s i oh(peak) s i ol(peak) s i ol(peak) s i ol(peak) s i oh(avg) s i oh(avg) s i ol(avg) s i ol(avg) s i ol(avg) i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) limits ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma parameter min. typ. max. symbol unit C60 C30 40 80 40 C30 C15 20 40 20 C4.0 C10 5.0 10 30 C2.0 C5.0 2.5 5.0 15 table 3.1.3 recommended operating conditions (vcc = 2.5 to 5.5 v, ta = C20 to 85c, unless otherwise noted) notes 1: the total output current is the sum of all the currents flowing through all the applicable ports. the total average current is an average value mea- sured over 100 ms. the total peak current is the peak value of all the currents. 2: the peak output current is the peak current flowing in each port. 3: the average output current is average value measured over 100 ms.
3-4 38C3 group users manual appendix 3.1 electrical characteristics table 3.1.4 recommended operating conditions (vcc = 2.5 to 5.5 v, ta = C20 to 85c, unless otherwise noted) input frequency (duty cycle 50%) main clock input oscillation frequency (note 4) sub-clock input oscillation frequency (notes 4, 5) f(cntr 0 ) f(cntr 1 ) f(x in ) f(x cin ) limits mhz mhz mhz mhz mhz khz parameter min. typ. 32.768 max. 4.0 (2 5 v cc )C4 8.0 (4 5 v cc )C8 8.0 50 symbol unit (4.0 v v cc 5.5 v) (v cc 4.0 v) high-speed mode (4.0 v v cc 5.5 v) high-speed mode (v cc 4.0 v) middle-speed mode notes 4: when the oscillation frequency has a duty cycle of 50%. 5: when using the microcomputer in low-speed mode, set the sub-clock input oscillation frequency on condition that f(x cin ) < f(x in )/3.
3-5 appendix 3.1 electrical characteristics 38C3 group users manual i oh = C2.0 ma i oh = C0.6 ma v cc = 2.5 v i oh = C5 ma i oh = C1.25 ma i oh = C1.25 ma v cc = 2.5 v i ol = 2.5 ma i ol = 1.25 ma i ol = 1.25 ma v cc = 2.5 v i ol = 5.0 ma i ol = 2.5 ma i ol = 2.5 ma v cc = 2.5 v i ol = 15 ma reset: v cc = 2.5 v C 5.5 v v i = v cc pull-down off v cc = 5.0 v, v i = v cc pull-down on v cc = 3.0 v, v i = v cc pull-down on v i = v cc v i = v cc v i = v cc v i = v ss pull-up off v cc = 5.0 v, v i = v ss pull-up on v cc = 3.0 v, v i = v ss pull-up on v i = v ss v i = v ss h output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h output voltage p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1, (note) p8 0 Cp8 7 l output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7, p3 0 Cp3 7 l output voltage p4 0 Cp4 7 , p5 2 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 (note) l output voltage p8 0 Cp8 7 , p5 0 hysteresis int 0 Cint 2 , cntr 0 , cntr 1 , p8 0 Cp8 7 hysteresis s clk1 , s in hysteresis reset h input current p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 h input current p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 h input current reset h input current x in l input current p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p5 1 l input current p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 l input current reset l input current x in limits v v v v v v v v v v v v v v v m a m a m a m a m a m a m a m a m a m a m a m a parameter min. v cc C2.0 v cc C1.0 v cc C2.0 v cc C0.5 v cc C1.0 30 6.0 C30 C6 ty p. 0.5 0.5 0.5 70 25 4.0 C70 C25 C4 max. 2.0 0.5 1.0 2.0 0.5 1.0 2.0 5.0 140 45 5.0 5.0 C5.0 C5.0 C140 C45 C5 symbol unit test conditions v oh v oh v ol v ol v ol v t+ Cv t- v t+ Cv t- v t+ Cv t- i ih i ih i ih i ih i il i il i il i il note: when 1 is set to the port x c switch bit (bit 4 of address 003b 16 ) of the cpu mode register, the drive ability of port p7 1 is different from the value above mentioned. 3.1.3 electrical characteristics table 3.1.5 electrical characteristics (vcc = 4.0 to 5.5 v, ta = C20 to 85c, unless otherwise noted)
3-6 38C3 group users manual appendix 3.1 electrical characteristics ram hold voltage power source current limits parameter min. 2.0 ty p. 6.4 1.6 15 4.5 0.1 max. 5.5 13 3.2 22 9.0 1.0 10 symbol unit when clock is stopped high-speed mode, vcc = 5 v f(x in ) = 8 mhz f(x cin ) = 32.768 khz output transistors off, a-d converter in operating high-speed mode, vcc = 5 v f(x in ) = 8 mhz (in wit state) f(x cin ) = 32.768 khz output transistors off, a-d converter stopped low-speed mode, v cc = 3 v, ta 55 c f(x in ) = stopped f(x cin ) = 32.768 khz output transistors off low-speed mode, v cc = 3 v, ta = 25 c f(x in ) = stopped f(x cin ) = 32.768 khz (in wit state) output transistors off all oscillation stopped (in stp state) output transistors off test conditions v ram i cc v ma ma m a m a m a m a ta = 25 c ta = 85 c table 3.1.6 electrical characteristics (vcc = 2.5 to 5.5 v, ta = C20 to 85c, unless otherwise noted)
3-7 appendix 3.1 electrical characteristics 38C3 group users manual 3.1.4 a-d converter characteristics table 3.1.7 a-d converter characteristics (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, 4 mhz f(x in ) 8 mhz, in middle-speed/high-speed mode) resolution absolute accuracy (excluding quantization error) conversion time reference input current analog port input current ladder resistor unit bits lsb tc( f ) m a m a k w limits parameter min. 61 50 ty p. 1 150 0.5 35 max. 10 2.5 62 200 5.0 symbol v cc = v ref = 5.12 v v ref = 5 v test conditions t conv iv ref i ia r ladder
3-8 38C3 group users manual appendix 3.1 electrical characteristics t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (s in -s clk ) t h (s clk -s in ) reset input l pulse width main clock input cycle time (x in input) main clock input h pulse width main clock input l pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input h pulse width cntr 0 , cntr 1 input l pulse width int 0 Cint 2 input h pulse width int 0 Cint 2 input l pulse width serial i/o clock input cycle time serial i/o clock input h pulse width serial i/o clock input l pulse width serial i/o input setup time serial i/o input hold time t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (s in -s clk ) t h (s clk -s in ) limits m s ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 125 45 40 250 105 105 80 80 800 370 370 220 100 typ. max. symbol unit limits m s ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 125 45 40 500/(v cc C2) 250/(v cc C2)C20 250/(v cc C2)C20 230 230 2000 950 950 400 200 typ. max. symbol unit reset input l pulse width main clock input cycle time (x in input) main clock input h pulse width main clock input l pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input h pulse width cntr 0 , cntr 1 input l pulse width int 0 Cint 2 input h pulse width int 0 Cint 2 input l pulse width serial i/o clock input cycle time serial i/o clock input h pulse width serial i/o clock input l pulse width serial i/o input setup time serial i/o input hold time table 3.1.9 timing requirements 2 (vcc = 2.5 to 4.0 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) 3.1.5 timing requirements and switching characteristics table 3.1.8 timing requirements 1 (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted)
3-9 appendix 3.1 electrical characteristics 38C3 group users manual t wh (s clk ) t wl (s clk ) t d (s clk -s out ) t v (s clk -s out ) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) t wh (s clk ) t wl (s clk ) t d (s clk -s out ) t v (s clk -s out ) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) limits parameter min. t c (s clk )/2C30 t c (s clk )/2C30 C30 ty p. 10 10 max. 140 30 30 30 30 symbol unit ns ns ns ns ns ns ns ns notes 1: when the p-channel output disable bit (bit 7 of address 0019 16 ) is 0. 2: the x out , x cout pins are excluded. serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time (note 1) serial i/o output valid time (note 1) serial i/o clock output rising time serial i/o clock output falling time cmos output rising time (note 2) cmos output falling time (note 2) table 3.1.10 switching characteristics 1 (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) limits ns ns ns ns ns ns ns ns parameter min. t c (s clk )/2C50 t c (s clk )/2C50 C30 ty p. 20 20 max. 350 50 50 50 50 symbol unit serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time (note 1) serial i/o output valid time (note 1) serial i/o clock output rising time serial i/o clock output falling time cmos output rising time (note 2) cmos output falling time (note 2) table 3.1.11 switching characteristics 2 (vcc = 2.5 to 4.0 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) notes 1: when the p-channel output disable bit (bit 7 of address 0019 16 ) is 0. 2: the x out , x cout pins are excluded.
3-10 38C3 group users manual appendix 3.1 electrical characteristics 3.1.6 absolute maximum ratings (m version) table 3.1.12 absolute maximum ratings (m version) parameter power source voltage input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7, p4 0 Cp4 7 , p5 0 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 input voltage v l1 input voltage v l2 input voltage v l3 input voltage reset, x in output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 output voltage com 0 Ccom 3 output voltage p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 output voltage x out power dissipation operating temperature storage temperature symbol v cc v i v i v i v i v i v o v o v o v o p d t opr t stg conditions ratings C0.3 to 7.0 C0.3 to v cc +0.3 C0.3 to v l2 v l1 to v l3 v l2 to v cc +0.3 C0.3 to v cc +0.3 C0.3 to v cc +0.3 C0.3 to v l3 +0.3 C0.3 to v l3 +0.3 C0.3 to v cc +0.3 C0.3 to v cc +0.3 300 C20 to 85 C40 to 125 unit v v v v v v v v v v v mw c c all voltages are based on vss. output transistors are cut off. at output port at segment output ta = 25c 3.1.7 recommended operating conditions (m version) table 3.1.13 recommended operating conditions (m version) (vcc = 2.2 to 5.5 v, ta = C20 to 85c, unless otherwise noted) power source voltage high-speed mode f(x in ) = 8 mhz middle-speed mode f(x in ) = 8 mhz low-speed mode power source voltage a-d converter reference voltage analog power source voltage analog input voltage an 0 Can 7 v cc v ss v ref av ss v ia limits v v v v v v v parameter min. 4.0 2.2 2.2 2.0 av ss ty p. 5.0 5.0 5.0 0 0 max. 5.5 5.5 5.5 v cc v cc symbol unit
3-11 appendix 3.1 electrical characteristics 38C3 group users manual table 3.1.14 recommended operating conditions (m version) (vcc = 2.5 to 5.5 v, ta = C20 to 85c, unless otherwise noted) h input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 h input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) h input voltage p8 0 Cp8 7 h input voltage reset h input voltage x in l input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 l input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) l input voltage p8 0 Cp8 7 l input voltage reset l input voltage x in v ih v ih v ih v ih v ih v il v il v il v il v il limits v v v v v v v v v v parameter min. 0.7v cc 0.8v cc 0.4v cc 0.8v cc 0.8v cc 0 0 0 0 0 ty p. max. v cc v cc v cc v cc v cc 0.3v cc 0.2v cc 0.16v cc 0.2v cc 0.2v cc symbol unit table 3.1.15 recommended operating conditions (m version) (vcc = 2.2 to 2.5 v, ta = C20 to 85c, unless otherwise noted) h input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 h input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) h input voltage p8 0 Cp8 7 h input voltage reset h input voltage x in l input voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 l input voltage p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 (cm4 = 0) l input voltage p8 0 Cp8 7 l input voltage reset l input voltage x in v ih v ih v ih v ih v ih v il v il v il v il v il limits v v v v v v v v v v parameter min. 0.8v cc 0.95v cc 0.5v cc 0.95v cc 0.95v cc 0 0 0 0 0 ty p. max. v cc v cc v cc v cc v cc 0.2v cc 0.05v cc 0.1v cc 0.05v cc 0.05v cc symbol unit
3-12 38C3 group users manual appendix 3.1 electrical characteristics h total peak output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 p8 0 Cp8 7 , p5 0 h total peak output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l total peak output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l total peak output current (note 1) p8 0 Cp8 7 , p5 0 l total peak output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 h total average output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 p8 0 Cp8 7 , p5 0 h total average output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l total average output current (note 1) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l total average output current (note 1) p8 0 Cp8 7 , p5 0 l total average output current (note 1) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 h peak output current (note 2) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h peak output current (note 2) p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 p8 0 Cp8 7 l peak output current (note 2) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l peak output current (note 2) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l peak output current (note 2) p8 0 Cp8 7 , p5 0 h average output current (note 3) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h average output current (note 3) p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 p8 0 Cp8 7 l average output current (note 3) p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 l average output current (note 3) p4 0 Cp4 7 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 l average output current (note 3) p8 0 Cp8 7 , p5 0 s i oh(peak) s i oh(peak) s i ol(peak) s i ol(peak) s i ol(peak) s i oh(avg) s i oh(avg) s i ol(avg) s i ol(avg) s i ol(avg) i oh(peak) i oh(peak) i ol(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i ol(avg) limits ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma parameter min. typ. max. symbol unit C60 C30 40 80 40 C30 C15 20 40 20 C4.0 C10 5.0 10 30 C2.0 C5.0 2.5 5.0 15 table 3.1.16 recommended operating conditions (m version) (vcc = 2.2 to 5.5 v, ta = C20 to 85c, unless otherwise noted) notes 1: the total output current is the sum of all the currents flowing through all the applicable ports. the total average current is an average value mea- sured over 100 ms. the total peak current is the peak value of all the currents. 2: the peak output current is the peak current flowing in each port. 3: the average output current is average value measured over 100 ms.
3-13 appendix 3.1 electrical characteristics 38C3 group users manual table 3.1.17 recommended operating conditions (m version) (vcc = 2.2 to 5.5 v, ta = C20 to 85c, unless otherwise noted) input frequency (duty cycle 50%) main clock input oscillation frequency (note 4) sub-clock input oscillation frequency (notes 4, 5) f(cntr 0 ) f(cntr 1 ) f(x in ) f(x cin ) limits mhz mhz mhz mhz mhz khz parameter min. typ. 32.768 max. 4.0 (2 5 v cc )C4 8.0 (4 5 v cc )C8 8.0 50 symbol unit (4.0 v v cc 5.5 v) (2.2 v v cc 4.0 v) high-speed mode (4.0 v v cc 5.5 v) high-speed mode (2.2 v v cc 4.0 v) middle-speed mode notes 4: when the oscillation frequency has a duty cycle of 50%. 5: when using the microcomputer in low-speed mode, set the sub-clock input oscillation frequency on condition that f(x cin ) < f(x in )/3.
3-14 38C3 group users manual appendix 3.1 electrical characteristics i oh = C2.0 ma i oh = C0.6 ma v cc = 2.5 v i oh = C5 ma i oh = C1.25 ma i oh = C1.25 ma v cc = 2.5 v i ol = 2.5 ma i ol = 1.25 ma i ol = 1.25 ma v cc = 2.5 v i ol = 5.0 ma i ol = 2.5 ma i ol = 2.5 ma v cc = 2.5 v i ol = 15 ma reset: v cc = 2.2 v C 5.5 v v i = v cc pull-down off v cc = 5.0 v, v i = v cc pull-down on v cc = 3.0 v, v i = v cc pull-down on v i = v cc v i = v cc v i = v cc v i = v ss pull-up off v cc = 5.0 v, v i = v ss pull-up on v cc = 3.0 v, v i = v ss pull-up on v i = v ss v i = v ss h output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p3 0 Cp3 7 h output voltage p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1, (note) p8 0 Cp8 7 l output voltage p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7, p3 0 Cp3 7 l output voltage p4 0 Cp4 7 , p5 2 Cp5 7, p6 0 Cp6 7 , p7 0 , p7 1 (note) l output voltage p8 0 Cp8 7 , p5 0 hysteresis int 0 Cint 2 , cntr 0 , cntr 1 , p8 0 Cp8 7 hysteresis s clk1 , s in hysteresis reset h input current p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 h input current p4 0 Cp4 7 , p5 0 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 h input current reset h input current x in l input current p0 0 Cp0 7 , p1 0 Cp1 7 , p2 0 Cp2 7 , p5 1 l input current p4 0 Cp4 7 , p5 0 , p5 2 Cp5 7 , p6 0 Cp6 7 , p7 0 , p7 1 , p8 0 Cp8 7 l input current reset l input current x in limits v v v v v v v v v v v v v v v m a m a m a m a m a m a m a m a m a m a m a m a parameter min. v cc C2.0 v cc C1.0 v cc C2.0 v cc C0.5 v cc C1.0 30 6.0 C30 C6 ty p. 0.5 0.5 0.5 70 25 4.0 C70 C25 C4 max. 2.0 0.5 1.0 2.0 0.5 1.0 2.0 5.0 140 45 5.0 5.0 C5.0 C5.0 C140 C45 C5 symbol unit test conditions v oh v oh v ol v ol v ol v t+ Cv t- v t+ Cv t- v t+ Cv t- i ih i ih i ih i ih i il i il i il i il note: when 1 is set to the port x c switch bit (bit 4 of address 003b 16 ) of the cpu mode register, the drive ability of port p7 1 is different from the value above mentioned. 3.1.8 electrical characteristics (m version) table 3.1.18 electrical characteristics (m version) (vcc = 4.0 to 5.5 v, ta = C20 to 85c, unless otherwise noted)
3-15 appendix 3.1 electrical characteristics 38C3 group users manual ram hold voltage power source current limits parameter min. 2.0 ty p. 6.4 1.6 15 4.5 0.1 max. 5.5 13 3.2 22 9.0 1.0 10 symbol unit when clock is stopped high-speed mode, vcc = 5 v f(x in ) = 8 mhz f(x cin ) = 32.768 khz output transistors off, a-d converter in operating high-speed mode, vcc = 5 v f(x in ) = 8 mhz (in wit state) f(x cin ) = 32.768 khz output transistors off, a-d converter stopped low-speed mode, v cc = 3 v, ta 55 c f(x in ) = stopped f(x cin ) = 32.768 khz output transistors off low-speed mode, v cc = 3 v, ta = 25 c f(x in ) = stopped f(x cin ) = 32.768 khz (in wit state) output transistors off all oscillation stopped (in stp state) output transistors off test conditions v ram i cc v ma ma m a m a m a m a ta = 25 c ta = 85 c table 3.1.19 electrical characteristics (m version) (vcc = 2.2 to 5.5 v, ta = C20 to 85c, unless otherwise noted)
3-16 38C3 group users manual appendix 3.1 electrical characteristics 3.1.9 a-d converter characteristics (m version) table 3.1.20 a-d converter characteristics (m version) (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, 4 mhz f(x in ) 8 mhz, in middle-speed/high-speed mode) resolution absolute accuracy (excluding quantization error) conversion time reference input current analog port input current ladder resistor unit bits lsb tc( f ) m a m a k w limits parameter min. 61 50 ty p. 1 150 0.5 35 max. 10 2.5 62 200 5.0 symbol v cc = v ref = 5.12 v v ref = 5 v test conditions t conv iv ref i ia r ladder
3-17 appendix 3.1 electrical characteristics 38C3 group users manual t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (s in -s clk ) t h (s clk -s in ) reset input l pulse width main clock input cycle time (x in input) main clock input h pulse width main clock input l pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input h pulse width cntr 0 , cntr 1 input l pulse width int 0 Cint 2 input h pulse width int 0 Cint 2 input l pulse width serial i/o clock input cycle time serial i/o clock input h pulse width serial i/o clock input l pulse width serial i/o input setup time serial i/o input hold time t w (reset) t c (x in ) t wh (x in ) t wl (x in ) t c (cntr) t wh (cntr) t wl (cntr) t wh (int) t wl (int) t c (s clk ) t wh (s clk ) t wl (s clk ) t su (s in -s clk ) t h (s clk -s in ) limits m s ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 125 45 40 250 105 105 80 80 800 370 370 220 100 typ. max. symbol unit limits m s ns ns ns ns ns ns ns ns ns ns ns ns ns parameter min. 2 125 45 40 500/(v cc C2) 250/(v cc C2)C20 250/(v cc C2)C20 230 230 2000 950 950 400 200 typ. max. symbol unit reset input l pulse width main clock input cycle time (x in input) main clock input h pulse width main clock input l pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input h pulse width cntr 0 , cntr 1 input l pulse width int 0 Cint 2 input h pulse width int 0 Cint 2 input l pulse width serial i/o clock input cycle time serial i/o clock input h pulse width serial i/o clock input l pulse width serial i/o input setup time serial i/o input hold time table 3.1.22 timing requirements 2 (m version) (vcc = 2.2 to 4.0 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) 3.1.10 timing requirements and switching characteristics (m version) table 3.1.21 timing requirements 1 (m version) (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted)
3-18 38C3 group users manual appendix 3.1 electrical characteristics t wh (s clk ) t wl (s clk ) t d (s clk -s out ) t v (s clk -s out ) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) t wh (s clk ) t wl (s clk ) t d (s clk -s out ) t v (s clk -s out ) t r (s clk ) t f (s clk ) t r (cmos) t f (cmos) limits parameter min. t c (s clk )/2C30 t c (s clk )/2C30 C30 ty p. 10 10 max. 140 30 30 30 30 symbol unit ns ns ns ns ns ns ns ns notes 1: when the p-channel output disable bit (bit 7 of address 0019 16 ) is 0. 2: the x out , x cout pins are excluded. serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time (note 1) serial i/o output valid time (note 1) serial i/o clock output rising time serial i/o clock output falling time cmos output rising time (note 2) cmos output falling time (note 2) table 3.1.23 switching characteristics 1 (m version) (vcc = 4.0 to 5.5 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) limits ns ns ns ns ns ns ns ns parameter min. t c (s clk )/2C50 t c (s clk )/2C50 C30 ty p. 20 20 max. 350 50 50 50 50 symbol unit serial i/o clock output h pulse width serial i/o clock output l pulse width serial i/o output delay time (note 1) serial i/o output valid time (note 1) serial i/o clock output rising time serial i/o clock output falling time cmos output rising time (note 2) cmos output falling time (note 2) table 3.1.24 switching characteristics 2 (m version) (vcc = 2.2 to 4.0 v, vss = 0 v, ta = C20 to 85c, unless otherwise noted) notes 1: when the p-channel output disable bit (bit 7 of address 0019 16 ) is 0. 2: the x out , x cout pins are excluded. fig. 3.1.1 circuit for measuring output switching characteristics measurement output pin 100 pf cmos output measurement output pin 100 pf n-channel open-drain output 1 k w note: when bit 7 of the serial i/o control register 1 (address 0019 16 ) is ?1.? (n-channel open-drain output mode)
3-19 appendix 3.1 electrical characteristics 38C3 group users manual fig. 3.1.2 timing chart 0.2v cc t d (s clk -s out ) t f 0.2v cc 0.8v cc 0.8v cc t r t su (s in -s clk )t h (s clk -s in ) t v (s clk -s out ) t c (s clk ) t wl (s clk ) t wh (s clk ) s out s in s clk 0.2v cc t wl (x in ) 0.8v cc t wh (x in ) t c (x in ) x in 0.2v cc 0.8v cc t w (reset) reset 0.2v cc t wl (cntr) 0.8v cc t wh (cntr) t c (cntr) 0.2v cc t wl (int) 0.8v cc t wh (int) cntr 0 ,cntr 1 int 0 ?int 2
3-20 38C3 group user's manual appendix 3.2 standard characteristics 3.2 standard characteristics 3.2.1 power source current standard characteristics fig. 3.2.1 power source current standard characteristics fig. 3.2.2 power source current standard characteristics (in wait mode) 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 024681012 rectangular waveform input measuring conditions: 25 c, f(x cin ) = 32.768 khz, at a-d converter operating, in high-speed mode vcc = 5.5 v vcc = 5.0 v vcc = 4.0 v frequency f(x in ) (mhz) power source current (ma) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 024681012 rectangular waveform input measuring conditions: 25 c, f(x cin ) = 32.768 khz, at a-d conversion completed, in high-speed mode frequency f(x in ) (mhz) power source current (ma) vcc = 5.5 v vcc = 5.0 v vcc = 4.0 v
38C3 group user's manual appendix 3-21 3.2 standard characteristics 3.2.2 port standard characteristics fig. 3.2.3 cmos output port (p0, p1, p2, p3) p-channel side characteristics (25 c) fig. 3.2.4 cmos output port (p0, p1, p2, p3) p-channel side characteristics (90 c) -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 0123456 port p0 0 i oh ? oh characteristics (25 c) (same characteristics pins: p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 ?3 7 ) i oh (ma) v oh (v) vcc = 5.5 v vcc = 2.5 v vcc = 5.0 v -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 0123456 port p0 0 i oh ? oh characteristics (90 c) (same characteristics pins: p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 ?3 7 ) i oh (ma) v oh (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v
3-22 38C3 group user's manual appendix 3.2 standard characteristics fig. 3.2.5 cmos output port (p0, p1, p2, p3) p-channel side characteristics (25 c) fig. 3.2.6 cmos output port (p0, p1, p2, p3) n-channel side characteristics (90 c) 0 10 20 30 40 50 60 70 80 90 100 0123456 port p0 0 i ol ? ol characteristics (25 c) (same characteristics pins: p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 ?3 7 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v 0 10 20 30 40 50 60 70 80 90 100 0123456 port p0 0 i ol ? ol characteristics (90 c) (same characteristics pins: p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 0 ?3 7 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v
38C3 group user's manual appendix 3-23 3.2 standard characteristics fig. 3.2.7 cmos output port (p4, p5 0 , p5 2 Cp5 7 , p6, p7 0 , p7 1 , p8) p-channel side characteristics (25 c) fig. 3.2.8 cmos output port (p4, p5 0 , p5 2 Cp5 7 , p6, p7 0 , p7 1 , p8) p-channel side characteristics (90 c) -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 0123456 port p4 0 i oh ? oh characteristics (25 c) (same characteristics pins: p4 0 ?4 7 , p5 0 , p5 2 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 , p8 0 ?8 7 ) i oh (ma) v oh (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 0123456 port p4 0 i oh ? oh characteristics (90 c) (same characteristics pins: p4 0 ?4 7 , p5 0 , p5 2 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 , p8 0 ?8 7 ) i oh (ma) v oh (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v
3-24 38C3 group user's manual appendix 3.2 standard characteristics fig. 3.2.9 cmos output port (p4, p5 2 Cp5 7 , p6, p7 0 , p7 1 ) n-channel side characteristics (25 c) fig. 3.2.10 cmos output port (p4, p5 2 Cp5 7 , p6, p7 0 , p7 1 ) n-channel side characteristics (90 c) 0 10 20 30 40 50 60 70 80 90 100 0123456 port p4 0 i ol ? ol characteristics (25 c) (same characteristics pins: p4 0 ?4 7 , p5 2 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v 0 10 20 30 40 50 60 70 80 90 100 0123456 port p4 0 i ol ? ol characteristics (90 c) (same characteristics pins: p4 0 ?4 7 , p5 2 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v
38C3 group user's manual appendix 3-25 3.2 standard characteristics fig. 3.2.11 cmos output port (p5 0 , p8) n-channel side characteristics (25 c) fig. 3.2.12 cmos output port (p5 0 , p8) n-channel side characteristics (90 c) 0 10 20 30 40 50 60 70 80 90 100 0123456 port p8 0 i ol ? ol characteristics (25 c) (same characteristics pins: p8 0 ?8 7 , p5 0 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v 0 10 20 30 40 50 60 70 80 90 100 0123456 port p8 0 i ol ? ol characteristics (90 c) (same characteristics pins: p8 0 ?8 7 , p5 0 ) i ol (ma) v ol (v) vcc = 2.5 v vcc = 5.0 v vcc = 5.5 v
3-26 appendix 38C3 group users manual 3.3 notes on use 3.3 notes on use 3.3.1 notes on interrupts (1) switching external interrupt detection edge for the products able to switch the external interrupt detection edge, switch it as the following sequence. clear an interrupt enable bit to 0 (interrupt disabled) switch the detection edge clear an interrupt request bit to 0 (no interrupt request issued) set the interrupt enable bit to 1 (interrupt enabled) clear the interrupt request bit to 0 (no interrupt issued) nop (one or more instructions) execute the bbc or bbs instruction data transfer instruction: ldm, lda, sta, stx, and sty instructions fig. 3.3.2 sequence of check of interrupt request bit fig. 3.3.1 sequence of switch detection edge n reason the interrupt circuit recognizes the switching of the detection edge as the change of external input signals. this may cause an unnecessary interrupt. (2) check of interrupt request bit l when executing the bbc or bbs instruction to an interrupt request bit of an interrupt request register immediately after this bit is set to 0 by using a data transfer instruction, execute one or more instructions before executing the bbc or bbs instruction. n reason if the bbc or bbs instruction is executed immediately after an interrupt request bit of an interrupt request register is cleared to 0, the value of the interrupt request bit before being cleared to 0 is read.
38C3 group users manual 3-27 appendix 3.3 notes on use (3) structure of interrupt control register 2 fix the bit 7 of the interrupt control register 2 to 0. figure 3.3.3 shows the structure of the interrupt control register 2. fig. 3.3.3 structure of interrupt control register 2 b7 b0 interrupt control register 2 address 003f 16 interrupt enable bits not used fix this bit to ?? 0 3.3.2 notes on timer a (pwm mode and igbt output mode) (1) when timer starts first or last value of compare register is 0000 16 after l level (timer a output active edge switch bit is 0; when starting from l output) is output during 2 cycles (until timer underflows two times), start pwm output or igbt output. reason: when data is written to timer a and compare register, value of timer a and value of compare register are renewed at timer underflow. in case of this, compare register value and timer value are compared before renewal so that they are judged to be equal, and ta out output becomes l. (timer a output switch bit = 0: when starting from l output) timer a underflow should be h output, but the match have the priority. (see figure 3.3.4 ) fig. 3.3.4 pwm output and igbt output (1) t i m e r a s t a r tt i m e r a u n d e r f l o w c o m p a r e r e g i s t e r v a l u e i s 0 0 0 0 1 6 ( l a s t v a l u e o r i n i t i a l v a l u e ) c o m p a r e r e g i s t e r v a l u e i s v a l u e w h i c h i s w r i t t e n a t t i m e r a u n d e r f l o wt i m e r a u n d e r f l o w t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g
3-28 appendix 38C3 group users manual 3.3 notes on use (2) when compare register is set to 0000 16 (last value is except 0000 16 ) next 1 cycle of the cycle which data is written to timer a and compare register is output h, and l is output from the next cycle. (timer a output switch bit = 0: when starting from l output) (see figure 3.3.5 ) fig. 3.3.5 pwm output and igbt output (2) (3) when timer a and compare register are same value ta out output becomes h with underflow immediately after data is written to timer a and compare register. and ta out output becomes l when timer a is reloaded and the value matches with compare register. this h output width becomes 1 count of timer a count source. (timer a output switch bit =0: when starting from l output) (see figure 3.3.6 ) fig. 3.3.6 pwm output and igbt output (3) t i m e r a u n d e r f l o w c o m p a r e r e g i s t e r v a l u e i s 0 0 0 0 1 6 t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g c o m p a r e r e g i s t e r v a l u e i s l a s t v a l u e t i m e r a u n d e r f l o wt i m e r a u n d e r f l o wt i m e r a u n d e r f l o w t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e t i m e r a c o u n t s o u r c e 1 c o u n t w i d t h t i m e r a u n d e r f l o wt i m e r a u n d e r f l o w t i m e r a v a l u e c o m p a r e r e g i s t e r v a l u e w r i t i n g
38C3 group users manual 3-29 appendix 3.3 notes on use 3.3.3 notes on serial i/o (1) selecting external synchronous clock when an external synchronous clock is selected, the contents of serial i/o register are being shifted continually while the transfer clock is input to the serial i/o1 clock pin. in this case, control the clock externally. (2) transmission data writing when an external clock is used as the synchronous clock, write the transmit data to the serial i/o shift register at h level of transfer clock input. 3.3.4 notes on lcd controller l when switching from the high-speed or middle-speed mode to the low-speed mode, switch the mode in the following order: (1) 32 khz oscillation selected (bit 4 of cpu mode register (address 003b 16 ) = 1) (2) count source for lcdck = f(x cin )/32 (bit 7 of lcd mode register (address 0039 16 ) = 0) (3) internal system clock: x cin -x cout selected (bit 7 of cpu mode register (address 003b 16 ) = 1) (4) main clock x in Cx out stopped (bit 5 of cpu mode register (address 003b 16 ) = 1) execute the setting (2) after the oscillation at 32 khz (setting (1)) becomes completely stable. l if the stp instruction is executed while the lcd is turned on by setting bit 3 of the lcd mode register (address 0039 16 ) to 1, a dc voltage is applied to the lcd. for this reason, do not execute the stp instruction while the lcd is lighting. l when the lcd is not used, open the segment and the common pins. connect v l1 to v l3 to v ss . l for the following products, if the lcd enable bit of the lcd mode register (bit 3 of address 0039 16 ) is set to 0, all lcds cannot be turned off. when all lcds are turned off, set 0 (turn off) to all corresponding lcd display ram. corresponding products: m38C34m6axxxfp, m38C34m6mxxxfp, m38C37ecaxxxfp, m38C37ecmxxxfp, m38C37ecafp, m38C37ecmfp, m38C37ecafs, m38C3ecmfs, m38C37rfs, m38C37rmfs
3-30 appendix 38C3 group users manual 3.3 notes on use 3.3.5 notes on a-d converter (1) analog input pin n make the signal source impedance for analog input low, or equip an analog input pin with an external capacitor of 0.01 m f to 1 m f. further, be sure to verify the operation of application products on the user side. l reason an analog input pin includes the capacitor for analog voltage comparison. accordingly, when signals from signal source with high impedance are input to an analog input pin, charge and discharge noise generates. this may cause the a-d conversion precision to be worse. (2) a-d converter power source pin the av ss pin is a-d converter power source pin. regardless of using the a-d conversion function or not, connect it as following : ? av ss : connect to the v ss line. l reason if the av ss pin is opened, the microcomputer may have a failure because of noise or others. (3) clock frequency during a-d conversion the comparator consists of a capacity coupling, and a charge of the capacity will be lost if the clock frequency is too low. thus, make sure the following during an a-d conversion. ? f(x in ) is 500 khz or more. ? use clock divided by main clock (f(x in )) as internal system clock. ? do not execute the stp instruction and wit instruction. 3.3.6 notes on reset circuit (1) reset input voltage control make sure that the reset input voltage is 0.5 v or less for vcc of 2.5 v (note) . perform switch to the high-speed mode when power source voltage is within 4.0 to 5.5 v. note: m version of mask rom version is 2.2 v. (2) countermeasure when reset signal rise time is long in case where the reset signal rise time is long, connect a ceramic capacitor or others across the reset pin and the v ss pin. and use a 1000 pf or more capacitor for high frequency use. when connecting the capacitor, note the following : ? make the length of the wiring which is connected to a capacitor as short as possible. ? be sure to verify the operation of application products on the user side. l reason if the several nanosecond or several ten nanosecond impulse noise enters the reset pin, it may cause a microcomputer failure.
38C3 group users manual 3-31 appendix 3.4 countermeasures against noise fig. 3.4.2 wiring for the reset pin 3.4 countermeasures against noise countermeasures against noise are described below. the following countermeasures are effective against noise in theory, however, it is necessary not only to take measures as follows but to evaluate before actual use. 3.4.1 shortest wiring length the wiring on a printed circuit board can function as an antenna which feeds noise into the microcomputer. the shorter the total wiring length (by mm unit), the less the possibility of noise insertion into a microcomputer. (1) package select the smallest possible package to make the total wiring length short. l reason the wiring length depends on a microcomputer package. use of a small package, for example qfp and not dip, makes the total wiring length short to reduce influence of noise. fig. 3.4.1 selection of packages (2) wiring for reset pin make the length of wiring which is connected to the reset pin as short as possible. especially, connect a capacitor across the reset pin and the v ss pin with the shortest possible wiring (within 20mm). l reason the width of a pulse input into the reset pin is determined by the timing necessary conditions. if noise having a shorter pulse width than the standard is input to the reset pin, the reset is released before the internal state of the microcomputer is completely initialized. this may cause a program runaway. dip sdip sop qfp reset reset circuit noise v ss v ss reset circuit v ss reset v ss n.g. o.k.
3-32 appendix 38C3 group users manual 3.4 countermeasures against noise (3) wiring for clock input/output pins ? make the length of wiring which is connected to clock i/o pins as short as possible. ? make the length of wiring (within 20 mm) across the grounding lead of a capacitor which is connected to an oscillator and the v ss pin of a microcomputer as short as possible. ? separate the v ss pattern only for oscillation from other v ss patterns. l reason if noise enters clock i/o pins, clock waveforms may be deformed. this may cause a program failure or program runaway. also, if a potential difference is caused by the noise between the v ss level of a microcomputer and the v ss level of an oscillator, the correct clock will not be input in the microcomputer. fig. 3.4.3 wiring for clock i/o pins noise x in x out v ss x in x out v ss n.g. o.k.
38C3 group users manual 3-33 appendix 3.4 countermeasures against noise (4) wiring to v pp pin of one time prom version and eprom version connect an approximately 5 k w resistor to the v pp pin the shortest possible in series. when not connecting the resistor, make the length of wiring between the v pp pin and the v ss pin the shortest possible. note: even when a circuit which included an approximately 5 k w resistor is used in the mask rom version, the microcomputer operates correctly. l reason the v pp pin of the one time prom and the eprom version is the power source input pin for the built-in prom. when programming in the built-in prom, the impedance of the v pp pin is low to allow the electric current for writing flow into the prom. because of this, noise can enter easily. if noise enters the v pp pin, abnormal instruction codes or data are read from the built-in prom, which may cause a program runaway. fig. 3.4.4 wiring for the v pp pin of the one time prom and the eprom version 3.4.2 connection of bypass capacitor across v ss line and v cc line connect an approximately 0.1 m f bypass capacitor across the v ss line and the v cc line as follows: ? connect a bypass capacitor across the v ss pin and the v cc pin at equal length. ? connect a bypass capacitor across the v ss pin and the v cc pin with the shortest possible wiring. ? use lines with a larger diameter than other signal lines for v ss line and v cc line. ? connect the power source wiring via a bypass capacitor to the v ss pin and the v cc pin. fig. 3.4.5 bypass capacitor across the v ss line and the v cc line p5 1 /v pp reset approximately 5 k w v ss v cc aa aa aa aa aa aa v ss v cc aa aa aa aa aa aa aa aa aa n.g. o.k.
3-34 appendix 38C3 group users manual 3.4 countermeasures against noise 3.4.3 wiring to analog input pins ? connect an approximately 100 w to 1 k w resistor to an analog signal line which is connected to an analog input pin in series. besides, connect the resistor to the microcomputer as close as possible. ? connect an approximately 1000 pf capacitor across the v ss pin and the analog input pin. besides, connect the capacitor to the v ss pin as close as possible. also, connect the capacitor across the analog input pin and the v ss pin at equal length. l reason signals which is input in an analog input pin (such as an a-d converter/comparator input pin) are usually output signals from sensor. the sensor which detects a change of event is installed far from the printed circuit board with a microcomputer, the wiring to an analog input pin is longer necessarily. this long wiring functions as an antenna which feeds noise into the microcomputer, which causes noise to an analog input pin. if a capacitor between an analog input pin and the v ss pin is grounded at a position far away from the v ss pin, noise on the gnd line may enter a microcomputer through the capacitor. fig. 3.4.6 analog signal line and a resistor and a capacitor 3.4.4 oscillator concerns take care to prevent an oscillator that generates clocks for a microcomputer operation from being affected by other signals. (1) keeping oscillator away from large current signal lines install a microcomputer (and especially an oscillator) as far as possible from signal lines where a current larger than the tolerance of current value flows. l reason in the system using a microcomputer, there are signal lines for controlling motors, leds, and thermal heads or others. when a large current flows through those signal lines, strong noise occurs because of mutual inductance. fig. 3.4.7 wiring for a large current signal line analog input pin v ss noise thermistor microcomputer n.g. o.k. (note) note : the resistor is used for dividing resistance with a thermistor. x in x out v ss m microcomputer mutual inductance large current gnd
38C3 group users manual 3-35 appendix 3.4 countermeasures against noise (2) installing oscillator away from signal lines where potential levels change frequently install an oscillator and a connecting pattern of an oscillator away from signal lines where potential levels change frequently. also, do not cross such signal lines over the clock lines or the signal lines which are sensitive to noise. l reason signal lines where potential levels change frequently (such as the cntr pin signal line) may affect other lines at signal rising edge or falling edge. if such lines cross over a clock line, clock waveforms may be deformed, which causes a microcomputer failure or a program runaway. fig. 3.4.8 wiring of signal lines where potential levels change frequently (3) oscillator protection using v ss pattern as for a two-sided printed circuit board, print a v ss pattern on the underside (soldering side) of the position (on the component side) where an oscillator is mounted. connect the v ss pattern to the microcomputer v ss pin with the shortest possible wiring. besides, separate this v ss pattern from other v ss patterns. fig. 3.4.9 v ss pattern on the underside of an oscillator x in x out v ss cntr do not cross n.g. aaa aaa aaa aaa a a a aaa a a a a a aa aa x in x out v ss an example of v ss patterns on the underside of a printed circuit board oscillator wiring pattern example separate the v ss line for oscillation from other v ss lines
3-36 appendix 38C3 group users manual 3.4 countermeasures against noise fig. 3.4.10 setup for i/o ports 3.4.5 setup for i/o ports setup i/o ports using hardware and software as follows: ? connect a resistor of 100 w or more to an i/o port in series. ? as for an input port, read data several times by a program for checking whether input levels are equal or not. ? as for an output port, since the output data may reverse because of noise, rewrite data to its port latch at fixed periods. ? rewrite data to direction registers and pull-up control registers at fixed periods. note: when a direction register is set for input port again at fixed periods, a several-nanosecond short pulse may be output from this port. if this is undesirable, connect a capacitor to this port to remove the noise pulse. direction register port latch data bus i/o port pins noise noise n.g. o.k.
38C3 group users manual 3-37 appendix 3.4 countermeasures against noise 3.4.6 providing of watchdog timer function by software if a microcomputer runs away because of noise or others, it can be detected by a software watchdog timer and the microcomputer can be reset to normal operation. this is equal to or more effective than program runaway detection by a hardware watchdog timer. the following shows an example of a watchdog timer provided by software. in the following example, to reset a microcomputer to normal operation, the main routine detects errors of the interrupt processing routine and the interrupt processing routine detects errors of the main routine. this example assumes that interrupt processing is repeated multiple times in a single main routine processing. ? assigns a single byte of ram to a software watchdog timer (swdt) and writes the initial value n in the swdt once at each execution of the main routine. the initial value n should satisfy the following condition: n+1 3 ( counts of interrupt processing executed in each main routine) as the main routine execution cycle may change because of an interrupt processing or others, the initial value n should have a margin. ? watches the operation of the interrupt processing routine by comparing the swdt contents with counts of interrupt processing after the initial value n has been set. ? detects that the interrupt processing routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents do not change after interrupt processing. ? decrements the swdt contents by 1 at each interrupt processing. ? determines that the main routine operates normally when the swdt contents are reset to the initial value n at almost fixed cycles (at the fixed interrupt processing count). ? detects that the main routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents are not initialized to the initial value n but continued to decrement and if they reach 0 or less. fig. 3.4.11 watchdog timer by software main routine (swdt) ? n cli main processing (swdt) interrupt processing routine errors n interrupt processing routine (swdt) ? (swdt)? interrupt processing (swdt) main routine errors > 0 0 rti return =n? 0? 1 n
3-38 appendix 38C3 group users manual 3.5 control registers 3.5 control registers fig. 3.5.1 structure of port pi fig. 3.5.2 structure of port p0 direction register and port p1 direction register port pi b7 b6 b5 b4 b3 b2 b1 b0 port pi (i = 0, 1, 2, 3, 4, 5, 6, 8) (pi: addresses 00 16 , 02 16 , 04 16 , 06 16 , 08 16 , 0a 16 , 0c 16 , 10 16 ) b 0 0 port pi 0 l in output mode write port latch read port latch l in input mode write port latch read value of pin port pi 1 port pi 2 port pi 3 port pi 4 port pi 5 port pi 6 port pi 7 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 port p0 direction register, port p1 direction register b7 b6 b5 b4 b3 b2 b1 b0 port p0 direction register (p0d: address 01 16 ) port p1 direction register (p1d: address 03 16 ) b 0 name 0 functions at reset r w 0 0 0 0 0 ports p0/p1 direction register 0 0 55 55 0 55 55 55 55 5 5 5 nothing is arranged for these bits. when these bits are read out, the contents are undefined. 2 3 4 5 6 7 1 0 : all bits of ports p0/p1 input mode 1 : all bits of ports p0/p1 output mode note: ports p0 and p1 are switched to input and output by each port. when b0 of corresponding port direction register is set to ?? all 8 bits of port become input port. when b0 of corresponding port direction register is set to ?? all 8 bits of port become output port. nothing is arranged for b1 to b7 of port p0 and port p1 direction registers. these are write disabled bits.
38C3 group users manual 3-39 appendix 3.5 control registers fig. 3.5.3 structure of port pi direction register port pi direction register b7 b6 b5 b4 b3 b2 b1 b0 port pi direction register (i = 2, 4, 5, 6, 8) (pid: addresses 05 16 , 09 16 , 0b 16 , 0d 16 , 11 16 ) 0 : port pi 0 input mode 1 : port pi 0 output mode b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 : port pi 2 input mode 1 : port pi 2 output mode 0 0 : port pi 3 input mode 1 : port pi 3 output mode 0 0 : port pi 4 input mode 1 : port pi 4 output mode 0 0 : port pi 5 input mode 1 : port pi 5 output mode 0 0 : port pi 6 input mode 1 : port pi 6 output mode 0 0 : port pi 7 input mode 1 : port pi 7 output mode 0 port pi direction register note: bit 1 of the port p5 direction register (address 0b 16 ) does not have direction register function, because p5 1 is an input port. when writing to bit 1 of the port p5 direction register, write ??to the bit. 0 : port pi 1 input mode 1 : port pi 1 output mode (note) fig. 3.5.4 structure of port p7 port p7 b7 b6 b5 b4 b3 b2 b1 b0 port p7 (p7: address 0e 16 ) b 0 0 port p7 0 l in output mode write port latch read port latch l in input mode write port latch read value of pin port p7 1 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 55 55 55 55 55 55 nothing is arranged for these bits. when these bits are read out, the contents are undefined.
3-40 appendix 38C3 group users manual 3.5 control registers fig. 3.5.6 structure of pull register a fig. 3.5.5 structure of port p7 direction register port p7 direction register b7 b6 b5 b4 b3 b2 b1 b0 port p7 direction register (p7d: address 0f 16 ) 0 : port p7 0 input mode 1 : port p7 0 output mode b 0 1 2 3 4 5 name 0 functions at reset r w 0 : port p7 1 input mode 1 : port p7 1 output mode 0 0 0 0 0 port p7 direction register 6 0 7 0 55 55 55 55 55 5 5 5 5 nothing is arranged for these bits. when these bits are read out, the contents are undefined. b7 b6 b5 b4 b3 b2 b1 b0 pull register a (pulla: address 16 16 ) 0: no pull-down control 1: pull-down control b 0 1 2 3 4 7 name functions at reset r w 0: no pull-down control 1: pull-down control 0: no pull-down control 1: pull-down control 0 0 1 1 1 1 port p0 0 ?0 7 pull-down control port p1 0 ?1 7 pull-down control port p2 0 ?2 7 pull-down control port p7 0 , p7 1 pull-up control port p8 0 ?8 7 pull-up control nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 0 0 5 6 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control note: the pin which is set to output port is cut off from pull-up control. pull register a
38C3 group users manual 3-41 appendix 3.5 control registers fig. 3.5.7 structure of pull register b pull register b b7 b6 b5 b4 b3 b2 b1 b0 pull register b (pullb: address 17 16 ) 0: no pull-up control 1: pull-up control b 0 1 2 3 4 7 name functions at reset r w 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control 0 0 0 0 0 0 port p4 0 ?4 3 pull-up control port p4 4 ?4 7 pull-up control port p6 0 ?6 3 pull-up control port p5 4 ?5 7 pull-up control port p5 0 , p5 2 , p5 3 pull-up control port p6 4 ?6 7 pull-up control nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 0 0 5 6 0: no pull-up control 1: pull-up control 0: no pull-up control 1: pull-up control note: the pin which is set to output port is cut off from pull-up control. 0: no pull-up control 1: pull-up control
3-42 appendix 38C3 group users manual 3.5 control registers fig. 3.5.8 structure of port p8 output selection register port p8 output selection register b7 b6 b5 b4 b3 b2 b1 b0 port p8 output selection register (p8sel: address 18 16 ) b 0 name functions at reset r w 0 port p8 output selection register 0 0 0 0 0 0 0 1 2 3 4 7 5 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) 6
38C3 group users manual 3-43 appendix 3.5 control registers fig. 3.5.9 structure of serial i/o control register 1 serial i/o control register 1 b7 b6 b5 b4 b3 b2 b1 b0 serial i/o control register 1 (siocon1: address 19 16 ) b 0 name 0 functions at reset r w 0 0 1 2 0 3 serial i/o port selection bit (p4 0 , p4 5 , p4 6 ) 4 0 s rdy output selection bit (p4 7 ) 0: i/o port 1: s rdy signal pin 0: lsb first 1: msb first 0: external clock 1: internal clock 5 0 transfer direction selection bit 7 6 0 synchronous clock selection bit p-channel output disable bit (p4 0 , p4 5 , p4 6 ) 0: i/o port 1: s out , s clk1 , s clk2 signal pin 0 0 0: f(x in )/8 or f(x cin )/8 0 0 1: f(x in )/16 or f(x cin )/16 0 1 0: f(x in )/32 or f(x cin )/32 0 1 1: f(x in )/64 or f(x cin )/64 1 1 0: f(x in )/128 or f(x cin )/128 1 1 1: f(x in )/256 or f(x cin )/256 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) b2b1b0 internal synchronous clock selection bits 0
3-44 appendix 38C3 group users manual 3.5 control registers fig. 3.5.10 structure of serial i/o control register 2 fig. 3.5.11 structure of serial i/o register serial i/o control register 2 b7 b6 b5 b4 b3 b2 b1 b0 serial i/o control register 2 (siocon2: address 1a 16 ) b 0 0 synchronous clock output pin selection bit 0: s clk1 1: s clk2 functions name at reset r w 1 0 2 0 3 0 4 0 5 0 6 0 7 0 5 5 5 5 5 5 5 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? serial i/o register b7 b6 b5 b4 b3 b2 b1 b0 serial i/o register (sio: address 1b 16 ) b 0 1 2 3 4 5 6 7 name undefined functions at reset r w undefined undefined undefined undefined undefined undefined undefined this register becomes shift register. set transmit data to this register. the serial transfer is started by writing the transmit data. serial i/o register
38C3 group users manual 3-45 appendix 3.5 control registers fig. 3.5.13 structure of timer 2 fig. 3.5.12 structure of timer i timer i b7 b6 b5 b4 b3 b2 b1 b0 timer i (i = 1, 3, 4, 5, 6) (ti: addresses 20 16 , 22 16 , 23 16 , 24 16 , 25 16 ) b 0 1 at reset r w 1 2 3 4 5 6 7 functions ?set timer i count value. ?the value set in this register is written to both the timer i and the timer i latch at one time. ?when the timer i is read out, the count value of the timer i is read out. 1 1 1 1 1 1 1 timer 2 b7 b6 b5 b4 b3 b2 b1 b0 timer 2 (t2: address 21 16 ) b 0 1 at reset r w 1 2 3 4 5 6 7 functions ?set timer 2 count value. ?the value set in this register is written to both the timer 2 and the timer 2 latch at one time. ?when the timer 2 is read out, the count value of the timer 2 is read out. 0 0 0 0 0 0 0
3-46 appendix 38C3 group users manual 3.5 control registers fig. 3.5.14 structure of timer 6 pwm register fig. 3.5.15 structure of timer 12 mode register timer 6 pwm register b7 b6 b5 b4 b3 b2 b1 b0 timer 6 pwm register (t6pwm: address 27 16 ) b 0 1 2 3 4 5 6 7 undefined functions at reset r w undefined undefined undefined undefined undefined undefined undefined ?in timer 6 pwm 1 mode ??level width of pwm rectangular waveform is set. ?duty of pwm rectangular waveform: n/(n + m) period: (n + m) ts n = timer 6 set value m = timer 6 pwm register set value ts = timer 6 count source period at n = 0, all pwm output ?? at m = 0, all pwm output ?? (however, n = 0 has priority.) ?selection of timer 6 pwm 1 mode set ??to the timer 6 operation mode selection bit. timer 12 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 12 mode register (t12m: address 28 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0 0: f(x in )/16 or f(x cin )/16 0 1: f(x cin ) 1 0: f(x in )/32 or f(x cin )/32 1 1: f(x in )/128 or f(x cin )/128 0 0 0 0: i/o port 1: timer 1 output 0 0 0 timer 1 count stop bit timer 2 count stop bit timer 2 count source selection bits timer 1 output selection bit (p4 1 ) timer 1 count source selection bits nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b3 b2 b5 b4 0 0: timer 1 underflow 0 1: f(x cin ) 1 0: external count input cntr 0 1 1: not available
38C3 group users manual 3-47 appendix 3.5 control registers fig. 3.5.16 structure of timer 34 mode register fig. 3.5.17 structure of timer 56 mode register timer 34 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 34 mode register (t34m: address 29 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 2 underflow 1 0: f(x in )/32 or f(x cin )/32 1 1: f(x in )/128 or f(x cin )/128 0 0 0 0: i/o port 1: timer 3 output 0 0 timer 3 count stop bit timer 4 count stop bit timer 4 count source selection bits timer 3 output selection bit (p4 2 ) timer 3 count source selection bits nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b3 b2 b5 b4 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 3 underflow 1 0: external count input cntr 1 1 1: not available timer 56 mode register b7 b6 b5 b4 b3 b2 b1 b0 timer 56 mode register (t56m: address 2a 16 ) 0: count operation 1: count stop b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0: count operation 1: count stop 0 0: f(x in )/16 or f(x cin )/16 1: timer 4 underflow 0: timer mode 1: pwm mode 0 0 0 0: i/o port 1: timer 6 output 0 0 0 timer 5 count stop bit timer 6 count stop bit timer 6 count source selection bits timer 6 (pwm) output selection bit (p5 2 ) timer 5 count source selection bit timer 6 operation mode selection bit nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? b5 b4 0 0: f(x in )/16 or f(x cin )/16 0 1: timer 5 underflow 1 0: timer 4 underflow 1 1: not available
3-48 appendix 38C3 group users manual 3.5 control registers fig. 3.5.18 structure of f output control register fig. 3.5.19 structure of timer a register (low-order, high-order) f output control register b7 b6 b5 b4 b3 b2 b1 b0 f output control register (ckout: address 2b 16 ) b 0 0 0 0 0 0 0 0 0 at reset r w 1 2 3 4 5 6 7 functions f output control bit (p4 3 ) 0: port function 1: f clock output nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? name 0 0 0 0 0 0 0 timer a register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 timer a register (low-order, high-order) (tal, tah: addresses 2c 16 , 2d 16 ) b 0 1 2 3 4 5 6 7 1 functions at reset r w 1 1 1 1 1 1 1 ?set timer a count value. ?when the timer a write control bit of the timer a mode register is ?? the value is written to timer a and the latch at one time. when the timer a write control bit of the timer a mode register is ?? the value is written only to the latch. ?the timer a count value is read out by reading this register. notes 1: when reading and writing, perform them to both the high- order and low-order bytes. 2: read both registers in order of tah and tal following. 3: write both registers in order of tal and tah following. 4: do not read both registers during a write, and do not write to both registers during a read.
38C3 group users manual 3-49 appendix 3.5 control registers fig. 3.5.20 structure of compare register (low-order, high-order) fig. 3.5.21 structure of timer a mode register compare register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 compare register (low-order, high-order) (conal, conah: addresses 2e 16 , 2f 16 ) b 0 1 2 3 4 5 6 7 0 functions at reset r w 0 0 0 0 0 0 0 ?set compare register value. note: write registers in order of conah, conal, tal, and tah following. timer a mode register b7 b6 b5 b4 b3 b2 b1 b0 timer a mode register (tam: address 30 16 ) b 0 4 name 0 functions at reset r w timer a operating mode bits timer a write control bit 0 0: timer mode 0 1: pulse output mode 1 0: igbt output mode 1 1: pwm mode 0 0: f(x in ) 0 1: f(x in )/2 1 0: f(x in )/4 1 1: f(x in )/8 0 0 0: write data to both timer latch and timer 1: write data to timer latch 1 timer a count source selection bits 3 0 0 0 0 0 timer a output active edge switch bit timer a count stop bit 0: output starts with ??level 1: output starts with ??level 0: count operating 1: count stop timer a output selection bit (p5 0 ) 0: i/o port 1: timer a output 5 6 7 b1b0 2 b4b3
3-50 appendix 38C3 group users manual 3.5 control registers fig. 3.5.22 structure of timer a control register fig. 3.5.23 structure of a-d control register timer a control register b7 b6 b5 b4 b3 b2 b1 b0 timer a control register (tacon: address 31 16 ) b 0 4 name 0 functions at reset r w noise filter sampling clock selection bit external trigger delay time selection bits 0: f(x in )/2 1: f(x in )/4 0: not used 1: int1 interrupt used 0 0: no delay 0 1: (4/f(x in )) m s 1 0: (8/f(x in )) m s 1 1: (16/f(x in )) m s 0 0 1 timer a output control bit 1 (p5 6 ) 0: not used 1: int2 interrupt used timer a output control bit 2 (p5 7 ) 3 0 0 0 5 6 7 2 b2b1 0 0 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? a-d control register b7 b6 b5 b4 b3 b2 b1 b0 a-d control register (adcon: address 32 16 ) b 0 1 2 name 0 functions at reset r w 0 0 0 analog input pin selection bits b2 b1 b0 0 0 0: p6 0 /an 0 0 0 1: p6 1 /an 1 0 1 0: p6 2 /an 2 0 1 1: p6 3 /an 3 1 0 0: p6 4 /an 4 1 0 1: p6 5 /an 5 1 1 0: p6 6 /an 6 1 1 1: p6 7 /an 7 3 0 ad conversion completion bit 0: conversion in progress 1: conversion completed 4 0 5 0 0 nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? nothing is arranged for this bit. this is write disabled bit. when this bit is read out, the contents are ?? 6 7
38C3 group users manual 3-51 appendix 3.5 control registers fig. 3.5.24 structure of a-d conversion register (low-order) fig. 3.5.25 structure of a-d conversion register (high-order) a-d conversion register (low-order) b7 b6 b5 b4 b3 b2 b1 b0 a-d conversion register (low-order) (adl: address 33 16 ) b 0 0 0 0 0 0 0 0 at reset r w 1 2 3 4 5 6 7 functions undefined undefined undefined undefined undefined undefined undefined undefined nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? these are a-d conversion result (low-order 2 bits) stored bits. this is read exclusive register. note: do not read this register during a-d conversion. a-d conversion register (high-order) b7 b6 b5 b4 b3 b2 b1 b0 a-d conversion register (high-order) (adh: address 34 16 ) b 0 0 0 0 0 0 0 0 at reset r w 1 2 3 4 5 6 7 functions undefined undefined undefined undefined undefined undefined undefined undefined this is a-d conversion result (high-order 8 bits) stored bits. this is read exclusive register. note: do not read this register during a-d conversion.
3-52 appendix 38C3 group users manual 3.5 control registers fig. 3.5.26 structure of segment output enable register fig. 3.5.27 structure of lcd mode register segment output enable register b7 b6 b5 b4 b3 b2 b1 b0 segment output enable register (seg: address 38 16 ) 0: i/o ports p2 0 ?2 3 1: segment output seg 0 ?eg 3 b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 0 segment output enable bit 0 0: i/o ports p2 4 ?2 7 1: segment output seg 4 ?eg 7 segment output enable bit 1 0: i/o ports p0 0 ?0 3 1: segment output seg 8 ?eg 11 segment output enable bit 2 0: i/o ports p0 4 ?0 7 1: segment output seg 12 ?eg 15 segment output enable bit 3 0: i/o ports p1 0 ?1 3 1: segment output seg 16 ?eg 19 segment output enable bit 4 0: i/o ports p1 4 ?1 7 1: segment output seg 20 ?eg 23 segment output enable bit 5 0: output ports p3 0 ?3 3 1: segment output seg 24 ?eg 27 segment output enable bit 6 0: output ports p3 4 ?3 7 1: segment output seg 28 ?eg 31 segment output enable bit 7 lcd mode register b7 b6 b5 b4 b3 b2 b1 b0 lcd mode register (lm: address 39 16 ) b 0 4 name 0 functions at reset r w duty ratio selection bits lcd circuit divider division ratio selection bits lcdck count source selection bit (note) bias control bit 0 0: 1 (use com 0 ) 0 1: 2 (use com 0 , com 1 ) 1 0: 3 (use com 0 ?om 2 ) 1 1: 4 (use com 0 ?om 3 ) 0 0: clock input 0 1: 2 division of clock input 1 0: 4 division of clock input 1 1: 8 division of clock input 0 0 0: 1/3 bias 1: 1/2 bias 0: f(x cin )/32 1: f(x in )/8192 (f(x cin )/8192 in low-speed mode) lcd enable bit fix ??to this bit. 0: lcd off 1: lcd on 1 3 0 0 0 0 0 5 6 7 b1b0 b6b5 2 note: lcdck is a clock for a lcd timing controller. 0
38C3 group users manual 3-53 appendix 3.5 control registers fig. 3.5.29 structure of cpu mode register fig. 3.5.28 structure of interrupt edge selection register interrupt edge selection register b7 b6 b5 b4 b3 b2 b1 b0 interrupt edge selection register (intedge: address 3a 16 ) 0: falling edge active 1: rising edge active b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 0 int 0 interrupt edge selection bit 0: i/o ports p2 4 ?2 7 1: segment output seg 4 ?eg 7 int 1 interrupt edge selection bit 0: i/o ports p0 0 ?0 3 1: segment output seg 8 ?eg 11 int 2 interrupt edge selection bit cntr 0 active edge switch bit cntr 1 active edge switch bit nothing is arranged for these bits. these are write disabled bits. when these bits are read out, the contents are ?? 0: falling edge active, rising edge count 1: rising edge active, falling edge count 0: falling edge active, rising edge count 1: rising edge active, falling edge count cpu mode register b7 b6 b5 b4 b3 b2 b1 b0 cpu mode register (cpum, cm: address 3b 16 ) 00 : single-chip mode 01 : 10 : not available 11 : b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 : page 0 1 : page 1 0 1 0 0: oscillating 1: stopped 0 1 0 processor mode bits stack page selection bit port xc switch bit nothing is arranged for this bit. when this bit is read out, the contents is ?? do not write ??to this bit. main clock (x in - x out ) stop bit main clock division ratio selection bit internal system clock selection bit b1 b0 0: f(x in )/2 (high-speed mode) 1: f(x in )/8 (middle-speed mode) 0: x in ? out selection (middle-/high-speed mode) 1: x cin ? cout selection (low-speed mode) 0: i/o port function 1: x cin -x cout oscillation function
3-54 appendix 38C3 group users manual 3.5 control registers fig. 3.5.30 structure of interrupt request register 1 interrupt request register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 1 (ireq1 : address 3c 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 int 0 interrupt request bit int 1 interrupt request bit serial i/o interrupt request bit timer a interrupt request bit timer 1 interrupt request bit timer 2 interrupt request bit int 2 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued timer 3 interrupt request bit 0 : no interrupt request issued 1 : interrupt request issued 0 ] ] ] ] ] ] ] ] ] : ??can be set by software, but ??cannot be set.
38C3 group users manual 3-55 appendix 3.5 control registers fig. 3.5.31 structure of interrupt request register 2 interrupt request register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt request register 2 (ireq2 : address 3d 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 timer 4 interrupt request bit timer 5 interrupt request bit cntr 0 interrupt request bit cntr 1 interrupt request bit key input interrupt request bit ad conversion interrupt request bit timer 6 interrupt request bit 0 ] ] ] ] ] ] ] nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? ] : ??can be set by software, but ??cannot be set. 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued 0 : no interrupt request issued 1 : interrupt request issued
3-56 appendix 38C3 group users manual 3.5 control registers fig. 3.5.32 structure of interrupt control register 1 fig. 3.5.33 structure of interrupt control register 2 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 1 (icon1 : address 3e 16 ) b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 int 0 interrupt enable bit int 1 interrupt enable bit serial i/o interrupt enable bit timer a interrupt enable bit timer 1 interrupt enable bit timer 2 interrupt enable bit int 2 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled timer 3 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 0 0 interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 interrupt control register 2 (icon2 : address 3f 16 ) b 0 1 2 4 name 0 functions at reset r w 0 0 0 0 timer 5 interrupt enable bit cntr 0 interrupt enable bit cntr 1 interrupt enable bit timer 6 interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 0 : interrupt disabled 1 : interrupt enabled 5 0 key input interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 6 7 0 ad conversion interrupt enable bit 0 : interrupt disabled 1 : interrupt enabled 0 timer 4 interrupt enable bit nothing is arranged for this bit. this is a write disabled bit. when this bit is read out, the contents are ?? 3
38C3 group users manual 3-57 appendix 3.5 control registers fig. 3.5.34 structure of rom correct enable register 1 rom correct enable register 1 b7 b6 b5 b4 b3 b2 b1 b0 rom correct enable register 1 (rc1: address 0f01 16 ) 0: disabled 1: enabled b 0 1 2 3 4 5 6 7 name 0 functions at reset r w 0 0 0 0 0 0 0 rom correct address 1 enable bit rom correct address 2 enable bit rom correct address 3 enable bit rom correct address 4 enable bit rom correct address 5 enable bit rom correct address 6 enable bit rom correct address 7 enable bit rom correct address 8 enable bit 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled 0: disabled 1: enabled
3-58 appendix 38C3 group users manual 3.6 mask rom confirmation form gzz-sh56-24b<91a0> receipt 740 family mask rom confirmation form single-chip microcomputer m38C34m6axxxfp mitsubishi electric mask rom number date: section head signature supervisor signature company name note : please fill in all items marked h . customer h issuance signature date issued submitted by tel () date: supervisor h 1. confirmation three eproms are required for each pattern if this order is performed by eproms. one floppy disk is required for each pattern if this order is performed by a floppy disk. checksum code for entire eprom (hexadecimal notation) in the address space of the microcomputer, the internal rom area is from address a080 16 to fffd 16 . the reset vector is stored in addresses fffc 16 and fffd 16 . (1) set the data in the unused area (the shaded area of the diagram) to ff 16 . (2) the ascii codes of the product name m38C34m6a must be entered in addresses 0000 16 to 0008 16 . and set the data ff 16 in addresses 0009 16 to 000f 16 . the ascii codes and addresses are listed to the right in hexadecimal notation. address 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 m = 4d 16 3 = 33 16 8 = 38 16 c = 43 16 3 = 33 16 4 = 34 16 m = 4d 16 6 = 36 16 address 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 a = 41 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 (1/2) eprom type (indicate the type used) 27256 eprom address 0000 16 000f 16 0010 16 207f 16 2080 16 7ffd 16 7ffe 16 7fff 16 product name ascii code : m38C34m6a data rom (24k-130) bytes 27512 eprom address 0000 16 000f 16 0010 16 a07f 16 a080 16 fffd 16 fffe 16 ffff 16 product name ascii code : m38C34m6a data rom (24k-130) bytes microcomputer name: m38C34m6axxxfp ordering by eproms specify the type of eproms submitted. if at least two of the three sets of eproms submitted contain identical data, we will produce masks based on this data. we shall assume the responsibility for errors only if the mask rom data on the products we produce differs from this data. thus, extreme care must be taken to verify the data in the submitted eproms. 3.6 mask rom confirmation form
38C3 group users manual 3-59 appendix 3.6 mask rom confirmation form 740 family mask rom confirmation form single-chip microcomputer m38C34m6axxxfp mitsubishi electric gzz-sh56-24b<91a0> mask rom number h 2. mark specification mark specification must be submitted using the correct form for the package being ordered. fill out the appropriate mark specification form (80p6n for m38C34m6axxxfp) and attach it to the mask rom confirmation form. h 3. usage conditions please answer the following questions about usage for use in our product inspection : (1) how will you use the x in -x out oscillator? at what frequency? f(x in ) = ceramic resonator external clock input quartz crystal other ( ) mhz h 4. comments (2/2) 27256 *= $8000 .byte m38C34m6a we recommend the use of the following pseudo-command to set the start address of the assembler source program be- cause ascii codes of the product name are written to addresses 0000 16 to 0008 16 of eprom. eprom type the pseudo-command note : if the name of the product written to the eproms does not match the name of the mask confirmation form, the rom will not be processed. 27512 *= $0000 .byte m38C34m6a ordering by floppy disk we will produce masks based on the mask files generated by the mask file generating utility. we shall assume the responsibility for errors only if the mask rom data on the products we produce differs from this mask file. thus, ex- treme care must be taken to verify the mask file in the submitted floppy disk. the submitted floppy disk must be 3.5-inch 2hd type and dos/v format. and the number of the mask files must be 1 in one floppy disk. file code (hexadecimal notation) mask file name .msk (equal or less than eight characters) (2) which function will you use the pins p7 0 /x cin and p7 1 /x cout as p7 0 and p7 1 , or x cin and x cout ? ports p7 0 and p7 1 function x cin and x cout function (external resonator)
3-60 appendix 38C3 group users manual 3.6 mask rom confirmation form gzz-sh56-25b<91a0> receipt 740 family mask rom confirmation form single-chip microcomputer m38C34m6mxxxfp mitsubishi electric mask rom number date: section head signature supervisor signature company name note : please fill in all items marked h . customer h issuance signature date issued submitted by tel () date: supervisor h 1. confirmation three eproms are required for each pattern if this order is performed by eproms. one floppy disk is required for each pattern if this order is performed by a floppy disk. checksum code for entire eprom (hexadecimal notation) in the address space of the microcomputer, the internal rom area is from address a080 16 to fffd 16 . the reset vector is stored in addresses fffc 16 and fffd 16 . (1) set the data in the unused area (the shaded area of the diagram) to ff 16 . (2) the ascii codes of the product name m38C34m6m must be entered in addresses 0000 16 to 0008 16 . and set the data ff 16 in addresses 0009 16 to 000f 16 . the ascii codes and addresses are listed to the right in hexadecimal notation. address 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 m = 4d 16 3 = 33 16 8 = 38 16 c = 43 16 3 = 33 16 4 = 34 16 m = 4d 16 6 = 36 16 address 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 m = 4d 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 (1/2) eprom type (indicate the type used) 27256 eprom address 0000 16 000f 16 0010 16 207f 16 2080 16 7ffd 16 7ffe 16 7fff 16 product name ascii code : m38C34m6m data rom (24k-130) bytes 27512 eprom address 0000 16 000f 16 0010 16 a07f 16 a080 16 fffd 16 fffe 16 ffff 16 product name ascii code : m38C34m6m data rom (24k-130) bytes microcomputer name: m38C34m6mxxxfp ordering by eproms specify the type of eproms submitted. if at least two of the three sets of eproms submitted contain identical data, we will produce masks based on this data. we shall assume the responsibility for errors only if the mask rom data on the products we produce differs from this data. thus, extreme care must be taken to verify the data in the submitted eproms.
38C3 group users manual 3-61 appendix 3.6 mask rom confirmation form 740 family mask rom confirmation form single-chip microcomputer m38C34m6mxxxfp mitsubishi electric gzz-sh56-25b<91a0> mask rom number h 2. mark specification mark specification must be submitted using the correct form for the package being ordered. fill out the appropriate mark specification form (80p6n for m38C34m6mxxxfp) and attach it to the mask rom confirmation form. h 3. usage conditions please answer the following questions about usage for use in our product inspection : (1) how will you use the x in -x out oscillator? at what frequency? f(x in ) = ceramic resonator external clock input quartz crystal other ( ) mhz h 4. comments (2/2) 27256 *= $8000 .byte m38C34m6m we recommend the use of the following pseudo-command to set the start address of the assembler source program be- cause ascii codes of the product name are written to addresses 0000 16 to 0008 16 of eprom. eprom type the pseudo-command note : if the name of the product written to the eproms does not match the name of the mask confirmation form, the rom will not be processed. 27512 *= $0000 .byte m38C34m6m ordering by floppy disk we will produce masks based on the mask files generated by the mask file generating utility. we shall assume the responsibility for errors only if the mask rom data on the products we produce differs from this mask file. thus, ex- treme care must be taken to verify the mask file in the submitted floppy disk. the submitted floppy disk must be 3.5-inch 2hd type and dos/v format. and the number of the mask files must be 1 in one floppy disk. file code (hexadecimal notation) mask file name .msk (equal or less than eight characters) (2) which function will you use the pins p7 0 /x cin and p7 1 /x cout as p7 0 and p7 1 , or x cin and x cout ? ports p7 0 and p7 1 function x cin and x cout function (external resonator)
3-62 appendix 38C3 group users manual 3.7 rom programming confirmation form 3.7 rom programming confirmation form gzz-sh56-29b<91a0> receipt 740 family writing to prom confirmation form single-chip 8-bit microcomputer m38C37ecaxxxfp mitsubishi electric rom number date: section head signature supervisor signature company name note : please fill in all items marked h . customer h issuance signature date issued submitted by tel () date: supervisor h 1. confirmation three eproms are required for each pattern if this order is performed by eproms. one floppy disk is required for each pattern if this order is performed by a floppy disk. checksum code for entire eprom (hexadecimal notation) in the address space of the microcomputer, the internal rom area is from address 4080 16 to fffd 16 . the reset vector is stored in addresses fffc 16 and fffd 16 . (1) set the data in the unused area (the shaded area of the diagram) to ff 16 . (2) the ascii codes of the product name m38C37eca must be entered in addresses 0000 16 to 0008 16 . and set the data ff 16 in addresses 0009 16 to 000f 16 . the ascii codes and addresses are listed to the right in hexadecimal notation. (1/2) eprom type (indicate the type used) ordering by eproms if at least two of the three sets of eproms submitted contain identical data, we will produce writing to prom based on this data. we shall assume the responsibility for errors only if the written prom data on the products we produce dif- fers from this data. thus, extreme care must be taken to verify the data in the submitted eproms. eprom address 27512 0000 16 000f 16 0010 16 407f 16 4080 16 fffd 16 fffe 16 ffff 16 eprom address product name ascii code : m38C37eca data rom 48k-130 bytes address 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 m = 4d 16 3 = 33 16 8 = 38 16 c = 43 16 3 = 33 16 7 = 37 16 e = 45 16 c = 43 16 address 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 a =41 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16
38C3 group users manual 3-63 appendix 3.7 rom programming confirmation form 740 family writing to prom confirmation form single-chip 8-bit microcomputer m38C37ecaxxxfp mitsubishi electric gzz-sh56-29b<91a0> rom number h 2. mark specification mark specification must be submitted using the correct form for the package being ordered. fill out the appropriate 80p6n mark specification form and attach it to the writing to prom confirmation form. (2/2) we recommend the use of the following pseudo-command to set the start address of the assembler source program be- cause ascii codes of the product name are written to addresses 0000 16 to 0008 16 of eprom. eprom type the pseudo-command note : if the name of the product written to the eproms does not match the name of the writing to prom confirmation form, the rom will not be processed. 27512 *= $0000 .byte m38C37eca ordering by floppy disk we will produce writing to prom based on the mask files generated by the mask file generating utility. we shall as- sume the responsibility for errors only if the written prom data on the products we produce differs from this mask file. thus, extreme care must be taken to verify the mask file in the submitted floppy disk. the submitted floppy disk must be 3.5-inch 2hd type and dos/v format. and the number of the mask files must be 1 in one floppy disk. file code (hexadecimal notation) mask file name .msk (equal or less than eight characters) h 3. usage conditions please answer the following questions about usage for use in our product inspection : (1) how will you use the x in -x out oscillator? at what frequency? f(x in ) = ceramic resonator external clock input quartz crystal other ( ) mhz h 4. comments (2) which function will you use the pins p7 0 /x cin and p7 1 /x cout as p7 0 and p7 1 , or x cin and x cout ? ports p7 0 and p7 1 function x cin and x cout function (external resonator)
3-64 appendix 38C3 group users manual 3.7 rom programming confirmation form gzz-sh56-30b<91a0> receipt 740 family writing to prom confirmation form single-chip 8-bit microcomputer m38C37ecmxxxfp mitsubishi electric rom number date: section head signature supervisor signature company name note : please fill in all items marked h . customer h issuance signature date issued submitted by tel () date: supervisor h 1. confirmation three eproms are required for each pattern if this order is performed by eproms. one floppy disk is required for each pattern if this order is performed by a floppy disk. checksum code for entire eprom (hexadecimal notation) in the address space of the microcomputer, the internal rom area is from address 4080 16 to fffd 16 . the reset vector is stored in addresses fffc 16 and fffd 16 . (1) set the data in the unused area (the shaded area of the diagram) to ff 16 . (2) the ascii codes of the product name m38C37ecm must be entered in addresses 0000 16 to 0008 16 . and set the data ff 16 in addresses 0009 16 to 000f 16 . the ascii codes and addresses are listed to the right in hexadecimal notation. (1/2) eprom type (indicate the type used) ordering by eproms if at least two of the three sets of eproms submitted contain identical data, we will produce writing to prom based on this data. we shall assume the responsibility for errors only if the written prom data on the products we produce dif- fers from this data. thus, extreme care must be taken to verify the data in the submitted eproms. eprom address 27512 0000 16 000f 16 0010 16 407f 16 4080 16 fffd 16 fffe 16 ffff 16 eprom address product name ascii code : m38C37ecm data rom 48k-130 bytes address 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 m = 4d 16 3 = 33 16 8 = 38 16 c = 43 16 3 = 33 16 7 = 37 16 e = 45 16 c = 43 16 address 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 m =4d 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16 ff 16
38C3 group users manual 3-65 appendix 3.7 rom programming confirmation form 740 family writing to prom confirmation form single-chip 8-bit microcomputer m38C37ecmxxxfp mitsubishi electric gzz-sh56-30b<91a0> rom number h 2. mark specification mark specification must be submitted using the correct form for the package being ordered. fill out the appropriate 80p6n mark specification form and attach it to the writing to prom confirmation form. (2/2) we recommend the use of the following pseudo-command to set the start address of the assembler source program be- cause ascii codes of the product name are written to addresses 0000 16 to 0008 16 of eprom. eprom type the pseudo-command note : if the name of the product written to the eproms does not match the name of the writing to prom confirmation form, the rom will not be processed. 27512 *= $0000 .byte m38C37ecm ordering by floppy disk we will produce writing to prom based on the mask files generated by the mask file generating utility. we shall as- sume the responsibility for errors only if the written prom data on the products we produce differs from this mask file. thus, extreme care must be taken to verify the mask file in the submitted floppy disk. the submitted floppy disk must be 3.5-inch 2hd type and dos/v format. and the number of the mask files must be 1 in one floppy disk. file code (hexadecimal notation) mask file name .msk (equal or less than eight characters) h 3. usage conditions please answer the following questions about usage for use in our product inspection : (1) how will you use the x in -x out oscillator? at what frequency? f(x in ) = ceramic resonator external clock input quartz crystal other ( ) mhz h 4. comments (2) which function will you use the pins p7 0 /x cin and p7 1 /x cout as p7 0 and p7 1 , or x cin and x cout ? ports p7 0 and p7 1 function x cin and x cout function (external resonator)
3-66 appendix 38C3 group users manual 3.8 mark specification form 3.8 mark specification form 1 80 65 40 64 41 25 24 mitsubishi product number (6-digit, or 7-digit) 1 80 65 40 64 41 25 24 customers parts number note : the fonts and size of characters are standard mitsubishi type. mitsubishi ic catalog name notes 1 : the mark field should be written right aligned. 2 : the fonts and size of characters are standard mitsubishi type. 3 : customers parts number can be up to 14 alphanumeric char- acters for capital letters, hyphens, commas, periods and so on. 4 : if the mitsubishi logo is not required, check the box below. mitsubishi logo is not required 80p6n (80-pin qfp) mark specification form mitsubishi ic catalog name please choose one of the marking types below (a, b, c), and enter the mitsubishi ic catalog name and the special mark (if neede d). a. standard mitsubishi mark c. special mark required b. customers parts number + mitsubishi ic catalog name mitsubishi ic catalog name notes1 :if special mark is to be printed, indicate the desired lay- out of the mark in the left figure. the layout will be duplicated technically as close as possible. mitsubishi product number (6-digit, or 7-digit) and mask rom number (3-digit) are always marked for sorting the products. 2 : if special character fonts (e,g., customers trade mark logo) must be used in special mark, check the box be- low. for the new special character fonts, a clean font original (ideally logo drawing) must be submitted. special character fonts required 1 80 65 40 64 41 25 24
38C3 group users manual 3-67 appendix 3.9 package outline 3.9 package outline qfp80-p-1420-0.80 1.58 weight(g) jedec code eiaj package code lead material alloy 42 80p6n-a plastic 80pin 14 5 20mm body qfp 0.1 0.2 symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.5 i 2 1.3 m d 14.6 m e 20.6 10 0 0.1 1.4 0.8 0.6 0.4 23.1 22.8 22.5 17.1 16.8 16.5 0.8 20.2 20.0 19.8 14.2 14.0 13.8 0.2 0.15 0.13 0.45 0.35 0.3 2.8 0 3.05 e e e e c h e 1 80 65 40 64 41 25 24 h d d m d m e a f b a 1 a 2 l 1 l y b 2 i 2 recommended mount pad detail f weight(g) jedec code eiaj package code 80d0 glass seal 80pin qfn 25 40 80 65 41 64 24 1 1.2typ 0.6typ 0.8typ index 1.78typ 3.32max 0.8typ 1.2typ 0.8typ 0.5typ 12.0 0.15 15.6 0.2 21.0 0.2 18.4 0.15
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38C3 group users manual 3-69 appendix 3.10 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-68 appendix 38C3 group users manual 3.10 machine instructions 75 35 16 4 4 6 2 2 2 6d 2d 0e 2c 4 4 6 4 3 3 3 3 7d 3d 1e 5 5 7 3 3 3 79 39 5 5 3 3 61 21 6 6 2 2 90 b0 f0 2 2 2 2 2 2 71 31 6 6 2 2 n n n ? ? ? ? ? m 7 ? ? v ? ? ? ? ? ? ? m 6 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? z z z ? ? ? ? ? z ? ? c ? c ? ? ? ? ? ? ? ? when t = 0, this instruction adds the contents m, c, and a; and stores the results in a and c. when t = 1, this instruction adds the contents of m(x), m and c; and stores the results in m(x) and c. when t=1, the contents of a re- main unchanged, but the contents of status flags are changed. m(x) represents the contents of memory where is indicated by x. when t = 0, this instruction transfers the con- tents of a and m to the alu which performs a bit-wise and operation and stores the result back in a. when t = 1, this instruction transfers the con- tents m(x) and m to the alu which performs a bit-wise and operation and stores the results back in m(x). when t = 1, the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction shifts the content of a or m by one bit to the left, with bit 0 always being set to 0 and bit 7 of a or m always being contained in c. this instruction tests the designated bit i of m or a and takes a branch if the bit is 0. the branch address is specified by a relative ad- dress. if the bit is 1, next instruction is executed. this instruction tests the designated bit i of the m or a and takes a branch if the bit is 1. the branch address is specified by a relative ad- dress. if the bit is 0, next instruction is executed. this instruction takes a branch to the ap- pointed address if c is 0. the branch address is specified by a relative address. if c is 1, the next instruction is executed. this instruction takes a branch to the ap- pointed address if c is 1. the branch address is specified by a relative address. if c is 0, the next instruction is executed. this instruction takes a branch to the ap- pointed address when z is 1. the branch address is specified by a relative address. if z is 0, the next instruction is executed. this instruction takes a bit-wise logical and of a and m contents; however, the contents of a and m are not modified. the contents of n, v, z are changed, but the contents of a, m remain unchanged. this instruction takes a branch to the ap- pointed address when n is 1. the branch address is specified by a relative address. if n is 0, the next instruction is executed. this instruction takes a branch to the ap- pointed address if z is 0. the branch address is specified by a relative address. if z is 1, the next instruction is executed. adc (note 1) (note 5) and (note 1) asl bbc (note 4) bbs (note 4) bcc (note 4) bcs (note 4) beq (note 4) bit bmi (note 4) bne (note 4) 7 0 c ? ? 0 29 2 2 0a 2 1 03 + 20i 17 + 20i 07 + 20i 06 5 2 25 3 2 3 65 3 2 69 2 2 4 4 2 2 13 + 20i 5 5 3 3 24 when t = 0 a ? a + m + c when t = 1 m(x) ? m(x) + m + c when t = 0 a ? a m when t = 1 m(x) ? m(x) m ai or mi = 0? ai or mi = 1? c = 0? c = 1? z = 1? a m n = 1? z = 0? v v v 2 3.10 machine instructions bit, a, r bit, zp, r 30 d0 2 2 2 2
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38C3 group users manual 3-71 appendix 3.10 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-70 appendix 38C3 group users manual 3.10 machine instructions d5 d6 cd ec cc ce 50 70 2 2 2 2 ? ? ? ? ? ? ? ? ? ? ? n n n n n ? ? ? ? ? ? ? ? ? ? 0 ? ? ? ? ? 4 6 4 4 4 6 3 3 3 3 dd de 5 7 3 3 d9 5 3 c1 6 2 d1 6 2 ? ? ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? ? 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? ? ? ? 1 ? ? ? ? ? 0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? z z z z z ? ? ? ? ? ? 0 ? ? ? ? c ? c c ? 2 2 this instruction takes a branch to the ap- pointed address if n is 0. the branch address is specified by a relative address. if n is 1, the next instruction is executed. this instruction branches to the appointed ad- dress. the branch address is specified by a relative address. when the brk instruction is executed, the cpu pushes the current pc contents onto the stack. the badrs designated in the interrupt vector table is stored into the pc. this instruction takes a branch to the ap- pointed address if v is 0. the branch address is specified by a relative address. if v is 1, the next instruction is executed. this instruction takes a branch to the ap- pointed address when v is 1. the branch address is specified by a relative address. when v is 0, the next instruction is executed. this instruction clears the designated bit i of a or m. this instruction clears c. this instruction clears d. this instruction clears i. this instruction clears t. this instruction clears v. when t = 0, this instruction subtracts the con- tents of m from the contents of a. the result is not stored and the contents of a or m are not modified. when t = 1, the cmp subtracts the contents of m from the contents of m(x). the result is not stored and the contents of x, m, and a are not modified. m(x) represents the contents of memory where is indicated by x. this instruction takes the ones complement of the contents of m and stores the result in m. this instruction subtracts the contents of m from the contents of x. the result is not stored and the contents of x and m are not modified. this instruction subtracts the contents of m from the contents of y. the result is not stored and the contents of y and m are not modified. this instruction subtracts 1 from the contents of a or m. bpl (note 4) bra brk bvc (note 4) bvs (note 4) clb clc cld cli clt clv cmp (note 3) com cpx cpy dec n = 0? pc ? pc offset b ? 1 (pc) ? (pc) + 2 m(s) ? pc h s ? s C 1 m(s) ? pc l s ? s C 1 m(s) ? ps s ? s C 1 i ? 1 pc l ? ad l pc h ? ad h v = 0? v = 1? ai or mi ? 0 c ? 0 d ? 0 i ? 0 t ? 0 v ? 0 when t = 0 a C m when t = 1 m(x) C m __ m ? m x C m y C m a ? a C 1 or m ? m C 1 18 d8 58 12 b8 2 2 2 2 2 1 1 1 1 1 c9 e0 c0 2 2 2 2 2 2 1a 2 1 1b + 20i c5 44 e4 c4 c6 3 5 3 3 5 2 2 2 2 2 1f + 20i 21 52 00 7 1 10 80 2 4 2 2
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38C3 group users manual 3-73 appendix 3.10 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-72 appendix 38C3 group users manual 3.10 machine instructions this instruction subtracts one from the current contents of x. this instruction subtracts one from the current contents of y. this instruction divides the 16-bit data in m(zz+(x)) (low-order byte) and m(zz+(x)+1) (high-order byte) by the contents of a. the quotient is stored in a and the one's comple- ment of the remainder is pushed onto the stack. when t = 0, this instruction transfers the con- tents of the m and a to the alu which performs a bit-wise exclusive or, and stores the result in a. when t = 1, the contents of m(x) and m are transferred to the alu, which performs a bit- wise exclusive or and stores the results in m(x). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction adds one to the contents of a or m. this instruction adds one to the contents of x. this instruction adds one to the contents of y. this instruction jumps to the address desig- nated by the following three addressing modes: absolute indirect absolute zero page indirect absolute this instruction stores the contents of the pc in the stack, then jumps to the address desig- nated by the following addressing modes: absolute special page zero page indirect absolute when t = 0, this instruction transfers the con- tents of m to a. when t = 1, this instruction transfers the con- tents of m to (m(x)). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction loads the immediate value in m. this instruction loads the contents of m in x. this instruction loads the contents of m in y. dex dey div eor (note 1) inc inx iny jmp jsr lda (note 2) ldm ldx ldy x ? x C 1 y ? y C 1 a ? (m(zz + x + 1), m(zz + x )) / a m(s) ? one's comple- ment of remainder s ? s C 1 when t = 0 a ? a v C m when t = 1 m(x) ? m(x) v C m a ? a + 1 or m ? m + 1 x ? x + 1 y ? y + 1 if addressing mode is abs pc l ? ad l pc h ? ad h if addressing mode is ind pc l ? m (ad h , ad l ) pc h ? m (ad h , ad l + 1) if addressing mode is zp, ind pc l ? m(00, ad l ) pc h ? m(00, ad l + 1) m(s) ? pc h s ? s C 1 m(s) ? pc l s ? s C 1 after executing the above, if addressing mode is abs, pc l ? ad l pc h ? ad h if addressing mode is sp, pc l ? ad l pc h ? ff if addressing mode is zp, ind, pc l ? m(00, ad l ) pc h ? m(00, ad l + 1) when t = 0 a ? m when t = 1 m(x) ? m m ? nn x ? m y ? m 3a 21 1 1 1 1 2 2 2 2 ca 88 e8 c8 45 e6 3 5 2 2 49 22 e2 16 2 4d ee 4 6 3 3 5d fe 5 7 3 3 59 5 3 n n ? n n n n ? ? n ? n n ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? z z ? z z z z ? ? z ? z z ? ? ? ? ? ? ? ? ? ? ? ? ? 41 6 2 51 6 2 b5 b4 4c 20 ad ae ac 6c a1 4 4 2 2 b6 4 2 3 6 4 4 4 3 3 3 3 3 bd bc 5 5 b9 be 5 5 3 3 3 3 53b2 02 4 7 2 2 62b162 22 5 2 a9 a2 a0 a5 3c a6 a4 3 4 3 3 2 3 2 2 2 2 2 2 2 2 55 f6 4 6 2 2
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38C3 group users manual 3-75 appendix 3.10 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-74 appendix 38C3 group users manual 3.10 machine instructions 0 ? ? n ? ? n n n ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? z ? ? z ? ? z z z ? ? c ? ? ? ? ? ? c c ? ? this instruction shifts either a or m one bit to the right such that bit 7 of the result always is set to 0, and the bit 0 is stored in c. this instruction multiply accumulator with the memory specified by the zero page x address mode and stores the high-order byte of the re- sult on the stack and the low-order byte in a. this instruction adds one to the pc but does no otheroperation. when t = 0, this instruction transfers the con- tents of a and m to the alu which performs a bit-wise or, and stores the result in a. when t = 1, this instruction transfers the con- tents of m(x) and the m to the alu which performs a bit-wise or, and stores the result in m(x). the contents of a remain unchanged, but status flags are changed. m(x) represents the contents of memory where is indicated by x. this instruction pushes the contents of a to the memory location designated by s, and decrements the contents of s by one. this instruction pushes the contents of ps to the memory location designated by s and dec- rements the contents of s by one. this instruction increments s by one and stores the contents of the memory designated by s in a. this instruction increments s by one and stores the contents of the memory location designated by s in ps. this instruction shifts either a or m one bit left through c. c is stored in bit 0 and bit 7 is stored in c. this instruction shifts either a or m one bit right through c. c is stored in bit 7 and bit 0 is stored in c. this instruction rotates 4 bits of the m content to the right. this instruction increments s by one, and stores the contents of the memory location designated by s in ps. s is again incremented by one and stores the contents of the memory location designated by s in pc l . s is again incremented by one and stores the contents of memory location designated by s in pc h . this instruction increments s by one and stores the contents of the memory location designated by s in pc l . s is again incremented by one and the contents of the memory location is stored in pc h . pc is incremented by 1. lsr mul nop ora (note 1) pha php pla plp rol ror rrf rti rts m(s) ? a ? a ] m(zz + x) s ? s C 1 pc ? pc + 1 when t = 0 a ? a v m when t = 1 m(x) ? m(x) v m m(s) ? a s ? s C 1 m(s) ? ps s ? s C 1 s ? s + 1 a ? m(s) s ? s + 1 ps ? m(s) s ? s + 1 ps ? m(s) s ? s + 1 pc l ? m(s) s ? s + 1 pc h ? m(s) s ? s + 1 pc l ? m(s) s ? s + 1 pc h ? m(s) (pc) ? (pc) + 1 7 0 ? ? c ? 7 0 ? ? 7 0 c ? ? 7 0 0 ? ? c 4a 2 1 ea 2 1 09 2 2 46 05 5 3 2 2 2a 6a 26 66 82 48 08 68 28 40 60 3 3 4 4 6 6 1 1 1 1 1 1 2 2 1 1 5 5 8 2 2 2 56 62 15 6 15 4 2 2 2 4e 0d 6 4 3 3 5e 1d 7 5 3 3 19 53 01 6 2 11 6 2 36 76 2e 6e 6 6 2 2 6 6 3 3 3e 7e 7 7 3 3 (value saved in stack) (value saved in stack)
addressing mode zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp 7 6 5 4 3 2 1 0 proc essor st atus register nvtbd i zc op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # op n # 38C3 group users manual 3-77 appendix 3.10 machine instructions addressing mode symbol function details imp imm a bit, a zp bit, zp opn#opn#opn#opn#opn# op n # 3-76 appendix 38C3 group users manual 3.10 machine instructions ? ? ? ? n n n n n ? n ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? z z z z z ? z ? ? ? ? ? ? ? ? ? ? ? ? ? when t = 0, this instruction subtracts the value of m and the complement of c from a, and stores the results in a and c. when t = 1, the instruction subtracts the con- tents of m and the complement of c from the contents of m(x), and stores the results in m(x) and c. a remain unchanged, but status flag are changed. m(x) represents the contents of memory where is indicated by x. this instruction sets the designated bit i of a or m. this instruction sets c. this instruction set d. this instruction set i. this instruction set t. this instruction stores the contents of a in m. the contents of a does not change. this instruction resets the oscillation control f/ f and the oscillation stops. reset or interrupt input is needed to wake up from this mode. this instruction stores the contents of x in m. the contents of x does not change. this instruction stores the contents of y in m. the contents of y does not change. this instruction stores the contents of a in x. the contents of a does not change. this instruction stores the contents of a in y. the contents of a does not change. this instruction tests whether the contents of m are 0 or not and modifies the n and z. this instruction transfers the contents of s in x. this instruction stores the contents of x in a. this instruction stores the contents of x in s. this instruction stores the contents of y in a. the wit instruction stops the internal clock but not the oscillation of the oscillation circuit is not stopped. cpu starts its function after the timer x over flows (comes to the terminal count). all regis- ters or internal memory contents except timer x will not change during this mode. (of course needs vdd). sbc (note 1) (note 5) seb sec sed sei set sta stp stx sty tax tay tst tsx txa txs tya wit when t = 0 _ a ? a C m C c when t = 1 _ m(x) ? m(x) C m C c ai or mi ? 1 c ? 1 d ? 1 i ? 1 t ? 1 m ? a m ? x m ? y x ? a y ? a m = 0? x ? s a ? x s ? x a ? y 85 86 84 64 4 4 4 3 2 2 2 2 notes 1 : the number of cycles n is increased by 3 when t is 1. 2 : the number of cycles n is increased by 2 when t is 1. 3 : the number of cycles n is increased by 1 when t is 1. 4 : the number of cycles n is increased by 2 when branching has occurred. 5 : n, v, and z flags are invalid in decimal operation mode. 3 35 fd 4 ed 2 4 f5 f9 5 3 e1 6 2 f1 6 2 e9 2 2 0b + 20i 0f + 20i 21 52 e5 3 2 38 f8 78 32 2 2 2 2 1 1 1 1 42 aa a8 ba 8a 9a 98 c2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 95 94 5 5 2 2 96 52 8d 8e 8c 5 5 5 3 3 3 9d 6 3 99 6 3 81 7 2 91 7 2 n ? ? ? ? ? v ? ? ? ? ? ? ? ? ? ? 1 ? ? ? ? ? ? ? ? ? 1 ? ? ? ? ? ? 1 ? z ? ? ? ? ? c ? 1 ? ? ?
addition subtraction multiplication division logical or logical and logical exclusive or negation shows direction of data flow index register x index register y stack pointer program counter processor status register 8 high-order bits of program counter 8 low-order bits of program counter 8 high-order bits of address 8 low-order bits of address ff in hexadecimal notation immediate value zero page address memory specified by address designation of any ad- dressing mode memory of address indicated by contents of index register x memory of address indicated by contents of stack pointer contents of memory at address indicated by ad h and ad l , in ad h is 8 high-order bits and ad l is 8 low-or- der bits. contents of address indicated by zero page ad l bit i (i = 0 to 7) of accumulator bit i (i = 0 to 7) of memory opcode number of cycles number of bytes implied addressing mode immediate addressing mode accumulator or accumulator addressing mode accumulator bit addressing mode accumulator bit relative addressing mode zero page addressing mode zero page bit addressing mode zero page bit relative addressing mode zero page x addressing mode zero page y addressing mode absolute addressing mode absolute x addressing mode absolute y addressing mode indirect absolute addressing mode zero page indirect absolute addressing mode indirect x addressing mode indirect y addressing mode relative addressing mode special page addressing mode carry flag zero flag interrupt disable flag decimal mode flag break flag x-modified arithmetic mode flag overflow flag negative flag imp imm a bit, a bit, a, r zp bit, zp bit, zp, r zp, x zp, y abs abs, x abs, y ind zp, ind ind, x ind, y rel sp c z i d b t v n symbol contents symbol contents + C ] / v v C C ? x y s pc ps pc h pc l ad h ad l ff nn zz m m(x) m(s) m(ad h , ad l ) m(00, ad l ) ai mi op n # v 3-78 appendix 38C3 group user's manual 3.10 machine instructions
38C3 group users manual 3-79 appendix 3.11 list of instruction code 3.11 list of instruction code d 7 C d 4 d 3 C d 0 hexadecimal notation 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 a b c d e f 0000 0 brk bpl jsr abs bmi rti bvc rts bvs bra bcc ldy imm bcs cpy imm bne cpx imm beq 0001 1 ora ind, x ora ind, y and ind, x and ind, y eor ind, x eor ind, y adc ind, x adc ind, y sta ind, x sta ind, y lda ind, x lda ind, y cmp ind, x cmp ind, y sbc ind, x sbc ind, y 0010 2 jsr zp, ind clt jsr sp set stp mul zp, x rrf zp ldx imm jmp zp, ind wit div zp, x 0011 3 bbs 0, a bbc 0, a bbs 1, a bbc 1, a bbs 2, a bbc 2, a bbs 3, a bbc 3, a bbs 4, a bbc 4, a bbs 5, a bbc 5, a bbs 6, a bbc 6, a bbs 7, a bbc 7, a 0100 4 bit zp com zp tst zp sty zp sty zp, x ldy zp ldy zp, x cpy zp cpx zp 0101 5 ora zp ora zp, x and zp and zp, x eor zp eor zp, x adc zp adc zp, x sta zp sta zp, x lda zp lda zp, x cmp zp cmp zp, x sbc zp sbc zp, x 0110 6 asl zp asl zp, x rol zp rol zp, x lsr zp lsr zp, x ror zp ror zp, x stx zp stx zp, y ldx zp ldx zp, y dec zp dec zp, x inc zp inc zp, x 0111 7 bbs 0, zp bbc 0, zp bbs 1, zp bbc 1, zp bbs 2, zp bbc 2, zp bbs 3, zp bbc 3, zp bbs 4, zp bbc 4, zp bbs 5, zp bbc 5, zp bbs 6, zp bbc 6, zp bbs 7, zp bbc 7, zp 1000 8 php clc plp sec pha cli pla sei dey tya tay clv iny cld inx sed 1001 9 ora imm ora abs, y and imm and abs, y eor imm eor abs, y adc imm adc abs, y sta abs, y lda imm lda abs, y cmp imm cmp abs, y sbc imm sbc abs, y 1010 a asl a dec a rol a inc a lsr a ror a txa txs tax tsx dex nop 1011 b seb 0, a clb 0, a seb 1, a clb 1, a seb 2, a clb 2, a seb 3, a clb 3, a seb 4, a clb 4, a seb 5, a clb 5, a seb 6, a clb 6, a seb 7, a clb 7, a 1100 c bit abs ldm zp jmp abs jmp ind sty abs ldy abs ldy abs, x cpy abs cpx abs 1101 d ora abs ora abs, x and abs and abs, x eor abs eor abs, x adc abs adc abs, x sta abs sta abs, x lda abs lda abs, x cmp abs cmp abs, x sbc abs sbc abs, x 1111 f seb 0, zp clb 0, zp seb 1, zp clb 1, zp seb 2, zp clb 2, zp seb 3, zp clb 3, zp seb 4, zp clb 4, zp seb 5, zp clb 5, zp seb 6, zp clb 6, zp seb 7, zp clb 7, zp : 3-byte instruction : 2-byte instruction : 1-byte instruction 1110 e asl abs asl abs, x rol abs rol abs, x lsr abs lsr abs, x ror abs ror abs, x stx abs ldx abs ldx abs, y dec abs dec abs, x inc abs inc abs, x
3-80 appendix 38C3 group users manual 3.12 sfr memory map 3.12 sfr memory map rom correct high-order address register 1 (note) rom correct high-order address register 2 (note) rom correct high-order address register 3 (note) rom correct high-order address register 4 (note) port p8 output selection register (p8sel) 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 port p0 (p0) port p0 direction register (p0d) port p1 (p1) port p1 direction register (p1d) port p2 (p2) port p2 direction register (p2d) port p3 (p3) port p4 (p4) port p4 direction register (p4d) port p5 (p5) port p5 direction register (p5d) port p6 (p6) port p6 direction register (p6d) port p7 (p7) port p7 direction register (p7d) serial i/o control register 1 (siocon1) serial i/o control register 2 (siocon2) serial i/o register (sio) interrupt control register 2 (icon2) timer 6 pwm register (t6pwm) interrupt edge selection register (intedge) cpu mode register (cpum) interrupt request register 1 (ireq1) interrupt request register 2 (ireq2) interrupt control register 1 (icon1) timer 1 (t1) timer 3 (t3) timer 5 (t5) timer 6 (t6) timer 2 (t2) timer 4 (t4) pull register a (pulla) pull register b (pullb) timer 12 mode register (t12m) timer 34 mode register (t34m) timer 56 mode register (t56m) segment output enable register (seg) lcd mode register (lm) a-d control register (adcon) a-d conversion register (low) (adl) port p8 (p8) port p8 direction register (p8d) f output control register (ckout) timer a register (low) (tal) timer a register (high) (tah) compare register (low) (conal) compare register (high) (conah) timer a mode register (tam) timer a control register (tacon) a-d conversion register (high) (adh) 0f0a 16 0f0b 16 0f0c 16 0f0d 16 0f0e 16 0f0f 16 0f10 16 0f11 16 rom correct enable register 1 (note) rom correct low-order address register 1 (note) rom correct high-order address register 5 (note) rom correct low-order address register 5 (note) rom correct high-order address register 6 (note) rom correct low-order address register 6 (note) rom correct high-order address register 7 (note) rom correct low-order address register 7 (note) rom correct high-order address register 8 (note) rom correct low-order address register 8 (note) 0f01 16 0f02 16 0f03 16 0f07 16 0f08 16 0f09 16 0f04 16 0f05 16 0f06 16 rom correct low-order address register 2 (note) rom correct low-order address register 3 (note) rom correct low-order address register 4 (note) note: this register is valid only in mask rom version.
38C3 group users manual 3-81 appendix 3.13 pin configuration 3.13 pin configuration 1 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p6 4 /an 4 p6 5 /an 5 p6 6 /an 6 p6 7 /an 7 av ss v ref p6 0 /an 0 p6 1 /an 1 p6 2 /an 2 p6 3 /an 3 v cc v ss x out p7 0 /xc in p7 1 /xc out x in reset vl 1 com 3 com 2 com 1 com 0 vl 3 vl 2 p4 0 /s clk2 p4 2 /t3 out p4 3 / f p4 4 /s in p4 5 /s out p4 6 /s clk1 p4 7 /s rdy p4 1 /t1 out p8 0 p8 1 p8 2 p8 3 p8 4 p8 5 p8 6 p8 7 p3 0 /seg 24 p3 3 /seg 27 p3 4 /seg 28 p3 5 /seg 29 p3 6 /seg 30 p3 7 /seg 31 p3 1 /seg 25 p3 2 /seg 26 m38C34m6axxxfp p5 1 p5 2 /pwm 1 p5 3 /cntr 0 p5 4 /cntr 1 p5 5 /int 0 p5 6 /int 1 p5 7 /int 2 p5 0 /ta out p1 0 /seg 16 p1 1 /seg 17 p1 2 /seg 18 p1 3 /seg 19 p1 4 /seg 20 p1 5 /seg 21 p1 6 /seg 22 p1 7 /seg 23 p0 0 /seg 8 p0 1 /seg 9 p0 2 /seg 10 p0 3 /seg 11 p0 4 /seg 12 p0 5 /seg 13 p0 6 /seg 14 p0 7 /seg 15 p2 7 /seg 7 p2 6 /seg 6 p2 5 /seg 5 p2 4 /seg 4 p2 3 /seg 3 p2 2 /seg 2 p2 1 /seg 1 p2 0 /seg 0 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 package type: 80p6n-a 80-pin plastic molded qfp (top view)
3-82 appendix 38C3 group users manual 3.13 pin configuration memorandum
mitsubishi semiconductors users manual 38C3 group apr. first edition 1999 editioned by committee of editing of mitsubishi semiconductor users manual published by mitsubishi electric corp., semiconductor marketing division this book, or parts thereof, may not be reproduced in any form without permission of mitsubishi electric corporation. ?1999 mitsubishi electric corporation
users manual 38C3 group ? 1999 mitsubishi electric corporation. new publication, effective apr. 1999. specifications subject to change without notice.


▲Up To Search▲   

 
Price & Availability of 38C3

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