Part Number Hot Search : 
M8282 28101 MAX1391 FN3395 MYB36CA 30374 2SC328 ASC7512
Product Description
Full Text Search
 

To Download TMP86CS25ADFG Datasheet File

  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 TMP86CS25ADFG
page 2 TMP86CS25ADFG the information contained herein is su bject to change without notice. 021023 _ d toshiba is continually working to improve the qual ity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fa il due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utilizing toshiba products , to comply with the standards of safety 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, please ensure that to shiba products are used within specified operating ranges as set forth in the most re cent toshiba products specifications. also, please keep in mind the precautio ns 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 inte nded for usage in general electronics applications (computer, personal equipment, office 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, tr ansportation instruments, 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 he rein is presented only as a guide for the applications of our products. no responsibility is assumed by tosh iba for any infringements 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 patent or patent rights of toshiba or others. 021023_c the products described in this document may include products subject to the foreign exchange and foreign trade laws. 021023_f 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 reli ability assurance/hand ling precautions. 030619_s ? 2006 toshiba corporation all rights reserved
revision history date revision 2006/2/11 1 first release 2006/7/10 2 periodical updating.no change in contents. 2006/7/27 3 periodical updating.no change in contents. 2006/9/5 4 contents revised 2006/11/15 5 contents revised

i table of contents TMP86CS25ADFG 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.1 memory address map ............................................................................................................................... 9 2.1.2 program memory (maskrom) .................................................................................................................. 9 2.1.3 data memory (ram) ............................................................................................................................... .. 9 2.2 system clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.1 clock generator ............................................................................................................................... ....... 10 2.2.2 timing generator ............................................................................................................................... ..... 12 2.2.2.1 configuration of timing generator 2.2.2.2 machine cycle 2.2.3 operation mode control circuit .............................................................................................................. 13 2.2.3.1 single-clock mode 2.2.3.2 dual-clock mode 2.2.3.3 stop mode 2.2.4 operating mode control ......................................................................................................................... 18 2.2.4.1 stop mode 2.2.4.2 idle1/2 mode and sleep1/2 mode 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) 2.2.4.4 slow mode 2.3 reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.3.1 external reset input ............................................................................................................................... 31 2.3.2 address trap reset ............................................................................................................................... ... 32 2.3.3 watchdog timer reset .............................................................................................................................. 32 2.3.4 system clock reset ............................................................................................................................... ... 32 3. interrupt control circuit 3.1 interrupt latches (il15 to il2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.2 interrupt enable register (eir) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.2.1 interrupt master enable flag (imf) .......................................................................................................... 36 3.2.2 individual interrupt enable flags (ef15 to ef4) ...................................................................................... 36 3.3 interrupt source selector (intsel) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.4 interrupt sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.4.1 interrupt acceptance processing is packaged as follows. ....................................................................... 39 3.4.2 saving/restoring general-purpose registers ............................................................................................ 40 3.4.2.1 using push and pop instructions 3.4.2.2 using data transfer instructions 3.4.3 interrupt return ............................................................................................................................... ......... 42 3.5 software interrupt (intsw) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.5.1 address error detection .......................................................................................................................... 43 3.5.2 debugging ............................................................................................................................... ............... 43
ii 3.6 undefined instruction interrupt (intundef) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.7 address trap interrupt (intatrap) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.8 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4. special function r egister (sfr) 4.1 sfr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.2 dbr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5. i/o ports 5.1 port p1 (p17 to p10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.2 port p2 (p22 to p20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.3 port p3 (p36 to p30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 5.4 port p5 (p57 to p50) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.5 port p6 (p67 to p60) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.6 port p7 (p77 to p70) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.7 multi function register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 6. watchdog timer (wdt) 6.1 watchdog timer configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.2 watchdog timer control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6.2.1 malfunction detection methods using the watchdog timer ................................................................... 62 6.2.2 watchdog timer enable ......................................................................................................................... 63 6.2.3 watchdog timer disable ........................................................................................................................ 64 6.2.4 watchdog timer interrupt (intwdt) ...................................................................................................... 64 6.2.5 watchdog timer reset ........................................................................................................................... 65 6.3 address trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 6.3.1 selection of address trap in internal ram (atas) ................................................................................ 66 6.3.2 selection of operation at address trap (atout) .................................................................................. 66 6.3.3 address trap interrupt (intatrap) ....................................................................................................... 66 6.3.4 address trap reset ............................................................................................................................... . 67 7. time base timer (tbt) 7.1 time base timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 7.1.1 configuration ............................................................................................................................... ........... 69 7.1.2 control ............................................................................................................................... ..................... 69 7.1.3 function ............................................................................................................................... ................... 70 7.2 divider output (dvo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 7.2.1 configuration ............................................................................................................................... ........... 71 7.2.2 control ............................................................................................................................... ..................... 71 8. 18-bit timer/counter (tc1) 8.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 8.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 8.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
iii 8.3.1 timer mode ............................................................................................................................... .............. 77 8.3.2 event counter mode ............................................................................................................................... 78 8.3.3 pulse width measurement mode ............................................................................................................ 79 8.3.4 frequency measurement mode .............................................................................................................. 80 9. 8-bit timercounter (tc3, tc4) 9.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 9.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 9.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 9.3.1 8-bit timer mode (tc3 and 4) ................................................................................................................ 89 9.3.2 8-bit event counter mode (tc3, 4) ........................................................................................................ 90 9.3.3 8-bit programmable divider ou tput (pdo) mode (tc3, 4) ..................................................................... 90 9.3.4 8-bit pulse width modulation (pwm) output mode (tc3, 4) .................................................................. 93 9.3.5 16-bit timer mode (tc3 and 4) .............................................................................................................. 95 9.3.6 16-bit event counter mode (tc3 and 4) ................................................................................................ 96 9.3.7 16-bit pulse width modulation (pwm) output mode (tc3 and 4) .......................................................... 96 9.3.8 16-bit programmable pulse generate (ppg) output mode (tc3 and 4) ............................................... 99 9.3.9 warm-up counter mode ....................................................................................................................... 101 9.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) 9.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) 10. 8-bit timercounter (tc5, tc6) 10.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10.2 timercounter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 10.3.1 8-bit timer mode (tc5 and 6) ............................................................................................................ 108 10.3.2 8-bit event counter mode (tc6) ........................................................................................................ 109 10.3.3 8-bit programmable divider output (pdo) mode (tc6) ..................................................................... 109 10.3.4 8-bit pulse width modulation (pwm) output mode (tc6) .................................................................. 112 10.3.5 16-bit timer mode (tc5 and 6) .......................................................................................................... 114 10.3.6 16-bit pulse width modulation (pwm) output mode (tc5 and 6) ...................................................... 115 10.3.7 16-bit programmable pulse generate (ppg) output mode (tc5 and 6) ........................................... 118 10.3.8 warm-up counter mode ..................................................................................................................... 120 10.3.8.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) 10.3.8.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) 11. asynchronous serial interface (uart ) 11.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 11.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 11.3 transfer data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 11.4 transfer rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 11.5 data sampling method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 11.6 stop bit length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 11.7 parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 11.8 transmit/receive operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 11.8.1 data transmit operation .................................................................................................................... 128 11.8.2 data receive operation ..................................................................................................................... 128 11.9 status flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 11.9.1 parity error ............................................................................................................................... ........... 129
iv 11.9.2 framing error ............................................................................................................................... ....... 129 11.9.3 overrun error ............................................................................................................................... ....... 129 11.9.4 receive data buffer full ..................................................................................................................... 130 11.9.5 transmit data buffer empty ............................................................................................................... 130 11.9.6 transmit end flag .............................................................................................................................. 131 12. synchronous serial interface (sio0) 12.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 12.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 12.3 serial clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 12.3.1 clock source ............................................................................................................................... ........ 135 12.3.1.1 internal clock 12.3.1.2 external clock 12.3.2 shift edge ............................................................................................................................... ............. 137 12.3.2.1 leading edge 12.3.2.2 trailing edge 12.4 number of bits to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 12.5 number of words to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 12.6 transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 12.6.1 4-bit and 8-bit transfer modes ............................................................................................................. 138 12.6.2 4-bit and 8-bit receive modes ............................................................................................................. 140 12.6.3 8-bit transfer / receive mode ............................................................................................................... 141 13. synchronous serial interface (sio1) 13.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 13.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 13.3 serial clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 13.3.1 clock source ............................................................................................................................... ........ 145 13.3.1.1 internal clock 13.3.1.2 external clock 13.3.2 shift edge ............................................................................................................................... ............. 147 13.3.2.1 leading edge 13.3.2.2 trailing edge 13.4 number of bits to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 13.5 number of words to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 13.6 transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 13.6.1 4-bit and 8-bit transfer modes ............................................................................................................. 148 13.6.2 4-bit and 8-bit receive modes ............................................................................................................. 150 13.6.3 8-bit transfer / receive mode ............................................................................................................... 151 14. 8-bit ad converter (adc) 14.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 14.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 14.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 14.3.1 ad conveter operation ...................................................................................................................... 156 14.3.2 ad converter operation ..................................................................................................................... 156 14.3.3 stop and slow mode during ad conversion ................................................................................. 157 14.3.4 analog input voltage and ad conversion result ............................................................................... 158 14.4 precautions about ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 14.4.1 analog input pin voltage range ........................................................................................................... 159 14.4.2 analog input shared pins .................................................................................................................... 159 14.4.3 noise countermeasure ........................................................................................................................ 159
v 15. key-on wakeup (kwu) 15.1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 15.2 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 15.3 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 16. lcd driver 16.1 configuration of lcd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 16.2 controlling lcd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 16.2.1 frame frequency ............................................................................................................................... .. 165 16.3 lcd booster circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 16.4 methods of connecting lcd booster circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 16.4.1 method of connecting booster circuit by using a regulator ................................................................. 166 16.4.2 method of connecting booster ci rcuit without using a regulator .......................................................... 166 16.5 lcd display operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 16.5.1 setting display data ............................................................................................................................ 16 7 16.5.2 blanking ............................................................................................................................... ............... 168 16.6 method of controlling lcd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 16.6.1 initial setting ............................................................................................................................... ......... 168 16.6.2 storing display data ............................................................................................................................ 16 8 17. input/output circuitry 17.1 control pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 17.2 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 18. electrical characteristics 18.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 18.2 recommended operating condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 18.3 dc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 18.4 ad conversion characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 18.5 ac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 18.6 timer counter 1 input (ecin) characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 179 18.7 recommended oscillating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 18.8 handling precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 19. package dimension this is a technical docu ment that describes the operat ing functions and electrical specifications of the 8-bit microc ontroller series tlcs-870/c (lsi).
vi
page 1 060116ebp TMP86CS25ADFG 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. neverthel ess, semiconductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vul nerability 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 re liability or a malfunctionor 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 patent or patent rights of toshiba or others. 021023_c ? the products described in this document are subjec t to the foreign exchange and foreign trade laws. 021023_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 TMP86CS25ADFG 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c series - instruction execution time : 0.25 s (at 16 mhz) 122 s (at 32.768 khz) - 132 types & 731 basic instructions 2. 20interrupt sources (external : 5 internal : 15) 3. input / output ports (42 pins) large current output: 4pins (typ. 20ma), led direct drive 4. watchdog timer 5. prescaler - time base timer - divider output function 6. 18-bit timer/counter : 1ch - timer mode - event counter mode - pulse width measurement mode - frequency measurement mode 7. 8-bit timer counter : 4 ch - timer, event counter, programmable divider output (pdo), pulse width modulation (pwm) output, product no. rom (maskrom) ram package emulation chip TMP86CS25ADFG 61440 bytes 2048 bytes p-lqfp100-1414-0.50f tmp86c925xb
page 2 1.1 features TMP86CS25ADFG programmable pulse generation (ppg) modes 8. 8-bit uart/sio : 1 ch 9. 8-bit sio: 1 ch 10. 8-bit successive approximation type ad converter (with sample hold) analog inputs: 8ch 11. key-on wakeup : 4 ch 12. lcd driver/controller built-in voltage booster for lcd driver with displaymemory lcd direct driv e capability (60 seg 16 com, 60 seg 8 com, 60 seg 4 com) 1/16,1/8,1/4 duties or static drive are programmably selectable 13. clock operation single clock mode dual clock mode 14. low power consumption operation stop mode: oscillation stops. (battery/capacitor back-up.) slow1 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock stop.) slow2 mode: low power consumption operation usin g low-frequency clock.(high-frequency clock oscillate.) 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. idle1 mode: cpu stops and peripherals operate us ing high frequency clock. release by interru- puts(cpu restarts). idle2 mode: cpu stops and peripherals operate usin g high and low frequency clock. release by inter- ruputs. (cpu restarts). sleep0 mode: cpu stops, and only the time-based-t imer(tbt) on peripherals operate using low fre- quency clock.release by falling edge of th e source clock which is set by tbtcr. sleep1 mode: cpu stops, and peripherals operate using low frequency clock. release by interru- put.(cpu restarts). sleep2 mode: cpu stops and peripherals operate using high and low frequency clock. release by interruput. 15. wide operation voltage: 4.5 v to 5.5 v at 16.0 mhz /32.768 khz 2.7 v to 5.5 v at 8.0 mhz /32.768 khz 1.8 v to 5.5 v at 4.2 mhz /32.768 khz
page 3 TMP86CS25ADFG 1.2 pin assignment figure 1-1 pin assignment 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 seg26 seg27 seg28 seg29 seg30 seg31 seg32 seg33 seg34 seg35 seg36 seg37 seg38 seg39 p50 (seg40) p51 (seg41) p52 (seg42) p53 (seg43) p54 (seg44) p55 (seg45) p56 (seg46) p57 (seg47) p30 (seg48/mul0) p31 (seg49/mul1) p32 (seg50/mul2) xout test vdd (xtin) p21 (xtout) p22 reset ( int5 / stop ) p20 (ain0) p60 (ecin/ain1) p61 (ecnt/ain2) p62 ( int0 /ain3) p63 (stop2/ain4) p64 (stop4/ain6) p66 (stop3/ain5) p65 (stop5/ain7) p67 varef ( sck0 /seg59) p17 (so0/txd/seg58) p16 (si0/rxd/seg57) p15 (mul6/seg56) p14 (mul5/seg55) p13 (mul4/seg54) p12 (seg52) p10 (seg53) p11 (mul3/seg51) p33 com4 (com5/mul4) p34 (com6/mul5) p35 (com7/mul6) p36 (com8) p70 (com9/mul0) p71 (com10/mul1) p72 (com11/mul2) p73 (com12/mul3) p74 (com13/si1) p75 (com14/so1) p76 (com15/ sck1 ) p77 v4 v3 v2 v1 c1 c0 vss xin seg0 com0 com1 com2 com3 seg15 seg1 seg2 seg3 seg4 seg5 seg6 seg7 seg8 seg9 seg10 seg11 seg12 seg13 seg14 seg16 seg17 seg18 seg19 seg20 seg21 seg22 seg23 seg24 seg25
page 4 1.3 block diagram TMP86CS25ADFG 1.3 block diagram figure 1-2 block diagram
page 5 TMP86CS25ADFG 1.4 pin names and functions table 1-1 pin names and functions(1/4) pin name pin number input/output functions p17 seg59 sck0 17 io o i port17 lcd segment output 59 serial clock i/o 0 p16 seg58 txd so0 18 i o o o port16 lcd segment output 58 uart data output serial data output 0 p15 seg57 rxd si0 19 io o i i port15 lcd segment output 57 uart data input serial data input 0 p14 seg56 mul6 20 io o i port14 lcd segment output 56 multi function 6 pin p13 seg55 mul5 21 io o i port13 lcd segment output 55 multi function 5 pin p12 seg54 mul4 22 io o i port12 lcd segment output 54 multi function 4 pin p11 seg53 23 io o port11 lcd segment output 53 p10 seg52 24 io i port10 lcd segment output 52 p22 xtout 5 io o port22 resonator connecting pins(32.768 khz) for inputting external clock p21 xtin 4 io i port21 resonator connecting pins(32.768 khz) for inputting external clock p20 stop int5 7 io i i port20 stop mode release signal input external interrupt 5 input p36 mul6 com7 84 io i o port36 multi function 6 pin lcd common output 7 p35 mul5 com6 83 io i i port35 multi function 5 pin lcd common output 6 p34 mul4 com5 82 io i i port34 multi function 4 pin lcd common output 5 p33 seg51 mul3 25 io i i port33 lcd segment output 51 multi function 3 pin p32 seg50 mul2 26 io o i port32 lcd segment output 50 multi function 2 pin
page 6 1.4 pin names and functions TMP86CS25ADFG p31 seg49 mul1 27 io o i port31 lcd segment output 49 multi function 1 pin p30 seg48 mul0 28 io o i port30 lcd segment output 48 multi function 0 pin p57 seg47 29 io i port57 lcd segment output 47 p56 seg46 30 io o port56 lcd segment output 46 p55 seg45 31 io o port55 lcd segment output 45 p54 seg44 32 io o port54 lcd segment output 44 p53 seg43 33 io o port53 lcd segment output 43 p52 seg42 34 io o port52 lcd segment output 42 p51 seg41 35 io o port51 lcd segment output 41 p50 seg40 36 io o port50 lcd segment output 40 p67 ain7 stop5 15 io i i port67 ad converter analog input 7 stop5 input p66 ain6 stop4 14 io i i port66 ad converter analog input 6 stop4 input p65 ain5 stop3 13 io i i port65 ad converter analog input 5 stop3 input p64 ain4 stop2 12 io i i port64 ad converter analog input 4 stop2 input p63 ain3 int0 11 io i i port63 ad converter analog input 3 external interrupt 0 input p62 ain2 ecnt 10 io i i port62 ad converter analog input 2 ecnt input p61 ain1 ecin 9 io i i port61 ad converter analog input 1 ecin input p60 ain0 8 io i port60 ad converter analog input 0 p77 sck1 com15 92 io io o port77 serial clock i/o 1 lcd common output 15 table 1-1 pin names and functions(2/4) pin name pin number input/output functions
page 7 TMP86CS25ADFG p76 so1 com14 91 io o o port76 serial data output 1 lcd common output 14 p75 si1 com13 90 io i o port75 serial data input 1 lcd common output 13 p74 mul3 com12 89 io io o port74 multi function 3 pin lcd common output 12 p73 mul2 com11 88 io o o port73 multi function 2 pin lcd common output 11 p72 mul1 com10 87 io io o port72 multi function 1 pin lcd common output 10 p71 mul0 com9 86 io o o port71 multi function 0 pin lcd common output 9 p70 com8 85 io o port70 lcd common output 8 seg39 37 o lcd segment output 39 seg38 38 o lcd segment output 38 seg37 39 o lcd segment output 37 seg36 40 o lcd segment output 36 seg35 41 o lcd segment output 35 seg34 42 o lcd segment output 34 seg33 43 o lcd segment output 33 seg32 44 o lcd segment output 32 seg31 45 o lcd segment output 31 seg30 46 o lcd segment output 30 seg29 47 o lcd segment output 29 seg28 48 o lcd segment output 28 seg27 49 o lcd segment output 27 seg26 50 o lcd segment output 26 seg25 51 o lcd segment output 25 seg24 52 o lcd segment output 24 seg23 53 o lcd segment output 23 seg22 54 o lcd segment output 22 seg21 55 o lcd segment output 21 seg20 56 o lcd segment output 20 seg19 57 o lcd segment output 19 seg18 58 o lcd segment output 18 table 1-1 pin names and functions(3/4) pin name pin number input/output functions
page 8 1.4 pin names and functions TMP86CS25ADFG seg17 59 o lcd segment output 17 seg16 60 o lcd segment output 16 seg15 61 o lcd segment output 15 seg14 62 o lcd segment output 14 seg13 63 o lcd segment output 13 seg12 64 o lcd segment output 12 seg11 65 o lcd segment output 11 seg10 66 o lcd segment output 10 seg9 67 o lcd segment output 9 seg8 68 o lcd segment output 8 seg7 69 o lcd segment output 7 seg6 70 o lcd segment output 6 seg5 71 o lcd segment output 5 seg4 72 o lcd segment output 4 seg3 73 o lcd segment output 3 seg2 74 o lcd segment output 2 seg1 75 o lcd segment output 1 seg0 76 o lcd segment output 0 com4 81 o lcd common output 4 com3 80 o lcd common output 3 com2 79 o lcd common output 2 com1 78 o lcd common output 1 com0 77 o lcd common output 0 v4 93 i lcd voltage booster pin v3 94 i lcd voltage booster pin v2 95 i lcd voltage booster pin v1 96 i lcd voltage booster pin c1 97 i lcd voltage booster pin c0 98 i lcd voltage booster pin xin 100 i resonator connecting pins for high-frequency clock xout 1 o resonator connecting pins for high-frequency clock reset 6 i reset signal test 2 i test pin for out-going test. normally, be fixed to low. varef 16 i analog reference voltage input (high) vdd 3 i power supply vss 99 i 0(gnd) table 1-1 pin names and functions(4/4) pin name pin number input/output functions
page 9 TMP86CS25ADFG 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 TMP86CS25ADFG memory is composed maskrom, ram, dbr(data buffer register) and sfr(spe- cial function register). they are all mapped in 64-kbyte address space. figure 2-1 shows the TMP86CS25ADFG memory address map. figure 2-1 memory address map 2.1.2 program memory (maskrom) the TMP86CS25ADFG has a 61440 bytes (address 1000h to ffffh) of program memory (maskrom ). 2.1.3 data memory (ram) the TMP86CS25ADFG has 2048 bytes (address 0040h to 083fh) of internal ram. the first 192 bytes (0040h to 00ffh) of the internal ra m are located in the direct area; inst ructions with shorten operations are 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 2048 bytes 083f h dbr 0f00 h 256 bytes dbr: data buffer register includes: peripheral control registers peripheral status registers lcd display memory 0fff h 1000 h maskrom: program memory maskrom 61440 bytes ffc0 h vector table for vector call instructions (32 bytes) ffdf h ffe0 h vector table for interrupts (32 bytes) ffff h
page 10 2. operational description 2.2 system clock controller TMP86CS25ADFG 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. it contains two oscillation ci rcuits: one for the high-frequency clock and one for the low-frequency clock. power consumption can be reduced by switching of the standby controller to low-power operation based on the low-frequency clock. the high-frequency (fc) clock and low-frequency (fs) clock can easily be obtained by connecting a resonator between the xin/xout and xtin/xtout pins respectively. clock input from an exte rnal oscillator is also possible. in this case, external clock is applied to xin/xtin pin with xout/xtout pin not connected. example :clears ram to ?00h?. (TMP86CS25ADFG) ld hl, 0040h ; start address setup ld a, h ; initial value (00h) setup ld bc, 07ffh sramclr: ld (hl), a inc hl dec bc jrs f, sramclr tbtcr syscr2 syscr1 xin xout xtin xtout fc 0036 h 0038 h 0039 h fs timing generator control register timing generator standby controller system clocks clock generator control high-frequency clock oscillator low-frequency clock oscillator clock generator system control registers
page 11 TMP86CS25ADFG 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 (open) xout xin xtout xtin (open) xtout xtin (a) crystal/ceramic resonator (b) external oscillator (c) crystal (d) external oscillator high-frequency clock low-frequency clock
page 12 2. operational description 2.2 system clock controller TMP86CS25ADFG 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 or fs). 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 7. lcd 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. an input clock to the 7th stage of the divider depends on the operating mode, syscr2 and tbtcr, that is shown in figure 2-4. as reset and stop mode star ted/canceled, the prescaler and the divider are cleared to ?0?. figure 2-4 configurat ion of timing generator multi- plexer high-frequency clock fc low-frequency clock fs divider sysck fc/4 fc or fs machine cycle counters main system clock generator 1 2 1 4 3 2 8 7 10 9 12 11 14 13 16 15 dv7ck multiplexer warm-up controller watchdog timer a s b y s b0 a0 y0 b1 a1 y1 5 6 17 18 19 20 21 timer counter, serial interface, time-base-timer, divider output, etc. (peripheral functions)
page 13 TMP86CS25ADFG note 1: in single clock mode, do not set dv7ck to ?1?. note 2: do not set ?1? on dv7ck while the low-frequency clock is not operated stably. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 4: in slow1/2 and sleep1/2 modes, the dv7ck setting is ineffective, and fs is input to the 7th stage of the divider. note 5: when stop mode is entered from normal1/2 mode, the dv 7ck setting is ineffective during the warm-up period after release of stop mode, and the 6th stage of the divider is input to the 7th stage during this period. 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 th e oscillation circuits for the high-frequency and low- frequency clocks, and switches the main system clock. there are three operating modes: single clock mode, dual clock mode and stop mode. these modes are cont rolled by the system cont rol registers (syscr1 and syscr2). figure 2-6 shows the operating mode transition diagram. 2.2.3.1 single-clock mode only the oscillation circuit for the high-frequenc y clock is used, and p21 (xtin) and p22 (xtout) pins are used as input/output ports . 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 TMP86CS25ADFG is placed in this mode after reset. timing generator control register tbtcr (0036h) 76543210 (dvoen) (dvock) dv7ck (tbten) (tbtck) (initial value: 0000 0000) dv7ck selection of input to the 7th stage of the divider 0: fc/2 8 [hz] 1: fs r/w main system clock state machine cycle s3 s2 s1 s0 s3 s2 s1 s0 1/fc or 1/fs [s]
page 14 2. operational description 2.2 system clock controller TMP86CS25ADFG (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 = "1", and idle1 mode is released to normal1 mode by an interrupt request from the on-chip peri pherals or external interrupt inputs. when the imf (interrupt master enable flag) is ?1? (interrupt enable), the execution will resume with the acceptance of the interrupt, and the operation will return to nor mal after the interrupt service is completed. when the imf is ?0? (interrupt disable), the execution will resume with the instruction which follows the idle1 mode start instruction. (3) idle0 mode in this mode, all the circuit, except oscillator an d the timer-base-timer, stops operation. this mode is enabled by syscr2 = "1". 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, the timing generator starts feeding the clock to al l peripheral circuits. when returned from idle0 mode, the cpu rest arts operating, entering normal1 mode back again. idle0 mode is entered and returned regardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individu al enable flag) = ?1?, and tb tcr = ?1?, interrupt pro- cessing is performed. when idle0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to normal1 mode. 2.2.3.2 dual-clock mode both the high-frequency and low-frequency oscillatio n circuits are used in th is mode. p21 (xtin) and p22 (xtout) pins cannot be used as input/output ports. the main system clock is obtained from the high-frequency clock in normal2 and idle2 modes, and is obtained from the low-frequency clock in slow and sleep modes. th e machine cycle time is 4/fc [s] in the normal2 and idle2 modes, and 4/fs [s] (122 s at fs = 32.768 khz) in the slow and sleep modes. the tlcs-870/c is placed in the signal-clock mode during reset. to use the dual-clock mode, the low- frequency oscillator should be turned on at the start of a program. (1) normal2 mode in this mode, the cpu core operates with the high-frequency clock. on-chip peripherals operate using the high-frequency clock and/or low-frequency clock. (2) slow2 mode in this mode, the cpu core operates with the lo w-frequency clock, while both the high-frequency clock and the low-frequency clock are operated. as the syscr2 becomes "1", the hard- ware changes into slow2 mode. as the syscr2 becomes ?0?, the hardware changes into normal2 mode. as the syscr2 beco mes ?0?, the hardware changes into slow1 mode. do not clear syscr2 to ?0? during slow2 mode. (3) slow1 mode this mode can be used to reduce power-consu mption by turning off oscillation of the high-fre- quency clock. the cpu core and on-chip peri pherals operate using th e low-frequency clock.
page 15 TMP86CS25ADFG switching back and forth between slow1 and slow2 modes are performed by syscr2. in slow1 and sleep modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (4) idle2 mode in this mode, the internal oscillation circuit remain active. the cpu and the watchdog timer are halted; however, on-chip peripherals remain activ e (operate using the high-frequency clock and/or the low-frequency clock). starting and releasing of idle2 mode are the same as for idle1 mode, except that operation re turns to normal2 mode. (5) sleep1 mode in this mode, the internal oscillation circuit of the low-frequency clock remains active. the cpu, the watchdog timer, and the internal oscillation circuit of the high-frequency clock are halted; how- ever, on-chip peripherals remain active (operate us ing the low-frequency clock). starting and releas- ing of sleep mode are the same as for idle1 mo de, except that operation returns to slow1 mode. in slow1 and sleep1 modes, the input clock to the 1st stage of the divider is stopped; output from the 1st to 6th stages is also stopped. (6) sleep2 mode the sleep2 mode is the idle mode corresponding to the slow2 mode. the status under the sleep2 mode is same as that under the sleep1 mo de, except for the oscilla tion circuit of the high- frequency clock. (7) sleep0 mode in this mode, all the circuit, except oscillator and the timer-base-timer, stops operation. this mode is enabled by setting ?1? on bit syscr2. when sleep0 mode starts, the cp u 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, the timing generator starts feeding the clock to al l peripheral circuits. when returned from sleep0 mode, the cpu restarts operating, entering slow1 mode back again. sleep0 mode is entered and returned re gardless of how tbtcr is set. when imf = ?1?, ef6 (tbt interrupt individual enable flag ) = ?1?, and tbtcr = ?1?, interrupt pro- cessing is performed. when sleep0 mode is entered while tbtcr = ?1?, the inttbt interrupt latch is set after returning to slow1 mode. 2.2.3.3 stop mode in this mode, the internal oscillation circuit is turned off, causing all system operations to be halted. the internal status immediately prior to the halt is held with a lowest power consumption during stop mode. stop mode is started by the syst em control register 1 (syscr1), an d stop mode is released by a inputting (either level-sensitive or edge-sens itive can be programmably selected) to the stop pin. after the warm-up period is completed, the execution resumes with the instruction which follows the stop mode start instruction.
page 16 2. operational description 2.2 system clock controller TMP86CS25ADFG note 1: normal1 and normal2 modes are generically called no rmal; slow1 and slow2 are called slow; idle0, idle1 and idle2 are called idle; sleep0, sleep1 and sleep2 are called sleep. note 2: the mode is released by fa lling edge of tbtcr setting. figure 2-6 operating mode transition diagram table 2-1 operating mode and conditions operating mode oscillator cpu core tbt other peripherals machine cycle time high frequency low frequency single clock reset oscillation stop reset reset reset 4/fc [s] normal1 operate operate operate idle1 halt idle0 halt stop stop halt ? dual clock normal2 oscillation oscillation operate with high frequency operate operate 4/fc [s] idle2 halt slow2 operate with low frequency 4/fs [s] sleep2 halt slow1 stop operate with low frequency sleep1 halt sleep0 halt stop stop halt ? note 2 syscr2 = "1" stop pin input stop pin input stop pin input interrupt interrupt syscr2 = "0" syscr2 = "1" syscr2 = "0" syscr2 = "0" syscr1 = "1" syscr1 = "1" syscr1 = "1" syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" syscr2 = "1" interrupt syscr2 = "1" reset release normal1 mode idle0 mode (a) single-clock mode idle1 mode normal2 mode idle2 mode syscr2 = "1" slow2 mode sleep2 mode slow1 mode sleep1 mode sleep0 mode reset (b) dual-clock mode stop syscr2 = "1" note 2
page 17 TMP86CS25ADFG note 1: always set retm to ?0? when transiting from normal mode to stop mode. always set retm to ?1? when transiting from slow mode to stop mode. note 2: when stop mode is released with reset pin input, a return is made to normal1 regardless of the retm contents. note 3: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *; don?t care note 4: bits 1 and 0 in syscr1 are read as undefined data when a read instruction is executed. note 5: 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 6: when the key-on wakeup is used, relm should be set to "1". note 7: 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 8: the warmig-up time should be set correctly for using oscillator. note 1: a reset is applied if both xen and xten are cleared to ?0?, xen is cleared to ?0? when sysck = ?0?, or xten is cleared to ?0? when sysck = ?1?. note 2: *: don?t care, tg: timing generator, *; don?t care note 3: bits 3, 1 and 0 in syscr2 are always read as undefined value. note 4: do not set idle and tghalt to ?1? simultaneously. note 5: because returning from idle0/sleep0 to normal1/slow 1 is executed by the asynchronous internal clock, the period of idle0/sleep0 mode might be shorter than the period setting by tbtcr. note 6: when idle1/2 or sleep1/2 mode is rel eased, idle is automatically cleared to ?0?. note 7: when idle0 or sleep0 mode is released, tghalt is automatically cleared to ?0?. note 8: before setting tghalt to ?1?, be sure to stop peripheral s. if peripherals are not stopped, the interrupt latch of periph erals may be set after idle0 or sleep0 mode is released. system control register 1 syscr176543210 (0038h) stop relm retm outen wut (initial value: 0000 00**) stop stop mode start 0: cpu core and peripherals remain active 1: cpu core and peripherals are halted (start stop mode) r/w relm release method for stop mode 0: edge-sensitive release 1: level-sensitive release r/w retm operating mode after stop mode 0: return to normal1/2 mode 1: return to slow1 mode r/w outen port output during stop mode 0: high impedance 1: output kept r/w wut warm-up time at releasing stop mode return to normal mode return to slow mode r/w 00 01 10 11 3 x 2 16 /fc 2 16 /fc 3 x 2 14 /fc 2 14 /fc 3 x 2 13 /fs 2 13 /fs 3 x 2 6 /fs 2 6 /fs system control register 2 syscr2 (0039h) 76543210 xen xten sysck idle tghalt (initial value: 1000 *0**) xen high-frequency oscillator control 0: turn off oscillation 1: turn on oscillation r/w xten low-frequency oscillator control 0: turn off oscillation 1: turn on oscillation sysck main system clock select (write)/main system clock moni- tor (read) 0: high-frequency clock (normal1/normal2/idle1/idle2) 1: low-frequency clock (slow1/slow2/sleep1/sleep2) idle cpu and watchdog timer control (idle1/2 and sleep1/2 modes) 0: cpu and watchdog timer remain active 1: cpu and watchdog timer are stopped (start idle1/2 and sleep1/2 modes) r/w tghalt tg control (idle0 and sleep0 modes) 0: feeding clock to all peripherals from tg 1: stop feeding clock to peripherals except tbt from tg. (start idle0 and sleep0 modes)
page 18 2. operational description 2.2 system clock controller TMP86CS25ADFG 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 and key-on wakeup input (stop5 to stop2) which is controlled by the stop mode release control register (stopcr). 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 to ?1?. during stop mode, the following status is maintained. 1. oscillations are turned off, and all internal operations are halted. 2. the data memory, registers, the program status wo rd and port output latches are all held in the status in effect before stop mode was entered. 3. the prescaler and the divider of th e timing generator are cleared to ?0?. 4. the program counter holds the address 2 ahead of th e instruction (e.g., [set (syscr1).7]) which started stop mode. stop mode includes a level-sensitive mode and an edge-sensitive mode, either of which can be selected with the syscr1. do not use any key-on wakeup input (stop5 to stop2) for releas- ing stop mode in edge-sensitive mode. note 1: the stop mode can be released by either th e stop or key-on wakeup pin (stop5 to stop2). however, because the stop pin is different from the key-on wakeup and can not inhibit the release input, the stop pin must be used for releasing stop mode. note 2: during stop period (from start of stop mode to end of warm up), due to changes in the external interrupt pin signal, interrupt latches may be set to ?1? and interrupts may be accepted immediately after stop mode is released. before starting stop mode, therefore, disable interrupts. also, before enabling interrupts after stop mode is rel eased, clear unnecessary interrupt latches. (1) level-sensitive release mode (relm = ?1?) in this mode, stop mode is released by setting the stop pin high or setting the stop5 to stop2 pin input which is enabled by stopcr. this mo de is used for capacitor backup when the main power supply is cut off and long term battery backup. even if an instruction for starting stop mode is executed while stop pin input is high or stop5 to stop2 input is low, stop mode does not start but instead the warm-up sequence starts immedi- ately. thus, to start stop mode in the level-sensitive release mode, it is necessary for the program to first confirm that the stop pin input is low or stop5 to stop2 input is high. the following two methods can be used for confirmation. 1. testing a port. 2. using an external interrupt input int5 ( int5 is a falling edge-sensitive input). example 1 :starting stop mode from normal mode by testing a port p20. ld (syscr1), 01010000b ; sets up the level-sensitive release mode sstoph: test (p2prd). 0 ; wait until the stop pin input goes low level jrs f, sstoph di ; imf 0 set (syscr1). 7 ; starts stop mode
page 19 TMP86CS25ADFG 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. do not use any stop5 to stop2 pin input for releasing stop mode in edge-sensitive release mode. figure 2-8 edge-sensitive release mode example 2 :starting stop mode from normal mode with an int5 interrupt. pint5: test (p2prd). 0 ; to reject noise, stop mode does not start if jrs f, sint5 port p20 is at high ld (syscr1), 01010000b ; sets up the level-sensitive release mode. di ; imf 0 set (syscr1). 7 ; starts stop mode sint5: reti example :starting stop mode from normal mode di ; imf 0 ld (syscr1), 10010000b ; starts after specified to the edge-sensitive release mode v ih normal operation warm up stop operation confirm by program that the stop pin input is low and start stop mode. always released if the stop pin input is high. stop pin xout pin stop mode is released by the hardware. normal operation normal operation normal operation v ih stop mode is released by the hardware at the rising edge of stop pin input. warm up stop mode started by the program. stop operation stop operation stop pin xout pin
page 20 2. operational description 2.2 system clock controller TMP86CS25ADFG stop mode is released by the following sequence. 1. in the dual-clock mode, when returning to normal2, both the high-frequency and low- frequency clock oscillators are turned on; when returning to slow1 mode, only the low- frequency clock oscillator is turned on. in the single-clock mode, only 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 in accordance with the resonator characteristics. 3. when the warm-up time has elapsed, normal operation resumes with the instruction follow- ing the stop mode start instruction. 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 = 16.0 mhz, fs = 32.768 khz) wut warm-up time [ms] return to normal mode return to slow mode 00 01 10 11 12.288 4.096 3.072 1.024 750 250 5.85 1.95
page 21 TMP86CS25ADFG 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 22 2. operational description 2.2 system clock controller TMP86CS25ADFG 2.2.4.2 idle1/2 mode and sleep1/2 mode idle1/2 and sleep1/2 modes are controlled by the system control register 2 (syscr2) and maskable interrupts. the following status is maintained during these modes. 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 these modes were entered. 3. the program counter holds the address 2 ahead of th e instruction which starts these modes. figure 2-10 idle1/ 2 and sleep1/2 modes 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/2 and sleep1/2 modes by instruction execution of the instruc- tion which follows the idle1/2 and sleep1/2 modes start instruction
page 23 TMP86CS25ADFG ? start the idle1/2 and sleep1/2 modes after imf is set to "0", set the individual inte rrupt enable flag (ef) which releases idle1/2 and sleep1/2 modes. to start idle1/2 and sl eep1/2 modes, set syscr2 to ?1?. ? release the idle1 /2 and sleep1/2 modes idle1/2 and sleep1/2 modes include a normal release mode and an interrupt release mode. these modes are selected by interrupt master en able flag (imf). after releasing idle1/2 and sleep1/2 modes, the syscr2 is automa tically cleared to ?0? and the operation mode is returned to the mode preced ing idle1/2 and sleep1/2 modes. idle1/2 and sleep1/2 modes can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. (1) normal release mode (imf = ?0?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled by the individual interrupt enable flag (ef). after the interrupt is ge nerated, the program operation is resumed from the instruction following the idle1/2 and sleep1/2 mo des start instruction. normally, the interrupt latches (il) of the interrupt source used for releas ing must be cleared to ?0? by load instructions. (2) interrupt release mode (imf = ?1?) idle1/2 and sleep1/2 modes are released by any interrupt source enabled with the individual interrupt enable flag (ef) and the interrupt processi ng is started. after the interrupt is processed, the program operation is resumed from the instruction following the instruction, which starts idle1/2 and sleep1/2 modes. note: when a watchdog timer interrupts is generated immediately before idle1/2 and sleep1/2 modes are started, the watchdog timer interrupt will be processed but idle1/2 and sleep1/2 modes will not be started.
page 24 2. operational description 2.2 system clock controller TMP86CS25ADFG figure 2-11 idle1/2 and sleep1/2 modes 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:w normal release mode ?s:w interrupt 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/2 and sleep1/2 modes start (example: star ting with the set instruction located at address a) (b) idle1/2 and sleep1/2 modes release
page 25 TMP86CS25ADFG 2.2.4.3 idle0 and sleep0 modes (idle0, sleep0) idle0 and sleep0 modes are controlled by the system control register 2 (syscr2) and the time base timer control register (tbtcr). the following stat us is maintained during idle0 and sleep0 modes. 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 and sleep0 modes were entered. 3. the program counter holds the address 2 ahead of the instru ction which starts idle0 and sleep0 modes. note: before starting idle0 or sleep0 mode, be sure to stop (disable) peripherals. figure 2-12 idle 0 and sleep0 modes yes (normal release mode) yes (interrupt release mode) no yes reset input cpu and wdt are halted reset tbt source clock falling edge tbtcr = "1" interrupt processing imf = "1" yes tbt interrupt enable no no no no stopping peripherals by instruction yes starting idle0, sleep0 modes by instruction execution of the instruction which follows the idle0, sleep0 modes start instruction
page 26 2. operational description 2.2 system clock controller TMP86CS25ADFG ? start the idle0 and sleep0 modes stop (disable) peripherals such as a timer counter. to start idle0 and sleep0 modes, set syscr2 to ?1?. ? release the idle0 and sleep0 modes idle0 and sleep0 modes include a normal re lease mode and an interrupt release mode. these modes are selected by inte rrupt master flag (imf), the i ndividual interrupt enable flag of tbt and tbtcr. after releasing idle0 and sleep0 modes, the syscr2 is automatically cleared to ?0? and the operatio n mode is returned to the mode preceding idle0 and sleep0 modes. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. idle0 and sleep0 modes can also be re leased by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. note: idle0 and sleep0 modes start/release wi thout reference to tbtcr setting. (1) normal release mode (imf ? ef6 ? tbtcr = ?0?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr. after the falling edge is detect ed, the program operation is resumed from the instruction following the idle0 and sleep0 modes start instruction. before starting the idle0 or sleep0 mode, when the tbtcr is set to ?1?, inttbt interrupt latch is set to ?1?. (2) interrupt release mode (imf ? ef6 ? tbtcr = ?1?) idle0 and sleep0 modes are released by the source clock falling edge, which is setting by the tbtcr and inttbt interrupt processing is started. note 1: because returning from idle0, sleep0 to normal1, slow1 is executed by the asynchro- nous internal clock, the period of idle0, sleep0 mode might be the shorter than the period set- ting by tbtcr. note 2: when a watchdog timer interrupt is generat ed immediately before idle0/sleep0 mode is started, the watchdog timer interrupt will be processed but idle0/sleep0 mode will not be started.
page 27 TMP86CS25ADFG figure 2-13 idle0 and slee p0 modes start/release halt halt operate instruction address a + 2 halt operate set (syscr2). 2 halt operate acceptance of interrupt halt ?r:w normal release mode ?s:w interrupt 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 and sleep0 modes start (example: starting with the set instruction located at address a (b) idle and sleep0 modes release
page 28 2. operational description 2.2 system clock controller TMP86CS25ADFG 2.2.4.4 slow mode slow mode is controlled by the sy stem control register 2 (syscr2). the following is the methods to switch the mode with the warm-up counter. (1) switching from normal2 mode to slow1 mode first, set syscr2 to switch the main system clock to the low-frequency clock for slow2 mode. next, clear syscr2 to turn off high-frequency oscillation. note: the high-frequency clock can be co ntinued oscillation in order to return to normal2 mode from slow mode quickly. always turn off oscillat ion of high-frequency clock when switching from slow mode to stop mode. example 1 :switching from normal2 mode to slow1 mode. set (syscr2). 5 ; syscr2 1 (switches the main system clock to the low-frequency clock for slow2) clr (syscr2). 7 ; syscr2 0 (turns off high-frequency oscillation) example 2 :switching to the slow1 mode after low-frequency clock has stabilized. set (syscr2). 6 ; syscr2 1 ld (tc3cr), 43h ; sets mode for tc4, 3 (16-bit mode, fs for source) ld (tc4cr), 05h ; sets warming-up counter mode ldw (ttreg3), 8000h ; sets warm-up time (depend on oscillator accompanied) di ; imf 0 set (eirh). 3 ; enables inttc4 ei ; imf 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 set (syscr2). 5 ; syscr2 1 (switches the main system cl ock to the low-frequency clock) clr (syscr2). 7 ; syscr2 0 (turns off high-frequency oscillation) reti : vinttc4: dw pinttc4 ; inttc4 vector table
page 29 TMP86CS25ADFG (2) switching from slow1 mode to normal2 mode note: after sysck is cleared to ?0?, executing the in structions is continiued by the low-frequency clock for the period synchronized with low-frequency and high-frequency clocks. first, set syscr2 to turn on the high-fre quency oscillation. when time for stabilization (warm up) has been taken by the timer/counter (tc4,tc3), clear syscr2 to switch the main system clock to the high-frequency clock. slow mode can also be released by inputting low level on the reset pin. after releasing reset, the operation mode is started from normal1 mode. example :switching from the slow1 mode to the normal2 mode (fc = 16 mhz, warm-up time is 4.0 ms). set (syscr2). 7 ; syscr2 1 (starts high-frequency oscillation) ld (tc3cr), 63h ; sets mode for tc4, 3 (16-bit mode, fc for source) ld (tc4cr), 05h ; sets warming-up counter mode ld (ttreg4), 0f8h ; sets warm-up time di ; imf 0 set (eirh). 3 ; enables inttc4 ei ; imf 1 set (tc4cr). 3 ; starts tc4, 3 : pinttc4: clr (tc4cr). 3 ; stops tc4, 3 clr (syscr2). 5 ; syscr2 0 (switches the main system clock to the high-frequency clock) reti : vinttc4: dw pinttc4 ; inttc4 vector table high-frequency clock low-frequency clock main system clock sysck
page 30 2. operational description 2.2 system clock controller TMP86CS25ADFG figure 2-14 switching between the normal2 and slow modes set (syscr2). 7 normal2 mode clr (syscr2). 7 set (syscr2). 5 normal2 mode turn off (a) switching to the slow mode slow1 mode slow2 mode clr (syscr2). 5 (b) switching to the normal2 mode high- frequency clock low- frequency clock main system clock instruction execution sysck xen high- frequency clock low- frequency clock main system clock instruction execution sysck xen slow1 mode warm up during slow2 mode
page 31 TMP86CS25ADFG 2.3 reset circuit the TMP86CS25ADFG has four types of reset generation pr ocedures: an external rese t input, an address trap reset, a watchdog timer reset and a system clock reset. of these reset, the address trap reset, the watchdog timer and the system clock reset are a malfunction reset. when the malfunction rese t request is detected, reset occurs during the maximum 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] (1.5 s at 16.0 mhz) when power is turned on. table 2-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-15 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 lcd data buffer not initialized ram not initialized internal reset reset vdd malfunction reset output circuit watchdog timer reset address trap reset system clock reset
page 32 2. operational description 2.3 reset circuit TMP86CS25ADFG 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 is set to ?1 ?), dbr or the sfr area, ad dress trap reset will be generated. the reset time is maximum 24/fc[s] (1.5 s at 16.0 mhz). note:the operating mode under address tr apped is alternative of reset or interrupt. the address trap area is alter- native. note 1: address ?a? is in the sfr, dbr or on-chip ram (wdtcr1 = ?1?) space. note 2: during reset release, reset vector ?r? is read out, and an instruction at address ?r? is fetched and decoded. figure 2-16 addr ess trap reset 2.3.3 watchdog timer reset refer to section ?watchdog timer?. 2.3.4 system clock reset if the condition as follows is detected, the system clock reset occurs automatically to prevent dead lock of the cpu. (the oscillation is continued without stopping.) - in case of clearing syscr2 an d syscr2 simultaneously to ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 0 ? . - in case of clearing syscr2 to ? 0 ? , when the syscr2 is ? 1 ? . the reset time is maximum 24/fc (1.5 s at 16.0 mhz). instruction at address r 16/fc [s] maximum 24/fc [s] instruction execution internal reset jp a reset release address trap is occurred 4/fc to 12/fc [s]
page 33 TMP86CS25ADFG
page 34 2. operational description 2.3 reset circuit TMP86CS25ADFG
page 35 TMP86CS25ADFG 3. interrupt control circuit the TMP86CS25ADFG has a total of 20 interrupt sources excluding reset, of which 4 source levels are multi- plexed. interrupts can be nested with priorities. four of th e 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: the intsel register is used to select the interrupt source to be enabled for each multiplexed source level (see 3.3 inte r- rupt source selector (intsel)). note 2: to use the address trap interrupt (intatrap), clear wdtcr1 to ?0? (it is set for the ?reset request? after reset is cancelled). for details , see ?address trap?. note 3: to use the watchdog timer interrupt (intwdt), clear wdtcr1 to "0" (it is set for the "reset request" after reset is released). for details, see "watchdog timer". 3.1 interrupt latches (il15 to il2) an interrupt latch is provided for eac h interrupt source, except for a software interrupt and an executed the unde- fined instruction interrupt. when interrupt request is genera ted, the latch is set to ?1?, and the cpu is requested to accept the interrupt if its interrupt is enabled. the interrupt latch is cleared to "0" immediately after accepting inter- rupt. all interrupt latches are initialized to ?0? during reset. the interrupt latches are located on address 003ch and 003d h in sfr area. each latch can be cleared to "0" indi- vidually by instruction. however, il2 and il3 should not be cleared to "0" by software. for clearing the interrupt latch, load instruction should be used and then il2 and il3 should be set to "1". if the read-modify-write instructions such as bit manipulation or operation instructions are used, interrupt request would be cleared inadequately if inter- rupt is requested while such instructions are executed. interrupt factors enable condition interrupt latch vector address priority internal/external (reset) non-maskable ? fffe 1 internal intswi (software interrupt) non-maskable ? fffc 2 internal intundef (executed the undefined instruction interrupt) non-maskable ? fffc 2 internal intatrap (address trap interrupt) non-maskable il2 fffa 2 internal intwdt (watchdog timer interrupt) non-maskable il3 fff8 2 external int0 imf? ef4 = 1, int0en = 1 il4 fff6 5 external int1 imf? ef5 = 1 il5 fff4 6 internal inttbt imf? ef6 = 1 il6 fff2 7 external int2 imf? ef7 = 1 il7 fff0 8 internal inttc1 imf? ef8 = 1 il8 ffee 9 internal intrxd imf? ef9 = 1, il9er = 0 il9 ffec 10 internal intsio0 imf? ef9 = 1, il9er = 1 internal inttxd imf? ef10 = 1, il10er = 0 il10 ffea 11 internal intsio1 imf? ef10 = 1, il10er = 1 internal inttc4 imf? ef11 = 1 il11 ffe8 12 internal inttc6 imf? ef12 = 1 il12 ffe6 13 internal intadc imf? ef13 = 1 il13 ffe4 14 external int3 imf? ef14 = 1, il14er = 0 il14 ffe2 15 internal inttc3 imf? ef14 = 1, il14er = 1 external int5 imf? ef15 = 1, il15er = 0 il15 ffe0 16 internal inttc5 imf? ef15 = 1, il15er = 1
page 36 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86CS25ADFG interrupt latches are not set to ?1? by an instruction. since interrupt latches can be read, the status fo r interrupt requests can be monitored by software. 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 new ly 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, clearing imf need not execute normally on 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 ar ea, 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 i ndividual 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- example 1 :clears interrupt latches di ; imf 0 ldw (ill), 111010000011 1111b ; il12, il10 to il6 0 ei ; imf 1 example 2 :reads interrupt latchess ld wa, (ill) ; w ilh, a ill example 3 :tests interrupt latches test (ill). 7 ; if il7 = 1 then jump jr f, sset
page 37 TMP86CS25ADFG 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 :enables interrupts individually and sets imf di ; imf 0 ldw : (eirl), 1110100010100000b ; ef15 to ef13, ef11, ef7, ef5 1 note: imf should not be set. : ei ; imf 1 example 2 :c compiler description example unsigned int _io (3ah) eirl; /* 3ah shows eirl address */ _di(); eirl = 10100000b; : _ei();
page 38 3. interrupt control circuit 3.2 interrupt enable register (eir) TMP86CS25ADFG note 1: to clear any one of bits il7 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". interrupt latches (initial value: 00000000 000000**) ilh,ill (003dh, 003ch) 1514131211109876543210 il15 il14 il13 il12 il11 il10 il9 il8 il7 il6 il5 il4 il3 il2 ilh (003dh) ill (003ch) il15 to il2 interrupt latches at rd 0: no interrupt request 1: interrupt request at wr 0: clears the interrupt request 1: (interrupt latch is not set.) r/w interrupt enable registers (initial value: 00000000 0000***0) eirh,eirl (003bh, 003ah) 1514131211109876543210 ef15 ef14 ef13 ef12 ef11 ef10 ef9 ef8 ef7 ef6 ef5 ef4 imf eirh (003bh) eirl (003ah) ef15 to ef4 individual-interrupt enable flag (specified for each bit) 0: 1: disables the acceptance of each maskable interrupt. enables the acceptance of each maskable interrupt. r/w imf interrupt master enable flag 0: 1: disables the acceptance of all maskable interrupts enables the acceptance of all maskable interrupts
page 39 TMP86CS25ADFG 3.3 interrupt sour ce selector (intsel) each interrupt source that shares the interrupt source level with another interrupt source is allowed to enable the interrupt latch only when it is selected in the intsel register. the interrupt controller does not hold interrupt requests corresponding to interrupt sour ces that are not selected in the intsel register. th erefore, the intsel reg- ister must be set appropriately befo re interrupt requests are generated. the following interrupt sources share their interrupt sour ce level; the source is selected onnthe register intsel. 1. intrxd and intsio0 share the interr upt source level whose priority is 10. 2. inttxd and intsio1 shar e the interrupt source level whose priority is 11. 3. int3 and inttc3 share the interrupt source level whose priority is 15. 4. int5 and inttc5 share the interrupt so urce level whose priority is 16. 3.4 interrupt sequence an interrupt request, which raised inte rrupt latch, is held, until interrupt is accepted or interrupt latch is cleared to ?0? by resetting or an instruct ion. interrupt acceptance sequence requires 8 machine cycles (2 s @16 mhz) after the completion of the current instruction. the interrupt service task terminates upon execution of an interrupt return instruction [reti] (for maskable interrupts) or [retn] (for non-maskable interrupts). figure 3-1 shows the timing chart of interrupt acceptance processing. 3.4.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. 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. interrupt sour ce selector intsel (003eh) 76543210 - il9er il10er - - - il14er il15er (initial value: *00* **00) il9er selects intrxd or intsio0 0: intrxd 1: intsio0 r/w il10er selects inttxd or intsio1 0: inttxd 1: intsio1 r/w il14er selects int3 or inttc3 0: int3 1: inttc3 r/w il15er selects int5 or inttc5 0: int5 1: inttc5 r/w
page 40 3. interrupt control circuit 3.4 interrupt sequence TMP86CS25ADFG 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 ] or 38/fs [s] at maximum (if the interrupt latch is set at the first machine cycle on 10 cycle instruction) to start interrupt acceptance 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 an d the entry address of the interrupt service program figure 3-2 vector table 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. 3.4.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. 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 41 TMP86CS25ADFG 3.4.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.4.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 42 3. interrupt control circuit 3.4 interrupt sequence TMP86CS25ADFG figure 3-4 saving/restoring general-purpose r egisters under interrupt processing 3.4.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 immediat ely 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 43 TMP86CS25ADFG 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.5 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.5.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, dbr or sfr areas. 3.5.2 debugging debugging efficiency can be increased by placing the swi instruction at the software break point setting address. 3.6 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.7 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.8 external interrupts the TMP86CS25ADFG has 5 external interrupt inputs. these inputs are equipped with di gital noise reject circuits (pulse inputs of less than a certa in time are elimin ated as noise). edge selection is also possible with int1 to int3. the int0 /p63 pin can be configured as either an external inter- rupt input pin or an input/output port, and is configured as an input port during reset. edge selection, noise reject control and int0 /p63 pin function selection are performed by the external interrupt control register (eintcr).
page 44 3. interrupt control circuit 3.8 external interrupts TMP86CS25ADFG note 1: in normal1/2 or idle1/2 mode, if a signal with no noise is input on an external interrupt pin, it takes a maximum of "si g- nal 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. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered 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. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are considered to be signals. int2 int2 imf ? ef7 = 1 falling edge or rising edge pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int3 int3 imf ? ef14 = 1 and il14er=0 falling edge or rising edge pulses of less than 7/fc [s] are eliminated as noise. pulses of 25/fc [s] or more are considered to be signals. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals. int5 int5 imf ? ef15 = 1 and il15er=0 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. in the slow or the sleep mode, pulses of less than 1/fs [s] are eliminated as noise. pulses of 3.5/fs [s] or more are consid- ered to be signals.
page 45 TMP86CS25ADFG 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 - - int3es int2es int1es (initial value: 00** 000*) 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 p63/ int0 pin configuration 0: p63 input/output port 1: int0 pin (port p63 should be set to an input mode) r/w int3 es int3 edge select 0: rising edge 1: falling edge r/w int2 es int2 edge select 0: rising edge 1: falling edge r/w int1 es int1 edge select 0: rising edge 1: falling edge r/w
page 46 3. interrupt control circuit 3.8 external interrupts TMP86CS25ADFG
page 47 TMP86CS25ADFG 4. special function register (sfr) the TMP86CS25ADFG adopts the memory mapped i/o system , and all peripheral control and data transfers are performed through the special function register (sfr) or the data buffer register (dbr). the sfr is mapped on address 0000h to 003fh, dbr is mapped on address 0f00h to 0fffh. this chapter shows the arrangement of the special functi on register (sfr) and data buffer register (dbr) for TMP86CS25ADFG. 4.1 sfr address read write 0000h reserved 0001h p1dr 0002h p2dr 0003h p3dr 0004h p3lcr 0005h p5dr 0006h p6dr 0007h p7dr 0008h p1prd - 0009h p2prd - 000ah p3prd - 000bh p5prd - 000ch p6cr 000dh p7prd - 000eh adccr1 000fh adccr2 0010h treg1al 0011h treg1am 0012h treg1ah 0013h treg1b 0014h tc1cr1 0015h tc1cr2 0016h tc1sr - 0017h reserved 0018h tc3cr 0019h tc4cr 001ah tc5cr 001bh tc6cr 001ch ttreg3 001dh ttreg4 001eh ttreg5 001fh ttreg6 0020h adcdr1 - 0021h adcdr2 - 0022h reserved 0023h reserved 0024h reserved 0025h uartsr uartcr1
page 48 4. special function register (sfr) 4.1 sfr TMP86CS25ADFG note 1: do not access reserved areas by the program. note 2: ? ; cannot be accessed. note 3: write-only registers and interrupt latches cannot use the read-modify-write instructions (bit manipulation instructions such as set, clr, etc. and logical operation instructions such as and, or, etc.). 0026h - uartcr2 0027h lcdctl1 0028h lcdctl2 0029h p1lcr 002ah p5lcr 002bh p7lcr 002ch pwreg3 002dh pwreg4 002eh pwreg5 002fh pwreg6 0030h reserved 0031h reserved 0032h reserved 0033h reserved 0034h - wdtcr1 0035h - wdtcr2 0036h tbtcr 0037h eintcr 0038h syscr1 0039h syscr2 003ah eirl 003bh eirh 003ch ill 003dh ilh 003eh intsel 003fh psw address read write
page 49 TMP86CS25ADFG 4.2 dbr address read write 0f80h reserved 0f81h reserved 0f82h reserved 0f83h reserved 0f84h reserved 0f85h reserved 0f86h reserved 0f87h reserved 0f88h reserved 0f89h reserved 0f8ah reserved 0f8bh reserved 0f8ch reserved 0f8dh reserved 0f8eh reserved 0f8fh reserved 0f90h sio0br0 0f91h sio0br1 0f92h sio0br2 0f93h sio0br3 0f94h sio0br4 0f95h sio0br5 0f96h sio0br6 0f97h sio0br7 0f98h - sio0cr1 0f99h sio0sr sio0cr2 0f9ah - stopcr 0f9bh rdbuf tdbuf 0f9ch reserved 0f9dh reserved 0f9eh reserved 0f9fh reserved
page 50 4. special function register (sfr) 4.2 dbr TMP86CS25ADFG address read write 0fa0h sio1br0 0fa1h sio1br1 0fa2h sio1br2 0fa3h sio1br3 0fa4h sio1br4 0fa5h sio1br5 0fa6h sio1br6 0fa7h sio1br7 0fa8h - sio1cr1 0fa9h sio1sr sio1cr2 0faah reserved 0fabh reserved 0fach reserved 0fadh reserved 0faeh reserved 0fafh reserved 0fb0h reserved 0fb1h reserved 0fb2h reserved 0fb3h reserved 0fb4h reserved 0fb5h reserved 0fb6h reserved 0fb7h reserved 0fb8h reserved 0fb9h reserved 0fbah reserved 0fbbh reserved 0fbch reserved 0fbdh reserved 0fbeh reserved 0fbfh reserved
page 51 TMP86CS25ADFG note 1: do not access reserved areas by the program. note 2: ? ; cannot be accessed. note 3: write-only registers and interrupt latches cannot use the read-modify-write instructions (bit manipulation instructions such as set, clr, etc. and logical operation instructions such as and, or, etc.). note 4: this product has a lcd display data buffer (assigned to address 0f00h to 0f7fh). for detail, refer to the chapter of lcd driver. address read write 0fc0h mulsel 0fc1h reserved 0fc2h reserved 0fc3h reserved 0fc4h reserved 0fc5h reserved 0fc6h reserved 0fc7h reserved 0fc8h reserved 0fc9h reserved 0fcah reserved 0fcbh reserved 0fcch reserved 0fcdh reserved 0fceh reserved 0fcfh reserved 0fd0h reserved 0fd1h reserved 0fd2h reserved 0fd3h reserved 0fd4h reserved 0fd5h reserved 0fd6h reserved 0fd7h reserved 0fd8h reserved 0fd9h reserved 0fdah reserved 0fdbh reserved 0fdch reserved 0fddh reserved 0fdeh reserved 0fdfh reserved address read write 0fe0h reserved : : : : 0fffh reserved
page 52 4. special function register (sfr) 4.2 dbr TMP86CS25ADFG
page 53 TMP86CS25ADFG 5. i/o ports the TMP86CS25ADFG have 6 parallel input/output ports (42 pins) 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 p1 8-bit i/o port external interrupt input, serial interface input/output, uart input/output and segment output. port p2 3-bit i/o port low-frequency resonator connections, external interrupt input, stop mode release signal input. port p3 7-bit i/o port timer/counter input/output and divider output and segment/common output. port p5 8-bit i/o port segment output. port p6 8-bit i/o port analog input, external interrupt input, timer/counter input and stop mode release signal input. port p7 8-bit i/o port common output. timer/counter input/output and divider output. 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 output strobe old new 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 54 5. i/o ports 5.1 port p1 (p17 to p10) TMP86CS25ADFG 5.1 port p1 (p17 to p10) port p1 is an 8-bit i nput/output port which is al so used as an external interrup t input, serial interface input/output, uart input/output and segment output of lcd. when used as a segment pins of lcd, the respective bit of p1lcr should be set to ?1?. when used as an input port or a secondary function (e xcept for segment) pins, the respective output latch (p1dr) should be set to ?1? and its corresponding p1lcr bit should be set to ?0?. when used as an output port, the respec- tive p1lcr bit should be set to ?0?. during reset, the output latch is initialized to ?1?. p1 port output latch (p1dr) and p1 port terminal input (p1prd) are located on their respective address. when read the output latch data, the p1dr should be r ead and when read the termin al input data, the p1prd reg- ister should be read. if the terminal input data which is configured as lcd segment output is read, unstable data is read. figure 5-2 port 1 note: with ports assigned as mul6 to mul0, assigned pins can be switched by the multi function register (mulsel). the assigned functions are shown in ?5.7 multi function register?. p1dr (0001h) r/w 76543210 p17 seg59 sck0 p16 seg58 txd so0 p15 seg57 rxd si0 p14 seg56 mul6 p13 seg55 mul5 p12 seg54 mul4 p11 seg53 p10 seg52 (initial value: 1111 1111) p1lcr (0029h) 76543210 (initial value: 0000 0000) p1lcr port p1/segment output select (set for each bit individually) 0: p1 input/output port or secondary function (expect for segment) 1: segment output r/w p1prd (0008h) read only 76543210 p17 p16 p15 p14 p13 p12 p11 p10 output latch p1lcri data output (p1dr) output latch data (p1dr) lcd data output control input terminal input (p1prd) stop outen control output p1lcri input p1i note: i = 7 to 0 dq dq dq
page 55 TMP86CS25ADFG 5.2 port p2 (p22 to p20) port p2 is a 3-bit input/output port. it is also used as an external interr upt, a stop mode release signal input, and low-frequency crys tal oscillator con- nection pins. when used as an input port or a secondary function pins, respective output latch (p2dr) should be set to ?1?. during reset, the p2dr is initialized to ?1?. a low-frequency crystal osci llator (32.768 khz) is connected to pins p21 (xtin) and p22 (xtout) in the dual- clock mode. in the single-clock mode, pins p21 and p22 can be used as normal input/output ports. it is recommended that pin p20 should be used as an exte rnal interrupt input, a stop mode release signal input, or an input port. if it is used as an output port, the in terrupt latch is set on the falling edge of the output pulse. p2 port output latch (p2dr) and p2 port terminal input (p2prd) are located on their respective address. when read the output latch data, the p2dr should be r ead and when read the termin al input data, the p2prd reg- ister should be read. if a read instruction is execute d for port p2, read data of bits 7 to 3 are unstable. figure 5-3 port 2 note: 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. p2dr (0002h) r/w 76543210 p22 xtout p21 xtin p20 int5 stop (initial value: **** *111) p2prd (0009h) read only 76543210 p22 p21 p20 output latch output latch output latch data input (p20prd) data input (p21) data output (p21) data output (p20) data input (p20) control input data input (p21prd) data input (p22) data input (p22prd) data output (p22) stop outen xten fs p22 (xtout) p21 (xtin) p20 (int5, stop) osc. enable dq dq dq
page 56 5. i/o ports 5.3 port p3 (p36 to p30) TMP86CS25ADFG 5.3 port p3 (p36 to p30) port p3 is a 7-bit input/output port. it is also used as a external interrupt input, timer/counter input/output, divider output and lcd common/segment output. when used as an input port or a secondary function pins , after setting segment/common output control (p3lcr) to ?0? respective output latch (p3dr) should be set to ?1?. during reset, the p3dr is initialized to ?1?, and segment output control (p3lcr) is initialized by ?0?. in using it as lcd segment/ common output, it sets the bit to which p3lcr corresponds to ?1?. p3 port output latch (p3dr) and p3 port terminal input (p3prd) are located on their respective address. when read the output latch data, the p3dr should be r ead and when read the termin al input data, the p3prd reg- ister should be read. if a read instruction is execu ted for port p3, read data of bit 7 is unstable. figure 5-4 port 3 note: with ports assigned as mul6 to mul0, assigned pins c an be switched by the multi function register (mulsel). the assigned functions are shown in ?5.7 multi function register?. p3dr (0003h) r/w 76543210 p36 com7 mul6 p35 com6 mul5 p34 com5 mul4 p33 seg51 mul3 p32 seg50 mjul2 p31 seg49 mjul1 p30 seg48 mjul0 (initial value: *111 1111) p3lcr (0004h) 76543210 (initial value: *000 0000) p3lcr port p3 control (set for each bit individually) 0: p3 input/output port or function except lcd segment or common output 1: lcd segment output/common output r/w p3prd (000ah) read only 76543210 p36p35p34p33p32p31p30 output latch p3lcri data output (p3dr) output latch data (p3dr) lcd data output control input terminal input (p3prd) stop outen control output p3lcri input p3i note: i = 6 to 0 dq dq
page 57 TMP86CS25ADFG 5.4 port p5 (p57 to p50) port p5 is an 8-bit input/output port which is also used as a segment pins of lcd. when used as input port, the respective output latch (p5dr) should be set to ?1?. during reset, the p5dr is initialized to ?1?. when used as a segment pins of lcd, the respective bit of p5lcr should be set to ?1?. when used as an output port, the respective p5lcr bit should be set to ?0?. p5 port output latch (p5dr) and p5 port terminal input (p5prd) are located on their respective address. when read the output latch data, the p5dr should be r ead and when read the termin al input data, the p5prd reg- ister should be read. if the terminal input data which is co nfigured as lcd segment output is read, unstable data is read. figure 5-5 port 5 p5dr (0005h) r/w 76543210 p57 seg47 p56 seg46 p55 seg45 p54 seg44 p53 seg43 p52 seg42 p51 seg41 p50 seg40 (initial value: 1111 1111) p5lcr (002ah) 76543210 (initial value: 0000 0000) p5lcr port p5/segment output select (set for each bit individually) 0: p5 input/output port 1: lcd segment output r/w p5prd (000bh) read only 76543210 p57 p56 p55 p54 p53 p52 p51 p50 output latch p5lcri data output (p5dr) data input (p5dr) data input (p5prd) lcd data output stop outen p5lcri input p5i note: i = 7 to 0 dq dq
page 58 5. i/o ports 5.5 port p6 (p67 to p60) TMP86CS25ADFG 5.5 port p6 (p67 to p60) port p6 is an 8-bit input/output port which can be configured as an input or an output in one-bit unit. port p6 is also used as an analog input, key on wake up input, timer/counter input and external interrupt input. input/output mode is specified by the p6 control register (p6cr), the p6 output latch (p6dr), and ad ccr1. during reset, p6cr and p6dr are initialized to ?0? an d adccr1 is set to ?1?. at th e same time, the input data of pins p67 to p60 are fixed to ?0?. to use port p6 as an input por t, external interrupt input, timer/counter input or key on wake up input, set data of p6dr to ?1? and p6cr to ?0?. to use it as an output port, set data of p6cr to ?1?. to use it as an analog input, set data of p6dr to ?0? and p6cr to ?0?, and start the ad. it is the penetration electric current measures by the analog voltage. pins not used for analog input can be used as i/o ports. during ad conversion, output instructions should not be executed to keep a precision. in addition , a variable signal should not be inpu t to a port adjacent to the analog input during ad conversion. when the ad converter is in use (p6dr = 0), bits mentione d above are read as ?0? by executing input instructions. figure 5-6 port 6 note 1: do not set output mode to pin which is used for an analog input. note 2: when used as an int0 , ecnt and ecin pins of a secondary function, the respective bit of p6cr should be set to ?0? and the p6 should set to ?1?. note 3: when used as an stop2 to stop5 pins of key on wa ke up, the respective bit of p6cr should be set to ?0?. note 4: when a read instruction for port p6 is executed, the bit of analog input mode becomes read data ?0?. note 5: although p6dr is a read/writer register, because it is also used as an input mode control function, read-modify-write instructions such as bit manipulate instructions cannot be used. read-modify-write instruction writes the all data of 8-bit af ter data is read and modified. because a bit setting input mode read data of terminal, the output latch is changed by t hese instruction. so p6 port can not input data. p6dr (0006h) r/w 76543210 p67 ain7 stop5 p66 ain6 stop4 p65 ain5 stop3 p64 ain4 stop2 p63 ain3 int0 p62 ain2 ecnt p61 ain1 ecin p60 ain0 (initial value: 0000 0000) 76543210 p6cr (000ch) (initial value: 0000 0000) p6cr i/o control for port p6 (specified for each bit) ainds = 1 (ad unused) ainds = 0 (ad used) r/w p6dr = ?0? p6dr = ?1? p6dr = ?0? p6dr = ?1? 0 input ?0? fixed input mode ad input input mode 1 output mode output mode data input (p6dr) analog input data output (p6dr) ainds sain p6cri p6cri input p6i note 1:i = 7 to 0, j = 7 to 4 note 2:stop is bit7 in syscr1 note 3:sain is bit 0 to 3 in adccra note 4: stopj is bit 4 to 7 is stopcr. d q d q stopj stop key on wake up
page 59 TMP86CS25ADFG 5.6 port p7 (p77 to p70) port p7 is an 8-bit input/output port which is also used as an external interrupt input, a divider output a segment pins of lcd. when used as input port or a secondary function pins, the respective output latch (p7dr) should be set to ?1?. during reset, the p7dr is initialized to ?1?. when used as a segment pins of lcd, the respective bit of p7lcr should be set to ?1?. when used as an output port, the respective p7lcr bit should be set to ?0?. p7 port output latch (p7dr) and p7 port terminal input (p7prd) are located on their respective address. when read the output latch data, the p7dr should be r ead and when read the termin al input data, the p7prd reg- ister should be read. if the terminal input data which is co nfigured as lcd segment output is read, unstable data is read. figure 5-7 port 7 note: with ports assigned as mul6 to mul0, assigned pins can be switched by the multi function register (mulsel). the assigned functions are shown in ?5.7 multi function register?. p7dr (0007h) r/w 76543210 p77 com15 sck1 p76 com14 so0 p75 com13 si1 p74 com12 mul3 p73 com11 mul2 p72 com10 mul1 p71 com9 mul0 p70 com8 (initial value: 1111 1111) p7lcr (002bh) 76543210 (initial value: 0000 0000) p7lcr port p7/segment output select (set for each bit individually) 0: p7 input/output port 1: segment output r/w p7prd (000dh) read only 76543210 p77 p76 p75 p74 p73 p72 p71 p70 output latch p7lcri data output (p7dr) output latch data (p7dr) lcd data output control input terminal input (p7prd) stop outen control output p7lcri input p7i note: i = 7 to 0 dq dq
page 60 5. i/o ports 5.7 multi function register TMP86CS25ADFG 5.7 multi function register with ports assigned as mul6 to mul0 , assigned pins can be switched by th e multi function register (mulsel). multi function register mulsel (0fc0h) 76543210 mul6 mul5 mul4 mul3 mul2 mul1 mul0 mul6 int3 function pin select 0: p14 1: p36 r/w mul5 int2 function pin select 0: p13 1: p35 mul4 int1 function pin select 0: p12 1: p34 mul3 ppg6 / pwm6 / pdo6 and tc6 functions pin select 0: p33 1: p74 mul2 ppg4 / pwm4 / pdo4 and tc4 functions pin select 0: p32 1: p73 mul1 pwm3 / pdo3 and tc3 functions pin select 0: p31 1: p72 mul0 dvo function pin select 0: p30 1: p71
page 61 TMP86CS25ADFG 6. watchdog timer (wdt) the watchdog timer is a fail-safe system to detect rapidl y the cpu malfunctions such as endless loops due to spu- rious noises or the deadlock conditions, and return the cpu to a sy stem recovery routine. the watchdog timer signal for detecting malfunctions can be programmed only once as ?reset request? or ?inter- rupt request?. upon the reset release, this signal is initialized to ?reset request?. when the watchdog timer is not used to detect malfunctions, it can be used as the timer to provide a periodic inter- rupt. note: care must be taken in system des ign since the watchdog timer functions are not be operated completely due to effect of disturbing noise. 6.1 watchdog timer configuration figure 6-1 watchdog timer configuration 0034 h overflow wdt output internal reset binary counters wdtout writing clear code writing disable code wdten wdtt 2 0035 h watchdog timer control registers wdtcr1 wdtcr2 intwdt interrupt request interrupt request reset request reset release clock clear 1 2 controller q sr s r q selector fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 19 or fs/2 11 fc/2 17 or fs/2 9
page 62 6. watchdog timer (wdt) 6.2 watchdog timer control TMP86CS25ADFG 6.2 watchdog timer control the watchdog timer is controlled by the watchdog timer control registers (wdtcr1 and wdtcr2). the watch- dog timer is automatically enabled after the reset release. 6.2.1 malfunction detection me thods using the watchdog timer the cpu malfunction is detected, as shown below. 1. set the detection time, select the output, and clear the binary counter. 2. clear the binary counter repeatedly within the specified detection time. if the cpu malfunctions such as en dless loops or the deadlock condition s occur for some reason, the watch- dog timer output is activated by the binary-counter overflow unless the binary counters are cleared. when wdtcr1 is set to ?1? at this time, the reset request is generated and then internal hardware is initialized. when wdtcr1 is set to ?0?, a watchdog timer interrupt (intwdt) is generated. the watchdog timer temporarily stops counting in th e stop mode including the warm-up or idle/sleep mode, and automatically restarts (continues counting) when the stop/idle/sleep mode is inactivated. note:the watchdog timer consists of an internal divider and a two-stage binary counter. when the clear code 4eh is written, only the binary counter is cleared, but not the internal divider . the minimum binary-counter overflow time, that depends on the timing at which the clear code (4eh) is written to the wdtcr2 register, may be 3/ 4 of the time set in wdtcr1. therefore, writ e the clear code using a cycle shorter than 3/4 of the time set to wdtcr1. example :setting the watchdog timer detection time to 2 21 /fc [s], and resetting the cpu malfunction detection ld (wdtcr2), 4eh : clears the binary counters. ld (wdtcr1), 00001101b : wdtt 10, wdtout 1 ld (wdtcr2), 4eh : clears the binary counters (always clears immediately before and after changing wdtt). within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters. within 3/4 of wdt detection time : : ld (wdtcr2), 4eh : clears the binary counters.
page 63 TMP86CS25ADFG note 1: after clearing wdtout to ?0?, the program cannot set it to ?1?. note 2: fc: high-frequency clock [hz], fs : low-frequency clock [hz], *: don?t care note 3: wdtcr1 is a write-only register and must not be used with any of read-modify-write instructions. if wdtcr1 is read, a don?t care is read. note 4: to activate the stop mode, disable the watchdog timer or clear the counter immediately before entering the stop mode. after clearing the counter, clear the counter again immediately after the stop mode is inactivated. note 5: to clear wdten, set the register in accordance wi th the procedures shown in ?1.2.3 watchdog timer disable?. note 1: the disable code is valid only when wdtcr1 = 0. note 2: *: don?t care note 3: the binary counter of the watchdog timer must not be cleared by the interrupt task. note 4: write the clear code 4eh using a cycle shor ter than 3/4 of the time set in wdtcr1. 6.2.2 watchdog timer enable setting wdtcr1 to ?1? enables the watc hdog timer. since wdtcr1 is initialized to ?1? during reset, the watchdog timer is enabled automatically after the reset release. watchdog timer control register 1 wdtcr1 (0034h) 76543210 (atas) (atout) wdten wdtt wdtout (initial value: **11 1001) wdten watchdog timer enable/disable 0: disable (writing the disable code to wdtcr2 is required.) 1: enable write only wdtt watchdog timer detection time [s] normal1/2 mode slow1/2 mode write only dv7ck = 0 dv7ck = 1 00 2 25 /fc 2 17 /fs 2 17 /fs 01 2 23 /fc 2 15 /fs 2 15 fs 10 2 21 fc 2 13 /fs 2 13 fs 11 2 19 /fc 2 11 /fs 2 11 /fs wdtout watchdog timer output select 0: interrupt request 1: reset request write only watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code 4eh: clear the watchdog timer binary counter (clear code) b1h: disable the watchdog timer (disable code) d2h: enable assigning address trap area others: invalid write only
page 64 6. watchdog timer (wdt) 6.2 watchdog timer control TMP86CS25ADFG 6.2.3 watchdog timer disable to disable the watchdog timer, set the register in accordance with the fo llowing procedures . setting the reg- ister in other procedures causes a malfunction of the microcontroller. 1. set the interrupt master flag (imf) to ?0?. 2. set wdtcr2 to the clear code (4eh). 3. set wdtcr1 to ?0?. 4. set wdtcr2 to the disable code (b1h). note:while the watchdog timer is disabled, the binary counters of the watchdog timer are cleared. 6.2.4 watchdog time r interrupt (intwdt) when wdtcr1 is cleared to ?0?, a watchdog timer interrupt request (intwdt) is generated by the binary-counter overflow. a watchdog timer interrupt is the non-maskable interr upt which can be accepted regardless of the interrupt master flag (imf). when a watchdog timer interrupt is generated while the other interrupt including a watchdog timer interrupt is already accepted, the new watchdog timer interrupt is processed immediately and the previous interrupt is held pending. therefore, if watchdog timer interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate a watchdog timer interrupt, set the stack pointer before setting wdtcr1. example :disabling the watchdog timer di : imf 0 ld (wdtcr2), 04eh : clears the binary coutner ldw (wdtcr1), 0b101h : wdten 0, wdtcr2 disable code table 6-1 watchdog timer detection time (example: fc = 16.0 mhz, fs = 32.768 khz) wdtt watchdog timer detection time[s] normal1/2 mode slow mode dv7ck = 0 dv7ck = 1 00 2.097 4 4 01 524.288 m 1 1 10 131.072 m 250 m 250 m 11 32.768 m 62.5 m 62.5 m example :setting watchdog timer interrupt ld sp, 083fh : sets the stack pointer ld (wdtcr1), 00001000b : wdtout 0
page 65 TMP86CS25ADFG 6.2.5 watchdog timer reset when a binary-counter overflow occurs while wdt cr1 is set to ?1?, a watchdog timer reset request is generated. when a watchdog timer reset request is generated, the internal hardware is reset. the reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 mhz). note:when a watchdog timer reset is generated in the sl ow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors. figure 6-2 watchdog timer interrupt clock binary counter overflow intwdt interrupt request (wdtcr1= "0") 2 17 /fc 2 19 /fc [s] (wdtt=11) write 4e h to wdtcr2 1 2 30 1 2 3 0 internal reset (wdtcr1= "1") a reset occurs
page 66 6. watchdog timer (wdt) 6.3 address trap TMP86CS25ADFG 6.3 address trap the watchdog timer control register 1 and 2 share the a ddresses with the control regi sters to generate address traps. 6.3.1 selection of address tr ap in internal ram (atas) wdtcr1 specifies whether or not to generate address traps in the inte rnal ram area. to execute an instruction in the internal ram area, clear wdtcr1 to ?0?. to enable the wdtcr1 set- ting, set wdtcr1 and then write d2h to wdtcr2. executing an instruction in the sfr or dbr area generates an address trap unconditionally regardless of the setting in wdtcr1. 6.3.2 selection of operati on at address trap (atout) when an address trap is generated, either the inte rrupt request or the reset request can be selected by wdtcr1. 6.3.3 address trap interrupt (intatrap) while wdtcr1 is ?0?, 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 (while wdtcr1 is ?1?), dbr or the sfr area, address trap interrupt (intatrap) will be generated. an address trap interrupt is a non-maskable interrupt which can be accepted regardless of the interrupt mas- ter flag (imf). when an address trap interrupt is generated while th e other interrupt including a watchdog timer interrupt is already accepted, the new address trap is processed immediately and the previous interrupt is held pending. therefore, if address trap interrupts are generated continuously without execution of the retn instruction, too many levels of nesting may cause a malfunction of the microcontroller. to generate address trap interrupts, set the stack pointer beforehand. watchdog timer control register 1 wdtcr1 (0034h) 7654 3 21 0 atas atout (wdten) (wdtt) (wdtout) (initial value: **11 1001) atas select address trap generation in the internal ram area 0: generate no address trap 1: generate address traps (after setting atas to ?1?, writing the control code d2h to wdtcr2 is reguired) write only atout select opertion at address trap 0: interrupt request 1: reset request watchdog timer control register 2 wdtcr2 (0035h) 76543210 (initial value: **** ****) wdtcr2 write watchdog timer control code and address trap area control code d2h: enable address trap area selection (atrap control code) 4eh: clear the watchdog timer binary counter (wdt clear code) b1h: disable the watchdog timer (wdt disable code) others: invalid write only
page 67 TMP86CS25ADFG 6.3.4 address trap reset while wdtcr1 is ?1?, 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 (while wdtcr1 is ?1?), dbr or the sfr area, address trap reset will be generated. when an address trap reset request is generated, the in ternal hardware is reset. the reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 mhz). note:when an address trap reset is generated in the slow1 mode, the reset time is maximum 24/fc (high-fre- quency clock) since the high-frequency cl ock oscillator is restarted. however, when crystals have inaccura- cies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors.
page 68 6. watchdog timer (wdt) 6.3 address trap TMP86CS25ADFG
page 69 TMP86CS25ADFG 7. time base timer (tbt) the time base timer generates time base for key scanning, dynamic displaying, etc. it also provides a time base timer interrupt (inttbt). 7.1 time base timer 7.1.1 configuration figure 7-1 time base timer configuration 7.1.2 control time base timer is controled by time base timer control register (tbtcr). note 1: fc; high-frequency clock [hz], fs ; low-frequency clock [hz], *; don't care time base timer control register 7 6543210 tbtcr (0036h) (dvoen) (dvock) (dv7ck) tbten tbtck (initial value: 0000 0000) tbten time base timer enable / disable 0: disable 1: enable tbtck time base timer interrupt frequency select : [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 23 fs/2 15 fs/2 15 001 fc/2 21 fs/2 13 fs/2 13 010 fc/2 16 fs/2 8 ? 011 fc/2 14 fs/2 6 ? 100 fc/2 13 fs/2 5 ? 101 fc/2 12 fs/2 4 ? 110 fc/2 11 fs/2 3 ? 111 fc/2 9 fs/2 ? fc/2 23 or fs/2 15 fc/2 21 or fs/2 13 fc/2 16 or fs/2 8 fc/2 14 or fs/2 6 fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 9 or fs/2 tbtcr tbten tbtck 3 mpx source clock falling edge detector time base timer control register inttbt interrupt request idle0, sleep0 release request
page 70 7. time base timer (tbt) 7.1 time base timer TMP86CS25ADFG note 2: the interrupt frequency (tbtck) must be selected with t he time base timer disabled (tbten="0"). (the interrupt fre- quency must not be changed with the disable from the enable state.) both frequency selection and enabling can be per- formed simultaneously. 7.1.3 function an inttbt ( time base timer interrupt ) is generated on the first falling edge of source clock ( the divider output of the timing generato which is selected by tbtck. ) after time base timer has been enabled. the divider is not cleared by the progra m; therefore, only the first interrupt may be generated ahead of the set interrupt period ( figure 7-2 ). figure 7-2 time base timer interrupt example :set the time base timer frequency to fc/2 16 [hz] and enable an inttbt interrupt. ld (tbtcr) , 00000010b ; tbtck 010 ld (tbtcr) , 00001010b ; tbten 1 di ; imf 0 set (eirl) . 6 table 7-1 time base timer interrupt frequency ( example : fc = 16.0 mhz, fs = 32.768 khz ) tbtck time base timer interrupt frequency [hz] normal1/2, idle1/2 mode normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 000 1.91 1 1 001 7.63 4 4 010 244.14 128 ? 011 976.56 512 ? 100 1953.13 1024 ? 101 3906.25 2048 ? 110 7812.5 4096 ? 111 31250 16384 ? source clock enable tbt interrupt period tbtcr inttbt
page 71 TMP86CS25ADFG 7.2 divider output ( dvo ) approximately 50% duty pulse can be output using the divider output circuit, which is useful for piezoelectric buzzer drive. divider output is from dvo pin. 7.2.1 configuration figure 7-3 divider output 7.2.2 control the divider output is controlled by the time base timer control register. note: selection of divider output frequency (dvock) must be made whil e divider output is disabled (dvoen="0"). also, in other words, when changing the state of the divider output frequen cy from enabled (dvoen="1") to disable(dvoen="0"), do not change the setting of the divider output frequency. time base timer control register 7654 321 0 tbtcr (0036h) dvoen dvock (dv7ck) (tbten) (tbtck) (initial value: 0000 0000) dvoen divider output enable / disable 0: disable 1: enable r/w dvock divider output ( dvo ) frequency selection: [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 00 fc/2 13 fs/2 5 fs/2 5 01 fc/2 12 fs/2 4 fs/2 4 10 fc/2 11 fs/2 3 fs/2 3 11 fc/2 10 fs/2 2 fs/2 2 tbtcr output latch port output latch mpx dvoen tbtcr dvo pin output dvock divider output control register (a) configuration (b) timing chart data output 2 a b c y d s d q dvo pin fc/2 13 or fs/2 5 fc/2 12 or fs/2 4 fc/2 11 or fs/2 3 fc/2 10 or fs/2 2
page 72 7. time base timer (tbt) 7.2 divider output (dvo) TMP86CS25ADFG example :1.95 khz pulse output (fc = 16.0 mhz) ld (tbtcr) , 00000000b ; dvock "00" ld (tbtcr) , 10000000b ; dvoen "1" table 7-2 divider output frequency ( exam ple : fc = 16.0 mhz, fs = 32.768 khz ) dvock divider output frequency [hz] normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 00 1.953 k 1.024 k 1.024 k 01 3.906 k 2.048 k 2.048 k 10 7.813 k 4.096 k 4.096 k 11 15.625 k 8.192 k 8.192 k
page 73 TMP86CS25ADFG 8. 18-bit timer/counter (tc1) 8.1 configuration tc1cr1 treg1b f/f tc1sr cmp tc1cr2 c b y a s h c d e f g b a a b y c s treg1a l treg1a m treg1a h window pulse generator edge detector 18- bit up-counter 10 11 00 s y y pin ecnt pin clear signal ecin pin wgpsck tc1m sgedg inttc1 2 3 22 1 12121 wgpsck sgedg sgp seg tc1c tc1s tc1m tc1ck 2 1 1 11 pulse width measurement mode frequency measurement mode timer/event count modes mul3 pin tc6out tc6out fc/2 12 or fs/2 4 fc/2 13 or fs/2 5 fc/2 14 or fs/2 6 fs/2 15 or fc/2 23 fs/2 5 or fc/2 13 fs/2 3 or fc/2 11 fc/2 7 fc/2 3 fs fc pwm6 /pdo6 /ppg6
page 74 8. 18-bit timer/counter (tc1) 8.2 control TMP86CS25ADFG 8.2 control the timer/counter 1 is controlled by timer/counter 1 control registers (tc1cr1/tc1cr2), an 18-bit timer register (treg1a), and an 8-bit inte rnal window gate pulse setting register (treg1b). timer register 76543210 treg1ah (0012h) r/w ?????? treg1ah (initial value: ???? ?? 00) 76543210 treg1am (0011h) r/w treg1am (initial value: 0000 0000) 76543210 treg1al (0010h) r/w treg1al (initial value: 0000 0000) 76543210 treg1b (0013h) ta tb (initial value: 0000 0000) wgpsck normal1/2,idle1/2 modes slow1/2, sleep1/2 modes r/w dv7ck=0 dv7ck=1 ta setting "h" level period of the window gate pulse 00 01 10 (16 - ta) 2 12 /fc (16 - ta) 2 13 /fc (16 - ta) 2 14 /fc (16 - ta) 2 4 /fs (16 - ta) 2 5 /fs (16 - ta) 2 6 /fs (16 - ta) 2 4 /fs (16 - ta) 2 5 /fs (16 - ta) 2 6 /fs tb setting "l" level period of the window gate pulse 00 01 10 (16 - tb) 2 12 /fc (16 - tb) 2 13 /fc (16 - tb) 2 14 /fc (16 - tb) 2 4 /fs (16 - tb) 2 5 /fs (16 - tb) 2 6 /fs (16 - tb) 2 4 /fs (16 - tb) 2 5 /fs (16 - tb) 2 6 /fs
page 75 TMP86CS25ADFG note 1: fc; high-frequency clock [hz] fs; low-frequency clock [hz] * ; don?t care note 2: writing to the low-byte of the timer register 1a (tre g1al, treg1am), the compare func tion is inhibited until the high- byte (treg1ah) is written. note 3: set the mode and source clock, and edge (selection) when the tc1 stops (tc1s=00). note 4: ?fc? can be selected as the source clock only in the timer mode during slow mode and in the pulse width measurement mode during normal 1/2 or idle 1/2 mode. note 5: when a read instruction is executed to the timer register (treg1a), the counter immediate value, not the register set value, is read out. therefore it is impossible to read out the written value of treg1a. to read the counter value, the read instruction should be executed when the coun ter stops to avoid reading unstable value. note 6: set the timer r egister (treg1a) to 1. note 7: when using the timer mode and pulse width measurement m ode, set tc1ck (tc1 source clock select) to internal clock. note 8: when using the event counter mode, set tc1c k (tc1 source clock select) to external clock. note 9: because the read value is different from the written va lue, do not use read-modify-wri te instructions to treg1a. note 10:fc/2 7 , fc/2 3 can not be used as source clock in slow/sleep mode. note 11:the read data of bits 7 to 2 in treg1ah are always ?0?. (data ?1? can not be written.) timer/counter 1 control register 1 7 6543210 tc1cr1 (0014h) tc1c tc1s tc1ck tc1m (initial value: 1000 1000) tc1c counter/overfow flag controll 0: 1: clear counter/overflow flag ( ?1? is automatically set after clearing.) not clear counter/overflow flag r/w tc1s tc1 start control 00: 10: *1: stop and counter clear and overflow flag clear start reserved r/w tc1ck tc1 source clock select normal1/2,idle1/2 modes slow1/2 mode sleep1/2 mode r/w dv7ck="0" dv7ck="1" 000 : 001: 010: 011: 100: 101: 110: fc fs fc/2 23 fc/2 13 fc/2 11 fc/2 7 fc/2 3 fc fs fs/2 15 fs/2 5 fs/2 3 fc/2 7 fc/2 3 fc - fs/2 15 fs/2 5 fs/2 3 - - fc - fs/2 15 fs/2 5 fs/2 3 - - 111: external clock (ecin pin input) tc1m tc1 mode select 00: 01: 10: 11: timer/event counter mode reserved pulse width measurement mode frequency measurement mode r/w
page 76 8. 18-bit timer/counter (tc1) 8.2 control TMP86CS25ADFG note 1: fc; high-frequency clock [hz] fs; low-frequency clock [hz] *; don't care note 2: set the mode, source clock, and edge (selection) when the tc1 stops (tc1s = 00). note 3: if there is no need to use pwm6 / pdo6 / ppg6 as window gate pulse of tc1 always write "0" to tc6out. note 4: make sure to write tc1cr2 "0,7" to bit 0 in tc1cr2. timer/counter 1 control register 2 76543210 tc1cr2 (0015h) "0" sgp sgedg wgpsck tc6out "0" (initial value: *000 000*) sgp window gate pulse select 00: 01: 10: 11: ecnt input internal window gate pulse (treg1b) pwm6 / pdo6 / ppg6 (tc6)output reserved r/w sgedg window gate pulse interrupt edge select 0: 1: interrupts at the falling edge interrupts at the falling/rising edges wgpsck window gate pulse source clock select normal1/2,idle1/2 modes slow1/2 mode sleep1/2 mode r/w dv7ck="0" dv7ck="1" 00: 01: 10: 11: 2 12 /fc 2 13 /fc 2 14 /fc reserved 2 4 /fs 2 5 /fs 2 6 /fs reserved 2 4 /fs 2 5 /fs 2 6 /fs reserved 2 4 /fs 2 5 /fs 2 6 /fs reserved tc6out tc6 output ( pwm6 / pdo6 / ppg6 ) external output select 0: 1: output to mul3 pin no output to mul3 pin r/w
page 77 TMP86CS25ADFG 8.3 function tc1 has four operating modes. the timer mode of the tc 1 is used at warm-up when switching form slow mode to normal2 mode. 8.3.1 timer mode in this mode, counting up is perfor med using the internal clock. the c ontents of tregia are compared with the contents of up-counter. if a match is found, an in ttc1 interrupt is generated, and the counter is cleared. counting up resumes after the counter is cleared. note: when fc is selected for the source clock in slow mode, the lower bits 11 of treg1a is invalid, and a match of the upper bits 7 makes interrupts. tc1 status register tc1sr (0016h) 7 6 543210 hecf heovf "0" "0" "0" "0" "0" "0" (initial value: 0000 0000) hecf operating status monitor 0: 1: stop (during tb) or disable under counting (during ta) read only heovf counter overflow monitor 0: 1: no overflow overflow status table 8-1 source clock (internal clock) of timer/counter 1 source clock resolution maximum time setting normal1/2, idle1/2 mode slow mode sleep mode fc = 16 mhz fs =32.768 khz fc = 16 mhz fs =32.768 khz dv7ck = 0 dv7ck = 1 fc/2 23 [hz] fs/2 15 [hz] fs/2 15 [hz] fs/2 15 [hz] 0.52 s 1 s 38.2 h 72.8 h fc/2 13 fs/2 5 fs/2 5 fs/2 5 512 ms 0.98 ms 2.2 min 4.3 min fc/2 11 fs/2 3 fs/2 3 fs/2 3 128 ms 244 ms 0.6 min 1.07 min fc/2 7 fc/2 7 --8 ms-2.1 s- fc/2 3 fc/2 3 - - 0.5 ms - 131.1 ms - fc fc fc (note) - 62.5 ns - 16.4 ms - fs fs - - - 30.5 ms - 8 s
page 78 8. 18-bit timer/counter (tc1) 8.3 function TMP86CS25ADFG figure 8-1 timing chart for timer mode 8.3.2 event counter mode it is a mode to count up at the falling edge of the ecin pin input. when using this mode, set tc1cr1 to the external clock. the countents of treg1a are compared with the cont ents of up-counter. if a match is found, an inttc1 interrupt is generated, and the counter is cleared. count ing up resumes for ecin pin input edge each after the counter is cleared. the maximum applied frequency is fc/2 4 [hz] in normal 1/2 or idle 1/2 mode and fs/2 4 [hz] in slow or sleep mode . two or more machine cycles are requi red for both the ?h? and ?l? levels of the pulse width. figure 8-2 event count er mode timing chart 1 0 2 3 4 n 0 1 n-1 2 3 4 5 6 n treg1a internal clock up counter command start match detect counter clear inttc1 interrupt 1 0 2 2 n-1 n 0 1 n treg1a ecin pin input up counter start match detect counter clear inttc1 interrupt
page 79 TMP86CS25ADFG 8.3.3 pulse width measurement mode in this mode, pulse widths are coun ted on the falling edge of logical and-ed pulse between ecin pin input (window pulse) and the internal clock. when using this mode, set tc1cr1 to suitable internal clock . an inttc1 interrupt is generated when the ecin inpu t detects the falling edge of the window pulse or both rising and falling edges of the window pulse, that can be selected by tc1cr2. the contents of treg1a should be read while the c ount is stopped (ecin pin is low), then clear the counter using tc1cr1 (normally, execute these process in the interrupt program). when the counter is not cleared by tc1cr1, counting-up resumes from previous stopping value. when up counter is counted up from 3ffffh to 00000 h, an overflow occurs. at that time, tc1sr is set to ?1?. tc1sr remains the previous data until the counter is required to be cleared by tc1cr1. note:in pulse width measurement mode, if tc1cr1 is written to "00" while ecin input is "1", inttc1 inter- rupt occurs. according to the following step, when ti mer counter is stopped, inttc1 interrupt latch should be cleared to "0". note 1: when sgedg (window gate pulse interrupt edge select ) is set to both edges and ecin pin input is "1" in the pulse width measurement mode, an inttc1 interrupt is generated by setting tc1s (tc1 start control) to "10" (start). note 2: in the pulse width measurement mode, hecf (operating status monitor) cannot used. note 3: because the up counter is counted on the falling e dge of logical and-ed pulse (between ecin pin input and the internal clock), if ecin input becomes falling edge while internal source clock is "h" level, the up counter stops plus "1". figure 8-3 pulse width me asurement mode timing chart example : tc1stop : | | di ; clear imf clr (eirh). 0 ; clear bit0 of eirh ld (tc1cr1), 00011010b ; stop timer couter 1 ld (ilh), 11111110b ; clear bit0 of ilh set (eirh). 0 ; set bit0 of eirh ei ; set imf | | 1 0 2 3 n-2 n-1 n n+1 0 12 ecin pin input inttc1 interrupt internal clock and-ed pulse (internal signal) up counter tc1cr1 interrupt read clear count start count start count stop
page 80 8. 18-bit timer/counter (tc1) 8.3 function TMP86CS25ADFG 8.3.4 frequency measurement mode in this mode, the frequency of ecin pin input pulse is measured. when using this mode, set tc1cr1 to the external clock. the edge of the ecin input pulse is counted during ?h? level of the window gate pulse selected by tc1cr2. to use ecnt input as a window ga te pulse, tc1cr2 should be set to ?00?. an inttc1 interrupt is generated on the falling edge or both the rising/falling edges of the window gate pulse, that can be selected by tc1cr2. in the interrupt service progr am, read the contents of treg1a while the count is stopped (window gate pulse is low), then clear the counter using tc1cr1. when the counter is not cleared, counting up resumes from previous stopping value. the window pulse status can be monitored by tc1sr. when up counter is counted up from 3ffffh to 00000h, an overflow occurs. at that time, tc1sr is set to ?1?. tc1sr remains the previous data until the counter is required to be cleared by tc1cr1. using tc6 output ( pwm6 / pdo6 / ppg6 ) for the window gate pulse, external output of pwm6 / pdo6 / ppg6 to mul3 pin can be controlled using tc1cr2. zero-clearing tc1cr2 outputs pwm6 / pdo6 / ppg6 to mul3 pin; setting 1 in tc1cr2 does not output pwm6 / pdo6 / ppg6 to mul3 pin. (tc1cr2 is used to control output to mul3 pin only. thus, use the timer counter 6 control regis- ter to operate/stop pwm6 / pdo6 / ppg6 .) when the internal window gate pulse is selected, the window gate pulse is set as follows. the internal window gate pulse consists of ?h? level period (ta) that is counting time and ?l? level period (tb) that is counting stop time. ta or tb can be individually set by treg1b. one cycle contains ta + tb. note 1: because the internal window gate pulse is generat ed in synchronization with the internal divider, it may be delayed for a maximum of one cycle of the source cloc k (wgpsck) immediately after start of the timer. note 2: set the internal window gate pulse when the timer counter is not operating or during the tb period. when tb is overwritten during the tb period, t he update is valid from the next tb period. note 3: because the up counter is counted on the falling e dge of logical and-ed pulse (between ecin pin input and window gate pulse), if window gate pulse becomes falling edge while ecin input is "h" level, the up counter stops plus "1". therefore, if ecin i nput is always "h" level, count value becomes "1". table 8-2 internal window gate pulse setting time wgpsck normal1/2,idle1/2 modes slow1/2, sleep1/2 modes r/w dv7ck=0 dv7ck=1 ta setting "h" level period of the window gate pulse 00 01 10 (16 - ta) 2 12 /fc (16 - ta) 2 13 /fc (16 - ta) 2 14 /fc (16 - ta) 2 4 /fs (16 - ta) 2 5 /fs (16 - ta) 2 6 /fs (16 - ta) 2 4 /fs (16 - ta) 2 5 /fs (16 - ta) 2 6 /fs tb setting "l" level period of the window gate pulse 00 01 10 (16 - tb) 2 12 /fc (16 - tb) 2 13 /fc (16 - tb) 2 14 /fc (16 - tb) 2 4 /fs (16 - tb) 2 5 /fs (16 - tb) 2 6 /fs (16 - tb) 2 4 /fs (16 - tb) 2 5 /fs (16 - tb) 2 6 /fs
page 81 TMP86CS25ADFG figure 8-4 timing chart for the frequency measurement mode (window gate pulse falling interrupt) table 8-3 table setting ta and tb (wgpsck = 10, fc = 16 mhz) setting value setting time setting value setting time 0 16.38ms 8 8.19ms 1 15.36ms 9 7.17ms 2 14.34ms a 6.14ms 3 13.31ms b 5.12ms 4 12.29ms c 4.10ms 5 11.26ms d 3.07ms 6 10.24ms e 2.05ms 7 9.22ms f 1.02ms table 8-4 table setting ta and tb (wgpsck = 10, fs = 32.768 khz) setting valuen setting time setting value setting time 0 31.25ms 8 15.63ms 1 29.30ms 9 13.67ms 2 27.34ms a 11.72ms 3 25.39ms b 9.77ms 4 23.44ms c 7.81ms 5 21.48ms d 5.86ms 6 19.53ms e 3.91ms 7 17.58ms f 1.95ms 1 0 2 3 5 4 1 2 3 56 4 6 0 ecin pin input and-ed pulse (internal signal) inttc1 interrupt window gate pulse up counter tc1cr1 read clear ta tb ta
page 82 8. 18-bit timer/counter (tc1) 8.3 function TMP86CS25ADFG
page 83 TMP86CS25ADFG 9. 8-bit timercounter (tc3, tc4) 9.1 configuration figure 9-1 8-bit timercouter 3, 4 8-bit up-counter decode en a y b s a b y c d e f g h s a y b s s a y b toggle q set clear 8-bit up-counter a b y c d e f g h s decode en toggle q set clear pwm mode pdo, ppg mode pdo mode pwm, ppg mode pwm mode pwm mode 16-bit mode 16-bit mode 16-bit mode 16-bit mode timer, event counter mode overflow overflow timer, event couter mode 16-bit mode clear clear fc/2 7 fc/2 5 fc/2 3 fc/2 fc fc/2 7 fc/2 5 fc/2 3 fc/2 fc pdo, pwm, ppg mode pdo, pwm mode 16-bit mode fc/2 11 or fs/2 3 fc/2 11 or fs/2 3 fs fs tc4cr tc3cr ttreg4 pwreg4 ttreg3 pwreg3 tc3 pin tc4 pin tc4s tc3s inttc3 interrupt request inttc4 interrupt request tff4 tff3 pdo 4/pwm 4/ ppg 4 pin pdo 3/pwm 3/ pin tc3ck tc4ck tc3m tc3s tff3 tc4m tc4s tff4 timer f/f4 timer f/f3
page 84 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG 9.2 timercounter control the timercounter 3 is controlled by the timercounter 3 control register (tc3cr) and two 8-bit timer registers (ttreg3, pwreg3). note 1: do not change the timer register (t treg3) setting while the timer is running. note 2: do not change the timer register (pwreg3) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock[hz] note 2: do not change the tc3m, tc3ck and tff3 settings while the timer is running. note 3: to stop the timer operation (tc3s= 1 0), do not change the tc3m, tc3ck and tff3 settings. to start the timer opera- tion (tc3s= 0 1), tc3m, tc3ck and tff3 can be programmed. note 4: to use the timercounter in the 16-bit mode, set th e operating mode by programming tc4cr, where tc3m must be fixed to 011. note 5: to use the timercounter in the 16-bit mode, select the source clock by programming tc3ck. set the timer start control and timer f/f control by programming tc4 cr and tc4cr, respectively. note 6: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. timercounter 3 timer register ttreg3 (001ch) r/w 76543210 (initial value: 1111 1111) pwreg3 (002ch) r/w 76543210 (initial value: 1111 1111) timercounter 3 control register tc3cr (0018h) 76543210 tff3 tc3ck tc3s tc3m (initial value: 0000 0000) tff3 time f/f3 control 0: 1: clear set r/w tc3ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc fc (note 8) 111 tc3 pin input tc3s tc3 start control 0: 1: operation stop and counter clear operation start r/w tc3m tc3m operating mode select 000: 001: 010: 011: 1**: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode 16-bit mode (each mode is selectable with tc4m.) reserved r/w
page 85 TMP86CS25ADFG note 7: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 8: the operating clock fc in t he slow or sleep mode can be used only as the high-frequency warm-up mode.
page 86 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG the timercounter 4 is controlled by the timercounter 4 control register (tc4cr) and two 8-bit timer registers (ttreg4 and pwreg4). note 1: do not change the timer register (t treg4) setting while the timer is running. note 2: do not change the timer register (pwreg4) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock [hz] note 2: do not change the tc4m, tc4ck and tff4 settings while the timer is running. note 3: to stop the timer operation (tc4s= 1 0), do not change the tc4m, tc4ck and tff4 settings. to start the timer operation (tc4s= 0 1), tc4m, tc4ck and tff4 can be programmed. note 4: when tc4m= 1** (upper byte in the 16-bit mode), the sour ce clock becomes the tc4 over flow signal regardless of the tc3ck setting. note 5: to use the timercounter in the 16-bit mode, select the operating mode by programming tc4m, where tc3cr must be set to 011. timercounter 4 timer register ttreg4 (001dh) r/w 76543210 (initial value: 1111 1111) pwreg4 (002dh) r/w 76543210 (initial value: 1111 1111) timercounter 4 control register tc4cr (0019h) 76543210 tff4 tc4ck tc4s tc4m (initial value: 0000 0000) tff4 timer f/f4 control 0: 1: clear set r/w tc4ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc ? 111 tc4 pin input tc4s tc4 start control 0: 1: operation stop and counter clear operation start r/w tc4m tc4m operating mode select 000: 001: 010: 011: 100: 101: 110: 111: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode reserved 16-bit timer/event counter mode warm-up counter mode 16-bit pulse width modulation (pwm) output mode 16-bit ppg mode r/w
page 87 TMP86CS25ADFG note 6: to the timercounter in the 16-bit mode, select the so urce clock by programming tc3cr. set the timer start control and timer f/f control by prog ramming tc4s and tff4, respectively. note 7: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9-1 and table 9-2. note 8: the timer register settings are limited depending on the timer operating mode. for the detailed descriptions, see table 9- 3. note 1: for 16-bit operations (16-bit timer/event counter, warm- up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). note 2: : available source clock table 9-1 operating mode and selectable source clock (normal1/2 and idle1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer ??? ????? 8-bit event counter ??????? 8-bit pdo ??? ????? 8-bit pwm ?????? ?? 16-bit timer ??? ????? 16-bit event counter ??????? ? warm-up counter ???? ???? 16-bit pwm ??????? ? 16-bit ppg ??? ??? ? table 9-2 operating mode an d selectable source clock (slow1/2 and sleep1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc3 pin input tc4 pin input 8-bit timer ???????? 8-bit event counter ??????? ? 8-bit pdo ???????? 8-bit pwm ??? ???? 16-bit timer ???????? 16-bit event counter ??????? ? warm-up counter ?????? ?? 16-bit pwm ??? ?? ? 16-bit ppg ?????? ? note1: note2: for 16-bit operations (16-bit timer/event counter, warm-up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc3ck). : available source clock
page 88 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG note: n = 3 to 4 table 9-3 constraints on register values being compared operating mode register value 8-bit timer/event counter 1 (ttregn) 255 8-bit pdo 1 (ttregn) 255 8-bit pwm 2 (pwregn) 254 16-bit timer/event counter 1 (ttreg4, 3) 65535 warm-up counter 256 (ttreg4, 3) 65535 16-bit pwm 2 (pwreg4, 3) 65534 16-bit ppg 1 (pwreg4, 3) < (ttreg4, 3) 65535 and (pwreg4, 3) + 1 < (ttreg4, 3)
page 89 TMP86CS25ADFG 9.3 function the timercounter 3 and 4 have the 8-bit timer, 8-bit ev ent counter, 8-bit programmable divider output (pdo), 8- bit pulse width modulation (pwm) output modes. the time rcounter 3 and 4 (tc3, 4) are cascadable to form a 16- bit timer. the 16-bit timer has the operat ing modes such as the 16-bit timer, 16-bit event counter, warm-up counter, 16-bit pulse width modulation (pwm) output and 16-bit programmable pulse generation (ppg) modes. 9.3.1 8-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register j (ttregj) value is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cl eared, the up-counter restarts counting. note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed while the timer is r unning, an expected operation may not be obtained. note 3: j = 3, 4 table 9-4 source clock for timercounter 3, 4 (internal clock) source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.6 ms 62.3 ms fc/2 7 fc/2 7 ?8 s ? 2.0 ms ? fc/2 5 fc/2 5 ?2 s ? 510 s? fc/2 3 fc/2 3 ? 500 ns ? 127.5 s? example :setting the timer mode with source clock fc/2 7 hz and generating an interrupt 80 s later (timercounter4, fc = 16.0 mhz) ld (ttreg4), 0ah : sets the timer register (80 s 2 7 /fc = 0ah). di set (eirh). 3 : enables inttc4 interrupt. ei ld (tc4cr), 00010000b : sets the operating cock to fc/2 7 , and 8-bit timer mode. ld (tc4cr), 00011000b : starts tc4.
page 90 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG figure 9-2 8-bit timer mode timing chart (tc4) 9.3.2 8-bit event counter mode (tc3, 4) in the 8-bit event counter mode, the up-counter counts up at the falling edge of the input pulse to the tcj pin. when a match between the up-counter and the ttregj valu e is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counti ng at the falling edge of the input pulse to the tcj pin. two machine cycles are required for the low- or high-level pulse input to the tcj pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 hz in the slow1/2 or sleep1/2 mode. note 1: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the event counter mode, do not change the ttre gj setting while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed whil e the timer is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-3 8-bit event count er mode timing chart (tc4) 9.3.3 8-bit programmable divi der output (pdo) mode (tc3, 4) this mode is used to generate a pu lse with a 50% duty cycle from the pdoj pin. in the pdo mode, the up-counter counts up using the internal clock. when a match between the up-counter and the ttregj value is detected , the logic level output from the pdoj pin is switched to the opposite state and the up-counter is cleared. the inttcj interrupt request is generated at the time. the logic state opposite to the timer f/fj logic level is output from the pdoj pin. an arbitrary value can be set to the timer f/fj by tcjcr. upon reset, the timer f/fj value is initialized to 0. to use the programmable divider output, set the output latch of the i/o port to 1. 1 2 3 n-1 n 0 1 n-1 n 2 0 1 2 0 n ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg4 inttc4 interrupt request 1 0 2 n-1 n 0 1 2 0 n ? counter match detect counter clear n-1 n 2 0 1 match detect counter clear tc4cr ttreg4 inttc4 interrupt request tc4 pin input
page 91 TMP86CS25ADFG note 1: in the programmable divider output mode, do not change the ttregj setting while the timer is running. since ttregj is not in the shift register configur ation in the programmable divider output mode, the new value programmed in ttregj is in effect immediatel y after programming. therefore, if ttregi is changed while the timer is running, an ex pected operation may not be obtained. note 2: when the timer is stopped during pdo output, the pdoj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr setting upon stopping of the timer. example: fixing the pdoj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pdoj pin to the high level. note 3: j = 3, 4 example :generating 1024 hz pulse using tc4 (fc = 16.0 mhz) setting port ld (ttreg4), 3dh : 1/1024 2 7 /fc 2 = 3dh ld (tc4cr), 00010001b : sets the operating clock to fc/2 7 , and 8-bit pdo mode. ld (tc4cr), 00011001b : starts tc4.
page 92 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG figure 9-4 8-bit pdo mode timing chart (tc4) 12 0 n 0 n 0 n 0 n 0 1 2 2 1 2 1 2 3 1 0 n ? internal source clock counter match detect match detect match detect match detect held at the level when the timer is stopped set f/f write of "1" tc4cr tc4cr ttreg4 timer f/f4 pdo 4 pin inttc4 interrupt request
page 93 TMP86CS25ADFG 9.3.4 8-bit pulse wi dth modulation (pwm) output mode (tc3, 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 8 bits of resolution. the up-counter counts up using the internal clock. when a match between the up-counter and the pwregj value is detected, the logic level output from the timer f/fj is switched to the opposite state. the counter continues counting. the logic level output from the timer f/fj is switched to the opposite state again by the up-co unter overflow, and the counter is cleared. the inttcj interrupt request is generated at this time. since the initial value can be set to the timer f/fj by tcjcr, positive and negative pulses can be gen- erated. upon reset, the tim er f/fj is cleared to 0. (the logic level output from the pwmj pin is the opposite to the timer f/fj logic level.) since pwregj in the pwm mode is se rially connected to the shift regist er, the value set to pwregj can be changed while the timer is running. the value set to pwregj during a run of the timer is shifted by the inttcj interrupt request and loaded into pwregj. while the timer is stopped, the value is shifted immedi- ately after the programming of pwre gj. if executing the read instruction to pwregj during pwm output, the value in the shift register is read, but not the valu e set in pwregj. therefore, after writing to pwregj, the reading data of pwregj is previo us value until inttcj is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pw regj immediately after the inttcj interrupt request is generated (normally in the inttcj interrupt service r outine.) if the programming of pwregj and the inter- rupt request occur at the same time, an unstable value is shifted, that may result in generation of the pulse different from the programmed value until the next inttcj interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwmj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr upon stopping of the timer. example: fixing the pwmj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pwmj pin to the high level. note 3: to enter the stop mode during pwm output, stop the timer and then enter the stop mode. if the stop mode is entered without stopping the timer when fc, fc/2 or fs is selected as the source clock, a pulse is out- put from the pwmj pin during the warm-up period time after exiting the stop mode. note 4: j = 3, 4 table 9-5 pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.8 ms 62.5 ms fc/2 7 fc/2 7 ?8 s?2.05 ms? fc/2 5 fc/2 5 ?2 s ? 512 s? fc/2 3 fc/2 3 ? 500 ns ? 128 s? fs fs fs 30.5 s30.5 s 7.81 ms 7.81 ms fc/2 fc/2 ? 125 ns ? 32 s? fc fc ? 62.5 ns ? 16 s?
page 94 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG figure 9-5 8-bit pwm mo de timing chart (tc4) 1 0 n n+1 ff 0 n n+1 ff 0 1 m m+1 ff 0 1 1 p n ? internal source clock counter write to pwreg4 write to pwreg4 m p m p n ? shift registar shift shift shift shift match detect match detect one cycle period match detect match detect n m p n tc4cr tc4cr pwreg4 timer f/f4 pwm 4 pin inttc4 interrupt request
page 95 TMP86CS25ADFG 9.3.5 16-bit timer mode (tc3 and 4) in the timer mode, the up-counter counts up using the internal clock. the timercounter 3 and 4 are cascad- able to form a 16-bit timer. when a match between the up-counter and the timer regi ster (ttreg3, ttreg4) valu e is detected after the timer is started by setting tc4cr to 1, an inttc 4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter continues counting. pr ogram the upper byte and lower byte in this order in the timer register. (programming only the uppe r or lower byte should not be attempted.) note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj , and ppgj pins may output a pulse. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after programming of ttregj. therefore, if ttreg j is changed while the time r is running, an expected operation may not be obtained. note 3: j = 3, 4 figure 9-6 16-bit timer m ode timing chart (tc3 and tc4) table 9-6 source clock for 16-bit timer mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 fs/2 3 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? example :setting the timer mode with source clock fc/2 7 hz, and generating an interrupt 300 ms later (fc = 16.0 mhz) ldw (ttreg3), 927ch : sets the timer register (300 ms 2 7 /fc = 927ch). di set (eirh). 3 : enables inttc4 interrupt. ei ld (tc3cr), 13h :sets the operating cock to fc/2 7 , and 16-bit timer mode (lower byte). ld (tc4cr), 04h : sets the 16-bit timer mode (upper byte). ld (tc4cr), 0ch : starts the timer. 1 0 2 3 mn-1 mn 0 1 mn-1 mn 2 0 1 2 0 n ? m ? internal source clock counter match detect counter clear match detect counter clear tc4cr ttreg3 (lower byte) inttc4 interrupt request ttreg4 (upper byte)
page 96 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG 9.3.6 16-bit event c ounter mode (tc3 and 4) 9.3.7 16-bit pulse width modulatio n (pwm) output mode (tc3 and 4) this mode is used to generate a pulse-width modulated (pwm) signals with up to 16 bits of resolution. the timercounter 3 and 4 are cascadable to form the 16-bit pwm signal generator. the counter counts up using the internal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again by the counter overflow, and the counter is cleared. the inttc4 interrupt is generated at this time. two machine cycles are required for the high- or low-level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1 or idle1 mode, and fs/2 4 to in the slow1/2 or sleep1/2 mode. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the pwm 4 pin is the opposite to the timer f/f4 logic level.) since pwreg4 and 3 in the pwm mode are serially connected to the shift register, the values set to pwreg4 and 3 can be changed while the timer is runni ng. the values set to pwreg4 and 3 during a run of the timer are shifted by the inttcj interrupt request and loaded into pwreg4 and 3. while the timer is stopped, the values are shifted i mmediately after the programming of pwreg4 and 3. set the lower byte (pwreg3) and upper byte (pwreg3) in this order to program pwreg4 and 3. (programming only the lower or upper byte of the register should not be attempted.) if executing the read instruction to pwreg4 and 3 during pwm output, the values set in the shift register is read, but not the values set in pwreg4 and 3. therefore, after writing to the pwreg4 and 3, reading data of pwreg4 and 3 is previous value until inttc4 is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pwreg4 and 3 immediately after the inttc4 interrupt request is generated (normally in the inttc4 interrupt service routine.) if the programming of pwregj and the interrupt request occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next inttc4 interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwm 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not program tc4cr upon stopping of the timer. example: fixing the pwm 4 pin to the high level when the timercounter is stopped in the event counter mode, the up-counter counts up at the falling edge to the tc3 pin. the timercounter 3 and 4 are cascadable to fo rm a 16-bit event counter. when a match between the up-counter and the timer register (ttreg3, ttreg4) value is detected after the timer is started by setting tc4cr to 1, an inttc4 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter rest arts counting at the falling edge of the input pulse to the tc3 pin. two machine cycles are required for the low- or high-level pulse input to the tc3 pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1 or idle1 mode, and fs/2 4 in the slow1/2 or sleep1/2 mode. program the lower by te (ttreg3), and upper byte (ttreg4) in this order in the timer register. (programming only the upper or lower byte should not be attempted.) note 1: note 2: note 3: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. in the event counter mode, do not change the ttregj setti ng while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect imme- diately after the programming. therefore, if ttregj is changed while the timer is running, an expected operation may not be obtained. j = 3, 4
page 97 TMP86CS25ADFG clr (tc4cr).3: stops the timer. clr (tc4cr).7 : sets the pwm 4 pin to the high level. note 3: to enter the stop mode, stop the timer and then enter the stop mode. if the stop mode is entered with- out stopping of the timer when fc, fc/2 or fs is select ed as the source clock, a pulse is output from the pwm 4 pin during the warm-up period time after exiting the stop mode. table 9-7 16-bit pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500ns ? 32.8 ms ? fs fs fs 30.5 s30.5 s2 s 2 s fc/2 fc/2 ? 125 ns ? 8.2 ms ? fc fc ? 62.5 ns ? 4.1 ms ? example :generating a pulse with 1-ms high-level width and a period of 32.768 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and 16-bit pwm output mode (lower byte). ld (tc4cr), 056h : sets tff4 to the initial value 0, and 16-bit pwm signal generation mode (upper byte). ld (tc4cr), 05eh : starts the timer.
page 98 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG figure 9-7 16-bit pwm m ode timing chart (tc3 and tc4) 1 0 an an+1 ffff 0 an an+1 ffff 0 1 bm bm+1 ffff 0 bm cp b c 1 1 cp n a an ? ? ? internal source clock 16-bit shift register shift shift shift shift counter match detect match detect one cycle period match detect match detect an bm cp an m p tc4cr tc4cr pwreg3 (lower byte) timer f/f4 pwm 4 pin inttc4 interrupt request pwreg4 (upper byte) write to pwreg4 write to pwreg4 write to pwreg3 write to pwreg3
page 99 TMP86CS25ADFG 9.3.8 16-bit programmable pulse generate (ppg) ou tput mode (tc3 and 4) this mode is used to generate pulses with up to 16- bits of resolution. the timer counter 3 and 4 are cascad- able to enter the 16-bit ppg mode. the counter counts up using the inte rnal clock or external clock. when a match between the up-counter and the timer register (pwreg3, pwreg4 ) value is detected, the logic level output from the timer f/f4 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f4 is switched to the opposite state again when a match betw een the up-counter and th e timer register (ttreg3, ttreg4) value is detected, and the counter is cleared. the inttc4 interrupt is generated at this time. since the initial value can be set to the timer f/f4 by tc4cr, positive and negative pulses can be generated. upon reset, the timer f/f4 is cleared to 0. (the logic level output from the ppg 4 pin is the opposite to the timer f/f4.) set the lower byte and upper byte in this order to program the timer register. (ttreg3 ttreg4, pwreg3 pwreg4) (programming only the upper or lower byte should not be attempted.) for ppg output, set the output latch of the i/o port to 1. note 1: in the ppg mode, do not change the pwregi and ttregi settings while the timer is running. since pwregi and ttregi are not in the shift register c onfiguration in the ppg mode, the new values pro- grammed in pwregi and ttregi are in effect immediately after progra mming pwregi and ttregi. therefore, if pwregi and ttregi are changed whil e the timer is running, an expected operation may not be obtained. note 2: when the timer is stopped during ppg output, the ppg 4 pin holds the output status when the timer is stopped. to change the output status, program tc4cr after the timer is stopped. do not change tc4cr upon stopping of the timer. example: fixing the ppg 4 pin to the high level when the timercounter is stopped clr (tc4cr).3: stops the timer clr (tc4cr).7: sets the ppg 4 pin to the high level note 3: i = 3, 4 two machine cycles are required for the high- or low- level pulse input to the tc3 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1 or idle1 mode, and fc/2 4 to in the slow1/2 or sleep1/2 mode. example :generating a pulse with 1-ms high-level width and a period of 16.385 ms (fc = 16.0 mhz) setting ports ldw (pwreg3), 07d0h : sets the pulse width. ldw (ttreg3), 8002h : sets the cycle period. ld (tc3cr), 33h : sets the operating clock to fc/2 3 , and16-bit ppg mode (lower byte). ld (tc4cr), 057h : sets tff4 to the initial value 0, and 16-bit ppg mode (upper byte). ld (tc4cr), 05fh : starts the timer.
page 100 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG figure 9-8 16-bit ppg mode timing chart (tc3 and tc40) 1 0 mn mn+1 qr-1 mn qr-1 1 mn mn+1 mn+1 0 qr 0 qr 1 0 internal source clock counter write of "0" match detect match detect match detect mn mn mn match detect match detect ? n m ? ? r q ? held at the level when the timer stops f/f clear tc4cr tc4cr pwreg3 (lower byte) timer f/f4 ppg 4 pin inttc4 interrupt request pwreg4 (upper byte) ttreg3 (lower byte) ttreg4 (upper byte)
page 101 TMP86CS25ADFG 9.3.9 warm-up counter mode in this mode, the warm-up period time is obtained to assure oscillation stability when the system clocking is switched between the high-frequency and low-frequency. the timer counter 3 and 4 are cascadable to form a 16-bit timercouter. the warm-up counter mode has two types of mode; switching from the high-frequency to low-frequency, and vice-versa. note 1: in the warm-up counter mode, fi x tcicr to 0. if not fixed, the pdoi , pwmi and ppgi pins may output pulses. note 2: in the warm-up counter mode, only upper 8 bits of the timer register ttreg4 and 3 are used for match detection and lower 8 bits are not used. note 3: i = 3, 4 9.3.9.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) in this mode, the warm-up period time from a stop of the low-frequency clock fs to oscillation stability is obtained. before starting the timer, set syscr2 to 1 to oscillate the low-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, set syscr2 to 1 to switch the system clock fr om the high-frequency to low-frequenc y, and then clear of syscr2 to 0 to stop the high-frequency clock. table 9-8 setting time of low-frequen cy warm-up counter mode (fs = 32.768 khz) maximum time setting (ttreg4, 3 = 0100h) maximum time setting (ttreg4, 3 = ff00h) 7.81 ms 1.99 s example :after check ing low-frequency clock oscillation stability with tc4 and 3, switching to the slow1 mode set (syscr2).6 : syscr2 1 ld (tc3cr), 43h : sets tff3=0, source clock fs, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 8000h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 3 : enables the inttc4. ei : imf 1 set (tc4cr).3 : starts tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops tc4 and 3. set (syscr2).5 : syscr2 1 (switches the system clock to the low-frequency clock.) clr (syscr2).7 : syscr2 0 (stops the high-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 102 9. 8-bit timercounter (tc3, tc4) 9.1 configuration TMP86CS25ADFG 9.3.9.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) in this mode, the warm-up period time from a stop of the high-frequency clock fc to the oscillation sta- bility is obtained. before starting the timer, set sy scr2 to 1 to oscillat e the high-frequency clock. when a match between the up-counter and the timer regist er (ttreg4, 3) value is detected after the timer is started by setting tc4cr to 1, the counter is cleared by generating the inttc4 interrupt request. after stopping the timer in the inttc4 inte rrupt service routine, clear syscr2 to 0 to switch the system clock from the low-frequency to high-frequency, and then syscr2 to 0 to stop the low-frequency clock. table 9-9 setting time in high-frequency warm-up counter mode minimum time (ttreg4, 3 = 0100h) maximum time (ttreg4, 3 = ff00h) 16 s 4.08 ms example :after check ing high-frequency clock oscillation stability with tc4 and 3, switching to the normal1 mode set (syscr2).7 : syscr2 1 ld (tc3cr), 63h : sets tff3=0, source clock fs, and 16-bit mode. ld (tc4cr), 05h : sets tff4=0, and warm-up counter mode. ld (ttreg3), 0f800h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 3 : enables the inttc4. ei : imf 1 set (tc4cr).3 : starts the tc4 and 3. : : pinttc4: clr (tc4cr).3 : stops the tc4 and 3. clr (syscr2).5 : syscr2 0 (switches the system clock to the high-frequency clock.) clr (syscr2).6 : syscr2 0 (stops the low-frequency clock.) reti : : vinttc4: dw pinttc4 : inttc4 vector table
page 103 TMP86CS25ADFG 10. 8-bit timercounter (tc5, tc6) 10.1 configuration figure 10-1 8-bit timercouter 5, 6 8-bit up-counter decode en a y b s a b y c d e f g h s a y b s s a y b toggle q set clear 8-bit up-counter a b y c d e f g s pwm mode pdo, ppg mode pwm, ppg mode 16-bit mode 16-bit mode 16-bit mode timer, event counter mode overflow overflow timer mode 16-bit mode clear clear fc/2 7 fc/2 5 fc/2 3 fc/2 fc fc/2 7 fc/2 5 fc/2 3 fc/2 fc pdo, pwm, ppg mode fc/2 11 or fs/2 3 fs fc/2 11 or fs/2 3 fs tc6cr ttreg6 pwreg6 tc6 pin tc6s inttc6 interrupt request tff6 pdo 6/pwm 6/ ppg 6 pin tc6ck tc6m tff6 timer f/f6 tc6s tc5cr ttreg5 pwreg5 tc5s inttc5 interrupt request tc5ck tc5m tc5s
page 104 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.2 timercounter control the timercounter 5 is controlled by the timercounter 5 control register (tc5cr) and two 8-bit timer registers (ttreg5, pwreg5). note 1: do not change the timer register (t treg5) setting while the timer is running. note 2: do not change the timer register (pwreg5) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock[hz] note 2: do not change the tc5m, tc5ck and tff5 settings while the timer is running. note 3: to stop the timer operation (tc5s= 1 0), do not change the tc5m and tc5ck settings. to start the timer operation (tc5s= 0 1), tc5m and tc5ck can be programmed. note 4: to use the timercounter in the 16-bit mode, set th e operating mode by programming tc6cr, where tc5m must be fixed to 011. note 5: to use the timercounter in the 16-bit mode, select the source clock by programming tc5ck. set the timer start control and timer f/f control by programming tc6 cr and tc6cr, respectively. note 6: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 10-1 and table 10-2. note 7: the timer register settings are limited depending on t he timer operating mode. for the detailed descriptions, see table 10- 3. note 8: the operating clock fc in t he slow or sleep mode can be used only as the high-frequency warm-up mode. timercounter 5 timer register ttreg5 (001eh) r/w 76543210 (initial value: 1111 1111) pwreg5 (002eh) r/w 76543210 (initial value: 1111 1111) timercounter 5 control register tc5cr (001ah) 76543210 tc5ck tc5s tc5m (initial value: ? 000 0000) tc5ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc fc (note 8) 111 reserved tc5s tc5 start control 0: 1: operation stop and counter clear operation start r/w tc5m tc5m operating mode select 000: 001: 010: 011: 1**: 8-bit timer reserved reserved 16-bit mode (each mode is selectable with tc6m.) reserved r/w
page 105 TMP86CS25ADFG the timercounter 6 is controlled by the timercounter 6 control register (tc6cr) and two 8-bit timer registers (ttreg6 and pwreg6). note 1: do not change the timer register (t treg6) setting while the timer is running. note 2: do not change the timer register (pwreg6) setting in the operating mode except the 8-bit and 16-bit pwm modes while the timer is running. note 1: fc: high-frequency clock [hz] fs: low-frequency clock [hz] note 2: do not change the tc6m, tc6ck and tff6 settings while the timer is running. note 3: to stop the timer operation (tc6s= 1 0), do not change the tc6m, tc6ck and tff6 settings. to start the timer operation (tc6s= 0 1), tc6m, tc6ck and tff6 can be programmed. note 4: when tc6m= 1** (upper byte in the 16-bit mode), the sour ce clock becomes the tc6 over flow signal regardless of the tc5ck setting. note 5: to use the timercounter in the 16-bit mode, select the operating mode by programming tc6m, where tc5cr must be set to 011. timercounter 6 timer register ttreg6 (001fh) r/w 76543210 (initial value: 1111 1111) pwreg6 (002fh) r/ w 76543210 (initial value: 1111 1111) timercounter 6 control register tc6cr (001bh) 76543210 tff6 tc6ck tc6s tc6m (initial value: 0000 0000) tff6 timer f/f6 control 0: 1: clear set r/w tc6ck operating clock selection [hz] normal1/2, idle1/2 mode slow1/2 sleep1/2 mode r/w dv7ck = 0 dv7ck = 1 000 fc/2 11 fs/2 3 fs/2 3 001 fc/2 7 fc/2 7 ? 010 fc/2 5 fc/2 5 ? 011 fc/2 3 fc/2 3 ? 100 fs fs fs 101 fc/2 fc/2 ? 110 fc fc ? 111 tc6 pin input tc6s tc6 start control 0: 1: operation stop and counter clear operation start r/w tc6m tc6m operating mode select 000: 001: 010: 011: 100: 101: 110: 111: 8-bit timer/event counter mode 8-bit programmable divider output (pdo) mode 8-bit pulse width modulation (pwm) output mode reserved 16-bit timer/event counter mode warm-up counter mode 16-bit pulse width modulation (pwm) output mode 16-bit ppg mode r/w
page 106 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG note 6: to the timercounter in the 16-bit mode, select the so urce clock by programming tc5cr. set the timer start control and timer f/f control by prog ramming tc6s and tff6, respectively. note 7: the operating clock settings are limited depending on the timer operating mode. for the detailed descriptions, see table 10-1 and table 10-2. note 8: the timer register settings are limited depending on t he timer operating mode. for the detailed descriptions, see table 10- 3. note 9: to use the pdo, pwm or ppg mode, a pulse is not output from the timer output pin when tc1cr2 is set to 1. to output a pulse from the timer output pin, clear tc1cr2 to 0. note 1: for 16-bit operations (16-bit timer, warm-up counter, 16-bit pwm and 16-bit ppg), set its source clock on lower bit (tc5ck). note 2: : available source clock table 10-1 operating mode and selectable source clock (normal1/2 and idle1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc5 pin input tc6 pin input 8-bit timer ??? ????? 8-bit event counter ???????? 8-bit pdo ??? ????? 8-bit pwm ?????? ?? 16-bit timer ??? ????? warm-up counter ???? ???? 16-bit pwm ?????? ?? 16-bit ppg ??? ????? table 10-2 operating mode an d selectable source clock (slow1/2 and sleep1/2 modes) operating mode fc/2 11 or fs/2 3 fc/2 7 fc/2 5 fc/2 3 fs fc/2 fc tc5 pin input tc6 pin input 8-bit timer ???????? 8-bit event counter ???????? 8-bit pdo ???????? 8-bit pwm ??? ???? 16-bit timer ???????? warm-up counter ?????? ?? 16-bit pwm ??? ???? 16-bit ppg ???????? note1: note2: for 16-bit operations (16-bit timer, warm-up counter, 16-bi t pwm and 16-bit ppg), set its source clock on lower bit (tc5ck). : available source clock
page 107 TMP86CS25ADFG note: n = 5 to 6 table 10-3 constraints on register values being compared operating mode register value 8-bit timer/event counter 1 (ttregn) 255 8-bit pdo 1 (ttregn) 255 8-bit pwm 2 (pwregn) 254 16-bit timer 1 (ttreg6, 5) 65535 warm-up counter 256 (ttreg6, 5) 65535 16-bit pwm 2 (pwreg6, 5) 65534 16-bit ppg 1 (pwreg6, 5) < (ttreg6, 5) 65535 and (pwreg6, 5) + 1 < (ttreg6, 5)
page 108 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.3 function the timercounter 6 have the 8-bit timer, 8-bit event co unter, 8-bit programmable di vider output (pdo), 8-bit pulse width modulation (pwm) output modes. the timercounter 5 and 6 (tc5, 6) are cascadable to form a 16-bit timer. the 16-bit timer has the operating modes such as the 16-bit timer, 16-bit event counter, warm-up counter, 16- bit pulse width modulation (pwm) output and 16-bit programmable pulse generation (ppg) modes. 10.3.1 8-bit timer mode (tc5 and 6) in the timer mode, the up-counter counts up using the internal clock. when a match between the up-counter and the timer register j (ttregj) value is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cl eared, the up-counter restarts counting. note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed while the timer is r unning, an expected operation may not be obtained. note 3: j = 5, 6 table 10-4 source clock for timercounter 5, 6 (internal clock) source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.6 ms 62.3 ms fc/2 7 fc/2 7 ?8 s ? 2.0 ms ? fc/2 5 fc/2 5 ?2 s ? 510 s? fc/2 3 fc/2 3 ? 500 ns ? 127.5 s? example :setting the timer mode with source clock fc/2 7 hz and generating an interrupt 80 s later (timercounter6, fc = 16.0 mhz) ld (ttreg6), 0ah : sets the timer register (80 s 2 7 /fc = 0ah). di set (eirh). 4 : enables inttc6 interrupt. ei ld (tc6cr), 00010000b : sets the operating cock to fc/2 7 , and 8-bit timer mode. ld (tc6cr), 00011000b : starts tc6.
page 109 TMP86CS25ADFG figure 10-2 8-bit timer mode timing chart (tc6) 10.3.2 8-bit event counter mode (tc6) in the 8-bit event counter mode, the up-counter counts up at the falling edge of the input pulse to the tcj pin. when a match between the up-counter and the ttregj valu e is detected, an inttcj interrupt is generated and the up-counter is cleared. after being cleared, the up-counter restarts counti ng at the falling edge of the input pulse to the tcj pin. two machine cycles are required for the low- or high-level pulse input to the tcj pin. therefore, a maximum freque ncy to be supplied is fc/2 4 hz in the normal1/2 or idle1/2 mode, and fs/2 4 hz in the slow1/2 or sleep1/2 mode. note 1: in the event counter mode, fix tcjcr to 0. if not fixed, the pdoj, pwmj and ppgj pins may output pulses. note 2: in the event counter mode, do not change the ttre gj setting while the timer is running. since ttregj is not in the shift register configuration in the event counter mode, the new value programmed in ttregj is in effect immediately after the programming. therefore, if ttregi is changed whil e the timer is running, an expected operation may not be obtained. note 3: j = 6 figure 10-3 8-bit event counter mode ti ming chart (tc6) 10.3.3 8-bit programmable divi der output (pdo) mode (tc6) this mode is used to generate a pu lse with a 50% duty cycle from the pdoj pin. in the pdo mode, the up-counter counts up using the internal clock. when a match between the up-counter and the ttregj value is detected , the logic level output from the pdoj pin is switched to the opposite state and the up-counter is cleared. the inttcj interrupt request is generated at the time. the logic state opposite to the timer f/fj logic level is output from the pdoj pin. an arbitrary value can be set to the timer f/fj by tcjcr. upon reset, the timer f/fj value is initialized to 0. to use the programmable divider output, set the output latch of the i/o port to 1. 1 2 3 n-1 n 0 1 n-1 n 2 0 1 2 0 n ? internal source clock counter match detect counter clear match detect counter clear tc6cr ttreg6 inttc6 interrupt request 1 0 2 n-1 n 0 1 2 0 n ? counter match detect counter clear n-1 n 2 0 1 match detect counter clear tc6cr ttreg6 inttc6 interrupt request tc6 pin input
page 110 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG note 1: in the programmable divider output mode, do not change the ttregj setting while the timer is running. since ttregj is not in the shift register configur ation in the programmable divider output mode, the new value programmed in ttregj is in effect immediatel y after programming. therefore, if ttregi is changed while the timer is running, an ex pected operation may not be obtained. note 2: when the timer is stopped during pdo output, the pdoj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr setting upon stopping of the timer. example: fixing the pdoj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pdoj pin to the high level. note 3: j = 6 example :generating 1024 hz pulse using tc6 (fc = 16.0 mhz) setting port ld (ttreg6), 3dh : 1/1024 2 7 /fc 2 = 3dh ld (tc6cr), 00010001b : sets the operating clock to fc/2 7 , and 8-bit pdo mode. ld (tc6cr), 00011001b : starts tc6.
page 111 TMP86CS25ADFG figure 10-4 8-bi t pdo mode timing chart (tc6) 12 0 n 0 n 0 n 0 n 0 1 2 2 1 2 1 2 3 1 0 n ? internal source clock counter match detect match detect match detect match detect held at the level when the timer is stopped set f/f write of "1" tc6cr tc6cr ttreg6 timer f/f6 pdo 6 pin inttc6 interrupt request
page 112 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.3.4 8-bit pulse width modul ation (pwm) output mode (tc6) this mode is used to generate a pulse-width modulated (pwm) signals with up to 8 bits of resolution. the up-counter counts up using the internal clock. when a match between the up-counter and the pwregj value is detected, the logic level output from the timer f/fj is switched to the opposite state. the counter continues counting. the logic level output from the timer f/fj is switched to the opposite state again by the up-co unter overflow, and the counter is cleared. the inttcj interrupt request is generated at this time. since the initial value can be set to the timer f/fj by tcjcr, positive and negative pulses can be gen- erated. upon reset, the tim er f/fj is cleared to 0. (the logic level output from the pwmj pin is the opposite to the timer f/fj logic level.) since pwregj in the pwm mode is se rially connected to the shift regist er, the value set to pwregj can be changed while the timer is running. the value set to pwregj during a run of the timer is shifted by the inttcj interrupt request and loaded into pwregj. while the timer is stopped, the value is shifted immedi- ately after the programming of pwre gj. if executing the read instruction to pwregj during pwm output, the value in the shift register is read, but not the valu e set in pwregj. therefore, after writing to pwregj, the reading data of pwregj is previo us value until inttcj is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pw regj immediately after the inttcj interrupt request is generated (normally in the inttcj interrupt service r outine.) if the programming of pwregj and the inter- rupt request occur at the same time, an unstable value is shifted, that may result in generation of the pulse different from the programmed value until the next inttcj interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwmj pin holds the output status when the timer is stopped. to change the output status, program tcjcr after the timer is stopped. do not change the tcjcr upon stopping of the timer. example: fixing the pwmj pin to the high level when the timercounter is stopped clr (tcjcr).3: stops the timer. clr (tcjcr).7: sets the pwmj pin to the high level. note 3: to enter the stop mode during pwm output, stop the timer and then enter the stop mode. if the stop mode is entered without stopping the timer when fc, fc/2 or fs is selected as the source clock, a pulse is out- put from the pwmj pin during the warm-up period time after exiting the stop mode. note 4: j = 6 table 10-5 pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 [hz] fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 32.8 ms 62.5 ms fc/2 7 fc/2 7 ?8 s?2.05 ms? fc/2 5 fc/2 5 ?2 s ? 512 s? fc/2 3 fc/2 3 ? 500 ns ? 128 s? fs fs fs 30.5 s30.5 s 7.81 ms 7.81 ms fc/2 fc/2 ? 125 ns ? 32 s? fc fc ? 62.5 ns ? 16 s?
page 113 TMP86CS25ADFG figure 10-5 8-bit pwm mode timing chart (tc6) 1 0 n n+1 ff 0 n n+1 ff 0 1 m m+1 ff 0 1 1 p n ? internal source clock counter write to pwreg4 write to pwreg4 m p m p n ? shift registar shift shift shift shift match detect match detect one cycle period match detect match detect n m p n tc6cr tc6cr pwreg6 timer f/f6 pwm 6 pin inttc6 interrupt request
page 114 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.3.5 16-bit time r mode (tc5 and 6) in the timer mode, the up-counter counts up using the internal clock. the timercounter 5 and 6 are cascad- able to form a 16-bit timer. when a match between the up-counter and the timer regi ster (ttreg5, ttreg6) valu e is detected after the timer is started by setting tc6cr to 1, an inttc 6 interrupt is generated and the up-counter is cleared. after being cleared, the up-counter continues counting. pr ogram the upper byte and lower byte in this order in the timer register. (programming only the uppe r or lower byte should not be attempted.) note 1: in the timer mode, fix tcjcr to 0. if not fixed, the pdoj , pwmj , and ppgj pins may output a pulse. note 2: in the timer mode, do not change the ttregj setting while the timer is running. si nce ttregj is not in the shift register configuration in the timer mode, the new value programmed in ttregj is in effect immediately after programming of ttregj. therefore, if ttreg j is changed while the time r is running, an expected operation may not be obtained. note 3: j = 5, 6 figure 10-6 16-bit timer m ode timing chart (tc5 and tc6) table 10-6 source clock for 16-bit timer mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 fs/2 3 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500 ns ? 32.8 ms ? example :setting the timer mode with source clock fc/2 7 hz, and generating an interrupt 300 ms later (fc = 16.0 mhz) ldw (ttreg5), 927ch : sets the timer register (300 ms 2 7 /fc = 927ch). di set (eirh). 4 : enables inttc6 interrupt. ei ld (tc5cr), 13h :sets the operating cock to fc/2 7 , and 16-bit timer mode (lower byte). ld (tc6cr), 04h : sets the 16-bit timer mode (upper byte). ld (tc6cr), 0ch : starts the timer. 1 0 2 3 mn-1 mn 0 1 mn-1 mn 2 0 1 2 0 n ? m ? internal source clock counter match detect counter clear match detect counter clear tc6cr ttreg5 (lower byte) inttc6 interrupt request ttreg6 (upper byte)
page 115 TMP86CS25ADFG 10.3.6 16-bit pulse wi dth modulation (pwm) ou tput mode (tc5 and 6) this mode is used to generate a pulse-width modulated (pwm) signals with up to 16 bits of resolution. the timercounter 5 and 6 are cascadable to form the 16-bit pwm signal generator. the counter counts up using the internal clock. when a match between the up-counter and the timer register (pwreg5, pwreg6) value is detected, the logic level output from the timer f/f6 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f6 is switched to the opposite state again by the counter overflow, and the counter is cleared. the inttc6 interrupt is generated at this time. two machine cycles are required for the high- or low-level pulse input to the tc5 pin. therefore, a maxi- mum frequency to be supplied is fc/2 4 hz in the normal1 or idle1 mode, and fs/2 4 to in the slow1/2 or sleep1/2 mode. since the initial value can be set to the timer f/f6 by tc6cr, positive and negative pulses can be generated. upon reset, the timer f/f6 is cleared to 0. (the logic level output from the pwm 6 pin is the opposite to the timer f/f6 logic level.) since pwreg6 and 5 in the pwm mode are serially connected to the shift register, the values set to pwreg6 and 5 can be changed while the timer is runni ng. the values set to pwreg6 and 5 during a run of the timer are shifted by the inttcj interrupt request and loaded into pwreg6 and 5. while the timer is stopped, the values are shifted i mmediately after the programming of pwreg6 and 5. set the lower byte (pwreg5) and upper byte (pwreg5) in this order to program pwreg6 and 5. (programming only the lower or upper byte of the register should not be attempted.) if executing the read instruction to pwreg6 and 5 during pwm output, the values set in the shift register is read, but not the values set in pwreg6 and 5. therefore, after writing to the pwreg6 and 5, reading data of pwreg6 and 5 is previous value until inttc6 is generated. for the pin used for pwm output, the output latch of the i/o port must be set to 1. note 1: in the pwm mode, program the timer register pwreg6 and 5 immediately after the inttc6 interrupt request is generated (normally in the inttc6 interrupt service routine.) if the programming of pwregj and the interrupt request occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next inttc6 interrupt request is generated. note 2: when the timer is stopped during pwm output, the pwm 6 pin holds the output status when the timer is stopped. to change the output status, program tc6cr after the timer is stopped. do not program tc6cr upon stopping of the timer. example: fixing the pwm 6 pin to the high level when the timercounter is stopped clr (tc6cr).3: stops the timer. clr (tc6cr).7 : sets the pwm 6 pin to the high level. note 3: to enter the stop mode, stop the timer and then enter the stop mode. if the stop mode is entered with- out stopping of the timer when fc, fc/2 or fs is select ed as the source clock, a pulse is output from the pwm 6 pin during the warm-up period time after exiting the stop mode. table 10-7 16-bit pwm output mode source clock resolution repeated cycle normal1/2, idle1/2 mode slow1/2, sleep1/2 mode fc = 16 mhz fs = 32.768 khz fc = 16 mhz fs = 32.768 khz dv7ck = 0 dv7ck = 1 fc/2 11 fs/2 3 [hz] fs/2 3 [hz] 128 s244.14 s 8.39 s 16 s fc/2 7 fc/2 7 ?8 s ? 524.3 ms ? fc/2 5 fc/2 5 ?2 s ? 131.1 ms ? fc/2 3 fc/2 3 ? 500ns ? 32.8 ms ? fs fs fs 30.5 s30.5 s2 s 2 s fc/2 fc/2 ? 125 ns ? 8.2 ms ? fc fc ? 62.5 ns ? 4.1 ms ?
page 116 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG example :generating a pulse with 1-ms high-level width and a period of 32.768 ms (fc = 16.0 mhz) setting ports ldw (pwreg5), 07d0h : sets the pulse width. ld (tc5cr), 33h : sets the operating clock to fc/2 3 , and 16-bit pwm output mode (lower byte). ld (tc6cr), 056h : sets tff6 to the initial value 0, and 16-bit pwm signal generation mode (upper byte). ld (tc6cr), 05eh : starts the timer.
page 117 TMP86CS25ADFG figure 10-7 16-bit pwm mode timing chart (tc5 and tc6) 1 0 an an+1 ffff 0 an an+1 ffff 0 1 bm bm+1 ffff 0 bm cp b c 1 1 cp n a an ? ? ? internal source clock 16-bit shift register shift shift shift shift counter match detect match detect one cycle period match detect match detect an bm cp an m p tc6cr tc6cr pwreg5 (lower byte) timer f/f6 pwm 6 pin inttc6 interrupt request pwreg6 (upper byte) write to pwreg6 write to pwreg6 write to pwreg5 write to pwreg5
page 118 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.3.7 16-bit programmable pulse generate (ppg) ou tput mode (tc5 and 6) this mode is used to generate pulses with up to 16- bits of resolution. the timer counter 5 and 6 are cascad- able to enter the 16-bit ppg mode. the counter counts up using the internal clock. when a match between the up-counter and the timer register (pwreg5, pwreg6) value is detected, the logic level output from the timer f/f6 is switched to the opposite state. the counter continues counting. the logic level output from the timer f/f6 is switched to the opposite state again when a match between the up-counter and th e timer register (ttreg5, ttreg6) value is detected, and the counter is cleared. the inttc6 interrupt is generated at this time. since the initial value can be set to the timer f/f6 by tc6cr, positive and negative pulses can be generated. upon reset, the timer f/f6 is cleared to 0. (the logic level output from the ppg 6 pin is the opposite to the timer f/f6.) set the lower byte and upper byte in this order to program the timer register. (ttreg5 ttreg6, pwreg5 pwreg6) (programming only the upper or lower byte should not be attempted.) for ppg output, set the output latch of the i/o port to 1. note 1: in the ppg mode, do not change the pwregi and ttregi settings while the timer is running. since pwregi and ttregi are not in the shift register c onfiguration in the ppg mode, the new values pro- grammed in pwregi and ttregi are in effect immediately after progra mming pwregi and ttregi. therefore, if pwregi and ttregi are changed whil e the timer is running, an expected operation may not be obtained. note 2: when the timer is stopped during ppg output, the ppg 6 pin holds the output status when the timer is stopped. to change the output status, program tc6cr after the timer is stopped. do not change tc6cr upon stopping of the timer. example: fixing the ppg 6 pin to the high level when the timercounter is stopped clr (tc6cr).3: stops the timer clr (tc6cr).7: sets the ppg 6 pin to the high level note 3: i = 5, 6 example :generating a pulse with 1-ms high-level width and a period of 16.385 ms (fc = 16.0 mhz) setting ports ldw (pwreg5), 07d0h : sets the pulse width. ldw (ttreg5), 8002h : sets the cycle period. ld (tc5cr), 33h : sets the operating clock to fc/2 3 , and16-bit ppg mode (lower byte). ld (tc6cr), 057h : sets tff6 to the initial value 0, and 16-bit ppg mode (upper byte). ld (tc6cr), 05fh : starts the timer.
page 119 TMP86CS25ADFG figure 10-8 16-bit ppg mode timing chart (tc5 and tc60) 1 0 mn mn+1 qr-1 mn qr-1 1 mn mn+1 mn+1 0 qr 0 qr 1 0 internal source clock counter write of "0" match detect match detect match detect mn mn mn match detect match detect ? n m ? ? r q ? held at the level when the timer stops f/f clear tc6cr tc6cr pwreg5 (lower byte) timer f/f6 ppg 6 pin inttc6 interrupt request pwreg6 (upper byte) ttreg5 (lower byte) ttreg6 (upper byte)
page 120 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG 10.3.8 warm-up counter mode in this mode, the warm-up period time is obtained to assure oscillation stability when the system clocking is switched between the high-frequency and low-frequency. the timer counter 5 and 6 are cascadable to form a 16-bit timercouter. the warm-up counter mode has two types of mode; switching from the high-frequency to low-frequency, and vice-versa. note 1: in the warm-up counter mode, fi x tcicr to 0. if not fixed, the pdoi , pwmi and ppgi pins may output pulses. note 2: in the warm-up counter mode, only upper 8 bits of the timer register ttreg6 and 5 are used for match detection and lower 8 bits are not used. note 3: i = 5, 6 10.3.8.1 low-frequency warm-up counter mode (normal1 normal2 slow2 slow1) in this mode, the warm-up period time from a stop of the low-frequency clock fs to oscillation stability is obtained. before starting the timer, set syscr2 to 1 to oscillate the low-frequency clock. when a match between the up-counter and the timer regist er (ttreg6, 5) value is detected after the timer is started by setting tc6cr to 1, the counter is cleared by generating the inttc6 interrupt request. after stopping the timer in the inttc6 inte rrupt service routine, set syscr2 to 1 to switch the system clock fr om the high-frequency to low-frequenc y, and then clear of syscr2 to 0 to stop the high-frequency clock. table 10-8 setting time of low-frequency warm-up counter mode (fs = 32.768 khz) maximum time setting (ttreg6, 5 = 0100h) maximum time setting (ttreg6, 5 = ff00h) 7.81 ms 1.99 s example :after check ing low-frequency clock oscillation stability with tc6 and 5, switching to the slow1 mode set (syscr2).6 : syscr2 1 ld (tc5cr), 43h : sets tff5=0, source clock fs, and 16-bit mode. ld (tc6cr), 05h : sets tff6=0, and warm-up counter mode. ld (ttreg5), 8000h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 4 : enables the inttc6. ei : imf 1 set (tc6cr).3 : starts tc6 and 5. : : pinttc6: clr (tc6cr).3 : stops tc6 and 5. set (syscr2).5 : syscr2 1 (switches the system clock to the low-frequency clock.) clr (syscr2).7 : syscr2 0 (stops the high-frequency clock.) reti : : vinttc6: dw pinttc6 : inttc6 vector table
page 121 TMP86CS25ADFG 10.3.8.2 high-frequency warm-up counter mode (slow1 slow2 normal2 normal1) in this mode, the warm-up period time from a stop of the high-frequency clock fc to the oscillation sta- bility is obtained. before starting the timer, set sy scr2 to 1 to oscillat e the high-frequency clock. when a match between the up-counter and the timer regist er (ttreg6, 5) value is detected after the timer is started by setting tc6cr to 1, the counter is cleared by generating the inttc6 interrupt request. after stopping the timer in the inttc6 inte rrupt service routine, clear syscr2 to 0 to switch the system clock from the low-frequency to high-frequency, and then syscr2 to 0 to stop the low-frequency clock. table 10-9 setting time in high-frequency warm-up counter mode minimum time (ttreg6, 5 = 0100h) maximum time (ttreg6, 5 = ff00h) 16 s 4.08 ms example :after check ing high-frequency clock oscillation stability with tc6 and 5, switching to the normal1 mode set (syscr2).7 : syscr2 1 ld (tc5cr), 63h : sets tff5=0, source clock fs, and 16-bit mode. ld (tc6cr), 05h : sets tff6=0, and warm-up counter mode. ld (ttreg5), 0f800h : sets the warm-up time. (the warm-up time depends on the oscillator characteristic.) di : imf 0 set (eirh). 4 : enables the inttc6. ei : imf 1 set (tc6cr).3 : starts the tc6 and 5. : : pinttc6: clr (tc6cr).3 : stops the tc6 and 5. clr (syscr2).5 : syscr2 0 (switches the system clock to the high-frequency clock.) clr (syscr2).6 : syscr2 0 (stops the low-frequency clock.) reti : : vinttc6: dw pinttc6 : inttc6 vector table
page 122 10. 8-bit timercounter (tc5, tc6) 10.1 configuration TMP86CS25ADFG
page 123 TMP86CS25ADFG 11. asynchronous serial interface (uart ) 11.1 configuration figure 11-1 uart (asynch ronous serial interface) counter y a b c s s a b c d y e f g h uart status register uart control register 2 uart control register 1 transmit data buffer receive data buffer fc/13 fc/26 fc/52 fc/104 fc/208 fc/416 fc/96 stop bit parity bit fc/2 6 fc/2 7 fc/2 8 baud rate generator transmit/receive clock 2 4 3 2 2 2 noise rejection circuit m p x transmit control circuit shift register shift register receive control circuit mpx: multiplexer uartcr1 tdbuf rdbuf inttxd intrxd uartsr uartcr2 rxd txd inttc5
page 124 11. asynchronous serial interface (uart ) 11.2 control TMP86CS25ADFG 11.2 control uart is controlled by the uart control registers (uartcr1, uartcr2). the operating status can be moni- tored using the uart status register (uartsr). note 1: when operations are disabled by se tting txe and rxe bit to ?0?, the setting be comes valid when data transmit or receive complete. when the transmit data is stored in the transmit data buf fer, the data are not transmitted. even if data transmit is enabled, until new data are written to the transmit data buffer, the current data are not transmitted. note 2: the transmit clock and the parity are common to transmit and receive. note 3: uartcr1 and uartcr1 should be set to ?0? before uartcr1 is changed. note: when uartcr2 = ?01?, pulses longer than 96/fc [s] are always regarded as signals; when uartcr2 = ?10?, longer than 192/fc [s]; and when uart cr2 = ?11?, longer than 384/fc [s]. uart control register1 uartcr1 (0025h) 76543210 txe rxe stbt even pe brg (initial value: 0000 0000) txe transfer operation 0: 1: disable enable write only rxe receive operation 0: 1: disable enable stbt transmit stop bit length 0: 1: 1 bit 2 bits even even-numbered parity 0: 1: odd-numbered parity even-numbered parity pe parity addition 0: 1: no parity parity brg transmit clock select 000: 001: 010: 011: 100: 101: 110: 111: fc/13 [hz] fc/26 fc/52 fc/104 fc/208 fc/416 tc5 ( input inttc5) fc/96 uart control register2 uartcr2 (0026h) 7654321 0 rxdnc stopbr (initial value: **** *000) rxdnc selection of rxd input noise rejectio time 00: 01: 10: 11: no noise rejection (hysteresis input) rejects pulses shorter than 31/fc [s] as noise rejects pulses shorter than 63/fc [s] as noise rejects pulses shorter than 127/fc [s] as noise write only stopbr receive stop bit length 0: 1: 1 bit 2 bits
page 125 TMP86CS25ADFG note: when an inttxd is generated, tbep flag is set to "1" automatically. uart status register uartsr (0025h) 76543210 perr ferr oerr rbfl tend tbep (initial value: 0000 11**) perr parity error flag 0: 1: no parity error parity error read only ferr framing error flag 0: 1: no framing error framing error oerr overrun error flag 0: 1: no overrun error overrun error rbfl receive data buffer full flag 0: 1: receive data buffer empty receive data buffer full tend transmit end flag 0: 1: on transmitting transmit end tbep transmit data buffer empty flag 0: 1: transmit data buffer full (transmit data writing is finished) transmit data buffer empty uart receive data buffer rdbuf (0f9bh) 76543210read only (initial value: 0000 0000) uart transmit data buffer tdbuf (0f9bh) 76543210write only (initial value: 0000 0000)
page 126 11. asynchronous serial interface (uart ) 11.3 transfer data format TMP86CS25ADFG 11.3 transfer data format in uart, an one-bit start bit (low level), stop bit (bit length selectable at high level, by uartcr1), and parity (select parity in uartcr1

; even- or odd-number ed parity by uartcr1) are added to the transfer data. the transfer data formats are shown as follows. figure 11-2 transfer data format figure 11-3 caution on ch anging transfer data format note: in order to switch the transfer data format, perform transmit operations in the above figure 11-3 sequence except for the initial setting. start bit 0 bit 1 bit 6 bit 7 stop 1 start bit 0 bit 1 bit 6 bit 7 stop 1 stop 2 start bit 0 bit 1 bit 6 bit 7 parity stop 1 start bit 0 bit 1 bit 6 bit 7 parity stop 1 stop 2 pe 0 0 1 1 stbt frame length 0 1 123 89101112 0 1 without parity / 1 stop bit with parity / 1 stop bit without parity / 2 stop bit with parity / 2 stop bit
page 127 TMP86CS25ADFG 11.4 transfer rate the baud rate of uart is set of uartcr1. th e example of the baud rate are shown as follows. when tc5 is used as the uart transfer rate (when uartcr1 = ?110?), the tr ansfer clock and transfer rate are determined as follows: transfer clock [hz] = tc5 source clock [hz] / ttreg5 setting value transfer rate [baud] = transfer clock [hz] / 16 11.5 data sampling method the uart receiver keeps sampling input using the cloc k selected by uartcr1 until a start bit is detected in rxd pin input. rt clock star ts detecting ?l? level of the rxd pin. once a start bit is detected, the start bit, data bits, stop bi t(s), and parity bit are sampled at three times of rt7, rt8, and rt9 during one receiver clock interval (rt clock). (rt0 is the position where the bit supposedly starts.) bit is determined according to majority rule (the data are the same twice or more out of three samplings). figure 11-4 data sampling method table 11-1 transfer rate (example) brg source clock 16 mhz 8 mhz 4 mhz 000 76800 [baud] 38400 [baud] 19200 [baud] 001 38400 19200 9600 010 19200 9600 4800 011 9600 4800 2400 100 4800 2400 1200 101 2400 1200 600 rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit (a) without noise rejection circuit rt clock internal receive data rt0 1 2 3 4 5 6 7 8 9101112 1314 15  01234567891011 bit 0 start bit bit 0 start bit rt clock internal receive data (b) with noise rejection circuit rxd pin rxd pin
page 128 11. asynchronous serial interface (uart ) 11.6 stop bit length TMP86CS25ADFG 11.6 stop bit length select a transmit stop bit length (1 bit or 2 bits) by uartcr1. 11.7 parity set parity / no parity by uartcr1 and set parity type (odd- or even-numbered) by uartcr1. 11.8 transmit/receive operation 11.8.1 data transmit operation set uartcr1 to ?1?. read uartsr to check ua rtsr = ?1?, then write data in tdbuf (transmit data buffer). writing data in tdbuf zero-cl ears uartsr, transfers the data to the transmit shift register and the data are sequenti ally output from the txd pin. the data output include a one-bit start bit, stop bits whose number is specified in uartcr1 and a parity bit if parity addition is specified. select the data transfer baud rate using uartcr1. when data transmit st arts, transmit buffer empty flag uartsr is set to ?1? a nd an inttxd interrupt is generated. while uartcr1 = ?0? and from when ?1? is written to uartcr1 to when send data are written to tdbuf, the txd pin is fixed at high level. when transmitting data, first read uartsr, then write data in tdbuf. otherwise, uartsr is not zero-cleared and transm it does not start. 11.8.2 data receive operation set uartcr1 to ?1?. when data are received vi a the rxd pin, the receive data are transferred to rdbuf (receive data buffer). at this time, the data transmitted includes a start bit and stop bit(s) and a parity bit if parity addition is specified. when stop bit(s) are received, data only are extracted and transferred to rdbuf (receive data buffer). then the receive buffer full flag ua rtsr is set and an intrxd interrupt is generated. select the data transfer baud rate using uartcr1. if an overrun error (oerr) occurs when data are received, the da ta are not transferre d to rdbuf (receive data buffer) but discarded; data in the rdbuf are not affected. note:when a receive operation is disabled by setting ua rtcr1 bit to ?0?, the setting becomes valid when data receive is completed. however, if a framing error occurs in data receive, the receive-disabling setting may not become valid. if a framing error occurs , be sure to perform a re-receive operation.
page 129 TMP86CS25ADFG 11.9 status flag 11.9.1 parity error when parity determined using the receive data bits diff ers from the received parity bit, the parity error flag uartsr is set to ?1?. the uartsr is cl eared to ?0? when the rdbuf is read after read- ing the uartsr. figure 11-5 generation of parity error 11.9.2 framing error when ?0? is sampled as the stop bit in the receive data, framing error flag uartsr is set to ?1?. the uartsr is cleared to ?0? when the rdbuf is r ead after reading the uartsr. figure 11-6 generati on of framing error 11.9.3 overrun error when all bits in the next data are received while unread data are still in rdbuf, overrun error flag uartsr is set to ?1?. in this case, the receive data is discarded; data in rdbuf are not affected. the uartsr is cleared to ?0? when the rdbuf is read af ter reading the uartsr. parity stop shift register pxxxx0 * 1pxxxx0 xxxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears perr. final bit stop shift register xxxx0 * 0xxxx0 xxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears ferr.
page 130 11. asynchronous serial interface (uart ) 11.9 status flag TMP86CS25ADFG figure 11-7 generati on of overrun error note:receive operations are di sabled until the overrun error flag uartsr is cleared. 11.9.4 receive data buffer full loading the received data in rdbuf sets receive data buffer full flag uartsr to "1". the uartsr is cleared to ?0? when the rdbuf is read after reading the uartsr. figure 11-8 generation of receive data buffer full note:if the overrun error flag uartsr is set during the period between reading the uartsr and reading the rdbuf, it cannot be cleared by only reading the rdbuf. therefore, after reading the rdbuf, read the uartsr again to check whether or not the overrun er ror flag which should have been cleared still remains set. 11.9.5 transmit data buffer empty when no data is in the transmit buffer tdbuf, uartsr is set to ?1?, that is, when data in tdbuf are transferred to the transmit shif t register and data transmit star ts, transmit data buffer empty flag uartsr is set to ?1?. the uartsr is cleared to ?0? when the tdbuf is written after reading the uartsr. final bit stop shift register xxxx0 * 1xxxx0 yyyy xxx0 ** rxd pin uartsr intrxd interrupt after reading uartsr then rdbuf clears oerr. rdbuf uartsr final bit stop shift register xxxx0 * 1xxxx0 xxxx yyyy xxx0 ** rxd pin uartsr intrxd interrupt rdbuf after reading uartsr then rdbuf clears rbfl.
page 131 TMP86CS25ADFG figure 11-9 generation of transmit data buffer empty 11.9.6 transmit end flag when data are transmitted and no data is in tdbuf (uartsr = ?1?), transmit end flag uartsr is set to ?1?. the uartsr is cleared to ?0? when the data transmit is stated after writing the tdbuf. figure 11-10 generation of transmit end flag and transmit data buffer empty shift register data write data write zzzz xxxx yyyy start bit 0 final bit stop 1xxxx0 ***** 1 * 1xxxx **** 1x ***** 1 1yyyy0 tdbuf txd pin uartsr inttxd interrupt after reading uartsr writing tdbuf clears tbep. shift register * 1yyyy *** 1 xx **** 1 x ***** 1 stop start 1yyyy0 bit 0 txd pin uartsr uartsr inttxd interrupt data write for tdbuf
page 132 11. asynchronous serial interface (uart ) 11.9 status flag TMP86CS25ADFG
page 133 TMP86CS25ADFG 12. synchronous serial interface (sio0) the TMP86CS25ADFG has a clocked-sync hronous 8-bit serial in terface. serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transf er up to 64 bits of data. serial interface is connected to outside peri pherl devices via so0, si0, sck0 port. 12.1 configuration figure 12-1 serial interface sio control / status register serial clock shift clock shift register 3 2 1 0 7 6 5 4 transmit and receive data buffer (8 bytes in dbr) control circuit cpu serial data output serial data input 8-bit transfer 4-bit transfer serial clock i/o buffer control circuit so0 si0 sck 0 sio0cr2 sio0cr1 sio0sr intsio0 interrupt request
page 134 12. synchronous serial interface (sio0) 12.2 control TMP86CS25ADFG 12.2 control the serial interface is controlled by sio control registers (sio0cr1/sio0cr2 ). the serial interface status can be determined by reading sio status register (sio0sr). the transmit and receive data buffer is controlled by th e sio0cr2. the data buff er is assigned to address 0f90h to 0f97h for sio in the dbr area, and can continuously transfer up to 8 words (bytes or nibbles) at one time. when the specified number of words has b een transferred, a buffer empty (in th e transmit mode) or a buffer full (in the receive mode or tran smit/receive mode) interrupt (intsio0) is generated. when the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock fo r each word transferred. four different wait times can be selected with sio0cr2. note 1: fc; high-frequency clock [hz], fs; low-frequency clock [hz] note 2: set sios to "0" and sioinh to "1" when setting the transfer mode or serial clock. note 3: sio0cr1 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc. sio control register 1 sio0cr176543210 (0f98h) sios sioinh siom sck (initial value: 0000 0000) sios indicate transfer start / stop 0: stop write only 1: start sioinh continue / abort transfer 0: continuously transfer 1: abort transfer (automatically cleared after abort) siom transfer mode select 000: 8-bit transmit mode 010: 4-bit transmit mode 100: 8-bit transmit / receive mode 101: 8-bit receive mode 110: 4-bit receive mode except the above: reserved sck serial clock select normal1/2, idle1/2 mode slow1/2 sleep1/2 mode write only dv7ck = 0 dv7ck = 1 000 fc/2 13 fs/2 5 fs/2 5 001 fc/2 8 fc/2 8 - 010 fc/2 7 fc/2 7 - 011 fc/2 6 fc/2 6 - 100 fc/2 5 fc/2 5 - 101 fc/2 4 fc/2 4 - 110 reserved 111 external clock ( input from sck0 pin ) sio control register 2 sio0cr276543210 (0f99h) wait buf (initial value: ***0 0000)
page 135 TMP86CS25ADFG note 1: the lower 4 bits of each buffer are used during 4-bit tr ansfers. zeros (0) are stored to the upper 4bits when receiving. note 2: transmitting starts at the lowest address. received data are also stored starting from the lowest address to the highest address. ( the first buffer address transmitted is 0f90h ). note 3: the value to be loaded to buf is held after transfer is completed. note 4: sio0cr2 must be set when the serial interface is stopped (siof = 0). note 5: *: don't care note 6: sio0cr2 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc. note 1: t f ; frame time, t d ; data transfer time note 2: after sios is cleared to "0", siof is cleared to "0" at the termination of transfer or the setting of sioinh to "1". figure 12-2 fr ame time (t f ) and data transfer time (t d ) 12.3 serial clock 12.3.1 clock source internal clock or external clock for the source clock is selected by sio0cr1. wait wait control always sets "00" except 8-bit transmit / receive mode. write only 00: t f = t d (non wait) 01: t f = 2t d (wait) 10: t f = 4t d (wait) 11: t f = 8t d (wait) buf number of transfer words (buffer address in use) 000: 1 word transfer 0f90h 001: 2 words transfer 0f90h ~ 0f91h 010: 3 words transfer 0f90h ~ 0f92h 011: 4 words transfer 0f90h ~ 0f93h 100: 5 words transfer 0f90h ~ 0f94h 101: 6 words transfer 0f90h ~ 0f95h 110: 7 words transfer 0f90h ~ 0f96h 111: 8 words transfer 0f90h ~ 0f97h sio status register sio0sr76543210 (0f99h) siof sef siof serial transfer operating status moni- tor 0: 1: transfer terminated transfer in process read only sef shift operating status monitor 0: 1: shift operation terminated shift operation in process td tf (output) s ck0 output
page 136 12. synchronous serial interface (sio0) 12.3 serial clock TMP86CS25ADFG 12.3.1.1 internal clock any of six frequencies can be selected. the serial clock is output to the outside on the sck0 pin. the sck0 pin goes high when transfer starts. when data writing (in the transmit mo de) or reading (in the receive mode or the transmit/receive mode) cannot keep up with the serial clock rate, there is a wa it function that automatically stops the serial clock and holds the next shift operation until the read/write processing is completed. note: 1 kbit = 1024 bit (fc = 16 mhz, fs = 32.768 khz) figure 12-3 automatic wait fu nction (at 4-bit transmit mode) 12.3.1.2 external clock an external clock connected to the sck 0 pin is used as the serial clock. in this case, output latch of this port should be set to "1". to ensure shifting, a pulse width of at least 4 machine cycles is required. this pulse is needed for the shift operatio n to execute certainly. actually, there is necessary processing time for interrupting, writing, and reading. the minimum pulse is determined by setting the mode and the pro- gram. therfore, maximum transfer frequenc y will be 488.3k bit/sec (at fc=16mhz). figure 12-4 external clock pulse width table 12-1 serial clock rate normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 sck clock baud rate clock baud rate clock baud rate 000 fc/2 13 1.91 kbps fs/2 5 1024 bps fs/2 5 1024 bps 001 fc/2 8 61.04 kbps fc/2 8 61.04 kbps - - 010 fc/2 7 122.07 kbps fc/2 7 122.07 kbps - - 011 fc/2 6 244.14 kbps fc/2 6 244.14 kbps - - 100 fc/2 5 488.28 kbps fc/2 5 488.28 kbps - - 101 fc/2 4 976.56 kbps fc/2 4 976.56 kbps - - 110 - - - - - - 111 external external external external external external a 1 a 2 b 0 b 1 b 2 b 3 c 0 c 1 a 3 a c b a 0 pin (output) pin (output) written transmit data a utomat i ca ll y wait function sck0 so0 t sckl t sckh tcyc = 4/fc (in the normal1/2, idle1/2 modes) 4/fs (in the slow1/2, sleep1/2 modes) t sckl , t sckh > 4tcyc sck0 pin (output)
page 137 TMP86CS25ADFG 12.3.2 shift edge the leading edge is used to transmit, a nd the trailing edge is used to receive. 12.3.2.1 leading edge transmitted data are shifted on the leading edge of the serial clock (falling edge of the sck 0 pin input/ output). 12.3.2.2 trailing edge received data are shifted on th e trailing edge of the serial clock (rising edge of the sck 0 pin input/out- put). figure 12-5 shift edge 12.4 number of bits to transfer either 4-bit or 8-bit serial transfer can be selected. when 4-bit serial transfer is selected, only the lower 4 bits of the transmit/receive data buffer re gister are used. the upper 4 bits are cleared to ?0? when receiving. the data is transferred in sequence star ting at the least significant bit (lsb). 12.5 number of w ords to transfer up to 8 words consisting of 4 bits of data (4-bit serial tran sfer) or 8 bits (8-bit serial tr ansfer) of data can be trans- ferred continuously. the number of words to be transferred can be selected by sio0cr2. an intsio0 interrupt is generated when the specified number of words has been transferred. if the number of words is to be changed during transfer , the serial interface must be stopped before making the ch ange. the number of words can be changed during automatic-wa it operation of an internal clock. in this case, the serial interface is not required to be stopped. bit 1 bit 2 bit 3 * 321 3210 ** 32 *** 3 bit 0 shift register shift register bit 1 bit 0 bit 2 bit 3 0 *** **** 210 * 10 ** 3210 (a) leading edge (b) trailing edge * ; don?t care so0 pin si0 pin sck0 pin sck0 pin
page 138 12. synchronous serial interface (sio0) 12.6 transfer mode TMP86CS25ADFG figure 12-6 number of words to transfer (example: 1word = 4bit) 12.6 transfer mode sio0cr1 is used to select the tran smit, receive, or transmit/receive mode. 12.6.1 4-bit and 8-bit transfer modes in these modes, firstly set the sio control register to the transmit mode, and then write first transmit data (number of transfer words to be transfer red) to the data buffer registers (dbr). after the data are written, the transmission is star ted by setting sio0cr1 to ?1?. the data are then output sequentially to the so pin in synchronous with th e serial clock, starting with the least significant bit (lsb). as soon as the lsb has been output, the data are transferred from the data buffer register to the shift register. when the final data bit has b een transferred and the data buffer re gister is empty, an intsio0 (buffer empty) interrupt is generated to request the next transmitted data. when the internal clock is used, the serial clock will stop and an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer regist er by the time the number of data words specified with the sio0cr2 has been transmitted. writing even one word of data cancels the automatic-wait; there- fore, when transmitting two or more words, always wr ite the next word before transmission of the previous word is completed. note:automatic waits are also canceled by writing to a dbr not being used as a transmit data buffer register; there- fore, during sio do not use such dbr for other applicati ons. for example, when 3 words are transmitted, do not use the dbr of the remained 5 words. when an external clock is used, the data must be writte n to the data buffer register before shifting next data. thus, the transfer speed is determin ed by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. the transmission is ended by clear ing sio0cr1 to ?0? or se tting sio0cr1 to ?1? in buffer empty interrupt service program. a 1 a 2 a 3 a 0 a 1 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 a 0 a 1 a 0 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 (a) 1 word transmit (b) 3 words transmit (c) 3 words receive so0 pin intsio0 interrupt intsio0 interrupt intsio0 interrupt so0 pin si0 pin sck0 pin sck0 pin sck0 pin
page 139 TMP86CS25ADFG sio0cr1 is cleared, the operation will end after all bi ts of words are transmitted. that the transmission has ended can be determin ed from the status of sio0sr because sio0sr is cleared to ?0? when a transfer is completed. when sio0cr1 is set, the transmission is immediately ended and sio0sr is cleared to ?0?. when an external clock is used, it is also necessary to clear sio0cr1 to ?0? before shifting the next data; if sio0cr1 is not cleared before shift out, dummy data will be transmitted and the operation will end. if it is necessary to change th e number of words, si o0cr1 should be cleared to ?0?, then sio0cr2 must be rewritten after confirming that sio0sr has been cleared to ?0?. figure 12-7 transfer m ode (example: 8bit, 1word tr ansfer, internal clock) figure 12-8 transfer mode (example: 8b it, 1word transfer , external clock) a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck0 pin (output) so0 pin intsio0 interrupt sio0cr1 sio0sr sio0sr sio0sr a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck0 pin (input) so0 pin intsio0 interrupt sio0cr1 sio0sr sio0sr
page 140 12. synchronous serial interface (sio0) 12.6 transfer mode TMP86CS25ADFG figure 12-9 transmiiied data ho ld time at end of transfer 12.6.2 4-bit and 8- bit receive modes after setting the control registers to the receive mode, set sio0cr1 to ?1? to enab le receiving. the data are then transferred to the shift register via the si pin in synchronous with the serial clock. when one word of data has been received, it is tran sferred from the shift register to the data buffer register (dbr). when the number of words specified with the sio0cr2 has been received, an intsio0 (buffer full) interrupt is generated to request that these data be read out. the da ta are then read from the da ta buffer registers by the interrupt service program. when the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial cloc k will stop and an automatic-wait will be initiated until the data are read. a wait will not be initiated if even one data word has been read. note:waits are also canceled by readi ng a dbr not being used as a received data buffer register is read; therefore, during sio0 do not use such dbr for other applications. when an external clock is used, the shift operation is synchronized with the extern al clock; therefore, the previous data are read before the next data are transferred to the data buffer register. if the previous data have not been read, the next data will not be transferred to th e data buffer register and th e receiving of any more data will be canceled. when an external clock is used, th e maximum transfer speed is determined by the delay between the time when the interrupt request is gene rated and when the data received have been read. the receiving is ended by clearing sio0cr1 to ?0? or setting sio0cr1 to ?1? in buffer full interrupt service program. when sio0cr1 is cleared, th e current data are transferred to the buffer. after sio0cr1 cleared, the receiving is ended at the ti me that the final bit of the data has been received. that the receiving has ended can be determined from the status of sio0sr . sio0sr is cleared to ?0? when the receiving is ended. after confirmed the receiving te rmination, the final recei ving data is read. when sio0cr1 is set, the receivi ng is immediately ended and sio0sr is cleared to ?0?. (the received data is ignored, and it is not required to be read out.) if it is necessary to change the number of words in external clock operation, sio0cr1 should be cleared to ?0? then sio0cr2 mu st be rewritten after confirming that sio0sr has been cleared to ?0?. if it is necessary to chan ge the number of words in internal clock, during automatic-wait operation which occurs after completion of data receiving, sio0cr2 must be rewr itten before the received data is read out. note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by clearing sio0cr1 to ?0?, read the last data and then switch the trans- fer mode. msb of last word t sodh = min 3.5/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 3.5/fs [s] (in the slow1/2, sleep1/2 modes) sck0 pin so0 pin sio0sr
page 141 TMP86CS25ADFG figure 12-10 receive mode (example: 8b it, 1word transfer, internal clock) 12.6.3 8-bit trans fer / receive mode after setting the sio control register to the 8-bit transmit/recei ve mode, write the data to be transmitted first to the data buffer registers (dbr). af ter that, enable the transmit/receive by setting sio0cr1 to ?1?. when transmitting, the data are output from the so0 pin at leading edges of the serial clock. when receiving, the data are input to th e si0 pin at the trailing edges of the serial clock. when the all receive is enabled, 8-bit data are transferred from the shift re gister to the data buffer register. an intsio0 interrupt is generated when the number of data words specified with the sio0cr2 has been transferred. usually, read the receive data from the buffer register in the interrupt service. the data buffer register is used for both transmitting and receiving; therefore, always writ e the data to be transmitted af ter reading the all received data. when the internal clock is used, a wait is initiated until the received data are read and the next transfer data are written. a wait will not be initiated if ev en one transfer data word has been written. when an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift oper- ation. when an external clock is us ed, the transfer speed is determined by the maximum delay between genera- tion of an interrupt request and the received data are read and the data to be transmitted next are written. the transmit/receive operation is ended by clearing sio0cr1 to ?0? or setting sio0cr1 to ?1? in intsio0 interrupt service program. when sio0cr1 is cleared, the current data ar e transferred to the buff er. after sio0cr1 cleared, the transmitting/ receiving is ended at the time that the fi nal bit of the data has been transmitted. that the transmitting/receiving has ended can be determined fr om the status of sio0sr. sio0sr is cleared to ?0? when the transmitting/recei ving is ended. when sio0cr1 is set, th e transmit/receive operation is imm ediately ended and sio0sr is cleared to ?0?. if it is necessary to change the number of words in external clock operation, sio0cr1 should be cleared to ?0?, then sio0cr2 must be rewritten after confirming that sio0sr has been cleared to ?0?. if it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of transmit /receive operation, sio0 cr2 must be rewrit ten before reading and writing of the receive/transmit data. a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 dbr b a clear sios read out read out sck0 pin (output) si0 pin intsio0 interrupt sio0cr1 sio0sr sio0sr
page 142 12. synchronous serial interface (sio0) 12.6 transfer mode TMP86CS25ADFG note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by clearing sio0cr1 to ?0?, read the last data and then switch the trans- fer mode. figure 12-11 transfer / receive mode (examp le: 8bit, 1word transfe r, internal clock) figure 12-12 transmitted data hold ti me at end of tr ansfer / receive a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 c 1 c 0 c 2 c 3 c 4 c 5 c b c 6 c 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 clear sios dbr d a read out (c) write (a) read out (d) write (b) sck0 pin (output) so0 pin intsio0 interrupt sio0cr1 sio0sr sio0sr si0 pin bit 7 of last word bit 6 t sodh = min 4/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 4/fs [s] (in the slow1/2, sleep1/2 modes) sck0 pin so0 pin sio0sr
page 143 TMP86CS25ADFG 13. synchronous serial interface (sio1) the TMP86CS25ADFG has a clocked-sync hronous 8-bit serial in terface. serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transf er up to 64 bits of data. serial interface is connected to outside peri pherl devices via so1, si1, sck1 port. 13.1 configuration figure 13-1 serial interface sio control / status register serial clock shift clock shift register 3 2 1 0 7 6 5 4 transmit and receive data buffer (8 bytes in dbr) control circuit cpu serial data output serial data input 8-bit transfer 4-bit transfer serial clock i/o buffer control circuit so1 si1 sck 1 sio1cr2 sio1cr1 sio1sr intsio1 interrupt request
page 144 13. synchronous serial interface (sio1) 13.2 control TMP86CS25ADFG 13.2 control the serial interface is controlled by sio control registers (sio1cr1/sio1cr2 ). the serial interface status can be determined by reading sio status register (sio1sr). the transmit and receive data buffer is controlled by th e sio1cr2. the data buff er is assigned to address 0fa0h to 0fa7h for sio in the dbr area, and can continuously transfer up to 8 words (bytes or nibbles) at one time. when the specified number of words has been transferre d, a buffer empty (in the tran smit mode) or a buffer full (in the receive mode or tr ansmit/receive mode) interrup t (intsio1) is generated. when the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock fo r each word transferred. four different wait times can be selected with sio1cr2. note 1: fc; high-frequency clock [hz], fs; low-frequency clock [hz] note 2: set sios to "0" and sioinh to "1" when setting the transfer mode or serial clock. note 3: sio1cr1 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc. sio control register 1 sio1cr176543210 (0fa8h) sios sioinh siom sck (initial value: 0000 0000) sios indicate transfer start / stop 0: stop write only 1: start sioinh continue / abort transfer 0: continuously transfer 1: abort transfer (automatically cleared after abort) siom transfer mode select 000: 8-bit transmit mode 010: 4-bit transmit mode 100: 8-bit transmit / receive mode 101: 8-bit receive mode 110: 4-bit receive mode except the above: reserved sck serial clock select normal1/2, idle1/2 mode slow1/2 sleep1/2 mode write only dv7ck = 0 dv7ck = 1 000 fc/2 13 fs/2 5 fs/2 5 001 fc/2 8 fc/2 8 - 010 fc/2 7 fc/2 7 - 011 fc/2 6 fc/2 6 - 100 fc/2 5 fc/2 5 - 101 fc/2 4 fc/2 4 - 110 reserved 111 external clock ( input from sck1 pin ) sio control register 2 sio1cr276543210 (0fa9h) wait buf (initial value: ***0 0000)
page 145 TMP86CS25ADFG note 1: the lower 4 bits of each buffer are used during 4-bit tr ansfers. zeros (0) are stored to the upper 4bits when receiving. note 2: transmitting starts at the lowest address. received data are also stored starting from the lowest address to the highest address. ( the first buffer address transmitted is 0fa0h ). note 3: the value to be loaded to buf is held after transfer is completed. note 4: sio1cr2 must be set when the serial interface is stopped (siof = 0). note 5: *: don't care note 6: sio1cr2 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc. note 1: t f ; frame time, t d ; data transfer time note 2: after sios is cleared to "0", siof is cleared to "0" at the termination of transfer or the setting of sioinh to "1". figure 13-2 fr ame time (t f ) and data transfer time (t d ) 13.3 serial clock 13.3.1 clock source internal clock or external clock for the source clock is selected by sio1cr1. wait wait control always sets "00" except 8-bit transmit / receive mode. write only 00: t f = t d (non wait) 01: t f = 2t d (wait) 10: t f = 4t d (wait) 11: t f = 8t d (wait) buf number of transfer words (buffer address in use) 000: 1 word transfer 0fa0h 001: 2 words transfer 0fa0h ~ 0fa1h 010: 3 words transfer 0fa0h ~ 0fa2h 011: 4 words transfer 0fa0h ~ 0fa3h 100: 5 words transfer 0fa0h ~ 0fa4h 101: 6 words transfer 0fa0h ~ 0fa5h 110: 7 words transfer 0fa0h ~ 0fa6h 111: 8 words transfer 0fa0h ~ 0fa7h sio status register sio1sr76543210 (0fa9h) siof sef siof serial transfer operating status moni- tor 0: 1: transfer terminated transfer in process read only sef shift operating status monitor 0: 1: shift operation terminated shift operation in process td tf (output) s ck1 output
page 146 13. synchronous serial interface (sio1) 13.3 serial clock TMP86CS25ADFG 13.3.1.1 internal clock any of six frequencies can be selected. the serial clock is output to the outside on the sck1 pin. the sck1 pin goes high when transfer starts. when data writing (in the transmit mo de) or reading (in the receive mode or the transmit/receive mode) cannot keep up with the serial clock rate, there is a wa it function that automatically stops the serial clock and holds the next shift operation until the read/write processing is completed. note: 1 kbit = 1024 bit (fc = 16 mhz, fs = 32.768 khz) figure 13-3 automatic wait fu nction (at 4-bit transmit mode) 13.3.1.2 external clock an external clock connected to the sck 1 pin is used as the serial clock. in this case, output latch of this port should be set to "1". to ensure shifting, a pulse width of at least 4 machine cycles is required. this pulse is needed for the shift operatio n to execute certainly. actually, there is necessary processing time for interrupting, writing, and reading. the minimum pulse is determined by setting the mode and the pro- gram. therfore, maximum transfer frequenc y will be 488.3k bit/sec (at fc=16mhz). figure 13-4 external clock pulse width table 13-1 serial clock rate normal1/2, idle1/2 mode slow1/2, sleep1/2 mode dv7ck = 0 dv7ck = 1 sck clock baud rate clock baud rate clock baud rate 000 fc/2 13 1.91 kbps fs/2 5 1024 bps fs/2 5 1024 bps 001 fc/2 8 61.04 kbps fc/2 8 61.04 kbps - - 010 fc/2 7 122.07 kbps fc/2 7 122.07 kbps - - 011 fc/2 6 244.14 kbps fc/2 6 244.14 kbps - - 100 fc/2 5 488.28 kbps fc/2 5 488.28 kbps - - 101 fc/2 4 976.56 kbps fc/2 4 976.56 kbps - - 110 - - - - - - 111 external external external external external external a 1 a 2 b 0 b 1 b 2 b 3 c 0 c 1 a 3 a c b a 0 pin (output) pin (output) written transmit data a utomat i ca ll y wait function sck1 so1 t sckl t sckh tcyc = 4/fc (in the normal1/2, idle1/2 modes) 4/fs (in the slow1/2, sleep1/2 modes) t sckl , t sckh > 4tcyc sck1 pin (output)
page 147 TMP86CS25ADFG 13.3.2 shift edge the leading edge is used to transmit, a nd the trailing edge is used to receive. 13.3.2.1 leading edge transmitted data are shifted on the leading edge of the serial clock (falling edge of the sck 1 pin input/ output). 13.3.2.2 trailing edge received data are shifted on th e trailing edge of the serial clock (rising edge of the sck 1 pin input/out- put). figure 13-5 shift edge 13.4 number of bits to transfer either 4-bit or 8-bit serial transfer can be selected. when 4-bit serial transfer is selected, only the lower 4 bits of the transmit/receive data buffer re gister are used. the upper 4 bits are cleared to ?0? when receiving. the data is transferred in sequence star ting at the least significant bit (lsb). 13.5 number of w ords to transfer up to 8 words consisting of 4 bits of data (4-bit serial tran sfer) or 8 bits (8-bit serial tr ansfer) of data can be trans- ferred continuously. the number of words to be transferred can be selected by sio1cr2. an intsio1 interrupt is generated when the specified number of words has been transferred. if the number of words is to be changed during transfer , the serial interface must be stopped before making the ch ange. the number of words can be changed during automatic-wa it operation of an internal clock. in this case, the serial interface is not required to be stopped. bit 1 bit 2 bit 3 * 321 3210 ** 32 *** 3 bit 0 shift register shift register bit 1 bit 0 bit 2 bit 3 0 *** **** 210 * 10 ** 3210 (a) leading edge (b) trailing edge * ; don?t care so1 pin si1 pin sck1 pin sck1 pin
page 148 13. synchronous serial interface (sio1) 13.6 transfer mode TMP86CS25ADFG figure 13-6 number of words to transfer (example: 1word = 4bit) 13.6 transfer mode sio1cr1 is used to select the tran smit, receive, or transmit/receive mode. 13.6.1 4-bit and 8-bit transfer modes in these modes, firstly set the sio control register to the transmit mode, and then write first transmit data (number of transfer words to be transfer red) to the data buffer registers (dbr). after the data are written, the transmission is star ted by setting sio1cr1 to ?1?. the data are then output sequentially to the so pin in synchronous with th e serial clock, starting with the least significant bit (lsb). as soon as the lsb has been output, the data are transferred from the data buffer register to the shift register. when the final data bit has b een transferred and the data buffer re gister is empty, an intsio1 (buffer empty) interrupt is generated to request the next transmitted data. when the internal clock is used, the serial clock will stop and an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer regist er by the time the number of data words specified with the sio1cr2 has been transmitted. writing even one word of data cancels the automatic-wait; there- fore, when transmitting two or more words, always wr ite the next word before transmission of the previous word is completed. note:automatic waits are also canceled by writing to a dbr not being used as a transmit data buffer register; there- fore, during sio do not use such dbr for other applicati ons. for example, when 3 words are transmitted, do not use the dbr of the remained 5 words. when an external clock is used, the data must be writte n to the data buffer register before shifting next data. thus, the transfer speed is determin ed by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. the transmission is ended by clear ing sio1cr1 to ?0? or se tting sio1cr1 to ?1? in buffer empty interrupt service program. a 1 a 2 a 3 a 0 a 1 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 a 0 a 1 a 0 a 2 a 3 b 0 b 1 b 2 b 3 c 0 c 1 c 2 c 3 (a) 1 word transmit (b) 3 words transmit (c) 3 words receive so1 pin intsio1 interrupt intsio1 interrupt intsio1 interrupt so1 pin si1 pin sck1 pin sck1 pin sck1 pin
page 149 TMP86CS25ADFG sio1cr1 is cleared, the operation will end after all bi ts of words are transmitted. that the transmission has ended can be determin ed from the status of sio1sr because sio1sr is cleared to ?0? when a transfer is completed. when sio1cr1 is set, the transmission is immediately ended and sio1sr is cleared to ?0?. when an external clock is used, it is also necessary to clear sio1cr1 to ?0? before shifting the next data; if sio1cr1 is not cleared before shift out, dummy data will be transmitted and the operation will end. if it is necessary to change th e number of words, si o1cr1 should be cleared to ?0?, then sio1cr2 must be rewritten after confirming that sio1sr has been cleared to ?0?. figure 13-7 transfer m ode (example: 8bit, 1word tr ansfer, internal clock) figure 13-8 transfer mode (example: 8b it, 1word transfer , external clock) a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck1 pin (output) so1 pin intsio1 interrupt sio1cr1 sio1sr sio1sr sio1sr a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 a 0 dbr b a clear sios write (a) write (b) sck1 pin (input) so1 pin intsio1 interrupt sio1cr1 sio1sr sio1sr
page 150 13. synchronous serial interface (sio1) 13.6 transfer mode TMP86CS25ADFG figure 13-9 transmiiied data ho ld time at end of transfer 13.6.2 4-bit and 8- bit receive modes after setting the control registers to the receive mode, set sio1cr1 to ?1? to enab le receiving. the data are then transferred to the shift register via the si pin in synchronous with the serial clock. when one word of data has been received, it is tran sferred from the shift register to the data buffer register (dbr). when the number of words specified with the sio1cr2 has been received, an intsio1 (buffer full) interrupt is generated to request that these data be read out. the da ta are then read from the da ta buffer registers by the interrupt service program. when the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial cloc k will stop and an automatic-wait will be initiated until the data are read. a wait will not be initiated if even one data word has been read. note:waits are also canceled by readi ng a dbr not being used as a received data buffer register is read; therefore, during sio1 do not use such dbr for other applications. when an external clock is used, the shift operation is synchronized with the extern al clock; therefore, the previous data are read before the next data are transferred to the data buffer register. if the previous data have not been read, the next data will not be transferred to th e data buffer register and th e receiving of any more data will be canceled. when an external clock is used, th e maximum transfer speed is determined by the delay between the time when the interrupt request is gene rated and when the data received have been read. the receiving is ended by clearing sio1cr1 to ?0? or setting sio1cr1 to ?1? in buffer full interrupt service program. when sio1cr1 is cleared, th e current data are transferred to the buffer. after sio1cr1 cleared, the receiving is ended at the ti me that the final bit of the data has been received. that the receiving has ended can be determined from the status of sio1sr . sio1sr is cleared to ?0? when the receiving is ended. after confirmed the receiving te rmination, the final recei ving data is read. when sio1cr1 is set, the receivi ng is immediately ended and sio1sr is cleared to ?0?. (the received data is ignored, and it is not required to be read out.) if it is necessary to change the number of words in external clock operation, sio1cr1 should be cleared to ?0? then sio1cr2 mu st be rewritten after confirming that sio1sr has been cleared to ?0?. if it is necessary to chan ge the number of words in internal clock, during automatic-wait operation which occurs after completion of data receiving, sio1cr2 must be rewr itten before the received data is read out. note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by clearing sio1cr1 to ?0?, read the last data and then switch the trans- fer mode. msb of last word t sodh = min 3.5/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 3.5/fs [s] (in the slow1/2, sleep1/2 modes) sck1 pin so1 pin sio1sr
page 151 TMP86CS25ADFG figure 13-10 receive mode (example: 8b it, 1word transfer, internal clock) 13.6.3 8-bit trans fer / receive mode after setting the sio control register to the 8-bit transmit/recei ve mode, write the data to be transmitted first to the data buffer registers (dbr). af ter that, enable the transmit/receive by setting sio1cr1 to ?1?. when transmitting, the data are output from the so1 pin at leading edges of the serial clock. when receiving, the data are input to th e si1 pin at the trailing edges of the serial clock. when the all receive is enabled, 8-bit data are transferred from the shift re gister to the data buffer register. an intsio1 interrupt is generated when the number of data words specified with the sio1cr2 has been transferred. usually, read the receive data from the buffer register in the interrupt service. the data buffer register is used for both transmitting and receiving; therefore, always writ e the data to be transmitted af ter reading the all received data. when the internal clock is used, a wait is initiated until the received data are read and the next transfer data are written. a wait will not be initiated if ev en one transfer data word has been written. when an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift oper- ation. when an external clock is us ed, the transfer speed is determined by the maximum delay between genera- tion of an interrupt request and the received data are read and the data to be transmitted next are written. the transmit/receive operation is ended by clearing sio1cr1 to ?0? or setting sio1cr1 to ?1? in intsio1 interrupt service program. when sio1cr1 is cleared, the current data ar e transferred to the buff er. after sio1cr1 cleared, the transmitting/ receiving is ended at the time that the fi nal bit of the data has been transmitted. that the transmitting/receiving has ended can be determined fr om the status of sio1sr. sio1sr is cleared to ?0? when the transmitting/recei ving is ended. when sio1cr1 is set, th e transmit/receive operation is imm ediately ended and sio1sr is cleared to ?0?. if it is necessary to change the number of words in external clock operation, sio1cr1 should be cleared to ?0?, then sio1cr2 must be rewritten after confirming that sio1sr has been cleared to ?0?. if it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of transmit /receive operation, sio1 cr2 must be rewrit ten before reading and writing of the receive/transmit data. a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 dbr b a clear sios read out read out sck1 pin (output) si1 pin intsio1 interrupt sio1cr1 sio1sr sio1sr
page 152 13. synchronous serial interface (sio1) 13.6 transfer mode TMP86CS25ADFG note:the buffer contents are lost when the transfer mode is switched. if it should become necessary to switch the transfer mode, end receiving by clearing sio1cr1 to ?0?, read the last data and then switch the trans- fer mode. figure 13-11 transfer / receive mode (examp le: 8bit, 1word transfe r, internal clock) figure 13-12 transmitted data hold ti me at end of tr ansfer / receive a 1 a 0 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 c 1 c 0 c 2 c 3 c 4 c 5 c b c 6 c 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 clear sios dbr d a read out (c) write (a) read out (d) write (b) sck1 pin (output) so1 pin intsio1 interrupt sio1cr1 sio1sr sio1sr si1 pin bit 7 of last word bit 6 t sodh = min 4/fc [s] ( in the normal1/2, idle1/2 modes) t sodh = min 4/fs [s] (in the slow1/2, sleep1/2 modes) sck1 pin so1 pin sio1sr
page 153 TMP86CS25ADFG 14. 8-bit ad converter (adc) the TMP86CS25ADFG have a 8-bit successi ve approximation ty pe ad converter. 14.1 configuration the circuit configuration of the 8-bit ad converter is shown in figure 14-1. it consists of control registers adccr1 and adccr2, converted value registers adcdr1 and adcdr2, a da converter, a sample-and-hold circuit, a comp arator, and a successive comparison circuit. figure 14-1 8-bit ad converter (adc) 3 4 8 8 ainds analog input multiplexer adrs r/2 r/2 r ack irefon ad conversion result register1,2 ad converter control register 1,2 adbf eocf intadc interrupt sain successive approximate circuit adccr2 adcdr1 adcdr2 adccr1  sample hold circuit 0 y to n s en shift clock da converter reference voltage analog comparator control circuit varef ain0 ain7 vss vdd
page 154 14. 8-bit ad converter (adc) 14.1 configuration TMP86CS25ADFG 14.2 control the ad converter consists of the following four registers: 1. ad converter control register 1 (adccr1) this register selects the analog channels in which to perform ad conversion and controls the ad con- verter as it starts operating. 2. ad converter control register 2 (adccr2) this register selects the ad conver sion time and controls the connect ion of the da converter (ladder resistor network). 3. ad converted value register (adcdr1) this register is used to store the digital value after being converted by the ad converter. 4. ad converted value register (adcdr2) this register monitors the oper ating status of the ad converter. note 1: select analog input when ad converter stops (adcdr2 = ?0?). note 2: when the analog input is all use disabl ing, the adccr1 should be set to ?1?. note 3: during conversion, do not perform output instruction to ma intain a precision for all of the pins. and port near to analo g input, do not input intense signaling of change. note 4: the adrs is automatically cl eared to ?0? after starting conversion. note 5: do not set adccr1 newly again during ad conv ersion. before setting adccr1 newly again, check adcdr2 to see that the conversion is completed or wait until the interrupt signal (intadc) is generated (e.g., interrupt handling routine). note 6: after stop or slow/sleep mode are started, ad conver ter control register 1 (adccr1) is all initialized and no data can be written in this register. therefore, to use ad conv erter again, set the adccr1 newly after returning to normal1 or normal2 mode. note 7: always set bit 5 in adccr1 to ?1? and set bit 6 in adccr1 to ?0?. ad converter control register 1 adccr1 (000eh) 76543210 adrs "0" "1" ainds sain (initial value: 0001 0000) adrs ad conversion start 0: 1: ? start r/w ainds analog input control 0: 1: analog input enable analog input disable sain analog input channel select 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: ain0 ain1 ain2 ain3 ain4 ain5 ain6 ain7 reserved reserved reserved reserved reserved reserved reserved reserved
page 155 TMP86CS25ADFG note 1: always set bit 0 in adccr2 to ?0? and set bit 4 in adccr2 to ?1?. note 2: when a read instruction for adccr2, bit 6 to 7 in adccr2 read in as undefined data. note 3: after stop or slow/sleep mode are started, ad conver ter control register 2 (adccr2) is all initialized and no data can be written in this register. therefore, to use ad conv erter again, set the adccr2 newly after returning to normal1 or normal2 mode. note 1: settings for ? ? ? in the above table are inhibited. note 2: set conversion time by analog reference voltage (v aref ) as follows. note 1: the adcdr2 is cleared to ?0? when reading the adcdr1. therefore, the ad conversion result should be read to adcdr2 more first than adcdr1. note 2: adcdr2 is set to ?1? when ad conversion starts and cleared to ?0? when the ad conversion is finished. it also is cleared upon entering stop or slow mode. note 3: if a read instruction is executed for adcdr2, read data of bits 7, 6 and 3 to 0 are unstable. ad converter control register 2 adccr2 (000fh) 76543210 irefon ?1? ack ?0? (initial value: **0* 000*) irefon da converter (ladder resistor) connection control 0: 1: connected only during ad conversion always connected r/w ack ad conversion time select 000: 001: 010: 011: 100: 101: 110: 111: 39/fc reserved 78/fc 156/fc 312/fc 624/fc 1248/fc reserved r/w table 14-1 conversion time according to ack setting and frequency condition conbersion time? 16mhz 8mhz 4 mhz 2 mhz 10mhz 5 mhz 2.5 mhz ack 000 39/fc - - - 19.5 s - - 15.6 s 001 reserved 010 78/fc - - 19.5 s39.0 s-15.6 s 31.2 s 011 156/fc - 19.5 s 39.0 s78.0 s 15.6 s 31.2 s 62.4 s 100 312/fc 19.5 s39.0 s 78.0 s 156.0 s 31.2 s 62.4 s 124.8 s 101 624/fc 39.0 s78.0 s156.0 s - 62.4 s 124.8 s- 110 1248/fc 78.0 s 156.0 s- -124.8 s- - 111 reserved - v aref = 4.5 to 5.5 v (15.6 s or more) - v aref = 2.7 to 5.5 v (31.2 s or more) - v aref = 1.8 to 5.5 v (124.8 s or more) ad conversion result register adcdr1 (0020h) 76543210 ad07 ad06 ad05 ad04 ad03 ad02 ad01 ad00 (initial value: 0000 0000) ad conversion result register adcdr2 (0021h) 76543210 eocf adbf (initial value: **00 ****) eocf ad conversion end flag 0: before or during conversion 1: conversion completed read only adbf ad conversion busy flag 0: during stop of ad conversion 1: during ad conversion
page 156 14. 8-bit ad converter (adc) 14.3 function TMP86CS25ADFG 14.3 function 14.3.1 ad conveter operation when adccr1 is set to "1", ad conversion of the voltage at the analog input pin specified by adccr1 is thereby started. after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdr1) and at the same time adcdr2 is set to ?1?, the ad conversion finished interrupt (intadc) is generated. adccr1 is automatically cleared after ad conversion has started. do not set adccr1 newly again (restart) during ad conversion. before setting adrs newly again, check adcdr to see that the conversion is completed or wait until the inte rrupt signal (intadc) is generated (e.g., interrupt han- dling routine). figure 14-2 ad c onverter operation 14.3.2 ad converter operation 1. set up the ad converter control register 1 (adccr1) as follows: ? choose the channel to ad convert using ad input channel select (sain). ? specify analog input enable fo r analog input control (ainds). 2. set up the ad converter control register 2 (adccr2) as follows: ? set the ad conversion time using ad conversion time (ack). for details on how to set the con- version time, refer to table 14-1. ? choose irefon for da converter control. 3. after setting up 1. and 2. above, set ad conversion start (adrs) of ad converter control register 1 (adccr1) to ?1?. 4. after an elapse of the specified ad conversion time, the ad converted value is stored in ad con- verted value register 1 (adcdr1) and the ad conv ersion finished flag (e ocf) of ad converted value register 2 (adcdr2) is set to ?1?, upon wh ich time ad conversion interrupt intadc is gener- ated. 5. eocf is cleared to ?0? by a read of the conversion result. however, if reconverted before a register read, although eocf is cl eared the previous conversi on result is retained until the next conversion is completed. adcdr1 status eocf cleared by reading conversion result conversion result read conversion result read adcdr2 intadc interrupt reading adcdr1 reading adcdr2 adcdr2 adccr1 first conversion result second conversion result indeterminate ad conversion start ad conversion start
page 157 TMP86CS25ADFG 14.3.3 stop and slow m ode during ad conversion when the stop or slow mode is entered forcibly du ring ad conversion, the ad convert operation is sus- pended and the ad converter is initialized (adccr1 and adccr2 are initialized to initial value.). also, the conversion result is indeterminate. (c onversion results up to the previous operation are cleared, so be sure to read the conversion results before entering stop or slow mode.) when restored from stop or slow mode, ad conversion is not automatically restarted, so it is necessary to restart ad conversion. note that since the analog reference voltage is automa tically disconnected, there is no possibility of current flowing into the analog reference voltage. example :after selecting the conversion time of 19.5 s at 16 mhz and the analog input channel ain3 pin, perform ad conversion once. after checking eocf, read the converted value and store the 8-bit data in address 009fh on ram. ; ain select : : : : ; before setting the ad converter register, set each port reg- ister suitably (for detail, see chapter of i/o port.) ld (adccr1), 00100011b ; select ain3 ld (adccr2), 11011000b ; select conversion time (312/fc) and operation mode ; ad convert start set (adccr1). 7 ; adrs = 1 sloop: test (adcdr2). 5 ; eocf = 1 ? jrs t, sloop ; result data read ld a, (adcdr1) ld (9fh), a
page 158 14. 8-bit ad converter (adc) 14.3 function TMP86CS25ADFG 14.3.4 analog input volt age and ad conversion result the analog input voltage is corresponded to the 8-bit digital value converted by the ad as shown in figure 14-3. figure 14-3 analog i nput voltage and ad conv ersion result (typ.) 1 0 01h 02h 03h fdh feh ffh 2 3 253 254 255 256 analog input voltage ad conversion result 256 varef vss
page 159 TMP86CS25ADFG 14.4 precautions about ad converter 14.4.1 analog input pin voltage range make sure the analog input pins (ain 0 to ain7) are used at voltages w ithin vss below varef. if any volt- age outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncer- tain. the other analog input pi ns also are affected by that. 14.4.2 analog input shared pins the analog input pins (ain0 to ain7) are shared wi th input/output ports. when using any of the analog inputs to execute ad convers ion, do not execute in put/output instructions for all other ports. this is necessary to prevent the accuracy of ad conversi on from degrading. not only these analog input shared pins, some other pins may also be affected by noise arising from input/o utput to and from adjacent pins. 14.4.3 noise countermeasure the internal equivalent circuit of the analog input pins is shown in figure 14-4. the higher the output imped- ance of the analog input source, more easily they are su sceptible to noise. therefor e, make sure the output impedance of the signal source in your design is 5 k ? or less. toshiba also reco mmends attaching a capacitor external to the chip. figure 14-4 analog input equivalent ci rcuit and example of input pin processing da converter ainx analog comparator internal resistance allowable signal source impedance internal capacitance 5 k ? (typ) c = 22 pf (typ.) 5 k ? (max) note) i = 7~0
page 160 14. 8-bit ad converter (adc) 14.4 precautions about ad converter TMP86CS25ADFG
page 161 TMP86CS25ADFG 15. key-on wakeup (kwu) in the TMP86CS25ADFG, the stop mode is released by not only p20( int5 / stop ) pin but also four (stop2 to stop5) pins. when the stop mode is released by stop2 to stop5 pins, the stop pin needs to be used. in details, refer to the following section " 15.2 control ". 15.1 configuration figure 15-1 key-on wakeup circuit 15.2 control stop2 to stop5 pins can controlled by key-on wakeup c ontrol register (stopcr). it can be configured as enable/disable in 1-bit unit. when thos e pins are used for stop mode releas e, configure corresponding i/o pins to input mode by i/o port register beforehand. 15.3 function stop mode can be entered by setting up the system control register (syscr1), and can be exited by detecting the "l" level on stop2 to stop5 pins, which are enabled by stopcr, for releasing stop mode (note1). key-on wakeup control register stopcr76543210 (0f9ah) stop5 stop4 stop3 stop2 (initial value: 0000 ****) stop5 stop mode released by stop5 0:disable 1:enable write only stop4 stop mode released by stop4 0:disable 1:enable write only stop3 stop mode released by stop3 0:disable 1:enable write only stop2 stop mode released by stop2 0:disable 1:enable write only stopcr int5 stop stop mode release signal (1: release) (0f9ah) stop2 stop3 stop4 stop5 stop2 stop3 stop4 stop5
page 162 15. key-on wakeup (kwu) 15.3 function TMP86CS25ADFG also, each level of the stop2 to stop5 pins can be co nfirmed by reading correspondi ng i/o port data register, check all stop2 to stop5 pins "h" that is enabled by stopcr before the stop mode is startd (note2). note 1: when the stop mode released by the edge release mo de (syscr1 = ?0?), inhibit input from stop2 to stop5 pins by key-on wakeup control register (stopcr) or must be set "h" level into stop2 to stop5 pins that are available input during stop mode. note 2: when the stop pin input is high or stop2 to stop5 pins input which is enabled by stopcr is low, executing an instruction which starts stop mode wi ll not place in stop mode but instead will immediately start the release sequence (warm up). note 3: stop pin doesn?t have the control register such as stop cr, so when stop mode is released by stop2 to stop5 pins, stop pin also should be used as stop mode release function. note 4: in stop mode, key-on wakeup pin which is enabled as input mode (for releasing stop mode) by key-on wakeup control register (stopcr) may genarate the penet ration current, so the said pin must be disabled ad conversion input (analog voltage input). note 5: when the stop mode is released by stop2 to stop5 pins, the level of stop pin should hold "l" level (figure 15-2). figure 15-2 priority of stop pin and stop2 to stop5 pins table 15-1 release level (edge) of stop mode pin name release level (edge) syscr1="1" (note2) syscr1="0" stop "h" level rising edge stop2 "l" level don?t use (note1) stop3 "l" level don?t use (note1) stop4 "l" level don?t use (note1) stop5 "l" level don?t use (note1) stop pin a) stop release stop mode stop mode stop pin "l" b) release stop mode stop mode in case of stop2 to stop5 stop2 pin
page 163 TMP86CS25ADFG 16. lcd driver the TMP86CS25ADFG incorporates a driv er to directly drive th e liquid crystal display (lcd) and its control cir- cuit. the connecting pi ns with the lcd are as shown below: 1. segment output pin: 40 pins (seg39 to seg0) 2. segment output/ i/o port pin (shared): 20 pins (seg59 to seg40) 3. common output pin: 5 pins (com4 to com0) 4. common output i/o port pin (shared): 11 pins (com15 to com5) in addition, c0, c1, v1, v2, v3 and v4 are provided as the lcd drive booster circuit pins. the following three types of lcd can be driven directly: 1. 1/4 duty lcd: maximum 240 pixels (60 segments 4 digits) 2. 1/8 duty lcd: maximum 480 pixels (60 segments 8 digits) 3. 1/16 duty lcd: maximum 960 pixels (60 segments 16 digits) 16.1 configuration of lcd driver figure 16-1 lcd dr iver block diagram note: the lcd driver circuit has a built-in dedicated divider circuit. thus, during us e of the tool, lcd outputting is not stopped by debugger break processing. branking control dedicated divider low voltage booster circuit common driver disst bres duty3 duty4 duty5 refv duty c0 c1 v1 v2 v3 v4 com0 lcdctl1 lcd driver control register 1 lcdctl2 lcd driver control register 2 com15 segment driver display data buffer register display data select circuit timing gen. circuit duty control dbr data area seg0 fs fc seg39 seg40 seg59 vfsel0 vfsel1 vfsel2
page 164 16. lcd driver 16.1 configuration of lcd driver TMP86CS25ADFG 16.2 controlling lcd driver the lcd driver is controlled by the lcd control register 1 (lcdctl1 ) and the lcd control register 2 (lcdctl2). the display of the lcd driver is enabled by disst. note 1: after reset, lcdctl1 are set to ?0000? (initial value: reserved). set the duty as appropriate for lcd panel. note 2: switch lcdctl1 according to vdd. if it is not se t appropriately, an overcurrent may flow causing damage to the device. caution is especially r equired when vdd is battery-driven. note 3: if lcdctl1 is set to ?0? (lcd displa y blanking), all seg/com pins become vss level. note 4: when lcdctl1 for the lcd reference voltage is se t to ?0?, always make sure the reference power supply is entered from the v4 pin. in this case, input voltage from v4 pin should be kept within 2.7 v v4 vdd. note 5: when lcd is used, always set lcdctl1 to "1". note 6: reserved: not to be set. note: set the lcd control register 2 according to operating frequenc y. for details of the actual frame frequency, see table 16-1 lcd control register 1 lcdctl1 (0027h) 76543210 duty7 refv duty5 duty4 duty3 bres disst (initial value: 0000 00*0) duty7 duyu5 duty4 duty3 select duty. 0***: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111: reserved 1/4 duty reserved 1/8 duty reserved reserved reserved 1/16 duty reserved r/w refv sets lcd reference voltage. 0: 1: v4 vdd (note 4) vdd < v4 5.5 v bres sets booster circuit. 0: 1: booster circuit disable booster circuit enable (note 5) disst controls lcd display. 0: 1: lcd display blanking lcd display enable lcd control register 2 lcdctl2 (0028h) 76543210 vfsel2 vfsel1 vfsel0 (initial value: **** *011) vfsel selects base frequency for frame frequency. 000: fc/2 9 (at 16 mhz) r/w 001: fc/2 8 (at 8 mhz) 010: fc/2 7 (at 6 mhz) 011: fc/2 6 (at 2 mhz) 1**: fs (at 32.768 khz)
page 165 TMP86CS25ADFG 16.2.1 frame frequency the frame frequency is set depending on the driving meth od and the base frequency as shown in table 16-1. the base frequency is selected with lcdctl2 depending on the basic clock frequencies fc and fs to be used. note 1: fc ; high-frequency clock frequency [h z], fs ; low-frequency clock frequency [hz] note 2: although this product is guaranteed to operate at fc = 1.32 [mhz] or less is not recommended for lcd dis- play as the frame frequency becomes 61 [hz] or less. 16.3 lcd booster circuit the TMP86CS25ADFG can boost (divide) the externally-su pplied reference voltage using the built-in booster cir- cuit as a power supply for driving the lcd. when v1 pin is the reference voltage, the inputted reference voltage is boosted by two times (v2), 3 times (v3) and 4 times (v4) to generate a voltage for a segment/common signal. when v2 pin is the reference voltage, the inputted reference volta ge is divided/boosted by 1/2 time (v1), 3/2 times (v3) and two times (v4). likewise, when v3 pin or v4 pin is the reference, the inputted reference voltage is boosted/ divided and the voltage ratio is v1 4 = v2 2 = v3 (4/3) = v4. as this circuit uses a 4-times boosting method, the bias ratio is 1/4 only. note 1: when the reference pin is other than v1 pi n, a condenser is required between v1 pin and gnd. note 2: when lcdctl1 is set to ?0?, input voltage from v4 pin should be kept within 2.7 v v4 vdd. table 16-1 frame frequency settings vfsel base frequency [hz] frame frequency [hz] 1/4 duty 1/8 duty 1/16 duty 000 (fc = 16 mhz) 93 93 93 001 (fc = 8 mhz) 93 93 93 010 (fc = 4 mhz) 93 93 93 011 (fc = 2 mhz) 93 93 93 1** fs (fs = 32.768 khz) 97.5 97.5 97.5 fc 2 9 ----- - fc 2 9 84 4 ?? ------------------------ - fc 2 9 42 8 ?? ------------------------ - fc 2 9 21 16 ?? --------------------------- - fc 2 8 ----- - fc 2 8 84 4 ?? ------------------------ - fc 2 8 42 8 ?? ------------------------ - fc 2 8 21 16 ?? --------------------------- - fc 2 7 ----- - fc 2 7 84 4 ?? ------------------------ - fc 2 7 42 8 ?? ------------------------ - fc 2 7 21 16 ?? --------------------------- - fc 2 6 ----- - fc 2 6 84 4 ?? ------------------------ - fc 2 6 42 8 ?? ------------------------ - fc 2 6 21 16 ?? --------------------------- - fs 84 4 ? -------------- fs 42 8 ? -------------- fs 21 16 ? -----------------
page 166 16. lcd driver 16.3 lcd booster circuit TMP86CS25ADFG 16.4 methods of connec ting lcd booster circuit 16.4.1 method of connecting booste r circuit by using a regulator if vdd is not stable because it is battery-driven, etc., we recommend a connection method using a regulator as shown below in order to preserve the quality of display. note: for use with vdd v4 (lcdctl1 = 0), always make sure the reference power supply is entered from v4. figure 16-2 method of c onnecting booster circui t by using a regulator 16.4.2 method of connecting booster circuit without using a regulator if stable vdd supply is achieved (vdd v4), the booster circuit can be connected without using a regulator as shown below. in this case, set lcdctl1 to ?0? and make sure the reference power supply is entered from the v4 pin. note:when lcdctl1 is set to ?0?, input vo ltage from v4 pin should be kept within 2.7 v v4 vdd. figure 16-3 method of connecting booste r circuit without using a regulator vdd c1 c0 seg v4 com v3 v2 v1 vss c c c c regulator regulator vdd c1 c0 seg v4 com v3 v2 v1 vss c c c c c (a) example of voltage step-up operation by a regulator (relative v1 pin) (b) example of voltage step-up operation by a regulator (relative v2 pin) note: c = 0.1 to 0.47 f vdd c1 c0 seg v4 com v3 v2 v1 vss c c c c c vdd c1 c0 seg v4 com v3 v2 v1 vss c r1 (adjustment of contrast) r2 c c c c (c) example of voltage division from vdd (relative to v4 pin) (d) example of voltage division from vdd (relative to v4 pin) note: c = 0.1 to 0.47 f
page 167 TMP86CS25ADFG 16.5 lcd display operation 16.5.1setting display data display data is stored in display data area (128 by tes in addresses 0f00h to 0f7fh) provided in dbr. display data stored in the display data area is automa tically read by hardware and sent to the lcd driver. the lcd driver generates segment and common signals according to display data and the driving method. thus, display patterns can be changed simply by rewriting the contents of display data area in the program. table 16-2 shows the correspondence between display data areas and seg/com pins. the light comes on when display data is ?1? and it goes ou t when ?0?. because the number of pi xels that can be driven varies with the method of driving the lcd, the number of bytes in th e display data area used to store display data also var- ies. thus, bytes not used to store display data and da ta memory corresponding to ddresses not connected to the lcd can be used for storing generally processed data. (see table 16-3) note:because the contents of display data area become unstabl e at powering on, execute the initialize routine for the initial setting. table 16-2 lcd display data area (dbr) 0f00h 0f10h 0f20h 0f30h 0f40h 0f50h 0f60h 0f70h com0 0f01h 0f11h 0f21h 0f31h 0f41h 0f51h 0f61h 0f71h com1 0f02h 0f12h 0f22h 0f32h 0f42h 0f52h 0f62h 0f72h com2 0f03h 0f13h 0f23h 0f33h 0f43h 0f53h 0f63h 0f73h com3 0f04h 0f14h 0f24h 0f34h 0f44h 0f54h 0f64h 0f74h com4 0f05h 0f15h 0f25h 0f35h 0f45h 0f55h 0f65h 0f75h com5 0f06h 0f16h 0f26h 0f36h 0f46h 0f56h 0f66h 0f76h com6 0f07h 0f17h 0f27h 0f37h 0f47h 0f57h 0f67h 0f77h com7 0f08h 0f18h 0f28h 0f38h 0f48h 0f58h 0f68h 0f78h com8 0f09h 0f19h 0f29h 0f39h 0f49h 0f59h 0f69h 0f79h com9 0f0ah 0f1ah 0f2ah 0f3ah 0f4ah 0f5ah 0f6ah 0f7ah com10 0f0bh 0f1bh 0f2bh 0f3bh 0f4bh 0f5bh 0f6bh 0f7bh com11 0f0ch 0f1ch 0f2ch 0f3ch 0f4ch 0f5ch 0f6ch 0f7ch com12 0f0dh 0f1dh 0f2dh 0f3dh 0f4dh 0f5dh 0f6dh 0f7dh com13 0f0eh 0f1eh 0f2eh 0f3eh 0f4eh 0f5eh 0f6eh 0f7eh com14 0f0fh 0f1fh 0f2fh 0f3fh 0f4fh 0f5fh 0f6fh 0f7fh com15 seg7 to seg0 seg15 to seg8 seg23 to seg16 seg31 to seg24 seg39 to seg32 seg47 to seg40 seg55 to seg48 seg59 to seg56 table 16-3 areas used to store display data driving method com number to be used 1/16 duty com15 to com0 1/8 duty com7 to com0 1/4 duty com3 to com0
page 168 16. lcd driver 16.6 method of controlling lcd driver TMP86CS25ADFG 16.5.2blanking the lcd display can be blanked by clearing disst to ?0?. blanking extinguishes the lcd by outputting gnd level to com/seg pins. if the stop mode is entered while the lcd display is on, disst is cleared to ?0? and blanking is performed automatically. if the stop mode is then reverted, disst is set to ?1? and display is resumed automatically. note:at reset, the segment dedicated pins (seg39 to seg0) and common output becomes gnd level, whereas the i/o port/segment shared pins (p1,p3,p5 ports) outpu t, the i/o port/common shared pins (p3,p7 ports) out- put become the high-impedance state. thus, if an external reset input lasts for a significant length of time, it may affect the lcd display such as blurring. 16.6 method of co ntrolling lcd driver 16.6.1 initial setting the procedure of initial setting is shown below. 16.6.2 storing display data display data is normally prepared as fixed data in the program memory (rom) and stored in the display data area by a load instruction. example 1: corresponding to the connection and display using a 1/8 duty lcd shown in figure 16-4, the table 16-4 shows display data and figure 16-5 shows displyay timing. figure 16-4 example of display data (1/8 duty) example :when 60 seg 8 com, 1/8 duty , 5 v-system lcd operates with fc = 8 mhz (at vdd = 5 v) ld (lcdctl1), 10010100b ; 1/8 duty, lcd reference voltage (vdd = v4), booster circuit enable set port setting ; set port condition for lcd related pins ld (lcdctl1), 10010101b ; lcd display enable set        
 
