![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
8 bit microcontroller tlcs-870/c series TMP86P203PG
the information contained herein is subject to change without notice. 021023_d toshiba is continually working to improve the qua lity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utiliz ing toshiba products, to comply with the standards of safety in making a safe design for the entire sy stem, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that toshiba products are used within specified operating ranges as set forth in the most r ecent toshiba products specifications. also, please keep in mind the precauti ons and conditions set forth in the ? handling guide for semiconductor devices, ? or ? toshiba semiconductor reliability handbook ? etc. 021023_a the toshiba products listed in this document are intended for usage in general electronics applications (computer, personal equipment, of fice equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ( ? unintended usage ? ). unintended usage include atomic energy control instruments, airplane or spaceship instruments, transportation in struments, traffic signal instruments, combustion control instruments, medical instrument s, all types of safety devices, etc. unintended usage of toshiba products listed in this document shall be made at the customer's own risk. 021023_b the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohib ited under any applicable laws and regulations. 060106_q the information contained herein is presented only as a guide for the applications of our products. no responsibility is assumed by toshiba for any infring ements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patents or other rights of toshiba or the third parties. 070122_c the products described in this document are subject to foreign exchange and foreign trade control laws. 060925_e for a discussion of how the reliability of microcontro llers can be predicted, please refer to section 1.3 of the chapter entitled quality and reliabil ity assurance/handling precautions. 030619_s ? 2007 toshiba corporation all rights reserved revision history date revision 2007/8/31 1 first release 2007/10/16 2 contents revised 2008/8/29 3 contents revised caution in setting the ua rt noise rejection time when uart is used, settings of rxdnc are limited depend ing on the transfer clock specified by brg. the com- bination "o" is available but please do not select the combination "?". the transfer clock generated by timer/counter in terrupt is calculated by the following equation : transfer clock [hz] = time r/counter source clock [hz] brg setting transfer clock [hz] rxdnc setting 00 (no noise rejection) 01 (reject pulses shorter than 31/fc[s] as noise) 10 (reject pulses shorter than 63/fc[s] as noise) 11 (reject pulses shorter than 127/fc[s] as noise) 000 fc/13 o o o ? 110 (when the transfer clock gen- erated by timer/counter inter- rupt is the same as the right side column) fc/8 o ? ? ? fc/16 o o ? ? f c / 3 2ooo ? t h e s e t t i n g e x c e p t t h e a b o v eoooo i table of contents TMP86P203PG 1.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 pin names and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2. operational description 2.1 cpu core functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1 memory address map ............................................................................................................................... 7 2.1.2 program memory (otp) ........................................................................................................................... 7 2.1.3 data memory (ram) ................................................................................................................................. 7 2.2 system clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.1 clock generator ........................................................................................................................................ 8 2.2.2 timing generator .................................................................................................................................... 10 2.2.2.1 configuration of timing generator 2.2.2.2 machine cycle 2.2.3 operation mode control circuit .............................................................................................................. 11 2.2.3.1 single-clock mode 2.2.3.2 stop mode 2.2.4 operating mode control ......................................................................................................................... 14 2.2.4.1 stop mode 2.2.4.2 idle1 mode 2.2.4.3 idle0 mode (idle0) 2.3 reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.3.1 external reset input ............................................................................................................................... 24 2.3.2 address trap reset ............................................................................................................................... ... 25 2.3.3 watchdog timer reset .............................................................................................................................. 25 2.3.4 system clock reset ............................................................................................................................... ... 25 3. interrupt control circuit 3.1 interrupt latches (il15 to il2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2 interrupt enable register (eir) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.2.1 interrupt master enable flag (imf) .......................................................................................................... 28 3.2.2 individual interrupt enable flags (ef15 to ef4) ...................................................................................... 28 note 3: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.3 interrupt sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.3.1 interrupt acceptance processing is packaged as follows. ....................................................................... 30 3.3.2 saving/restoring general-purpose registers ............................................................................................ 32 3.3.2.1 using push and pop instructions 3.3.2.2 using data transfer instructions 3.3.3 interrupt return ........................................................................................................................................ 33 3.4 software interrupt (intsw) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.4.1 address error detection .......................................................................................................................... 34 3.4.2 debugging .............................................................................................................................................. 34 3.5 undefined instruction interrupt (intundef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 ii 3.6 address trap interrupt (intatrap) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.7 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4. special function r egister (sfr) 4.1 sfr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5. i/o ports 5.1 p0 (p01 to p00) port (high current) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.2 p1 (p12 to p10) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.3 p2 (p20) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5.4 p3 (p37 to p30) port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6. watchdog timer (wdt) 6.1 watchdog timer configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6.2 watchdog timer control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.2.1 malfunction detection methods using the watchdog timer ................................................................... 46 6.2.2 watchdog timer enable ......................................................................................................................... 47 6.2.3 watchdog timer disable ........................................................................................................................ 48 6.2.4 watchdog timer interrupt (intwdt) ...................................................................................................... 48 6.2.5 watchdog timer reset ........................................................................................................................... 49 6.3 address trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.3.1 selection of address trap in internal ram (atas) ................................................................................ 50 6.3.2 selection of operation at address trap (atout) .................................................................................. 50 6.3.3 address trap interrupt (intatrap) ....................................................................................................... 50 6.3.4 address trap reset ............................................................................................................................... . 51 7. time base timer (tbt) 7.1 time base timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7.1.1 configuration .......................................................................................................................................... 53 7.1.2 control .................................................................................................................................................... 53 7.1.3 function .................................................................................................................................................. 54 7.2 divider output (dvo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.2.1 configuration .......................................................................................................................................... 55 7.2.2 control .................................................................................................................................................... 55 8. 8-bit timercounter (tc3, tc4) 8.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 8.3.1 8-bit timer mode (tc3 and 4) ................................................................................................................ 62 8.3.2 8-bit event counter mode (tc3, 4) ........................................................................................................ 63 8.3.3 8-bit programmable divider ou tput (pdo) mode (tc3, 4) ..................................................................... 63 8.3.4 8-bit pulse width modulation (pwm) output mode (tc3, 4) .................................................................. 65 8.3.5 16-bit timer mode (tc3 and 4) .............................................................................................................. 67 8.3.6 16-bit event counter mode (tc3 and 4) ................................................................................................ 68 8.3.7 16-bit pulse width modulation (pwm) output mode (tc3 and 4) .......................................................... 68 iii 8.3.8 16-bit programmable pulse generate (ppg) output mode (tc3 and 4) ............................................... 71 9. 8-bit ad conv erter (adc) 9.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 9.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 9.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 9.3.1 ad converter operation ......................................................................................................................... 76 9.3.2 ad converter operation ......................................................................................................................... 76 9.3.3 stop mode during ad conversion ........................................................................................................ 77 9.3.4 analog input voltage and ad conversion result ................................................................................... 78 9.4 precautions about ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 9.4.1 analog input pin voltage range ............................................................................................................... 79 9.4.2 analog input shared pins ........................................................................................................................ 79 9.4.3 noise countermeasure ............................................................................................................................ 79 10. otp operation 10.1 operating mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 10.1.1 mcu mode ............................................................................................................................................ 81 10.1.1.1 program memory 10.1.1.2 data memory 10.1.2 prom mode ......................................................................................................................................... 81 10.1.2.1 programming flowchart (high-speed program writing) 10.1.2.2 program writing using a general-purpose prom programmer 11. input/output circuitry 11.1 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 11.2 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 12. electrical characteristics 12.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 12.2 operating condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 12.3 dc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 12.4 ad conversion characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 12.5 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 12.6 recommended oscillation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 12.7 dc characteristics, ac characteristics (prom mode) . . . . . . . . . . . . . . . . . . . . 94 12.7.1 read operation in prom mode ............................................................................................................ 94 12.7.2 program operation (high-speed) (topr = 25 ............................................................................. 95 12.8 handling precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 13. package dimensions this is a technical docu ment that describes the operat ing functions and electrical iv specifications of the 8-bit microc ontroller series tlcs-870/c (lsi). page 1 TMP86P203PG cmos 8-bit microcontroller ? the information contained herein is subject to change without notice. 021023_d ? toshiba is continually working to improve the quality and reli ability of its products. nevertheless, semiconductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vulnerability to physical stre ss. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of sa fety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, pleas e ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precautions and conditions set forth in the ?handling gui de for semiconductor devices,? or ?toshiba se miconductor reliability handbook? etc. 021023_a ? the toshiba products listed in this document are intended for usage in general electronics applic ations (computer, personal eq uip- ment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neithe r intended nor warranted for usage in equipment that requires extr aordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bod ily injury (?unintended usage?). unintended us age include atomic energy control instru ments, airplane or spaceship instruments, transporta tion instruments, traffic signal instrume nts, combustion control instruments, medi cal instru- ments, all types of safety dev ices, etc. unintended usage of toshiba products li sted in this document shall be made at the cust omer's own risk. 021023_b ? the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any appl icable laws and regulations. 060106_q ? the information contained herein is present ed only as a guide for the applications of our products. no responsibility is assum ed by toshiba for any infringements of patents or other rights of the th ird parties which may result from its use. no license is gran ted by impli- cation or otherwise under any patents or other rights of toshiba or the third parties. 070122_c ? the products described in this document are subject to foreign exchange and foreign trade control laws. 060925_e ? for a discussion of how the reliability of microcontrollers c an be predicted, please refer to section 1.3 of the chapter entit led quality and reliability assurance/h andling precautions. 030619_s TMP86P203PG the TMP86P203PG is a single-chip 8-bit high-speed an d high-functionality microcomputer incorporating 2048 bytes of one-time prom. 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c series - instruction execution time : 1.60 s (at 2.5 mhz) - 132 types & 731 basic instructions 2. 11interrupt sources (external : 3 internal : 8) 3. input / output ports (14 pins) large current output: 2pins (typ. 20ma), led direct drive 4. watchdog timer 5. prescaler - time base timer - divider output function 6. 8-bit timer counter : 2 ch - timer, event counter, - programmable divider output (pdo), - pulse width modulation (pwm) output, - programmable pulse generation (ppg) modes 7. 8-bit successive approximation type ad converter (with sample hold) analog inputs: 4ch 8. low power consumption operation product no. rom (eprom) ram package emulation chip TMP86P203PG 2048 bytes 128 bytes dip20-p-300-2.54 a tmp86c908xb page 2 1.1 features TMP86P203PG stop mode: oscillation stops. (battery/capacitor back-up.) idle0 mode: cpu stops, and only the time-based-tim er(tbt) on peripherals operate using high fre- quency clock. release by falling edge of th e source clock which is set by tbtcr page 3 TMP86P203PG 1.2 pin assignment figure 1-1 pin assignment vss xout test vdd p00 p01 reset ( int5 / stop ) p20 ( int0 ) p10 xin p12 ( dvo ) p31 (tc4/ pdo4/pwm4/ppg4 ) p32 p33 p35 (ain3) p36 (ain4) p37 (ain5) p30 (tc3/ pdo3/pwm3 ) p34 (ain2) p11 (int1) 20 19 18 17 16 15 14 13 12 11 1 2 3 4 5 6 7 8 9 10 page 4 1.3 block diagram TMP86P203PG 1.3 block diagram figure 1-2 block diagram page 5 TMP86P203PG 1.4 pin names and functions the TMP86P203PG has mcu mode and prom mode. tabl e 1-1 shows the pin functions in mcu mode. the prom mode is explained later in a separate chapter. table 1-1 pin names and functions pin name pin number input/output functions p01 7 io port01 p00 6 io port00 p12 dvo 12 io o port12 divider output p11 int1 11 io i port11 external interrupt 1 input p10 int0 10 io i port10 external interrupt 0 input p20 stop int5 9 io i i port20 stop mode release signal input external interrupt 5 input p37 ain5 20 io i port37 ad converter analog input 5 p36 ain4 19 io i port36 ad converter analog input 4 p35 ain3 18 io i port35 ad converter analog input 3 p34 ain2 17 io i port34 ad converter analog input 2 p33 16 io port33 p32 15 io port32 p31 tc4 pdo4/pwm4/ppg4 14 io i o port31 tc4 input pdo4/pwm4/ppg4 output p30 tc3 pdo3/pwm3 13 io i o port30 tc3 input pdo3/pwm3 output xin 2 i resonator connecting pins for high-frequency clock xout 3 o resonator connecting pins for high-frequency clock reset 8 i reset signal test 4 i test pin for out-going test. normally, be fixed to low. vdd 5 i +5v vss 1 i 0(gnd) page 6 1.4 pin names and functions TMP86P203PG page 7 TMP86P203PG 2. operational description 2.1 cpu core functions the cpu core consists of a cpu, a system cl ock controller, and an interrupt controller. this section provides a description of the cpu core, the program memory, the data memory, and the reset circuit. 2.1.1 memory address map the TMP86P203PG memory is compos ed otp ram, and sfr(special function register). they are all mapped in 64-kbyte address space. figure 2- 1 shows the TMP86P203PG memory address map. figure 2-1 memory address map 2.1.2 program memory (otp) the TMP86P203PG has a 2048 bytes (address f800h to ffffh) of program memory (otp). 2.1.3 data memory (ram) the TMP86P203PG has 128 bytes (address 0040h to 00bfh) of internal ram. the internal ram are located in the direct area; instru ctions with shorten operations ar e available against such an area. the data memory contents become un stable when the power supply is turned on; therefore, the data memory should be initialized by an initialization routine. sfr 0000 h 64 bytes sfr: ram: special function register includes: i/o ports peripheral control registers peripheral status registers system control registers program status word random access memory includes: data memory stack 003f h ram 0040 h 128 bytes 00bf h f800 h otp program memory otp 2048 bytes ffc0 h vector table for vector call instructions (32 bytes) ffdf h ffe0 h vector table for interrupts (32 bytes) ffff h page 8 2. operational description 2.2 system clock controller TMP86P203PG 2.2 system clock controller the system clock controller consists of a clock generator, a timing generator, and a standby controller. figure 2-2 syst em colck control 2.2.1 clock generator the clock generator generates the basic clock which pr ovides the system clocks supplied to the cpu core and peripheral hardware. the high-frequency (fc) clock can eas ily be obtained by connecting a resonator between the xin and xout pins . clock input from an external oscillator is also possi ble. in this case, external clock is applied to xin pin with xout pin not connected. example :clears ram to ?00h?. (TMP86P203PG) ld hl, 0040h ; start address setup ld a, h ; initial value (00h) setup ld bc, 007fh sramclr: ld (hl), a inc hl dec bc jrs f, sramclr tbtcr syscr2 syscr1 xin xout fc 0036 h 0038 h 0039 h timing generator control register clock generator high-frequency clock oscillator timing generator system clocks clock generator control system control registers standby controller page 9 TMP86P203PG figure 2-3 examples of resonator connection note:the function to monitor the basic clock directly at external is not provided for hardware, however, with dis- abling all interrupts and watchdog timers, the oscillation frequency can be adjusted by monitoring the pulse which the fixed frequency is outputted to the port by the program. the system to require the adjustment of the oscilla tion frequency should create the program for the adjust- ment in advance. xout xin (a) rc oscillation high-frequency clock r x c xin (open) xout xin (b) external oscillator page 10 2. operational description 2.2 system clock controller TMP86P203PG 2.2.2 timing generator the timing generator generates the various system cloc ks supplied to the cpu core and peripheral hardware from the basic clock (fc). the timing generator provides the following functions. 1. generation of main system clock 2. generation of divider output ( dvo ) pulses 3. generation of source clocks for time base timer 4. generation of source clocks for watchdog timer 5. generation of internal source clocks for timer/counters 6. generation of warm-up clocks for releasing stop mode 2.2.2.1 configuration of timing generator the timing generator consists of a 2-stage prescaler, a 21-stage divider, a main system clock generator, and machine cycle counters. as reset and stop mode started/canceled, the prescaler and the divider are cleared to ?0?. figure 2-4 configurat ion of timing generator high-frequency clock fc divider fc/4 fc machine cycle counters 1 2 1 4 3 2 8 7 10 9 12 11 14 13 16 15 warm-up controller watchdog timer 5 6 17 18 19 20 21 timer counter, time-base-timer , divider output, etc. divider prescaler page 11 TMP86P203PG 2.2.2.2 machine cycle instruction execution and peripheral hardware operat ion are synchronized with the main system clock. the minimum instruction execution uni t is called an ?machine cycle?. th ere are a total of 10 different types of instructions for the tlcs-870/c series: ra nging from 1-cycle instructions which require one machine cycle for execution to 10-cyc le instructions which require 10 machine cycles fo r execution. a machine cycle consists of 4 states (s0 to s3), and each state consists of one main system clock. figure 2-5 machine cycle 2.2.3 operation mode control circuit the operation mode control circuit starts and stops the oscillation circuit for the high-frequency clock. there are two operating modes: single cloc k mode and stop mode. these modes are controlled by the system con- trol registers (syscr1 and syscr2). figure 2- 6 shows the operating mode transition diagram. 2.2.3.1 single-clock mode the oscillation circuit for the high-frequency clock is used. the main-system clock is obtained from the high-frequency clock. in the single-clock mode, the machine cycle time is 4/fc [s]. (1) normal1 mode in this mode, both the cpu core and on-chip pe ripherals operate using the high-frequency clock. the TMP86P203PG is placed in this mode after reset. (2) idle1 mode in this mode, the internal oscillation circuit remains active. the cpu and the watchdog timer are halted; however on-chip peripherals remain active (operate using the high-frequency clock). idle1 mode is started by syscr2 page 12 2. operational description 2.2 system clock controller TMP86P203PG when idle0 mode starts, the cpu stops and the timing generator stops feeding the clock to the peripheral circuits other than tbt. then, upon de tecting the falling edge of the source clock selected with tbtcr page 13 TMP86P203PG note 1: when stop mode is released with reset pin input, a return is made to normal1. note 2: fc: high-frequency clock [hz], *; don?t care note 3: bits 1 and 0 in syscr1 are read as undefined data when a read instruction is executed. note 4: as the hardware becomes stop mode under outen = ?0?, input value is fixed to ?0?; therefore it may cause external interrupt request on account of falling edge. note 5: port p20 is used as stop pin. therefore, when stop mode is started, outen does not affect to p20, and p20 becomes high-z mode. note 6: always set bit5 in syscr1 to "0". note 7: the warmig-up time should be set correctly for using oscillator. note 1: when syscr2 page 14 2. operational description 2.2 system clock controller TMP86P203PG 2.2.4 operating mode control 2.2.4.1 stop mode stop mode is controlled by the system control register 1, the stop pin input. the stop pin is also used both as a port p20 and an int5 (external interrupt input 5) pin. stop mode is started by setting syscr1 page 15 TMP86P203PG figure 2-7 level-s ensitive release mode note 1: even if the stop pin input is low after warm-up start, the stop mode is not restarted. note 2: in this case of changing to the level-s ensitive mode from the edge-s ensitive mode, the release mode is not switched until a rising edge of the stop pin input is detected. (2) edge-sensitive release mode (relm = ?0?) in this mode, stop mode is released by a rising edge of the stop pin input. this is used in appli- cations where a relatively short pr ogram is executed repeat edly at periodic intervals. this periodic signal (for example, a clock from a low-power consumption oscillator) is input to the stop pin. in the edge-sensitive release mode, stop mode is started even when the stop pin input is high level. figure 2-8 edge-sensitive release mode stop mode is released by the following sequence. 1. the high-frequency clock oscillator is turned on. 2. a warm-up period is inserted to allow oscillation time to stabilize. during warm up, all internal operations remain halted. four differ ent warm-up times can be selected with the syscr1 page 16 2. operational description 2.2 system clock controller TMP86P203PG note 1: when the stop mode is released, the start is made after the prescaler and the divider of the timing generator are cleared to "0". note 2: stop mode can also be released by inputting low level on the reset pin, which immediately performs the normal reset operation. note 3: when stop mode is released with a low hold voltage, the following cautions must be observed. the power supply voltage must be at the operating voltage level before releasing stop mode. the reset pin input must also be ?h? level, rising together with the power supply voltage. in this case, if an external time const ant circuit has been connected, the reset pin input voltage will increase at a slower pace than the power supply vo ltage. at this time, there is a danger that a reset may occur if input voltage level of the reset pin drops below the non-inverting high-level input voltage (hysteresis input). note 1: the warm-up time is obtained by dividing the ba sic clock by the divider. therefore, the warm-up time may include a certain amount of error if ther e is any fluctuation of the oscillation frequency when stop mode is released. thus, the warm -up time must be considered as an approximate value. table 2-2 warm-up time example (at fc = 2.5 mhz) wut warm-up time [ms] 00 01 10 11 78.64 26.21 19.66 6.554 page 17 TMP86P203PG figure 2-9 stop mode start/release instruction address a + 4 0 instruction address a + 3 turn on turn on warm up 0 n halt set (syscr1). 7 turn off (a) stop mode start (example: start with set (syscr1). 7 instruction located at address a) a + 6 a + 5 a + 4 a + 3 a + 2 n + 2 n + 3 n + 4 a + 3 n + 1 instruction address a + 2 2 1 0 3 (b) stop mode release count up turn off halt oscillator circuit program counter instruction execution divider main system clock oscillator circuit stop pin input program counter instruction execution divider main system clock page 18 2. operational description 2.2 system clock controller TMP86P203PG 2.2.4.2 idle1 mode idle1 mode is controlled by the system control register 2 (syscr2) and maskable interrupts. the fol- lowing status is maintained during this mode. 1. operation of the cpu and watchdog timer (wdt) is halted. on-chip peripherals continue to operate. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before this mode were entered. 3. the program counter holds the address 2 ahead of the instruction which starts this mode. figure 2-10 idle1 mode reset reset input ?0? ?1? (interrupt release mode) yes no no cpu and wdt are halted interrupt request imf interrupt processing normal release mode yes starting idle1 mode by instruction execution of the instruc- tion which follows the idle1 mode start instruction page 19 TMP86P203PG ? start the idle1 mode after imf is set to "0", set the individual in terrupt enable flag (ef) which releases idle1 mode. to start idle1 mode, set syscr2 page 20 2. operational description 2.2 system clock controller TMP86P203PG figure 2-11 idle 1 mode start/release halt halt halt halt operate instruction address a + 2 a + 3 a + 2 a + 4 a + 3 a + 3 halt set (syscr2). 4 operate operate operate acceptance of interrupt ?r:wnormal release mode ?s:winterrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer main system clock interrupt request program counter instruction execution watchdog timer (a) idle1 mode start (example: starting with the set instruction located at address a) (b) idle1 mode release page 21 TMP86P203PG 2.2.4.3 idle0 mode (idle0) idle0 mode is controlled by the system control re gister 2 (syscr2) and the time base timer control register (tbtcr). the following status is maintained during idle0 mode. 1. timing generator stops feeding clock to peripherals except tbt. 2. the data memory, cpu registers, program status word and port output latches are all held in the status in effect before idle0 mode was entered. 3. the program counter holds the address 2 ahead of th e instruction which starts idle0 mode. note: before starting idle0 mode, be su re to stop (disable) peripherals. figure 2-12 idle0 mode yes (normal release mode) yes (interrupt release mode) no yes reset input cpu and wdt are halted reset tbt source clock falling edge tbtcr page 22 2. operational description 2.2 system clock controller TMP86P203PG ? start the idle0 mode stop (disable) peripherals such as a timer counter. to start idle0 mode, set syscr2 page 23 TMP86P203PG figure 2-13 idle0 m ode start/release halt halt operate instruction address a + 2 halt operate set (syscr2). 2 halt operate acceptance of interrupt halt ?r:wnormal release mode ?s:winterrupt release mode main system clock interrupt request program counter instruction execution watchdog timer main system clock tbt clock tbt clock program counter instruction execution watchdog timer main system clock program counter instruction execution watchdog timer a + 3 a + 2 a + 4 a + 3 a + 3 (a) idle0 mode start (example: starting with the set instruction located at address a (b) idle0 mode release page 24 2. operational description 2.3 reset circuit TMP86P203PG 2.3 reset circuit the TMP86P203PG has four types of reset generation procedur es: an external reset input, an address trap reset, a watchdog timer reset and a system clock re set. of these reset, the address trap reset, the watchdog timer and the sys- tem clock reset are a malfunction reset. when the malfunction reset request is detected, reset occurs during the max- imum 24/fc[s]. the malfunction reset circuit such as watchdog timer reset, address trap reset and system clock reset is not initial- ized when power is turned on. therefore, reset may occur during maximum 24/fc[s] (9.6 s at 2.5 mhz) when power is turned on. table 1-3 shows on-chip hardware initialization by reset action. 2.3.1 external reset input the reset pin contains a schmitt trigger (hysteresis) with an internal pull-up resistor. when the reset pin is held at ?l? level for at least 3 machin e cycles (12/fc [s]) wi th the power supply volt- age within the operating voltage range and oscillation stab le, a reset is applied and the internal state is initial- ized. when the reset pin input goes high, the reset operation is rele ased and the program execution starts at the vector address stored at addresses fffeh to ffffh. figure 2-14 reset circuit table 2-3 initializing internal status by reset action on-chip hardware initial value on-chip hardware initial value program counter (pc) (fffeh) prescaler and divider of timing generator 0 stack pointer (sp) not initialized general-purpose registers (w, a, b, c, d, e, h, l, ix, iy) not initialized jump status flag (jf) not initialized watchdog timer enable zero flag (zf) not initialized output latches of i/o ports refer to i/o port circuitry carry flag (cf) not initialized half carry flag (hf) not initialized sign flag (sf) not initialized overflow flag (vf) not initialized interrupt master enable flag (imf) 0 interrupt individual enable flags (ef) 0 control registers refer to each of control register interrupt latches (il) 0 ram not initialized internal reset reset vdd malfunction reset output circuit watchdog timer reset address trap reset system clock reset page 25 TMP86P203PG 2.3.2 address trap reset if the cpu should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip ram (when wdtcr1 page 26 2. operational description 2.3 reset circuit TMP86P203PG page 27 TMP86P203PG 3. interrupt control circuit the TMP86P203PG has a total of 11 interrupt sources excludi ng reset. interrupts can be nested with priorities. four of the internal interrupt sources ar e non-maskable while the rest are maskable. interrupt sources are provided with interrupt latches (il) , which hold interrupt requests, and independent vectors. the interrupt latch is set to ?1? by th e generation of its interrupt request wh ich requests the cpu to accept its inter- rupts. interrupts are enabled or disabled by software using the interrupt master enable fl ag (imf) and in terrupt enable flag (ef). if more than one interrupts are generated simultaneously, interrup ts are accepted in order which is domi- nated by hardware. however, there are no prioritized interrupt factors among non-maskable interrupts. note 1: to use the address trap interrupt (intatrap), clear wdtcr1 page 28 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86P203PG interrupt service routine. however, if using multiple inte rrupt on interrupt service routine, manipulating ef or il should be executed before setting imf="1". 3.2 interrupt enab le register (eir) the interrupt enable register (eir) enables and disables the acceptance of interrupts, except fo r the non-maskable interrupts (software interrupt, undefined instruction interr upt, address trap interrupt and watchdog interrupt). non- maskable interrupt is accepted regardless of the contents of the eir. the eir consists of an interrupt mast er enable flag (imf) and the individua l interrupt enable flags (ef). these registers are located on address 003ah and 003bh in sfr area, and they can be read and written by an instructions (including read-modify-write instructions such as bit manipulation or operation instructions). 3.2.1 interrupt ma ster enable flag (imf) the interrupt enable register (imf ) enables and disables the acceptance of the whole maskable interrupt. while imf = ?0?, all maskable interrupts are not accepted regardless of the status on each individual interrupt enable flag (ef). by setting imf to ?1?, the interrupt becomes acceptable if the individuals are enabled. when an interrupt is accepted, imf is cleared to ?0? after the latest status on imf is stacked. thus the maskable inter- rupts which follow are disabled. by executing return interrupt instruction [reti/retn], the stacked data, which was the status before interrup t acceptance, is loaded on imf again. the imf is located on bit0 in eirl (address: 003ah in sfr), and can be read and written by an instruction. the imf is normally set and cl eared by [ei] and [di] instruction respectively. during reset, the imf is initial- ized to ?0?. 3.2.2 individual interrupt enable flags (ef15 to ef4) each of these flags enables and disables the acceptan ce of its maskable interrupt . setting the corresponding bit of an individual interrupt enable flag to ?1? enables acceptan ce of its interrupt, and setting the bit to ?0? dis- ables acceptance. during reset, all the individual interrupt enable flags (ef15 to ef4) ar e initialized to ?0? and all maskable interrupts are not accepted until they are set to ?1?. note:in main program, before manipulating the interrupt enable flag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf become s "0" automatically, clearing imf need not execute nor- mally on interrupt service routine. however, if using mult iple interrupt on interrupt service routine, manipulat- ing ef or il should be executed before setting imf="1". example 1 :clears interrupt latches di ; imf example 2 :reads interrupt latchess ld wa, (ill) ; w example 3 :tests interrupt latches test (ill). 6 ; if il6 = 1 then jump jr f, sset page 29 TMP86P203PG example 1 :enables interrupts individually and sets imf di ; imf example 2 :c compiler description example unsigned int _io (3ah) eirl; /* 3ah shows eirl address */ _di(); eirl = 10100000b; : _ei(); page 30 3. interrupt control circuit 3.3 interrupt sequence TMP86P203PG note 1: to clear any one of bits il6 to il4, be sure to write "1" into il2 and il3. note 2: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". note 3: do not clear il with read-modify-w rite instructions such as bit operations. note 1: *: don?t care note 2: do not set imf and the interrupt enable flag (ef15 to ef4) to ?1? at the same time. note 3: in main program, before manipulating the interrupt enable fl ag (ef) or the interrupt latch (il), be sure to clear imf to "0" (disable interrupt by di instruction). then set imf newly again as required after operating on the ef or il (enable interrupt by ei instruction) in interrupt service routine, because the imf becomes "0" automatically, clear ing imf need not execute normally on inter- rupt service routine. however, if using multiple interrupt on interrupt service routine, mani pulating ef or il should be exe- cuted before setting imf="1". 3.3 interrupt sequence an interrupt request, which raised interrupt latch, is held, until interrupt is accepted or interrupt latch is cleared to ?0? by resetting or an instruc tion. interrupt acceptan ce sequence requires 8 machine cycles (12.8 s @2.5 mhz) after the completion of the current inst ruction. the interrupt service task term inates upon execution of an interrupt return instruction [reti] (for maskable interrupts) or [r etn] (for non-maskable interrupts). figure 3-1 shows the timing chart of interrupt acceptance processing. 3.3.1 interrupt acceptance proc essing is packaged as follows. a. the interrupt master enab le flag (imf) is cleared to ?0? in or der to disable the acceptance of any fol- lowing interrupt. b. the interrupt latch (il) for the interrupt source accepted is cleared to ?0?. c. the contents of the program coun ter (pc) and the program status word, including the interrupt master enable flag (imf), are saved (pushed) on the st ack in sequence of psw + imf, pch, pcl. mean- while, the stack pointer (s p) is decremented by 3. interrupt latches (initial value: 0**000** *00000**) ilh,ill (003dh, 003ch) 1514131211109876543210 il15 ?? ??? ?? ??? page 31 TMP86P203PG d. the entry address (interrupt vect or) of the corresponding interrupt service program, loaded on the vec- tor table, is transferred to the program counter. e. the instruction stored at the entry address of the inte rrupt service program is executed. note:when the contents of psw are saved on the stack, the contents of imf are also saved. note 1: a: return address entry address, b: entry address, c: address which reti instruction is stored note 2: on condition that interrupt is enabled, it takes 38/fc [s] at maximum (if the interrupt latch is set at the first machin e cycle on 10 cycle instruction) to start interrupt accept ance processing since its interrupt latch is set. figure 3-1 timing chart of interrupt acceptance/return in terrupt instruction example: correspondence be tween vector table address for inttbt and the entry address of the interrupt service program figure 3-2 vector tabl e address, entry address a maskable interrupt is not accepted until the imf is set to ?1? even if th e maskable interrupt higher than the level of current servicing interrupt is requested. in order to utilize nested interrupt service, the imf is set to ?1? in the interrupt service program. in this case, acceptable interrupt sources are selectively en abled by the individual interrupt enable flags. to avoid overloaded nesting, clear the individual interrupt enable flag whose interrupt is currently serviced, before setting imf to ?1?. as for non-maskable interr upt, keep interrupt service shorten compared with length between interrupt requests; otherwise the status cannot be recovered as non-maskable interrupt would simply nested. a b a c + 1 execute instruction sp pc execute instruction n n ? 2 n - 3 n ? 2n ? 1 n ? 1 n a + 2 a + 1 c + 2 b + 3 b + 2 b + 1 a + 1 a a ? 1 execute reti instruction interrupt acceptance execute instruction interrupt service task 1-machine cycle interrupt request interrupt latch (il) imf d2h 03h d203h d204h 06h vector table address entry address 0fh vector interrupt service program fff2h fff3h page 32 3. interrupt control circuit 3.3 interrupt sequence TMP86P203PG 3.3.2 saving/restoring general-purpose registers during interrupt acceptance processing , the program counter (pc) and the program status word (psw, includes imf) are automati cally saved on the stack, but the accumulato r and others are not. these registers are saved by software if necessary. when multiple interrupt se rvices are nested, it is also necessary to avoid using the same data memory area for saving registers. the fo llowing methods are used to save/restore the general- purpose registers. 3.3.2.1 using push and pop instructions if only a specific register is saved or interrupts of the same source are nested , general-purpose registers can be saved/restored using the push/pop instructions. figure 3-3 save/store register using push and pop instructions 3.3.2.2 using data transfer instructions to save only a specific register wi thout nested interrupts, data tran sfer instructions are available. example :save/store register us ing push and pop instructions pintxx: push wa ; save wa register (interrupt processing) pop wa ; restore wa register reti ; return example :save/store register us ing data transfer instructions pintxx: ld (gsava), a ; save a register (interrupt processing) ld a, (gsava) ; restore a register reti ; return pcl pch psw at acceptance of an interrupt at execution of push instruction at execution of reti instruction at execution of pop instruction b-4 b-3 b-2 b-1 b pcl pch psw pcl pch psw sp address (example) sp sp sp a w b-5 page 33 TMP86P203PG figure 3-4 saving/restoring general-purpose r egisters under interrupt processing 3.3.3 interrupt return interrupt return instructions [reti]/[retn] perform as follows. as for address trap interrupt (intatrap), it is requir ed to alter stacked data for program counter (pc) to restarting address, during interrupt service program. note:if [retn] is executed with the above data unaltered, the program returns to the address trap area and intatrap occurs again.when interrupt acceptance pr ocessing has completed, stacked data for pcl and pch are located on address (sp + 1) and (sp + 2) respectively. interrupt requests are sampled during the final cycle of the instruction being executed. thus, the next inter- rupt can be accepted immediately after the interrupt retu rn instruction is executed. [reti]/[retn] interrupt return 1. program counter (pc) and program status word (psw, includes imf) are restored from the stack. 2. stack pointer (sp) is incremented by 3. example 1 :returning from address trap interrupt (intatrap) service program pintxx: pop wa ; recover sp by 2 ld wa, return address ; push wa ; alter stacked data (interrupt processing) retn ; return example 2 :restarting without returning interrupt (in this case, psw (includes imf) befo re interrupt acceptance is discarded.) pintxx: inc sp ; recover sp by 3 inc sp ; inc sp ; (interrupt processing) ld eirl, data ; set imf to ?1? or clear it to ?0? jp restart address ; jump into restarting address interrupt acceptance interrupt service task restoring registers saving registers interrupt return saving/restoring general-purpose registers using push/pop data transfer instruction main task page 34 3. interrupt control circuit 3.4 software interrupt (intsw) TMP86P203PG note 1: it is recommended that stack pointer be return to rate before intatrap (increment 3 times), if return inter- rupt instruction [retn] is not utilized during inte rrupt service program under intatrap (such as example 2). note 2: when the interrupt processing time is longer than the interrupt request generation time, the interrupt service task is performed but not the main task. 3.4 software interrupt (intsw) executing the swi instruction generates a software interr upt and immediately starts interrupt processing (intsw is highest prioritized interrupt). use the swi instruction only for detection of the address error or for debugging. 3.4.1 address error detection ffh is read if for some cause such as noise the cpu attempts to fetch an instruction from a non-existent memory address during single chip mode. code ffh is th e swi instruction, so a software interrupt is gener- ated and an address error is detect ed. the address error detection range can be further expanded by writing ffh to unused areas of the program memory. address trap reset is generated in case that an instruction is fetched from ram or sfr areas. 3.4.2 debugging debugging efficiency can be increased by placing the swi instruction at the software break point setting address. 3.5 undefined instruct ion interrupt (intundef) taking code which is not defined as authorized instru ction for instruction causes intundef. intundef is gen- erated when the cpu fetches such a co de and tries to execute it. intundef is accepted even if non-maskable inter- rupt is in process. contemporary process is broken and intundef interrupt process starts, soon after it is requested. note: the undefined instruction interrupt (intundef) forces cpu to jump into vector address, as software interrupt (swi) does. 3.6 address trap interrupt (intatrap) fetching instruction from unauthorized area for instructio ns (address trapped area) cause s reset output or address trap interrupt (intatrap). intatrap is accepted even if non-maskable interrupt is in process. contemporary pro- cess is broken and intatrap interrupt pro cess starts, soon afte r it is requested. note: the operating mode under address trapped, whether to be reset output or interrupt processing, is selected on watchdog timer control register (wdtcr). 3.7 external interrupts the TMP86P203PG has 3 external interrupt inputs. these inputs are equipped with digital noise reject circuits (pulse inputs of less than a certa in time are elimin ated as noise). edge selection is also possible with int1. the int0 /p10 pin can be configured as ei ther an external interrupt input pin or an input/output port, and is configured as an input port during reset. edge selection, noise reject control and int0 / p10 pin function selection are performed by the external interrupt control register (eintcr). page 35 TMP86P203PG note 1: in normal1 or idle1 mode, if a signal with no noise is input on an external interrupt pin, it takes a maximum of "signal establishment time + 6/fs[s]" from the input signal's edge to set the interrupt latch. note 2: when int0en = "0", il4 is not set even if a falling edge is detected on the int0 pin input. note 3: when a pin with more than one function is used as an out put and a change occurs in data or input/output status, an inter - rupt request signal is generated in a pseudo manner. in this ca se, it is necessary to perform appropriate processing such as disabling the interrupt enable flag. source pin enable conditions release edge digital noise reject int0 int0 imf + ef4 + int0en=1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. int1 int1 imf + ef5 = 1 falling edge or rising edge pulses of less than 15/fc or 63/fc [s] are elimi- nated as noise. pulses of 49/fc or 193/fc [s] or more are considered to be signals. int5 int5 imf + ef15 = 1 falling edge pulses of less than 2/fc [s] are eliminated as noise. pulses of 7/fc [s ] or more are considered to be signals. page 36 3. interrupt control circuit 3.7 external interrupts TMP86P203PG note 1: fc: high-frequency clock [hz], *: don?t care note 2: when the system clock frequency is switched between high and low or when the external interrupt control register (eintcr) is overwritten, the noise canceller may not operat e normally. it is recommended that external interrupts are dis- abled using the interrupt enable register (eir). note 3: the maximum time from modifying int1 nc until a noise reject time is changed is 2 6 /fc. external interrupt control register eintcr76543210 (0037h) int1nc int0en - - - - int1es (initial value: 00** **0*) int1nc noise reject time select 0: pulses of less than 63/fc [s] are eliminated as noise 1: pulses of less than 15/fc [s] are eliminated as noise r/w int0en p10/ int0 pin configuration 0: p10 input/output port 1: int0 pin (port p10 should be set to an input mode) r/w int1 es int1 edge select 0: rising edge 1: falling edge r/w page 37 TMP86P203PG 4. special function register (sfr) the TMP86P203PG adopts the memory mapped i/o system, an d all peripheral control and data transfers are per- formed through the special function register (sfr). the sfr is mapped on address 0000h to 003fh. this chapter shows the arrangem ent of the special function re gister (sfr) for TMP86P203PG. 4.1 sfr address read write 0000h p0dr 0001h p1dr 0002h p2dr 0003h p3dr 0004h reserved 0005h reserved 0006h reserved 0007h reserved 0008h reserved 0009h p1cr 000ah p3cr 000bh p0outcr 000ch p0prd - 000dh p2prd - 000eh adccr1 000fh adccr2 0010h reserved 0011h reserved 0012h reserved 0013h reserved 0014h reserved 0015h reserved 0016h reserved 0017h reserved 0018h reserved 0019h reserved 001ah tc3cr 001bh tc4cr 001ch ttreg3 001dh ttreg4 001eh pwreg3 001fh pwreg4 0020h adcdr1 - 0021h adcdr2 - 0022h reserved 0023h reserved 0024h reserved 0025h reserved 0026h reserved 0027h reserved page 38 4. special function register (sfr) 4.1 sfr TMP86P203PG note 1: do not access reserved areas by the program. note 2: ? page 39 TMP86P203PG 5. i/o ports the TMP86P203PG has 4 parallel input/output ports as follows. each output port contains a latch, which holds the output data. all input ports do not have latches, so the external input data should be externally held until the input data is read from outside or reading should be performed several timer before processing. figure 5-1 shows input/output timing examples. external data is read from an i/o port in the s1 state of the read cycle during execution of the read instruction. this timing cannot be recognized from outside, so that transient input such as chattering must be processed by the pro- gram. output data changes in the s2 state of the write cycle du ring execution of the instruct ion which writes to an i/o port. note: the positions of the read and write c ycles may vary, depending on the instruction. figure 5-1 input/output timing (example) primary function secondary functions port p0 2-bit i/o port ? instruction execution cycle input strobe data input ex: ld a, (x) fetch cycle fetch cycle read cycle s0 s1 s2 s3 s0 s1 s2 s3 s0 s1 s2 s3 instruction execution cycle old new output strobe data output ex: ld (x), a fetch cycle fetch cycle write cycle s0 s1 s2 s3 s0 s1 s2 s3 s0 s1 s2 s3 (a) input timing (b) output timing page 40 5. i/o ports TMP86P203PG 5.1 p0 (p01 to p00) port (high current) the p0 port is an 2-bit input/output port. when using th is port as an input port set the output latch to 1. when using this port as an output port, the outp ut latch data (p0dr) is output to the p0 port. when reset, the output latch (p0dr) and the push-pull co ntrol register (p0outcr) ar e initialized to 1 and 0, respectively. the p0 port allows its output circuit to be selected between n-channel open-drain i nput/output or push-pull output by the p0outcr register. when using this port as an input port, set the p0outcr register's corresponding bit to 0 after setting the p0dr to 1. the p0 port has independent data input registers. to inspect the output latch status, read the p0dr register. to inspect the pin status, r ead the p0prd register. figure 5-2 port p0 p0dr (0000h) r/w 765432 1 0 p01 p00 (initial value: **** **11) p0prd (000ch) read only 765432 1 0 p01 p00 p0outcr (000bh) r/w 765432 1 0 p0outcr1 p0outcr0 (initial value: **** **00) p0outcr controls p0 port output 0: sink open-drain input/output 1: push-pull output r/w |