page 169 TMP86CS25ADFG figure 16-5 example of di splay timing (1/8 duty) table 16-4 example of display data (1/8 duty) dbr se g 0 se g 1 se g 2 se g 3 se g 4 se g 5 se g 6 se g 7 hex dbr se g 8 se g 9 se g 10 se g 11 se g 12 se g 13 se g 14 se g 15 hex bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 com0 0f00h 1 1 1 1 10 1 1 df 0f10h 100 1 1 10 1b9??? com1 0f01h 0 0 100 100240f11h0 1 1000 1 1c6??? com2 0f02h 0 0 100 1 0 0 24 0f12h 0 1 10000 186??? com3 0f03h 0 0 100 1 0 0 24 0f13h 0 10 1 1 10 1ba??? com4 0f04h 0 0 100 1 0 0 24 0f14h 0 10000 1 1c2??? com5 0f05h 0 0 100 1 0 0 24 0f15h 0 1 1000 1 1c6??? com6 0f06h 0 0 1000 1 1 c4 0f16h 100 1 1 10 1b9??? com70f07h00000000000f17h0000000000??? com0 com1 com2 com7 seg0 seg0-com0 seg0-com1 v4 v4 vss v2 v1 v3 v4 vss tfame off (extinguish) off (extinguish) on (light)
page 170 16. lcd driver 16.6 method of controlling lcd driver TMP86CS25ADFG example 2: corresponding to the connection and display using a 1/16 duty lcd shown in figure 16-6, table 16-5 shows display data and figure 16-7 shows display timing. figure 16-6 example of display data (1/16 duty) table 16-5 example of display data (1/16 duty) dbr se g 0 se g 1 se g 2 se g 3 se g 4 se g 5 se g 6 se g 7 hex dbr se g 8 se g 9 se g 10 se g 11 se g 12 se g 13 se g 14 se g 15 hex bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 com0 0f00h 1 1 1 1 10 1 1 df 0f10h 100 1 1 10 1b9??? com1 0f01h 0 0 100 1 0 0 24 0f11h 0 1 1000 1 1c6??? com2 0f02h 0 0 100 1 0 0 24 0f12h 0 1 10000 186??? com3 0f03h 0 0 100 1 0 0 24 0f13h 0 10 1 1 10 1ba??? com4 0f04h 0 0 100 1 0 0 24 0f14h 0 10000 1 1c2??? com5 0f05h 0 0 100 1 0 0 24 0f15h 0 1 1000 1 1c6??? com6 0f06h 0 0 1000 1 1 c4 0f16h 100 1 1 10 1b9??? com70f07h00000000000f17h0000000000??? com8 0f08h 0 0 1000 1 1 c4 0f18h 100 1 1 10039??? com9 0f09h 0 0 100 1 0 0 24 0f19h 0 1 1000 1046??? com10 0f0ah 0 0 100000040f1ah0 10000 1042??? com11 0f0bh 0 0 100000040f1bh 100 1 1 10 1b9??? com12 0f0ch 0 0 10000 1840f1ch000000 1 1c0??? com13 0f0dh 0 0 1000 1 0 44 0f1dh 0 0 1000 1 1c4??? com14 0f0eh 0 0 100 1 1 1e40f1eh 1 10 1 1 1003b??? com150f0fh00000000000f1fh0000000000???        
         
page 171 TMP86CS25ADFG figure 16-7 example of display timing (1/16 duty) com0 com1 com2 com15 seg0 seg0-com0 seg0-com1 v4 v4 vss v2 v1 v3 v4 vss tfame off (extinguish) on (light) off (extinguish)
page 172 16. lcd driver 16.6 method of controlling lcd driver TMP86CS25ADFG
page 173 TMP86CS25ADFG 17. input/output circuitry 17.1 control pins the input/output circuitries of the TMP86CS25ADFG control pins are shown below. note: the test pin of the tmp86ps25 does not have a pull-down resistor and protect diode (d 1 ). fix the test pin at low-level. control pin i/o input/output circuitry remarks xin xout input output resonator connecting pins (high-frequency) r f = 1.2 m ? (typ.) r o = 1.0 k ? (typ.) xtin xtout input output resonator connecting pins (low-frequency) r f = 6 m ? (typ.) r o = 220 k ? (typ.) reset i/o sink open drain output hysteresis input pull-up resistor r in = 220 k ? (typ.) r = 1 k ? (typ.) test input pull-down resistor r in = 70 k ? (typ.) r = 1 k ? (typ.) fc rf r o osc. enable xin xout vdd vdd fs rf r r o xtin xtout vdd vdd xten osc. enable r in vdd address trap reset watchdog timer reset system clock reset reset input r vdd r in r d 1
page 174 17. input/output circuitry 17.2 input/output ports TMP86CS25ADFG 17.2 input/output ports note: port p1, p3, p5 and p7 are sink open drain output. but they ar e also used as a segment output of lcd. therefore, absolute maximum ratings of port input voltage should be used in ? 0.3 to v dd + 0.3 volts. port i/o input/output circuitry remarks p1 p7 i/o sink open drain output hysteresis input r = 100 ? (typ.) p5 i/o sink open drain output r = 100 ? (typ.) p2 i/o sink open drain output hysteresis input r = 100 ? (typ.) p30 p31 p32 p33 i/o sink open drain output hysteresis input high current output (nch) r = 100 ? (typ.) p34 p35 p36 i/o sink open drain output hysteresis input r = 100 ? (typ.) p6 i/o tri-state i/o hysteresis input r = 100 ? (typ.) initial "high-z" data output seg output p1lcr/p7lcr pin input input from output latch r initial "high-z" data output seg output p5lcr pin input input from output latch r initial "high-z" data output pin input input from output latch vdd r initial "high-z" data output seg output p3lcr pin input input from output latch r initial "high-z" data output com output p3lcr pin input input from output latch r initial "high-z" disable vdd pin input data output r
page 175 TMP86CS25ADFG 18. electrical characteristics 18.1 absolute maximum ratings the absolute maximum ratings are rated values which must not be exceeded during operat ion, even for an instant. any one of the ratings must not be exceeded. if any absolute maximum rati ng is exceeded, a device may break down or its performance may be degraded, causi ng it to catch fire or explode resul ting in injury to the user. thus, when designing products which include this de vice, ensure that no absolute maximu m rating value will ever be exceeded. (v ss = 0 v) parameter symbol pins rating unit supply voltage v dd ? 0.3 to 6.5 v input voltage v in ? 0.3 to v dd + 0.3 v output voltage v out ? 0.3 to v dd + 0.3 v output current (per 1 pin) i out1 p6 port ? 1.8 ma i out2 p1, p2, p34 to p36, p5, p6, p7 port 3.2 i out3 p30 to p33 port 30 output current (total) i out2 p1, p2, p34 to p36, p5, p6, p7 port 60 i out3 p30 to p33 port 80 power dissipation [topr = 85 c] pd 350 mw soldering temperature (time) tsld 260 (10 s) c storage temperature tstg ? 55 to 125 operating temperature topr ? 40 to 85
page 176 18. electrical characteristics 18.2 recommended operating condition TMP86CS25ADFG 18.2 recommended op erating condition the recommended operating co nditions for a device are operating conditions under which it can be guaranteed that the device will operate as specified. if the device is us ed under operating conditions other than the recommended operating conditions (supply voltage, operating temperature range, specified ac/dc values etc.), malfunction may occur. thus, when designing products which include this device, ensure that the r ecommended operating conditions for the device are always adhered to. note 1: when the supply voltage is v dd =1.8 to 2.0v, the operating tempreture is topr= -20 to 85 c. (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol pins condition min max unit supply voltage v dd fc = 16 mhz normal1, 2 mode 4.5 5.5 v idle0, 1, 2 mode fc = 8 mhz normal1, 2 mode 2.7 idle0, 1, 2 mode fc = 4.2 mhz normal1, 2 mode 1.8 (note1) idle0, 1, 2 mode fs = 32.768 khz slow1, 2 mode sleep0, 1, 2 mode stop mode input high level v ih1 except hysteresis input v dd 4.5 v v dd 0.70 v dd v ih2 hysteresis input v dd 0.75 v ih3 v dd < 4.5 v v dd 0.90 input low level v il1 except hysteresis input v dd 4.5 v 0 v dd 0.30 v il2 hysteresis input v dd 0.25 v il3 v dd < 4.5 v v dd 0.10 lcd reference voltage range v1 in v1 lcdctl1 = ?1? vdd < v4 #1 #1 when lcdctl1 is set to ?1?, always keep the condition of vdd < v4. 1.0 1.375 v2 in v2 2.0 2.750 v3 in v3 3.0 4.125 v4 in v4 4.0 5.500 v4 in v4 #2 #2 when lcdctl1 is set to ?0?, always supply the reference voltage from v4 pin. lcdctl1 = ?0? 2.7 vdd clock frequency fc xin, xout v dd = 1.8 v to 5.5 v 1.0 4.2 mhz v dd = 2.7 v to 5.5 v 8.0 v dd = 4.5 v to 5.5 v 16.0 fs xtin, xtout 30.0 34.0 khz
page 177 TMP86CS25ADFG 18.3 dc characteristics note 1: typical values show those at topr = 25 c, v dd = 5 v note 2: input current (i in1 , i in3 ): the current through pull-up or pull-down resistor is not included. note 3: i dd does not include i ref current. note 4: the supply currents in slow2 and sleep2 modes are equivalent to those in idle0, idle1, and idle2 modes. (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol pins condition min typ. max unit hysteresis voltage v hs hysteresis input ? 0.9 ? v input current i in1 test v dd = 5.5 v v in = 5.5 v/0 v ?? 2 a i in2 sink open drain, tri-state port i in3 reset , stop input resistance r in1 test pull-down v dd = 5.5 v, v in = 5.5 v ?70? k ? r in2 reset pull-up vdd = 5.5 v, vin = 0 v 100 220 450 output leakage current i lo sink open drain, tri-state port v dd = 5.5 v, v out = 5.5 v/0 v ?? 2 a output high voltage v oh2 tri-state port v dd = 4.5 v, i oh = ? 0.7 ma 4.1 ? ? v output low voltage v ol except xout and p30 to p33 port v dd = 4.5 v, i ol = 1.6 ma ??0.4 output low current i ol high current port (p30 to p33 port) v dd = 4.5 v, v ol = 1.0 v ?20?ma supply current in normal 1, 2 mode i dd v dd = 5.5 v v in = 5.3 v/0.2 v fc = 16 mhz fs = 32.768 khz ?6.07.0 ma supply current in idle0, 1, 2 mode ?4.25.0 supply current in slow1 mode v dd = 3.0 v v in = 2.8 v/0.2 v fs = 32.768 khz ?8.525 a supply current in sleep1 mode ?5.015 supply current in sleep0 mode ?3.013 supply current in stop mode v dd = 5.5 v v in = 5.3 v/0.2 v ?0.510
page 178 18. electrical characteristics 18.4 ad conversion characteristics TMP86CS25ADFG 18.4 ad conversi on characteristics note 1: the total error includes all errors except a quantizati on error, and is defined as ma ximum deviation from the ideal conversion line. note 2: conversion time is different in recommended value by power supply voltage. about conversion time, refer to ?8-bit ad converter(adc)?. note 3: please use input voltage to ain input pin in limit of v aref ? v ss . when voltage of range outside is input, conversion val ue becomes unsettled and gives affect to other channel conversion value. note 4: analog reference voltage range: ? v aref = v aref ? v ss note 5: when ad is used with v dd < 2.7 v, the guaranteed temperature range varies with the operating voltage. (v ss = 0.0 v, 4.5 v v dd 5.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit analog reference voltage v aref v dd ? 1.5 ? v dd v analog reference voltage range (note 4) ? v aref 3.0 ? ? analog input voltage v ain v ss ? v aref power supply current of analog reference voltage i ref v dd = v aref = 5.5 v v ss = 0.0 v ?0.61.0ma non linearity error v dd = 5.0 v, v ss = 0.0 v v aref = 5.0 v ?? 1 lsb zero point error ?? 1 full scale error ?? 1 total error ?? 2 (v ss = 0.0 v, 2.7 v v dd < 4.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit analog reference voltage v aref v dd ? 1.5 ? v dd v analog reference voltage range (note 4) ? v aref 2.5 ? ? analog input voltage v ain v ss ? v aref power supply current of analog reference voltage i ref v dd = v aref = 4.5 v v ss = 0.0 v ?0.50.8ma non linearity error v dd = 2.7 v, v ss = 0.0 v v aref = 2.7 v ?? 1 lsb zero point error ?? 1 full scale error ?? 1 total error ?? 2 (v ss = 0.0 v, 2.0 v v dd < 2.7 v, topr = ? 40 to 85 c) (note 5) (v ss = 0.0 v, 1.8 v v dd < 2.0 v, topr = ? 10 to 85 c) (note 5) parameter symbol condition min typ. max unit analog reference voltage v aref v dd ? 0.9 ? v dd v analog reference voltage range (note 4) ? v aref 1.8 v v dd < 2.0 v 1.8 ? ? 2.0 v v dd < 2.7 v 2.0 ? ? analog input voltage v ain v ss ? v aref power supply current of analog reference voltage i ref v dd = v aref = 2.7 v v ss = 0.0 v ?0.30.5ma non linearity error v dd = 1.8 v, v ss = 0.0 v v aref = 1.8 v ?? 2 lsb zero point error ?? 2 full scale error ?? 2 total error ?? 4
page 179 TMP86CS25ADFG 18.5 ac characteristics note 1: when the supply voltage is v dd =1.8 to 2.0v, the operating tempreture is topr= -20 to 85 c. 18.6 timer counter 1 inpu t (ecin) characteristics (v ss = 0 v, v dd = 4.5 to 5.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit machine cycle time tcy normal1, 2 mode 0.25 ? 4 s idle0, 1, 2 mode slow1, 2 mode 117.6 ? 133.3 sleep0, 1, 2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 16 mhz ? 31.25 ? ns low level clock pulse width t wcl high level clock pulse width t wch for external clock operation (xtin input) fs = 32.768 khz ? 15.26 ? s low level clock pulse width t wcl (v ss = 0 v, v dd = 2.7 to 4.5 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit machine cycle time tcy normal1, 2 mode 0.5 ? 4 s idle0, 1, 2 mode slow1, 2 mode 117.6 ? 133.3 sleep0, 1, 2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 8 mhz ? 62.5 ? ns low level clock pulse width t wcl high level clock pulse width t wch for external clock operation (xtin input) fs = 32.768 khz ? 15.26 ? s low level clock pulse width t wcl (v ss = 0 v, v dd = 1.8 to 2.7 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit machine cycle time tcy normal1, 2 mode 0.95 ? 4 s idle0, 1, 2 mode slow1, 2 mode 117.6 ? 133.3 sleep0, 1, 2 mode high level clock pulse width t wch for external clock operation (xin input) fc = 4.2 mhz ? 119.05 ? ns low level clock pulse width t wcl high level clock pulse width t wch for external clock operation (xtin input) fs = 32.768 khz ? 15.26 ? s low level clock pulse width t wcl (v ss = 0 v, topr = ? 40 to 85 c) parameter symbol condition min typ. max unit tc1 input (ecin input) t tc1 frequency measurement mode v dd = 4.5 to 5.5 v single edge count ??1.0 mhz frequency measurement mode v dd = 2.7 to 4.5 v single edge count ??0.5 frequency measurement mode v dd = 1.8 to 2.7 v single edge count ? ? 0.262
page 180 18. electrical characteristics 18.7 recommended oscillating conditions TMP86CS25ADFG 18.7 recommended osc illating conditions note 1: a quartz resonator can be used for high-frequency oscillation only when v dd is 2.7 v or above. if v dd is below 2.7 v, use a ceramic resonator. note 2: to ensure stable oscillation, the resonator position, load capacitance, etc. must be appropriate. because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will act ually be mounted. note 3: for the resonators to be used with toshiba microcont rollers, we recommend ceramic resonators manufactured by murata manufacturing co., ltd. for details, please visit the website of murata at the following url: http://www.murata.com 18.8 handling precaution - the solderability test conditions for lead-free produc ts (indicated by the suffix g in product name) are shown below. 1. when using the sn-37pb solder bath solder bath temperature = 230 c dipping time = 5 seconds number of times = once r-type flux used 2. when using the sn-3.0ag-0.5cu solder bath solder bath temperature = 245 c dipping time = 5 seconds number of times = once r-type flux used note: the pass criteron of the above test is as follows: solderability rate until forming 95 % - when using the device (oscillator) in places exposed to high electric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition. (2) low-frequency oscillation (1) high-frequency oscillation xin xout c 2 c 1 xtin xtout c 2 c 1
page 181 TMP86CS25ADFG 19. package dimension p-lqfp100-1414-0.50f unit: mm
page 182 19. package dimension TMP86CS25ADFG
this is a technical document that de scribes the operating functi ons and electrical specif ications of the 8-bit microcontroller series tlcs-870/c (lsi). toshiba provides a variety of development tools a nd basic software to enable efficient software development. these development tools have specifi cations that support advances in microcomputer hardware (lsi) and can be used extensively. both the hardware and so ftware are supported continuous ly with version updates. the recent advances in cmos lsi production technology have be en phenomenal and microcomputer systems for lsi design are constant ly being improved. the products described in this document may also be revised in the future. be sure to check the latest specific ations before using. toshiba is developing highly integrated, high-perfo rmance microcomputers using advanced mos production technology and especially well proven cmos technology. we are prepared to meet the requests for custom packaging for a variet y of application areas. we are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP86CS25ADFG

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