![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c16a-3/BS86D20A-3 revision: v1.40 date: de ? e ?? e ? 0 ?? ? 01 ? de ? e ?? e ? 0 ?? ? 01 ?
rev. 1.40 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 3 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver table of contents eates cpu featu ? es ......................................................................................................................... ? pe ? iphe ? al featu ? es ................................................................................................................. 7 gene?al des??iption ........................................................................................ 8 sele?tion ta?le ................................................................................................. 8 blo?k diag?a? .................................................................................................. 9 pin assign?ent ........... ..................................................................................... 9 pin des??iption s ............................................................................................ 1? a?solute maxi?u? ratings .......................................................................... ?0 d.c. cha?a?te?isti?s ....................................................................................... ?1 a.c. cha?a?te?isti?s ....................................................................................... ?3 senso? os?illato? ele?t?i?al cha?a?te?isti?s ... ............................................ ?4 a/d conve?te? ele?t?i?al cha?a?te?isti?s ........... .......................................... ?? lcd ele?t?i?al cha?a?te?isti?s ..................................................................... ?7 powe?-on reset cha?a?te?isti?s ........... ........................................................ ?7 syste? a??hite?tu?e ...................................................................................... ?8 clo ? king and pipelining ......................................................................................................... ? 8 p ? og ? a ? counte ? ................................................................................................................... ? 9 sta ? k ..................................................................................................................................... 30 a ? ith ? eti ? and logi ? unit C alu ........................................................................................... 30 flash p?og?a? me?o?y ................................................................................. 31 st ? u ? tu ? e ................................................................................................................................ 31 spe ? ial ve ? to ? s ..................................................................................................................... 31 look-up ta ? le ............. ........................................................................................................... 3 ? ta ? le p ? og ? a ? exa ? ple ........................................................................................................ 3 ? in ci ?? uit p ? og ? a ?? ing C icp ............................................................................................... 33 on-chip de ? ug suppo ? t C ocds ......................................................................................... 34 ram data me?o?y ......................................................................................... 3? st ? u ? tu ? e ................................................................................................................................ 3 ? data me ? o ? y add ? essing ...................................................................................................... 3 ? gene ? al pu ? pose data me ? o ? y ............................................................................................ 3 ? spe ? ial pu ? pose data me ? o ? y ............................................................................................. 3 ? spe?ial fun?tion registe? des??iption ........................................................ 40 indi ? e ? t add ? essing registe ? s C iar0 ? iar1 ? iar ? ............................................................... 40 me ? o ? y pointe ? s C mp0 ? mp1l/mp1h ? mp ? l/mp ? h ........................................................... 40 a ?? u ? ulato ? C acc ............................................................................................................... 4 ? p ? og ? a ? counte ? low registe ? C pcl .................................................................................. 4 ? look-up ta ? le registe ? s C tblp ? tbhp ? tblh ..................................................................... 4 ? status registe ? C status .................................................................................................... 4 ? rev. 1.40 ? de?e??e? 0?? ?01? rev. 1.40 3 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver eeprom data memory ........... ....................................................................... 44 eeprom data me ? o ? y st ? u ? tu ? e ........................................................................................ 44 eeprom registe ? s ............ .................................................................................................. 44 reading data f ? o ? the eeprom ........................................................................................ 4 ? w ? iting data to the eeprom ................................................................................................ 4 ? w ? ite p ? ote ? tion ..................................................................................................................... 4 ? eeprom inte ?? upt ............. ................................................................................................... 4 ? p ? og ? a ?? ing conside ? ations ............. ................................................................................... 47 oscillators .......... ............................................................................................ 48 os ? illato ? ove ? view ............. .................................................................................................. 48 system clock confgurations ................................................................................................ 48 inte ? nal rc os ? illato ? C hirc ............. .................................................................................. 48 inte ? nal 3 ? khz os ? illato ? C lirc ........................................................................................... 49 exte ? nal 3 ? .7 ? 8khz c ? ystal os ? illato ? C lxt ............. ........................................................... 49 operating modes and system clocks ......................................................... 51 syste ? clo ? ks ...................................................................................................................... ? 1 syste ? ope ? ation modes ...................................................................................................... ?? cont ? ol registe ? .................................................................................................................... ? 3 ope ? ating mode swit ? hing ................................................................................................... ? 4 stand ? y cu ?? ent conside ? ations ........................................................................................... ? 7 wake-up ................................................................................................................................ ? 8 p ? og ? a ?? ing conside ? ations ............. ................................................................................... ? 8 watchdog timer ........... .................................................................................. 59 wat ? hdog ti ? e ? clo ? k sou ?? e .............................................................................................. ? 9 wat ? hdog ti ? e ? cont ? ol registe ? ............. ............................................................................ ? 9 wat ? hdog ti ? e ? ope ? ation ................................................................................................... ? 0 reset and initialisation .................................................................................. 61 reset fun ? tions ............. ....................................................................................................... ? 1 reset initial conditions ......................................................................................................... ? 3 input/output ports ......................................................................................... 68 i/o registe ? list .................................................................................................................... ? 8 pull-high resisto ? s ................................................................................................................ ? 8 po ? t a wake-up ............. ........................................................................................................ ? 9 i/o po ? t cont ? ol registe ? s ..................................................................................................... ? 9 pin- ? e ? apping fun ? tion ............. ........................................................................................... ? 9 i/o pin st ? u ? tu ? es .................................................................................................................. 70 sou ?? e cu ?? ent sele ? tion ............. ......................................................................................... 71 p ? og ? a ?? ing conside ? ations ............. ................................................................................... 7 ? timer modules C tm .......... ............................................................................ 73 int ? odu ? tion ........................................................................................................................... 73 tm ope ? ation ............. ........................................................................................................... 73 tm clo ? k sou ?? e ............. ...................................................................................................... 73 tm inte ?? upts ......................................................................................................................... 74 tm exte ? nal pins ................................................................................................................... 74 rev. 1.40 4 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ? de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver tm input/output pin cont ? ol registe ? ................................................................................... 7 ? p ? og ? a ?? ing conside ? ations ............. ................................................................................... 77 compact type tm C ctm 0 .......... .................................................................. 78 co ? pa ? t tm ope ? ation ......................................................................................................... 78 co ? pa ? t type tm registe ? des ?? iption ................................................................................ 78 co ? pa ? t type tm ope ? ating modes .................................................................................... 8 ? periodic type tm C ptm 1 & ptm2 ............................................................... 88 pe ? iodi ? tm ope ? ation ............. ............................................................................................. 88 pe ? iodi ? type tm registe ? des ?? iption ................................................................................. 89 pe ? iodi ? type tm ope ? ating modes ...................................................................................... 93 analog to digital converter .......... .............................................................. 102 a/d ove ? view ............. ......................................................................................................... 10 ? a/d conve ? te ? registe ? des ?? iption .................................................................................... 10 ? a/d conve ? te ? data registe ? s C adrl ? adrh ................................................................... 103 a/d conve ? te ? cont ? ol registe ? s C adcr0 ? adcr1 ? acerl ............................................. 103 a/d ope ? ation ..................................................................................................................... 10 ? a/d input pins ............. ........................................................................................................ 107 su ?? a ? y of a/d conve ? sion steps ............. ........................................................................ 108 p ? og ? a ?? ing conside ? ations ............. ................................................................................. 109 a/d t ? ansfe ? fun ? tion ............. ............................................................................................ 109 a/d p ? og ? a ?? ing exa ? ple s ................................................................................................ 110 touch key function ..................................................................................... 112 tou ? h key st ? u ? tu ? e ............................................................................................................. 11 ? touch key register defnition .............................................................................................. 11 ? tou ? h key ope ? ation ............................................................................................................ 117 tou ? h key inte ?? upt ............................................................................................................. 1 ? 0 p ? og ? a ?? ing conside ? ations ............. ................................................................................. 1 ? 0 serial interface module C sim ..................................................................... 121 spi inte ? fa ? e ....................................................................................................................... 1 ? 1 i ? c inte ? fa ? e ............ ............................................................................................................ 1 ? 7 uart interface ............................................................................................ 137 uart exte ? nal pin inte ? fa ? ing ............................................................................................ 137 uart data t ? ansfe ? s ? he ? e .............................................................................................. 138 uart status and cont ? ol registe ? s .................................................................................... 138 baud rate gene ? ato ? .......................................................................................................... 144 cal ? ulating the baud rate and e ?? o ? values ....................................................................... 144 uart setup and cont ? ol ..................................................................................................... 14 ? uart t ? ans ? itte ? ................................................................................................................ 14 ? uart re ? eive ? ............. ...................................................................................................... 148 managing re ? eive ? e ?? o ? s .................................................................................................. 149 uart module inte ?? upt st ? u ? tu ? e ........................................................................................ 1 ? 0 uart powe ? down and wake-up ....................................................................................... 1 ?? rev. 1.40 4 de?e??e? 0?? ?01? rev. 1.40 ? de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver interrupts ...................................................................................................... 153 inte ?? upt registe ? s ............................................................................................................... 1 ? 3 inte ?? upt ope ? ation .............................................................................................................. 1 ? 7 exte ? nal inte ?? upt ............. .................................................................................................... 1 ? 8 a/d conve ? te ? inte ?? upt ....................................................................................................... 1 ? 9 ti ? e base inte ?? upts ........................................................................................................... 1 ? 9 tm inte ?? upts ....................................................................................................................... 1 ? 0 eeprom inte ?? upt ............. ................................................................................................. 1 ? 1 lvd inte ?? upt ....................................................................................................................... 1 ? 1 tou ? h key inte ?? upt ............................................................................................................. 1 ? 1 se ? ial inte ? fa ? e module inte ?? upt ......................................................................................... 1 ? 1 uart inte ?? upt ............. ....................................................................................................... 1 ?? inte ?? upt wake-up fun ? tion ................................................................................................. 1 ?? p ? og ? a ?? ing conside ? ations ............. ................................................................................. 1 ?? scom and sseg function for lcd .......... ................................................. 163 lcd ope ? ation ............. ....................................................................................................... 1 ? 3 lcd bias cont ? ol ................................................................................................................ 1 ?? low voltage detector C lvd .......... ............................................................. 166 lvd registe ? ............. .......................................................................................................... 1 ?? lvd ope ? ation ..................................................................................................................... 1 ? 7 confguration options ................................................................................. 168 application circuit ....................................................................................... 168 instruction set .............................................................................................. 169 int ? odu ? tion ......................................................................................................................... 1 ? 9 inst ? u ? tion ti ? ing ................................................................................................................ 1 ? 9 moving and t ? ansfe ?? ing data ............................................................................................. 1 ? 9 a ? ith ? eti ? ope ? ations .......................................................................................................... 1 ? 9 logi ? al and rotate ope ? ation ............................................................................................. 170 b ? an ? hes and cont ? ol t ? ansfe ? ........................................................................................... 170 bit ope ? ations ..................................................................................................................... 170 ta ? le read ope ? ations ....................................................................................................... 170 othe ? ope ? ations ............. .................................................................................................... 170 instruction set summary .......... .................................................................. 171 ta ? le conventions ............................................................................................................... 171 extended inst ? u ? tion set ............. ........................................................................................ 173 instruction defnition ................................................................................... 175 ([whghg,vwuxfwlrhlwlr ........................................................................................... 184 package information ................................................................................... 191 ? 0-pin sop(300 ? il) outline di ? ensions ............................................................................ 19 ? ? 4-pin sop(300 ? il) outline di ? ensions ............................................................................ 193 ? 8 -pin sop( 300 ? il) outline di ? ensions ............................................................................ 194 rev. 1.40 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 7 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver features cpu features ? operating v oltage f sys = 8m hz: 2. 7v~5.5v f sys = 12m hz: 2.7v~5.5v f sys = 16m hz: 4.5v~5.5v ? up to 0.2 5 s instruction cycle with 16 mhz system clock at v dd =5v ? power down and wake-up functions to reduce power consumption ? three oscillators high speed internal rc -- hirc: 8/12/16mhz low speed internal rc -- lirc: 32khz low speed external crystal -- lxt: 32768hz (for bs86c16a-3/BS86D20A-3 only) ? multi-mode operation: normal, slow, idle and sleep ? all instructions executed in one to three instruction cycles ? table read instructions ? 115 powerful instructions ? u p to 8 -level subroutine nesting ? bit manipulation instruction rev. 1.40 ? de?e??e? 0?? ?01? rev. 1.40 7 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver peripheral features ? flash program memory: 2k 16~8k 16 ? ram data memory: 384 8~768 8 ? true eeprom memory: 648 ? fully integrated 12/16/20 touch key functions -- require no external components ? watchdog t imer function ? u p to 26 bidirectional i/o lines ? pmos source current adjustable ? software controlled 4-scom lines lcd driver with 1/3 bias ? one e xternal interrupt line shared with i/o pin ? multiple t imer module for time measure, input capture, compare match output, pwm output or single pulse output function ? dual t ime-base function s for generation of fxed time interrupt signals ? multi-channel 12-bit resolution a/d converter ? serial interfaces module C sim for spi or i 2 c ? uart interface ? low voltage reset function ? low voltage detect function ? flash program memory can be re-programmed up to 100,000 times ? flash program memory data retention > 10 years ? true eeprom data memory can be re-programmed up to 1,000,000 times ? true eeprom data memory data retention > 10 years ? package: 20/24/28-pin sop rev. 1.40 8 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 9 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver general description these devices are a series of flash memory type 8-bit high performance risc architecture microcontrollers with fully integrated touch key functions. w ith all touch key functions provided internally and with the convenience of flash memory multi-programming features, these devices have all the features to of fer designers a reliable and easy means of implementing touch switches within their product applications. the touch key functions are fully integrated thus completely eliminating the need for external components. in a ddition t o t he fl ash pro gram me mory, ot her m emory i ncludes a n a rea of ram data memory as well as an area of true eeprom memory for storage of non-volatile data such as serial num bers, c alibration da ta e tc. ana log fe ature i ncludes a m ulti-channel 12- bit a/ d c onverter. protective features such as an internal w atchdog t imer, low v oltage reset and low v oltage detector functions coupled with excellent noise immunity and esd protection ensure that reliable operation is maintained in hostile electrical environments. a full choice of internal, external high and low speed oscillators are provided including a fully integrated syst em osc illator whi ch re quire no e xternal c omponents for i ts i mplementation. t he ability t o opera te a nd swi tch dyna mically be tween a ra nge of opera ting m odes usi ng di fferent clock sources gives users the ability to optimise microcontroller operation and minimise power consumption. easy communication with the outside world is provided using the fully integrated spi or i2c interface functions, while the inclusion of fexible i/o programming features, t imer modules and many other features further enhance device functionality and fexibility. a uar t module is contained within these devices. this interface can support applications such as da ta c ommunication ne tworks be tween m icrocontrollers, l ow-cost da ta l inks be tween pcs a nd peripheral devices, portable and battery operated device communication, etc. these touch key devices will find excellent use in a huge range of modern t ouch key product applications such as instrumentatio n, household appliances, electronic ally controlled tools to name but a few. selection table most fe atures a re c ommon t o these de vices , the m ain features distinguishing them are memory capacity, i/o count, lcd driver segment count, t ouch key count, stack capacity amd package types . the following table summarises the main features of each device. part no. v dd program memory data memory data eeprom i/o ext. int. a/d bs8 ? b1 ? a-3 ? .7v~ ? . ? v ? k1 ? 3848 ? 4 8 ?? 1 1 ? - ? it 8 bs8 ? c1 ? a-3 ? .7v~ ? . ? v 4k1 ? ? 1 ? 8 ? 4 8 ?? 1 1 ? - ? it 8 bs8 ? d ? 0a-3 ? .7v~ ? . ? v 8k1 ? 7 ? 8 8 ? 4 8 ?? 1 1 ? - ? it 8 part no. lcd driver timer module touch key interface (spi/i 2 c) uart time base stack package bs8 ? b1 ? a-3 1 ? 4 10- ? it ctm 1 10- ? it ptm ? 1 ? ? ? ? 0/ ? 4sop bs8 ? c1 ? a-3 ? 0 4 10- ? it ctm 1 10- ? it ptm ? 1 ? ? ? ? 4/ ? 8sop bs8 ? d ? 0a-3 ? 0 4 10- ? it ctm 1 10- ? it ptm ? ? 0 ? 8 ? 4/ ? 8sop rev. 1.40 8 de?e??e? 0?? ?01? rev. 1.40 9 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver block diagram 8-bit risc mcu core timer modules flash program memory eeprom data memory flash/eeprom programming circuitry (icp/ocds) ram data memory time bases reset circuit lxt oscillator interrupt controller led driver lcd driver touch keys hirc/lirc oscillators uart sim (spi&i 2 c) i/o watchdog timer low voltage detect low voltage reset 12-bit a/d converter note: the lxt oscillator is only for the bs86c16a-3 and BS86D20A-3. pin assignment ?0 19 18 17 1? 1? 14 13 1? 11 1 ? 3 4 ? ? 7 8 9 10 pa3/sdi/sda/rx pa0/sdo/ptck1/scom?/icpda/ocdsda pa?/scs/ptp1i/sco m3/icpck/ocdsck pa7/sck/scl/tx vdd vss pa1/scom0 pa4/int/ctck0/scom1 pc?/ctp0b/sseg13/an? pc4/ptp1b/sseg1?/an4 pc3/sseg11/key1?/an3 pc?/sseg10/key11/an? pc1/sseg9/key10/an1 pc0/sseg8/key9/an0/vref pb?/ptck?/sseg?/key? pb4/[ptp?i]/sseg4/key? pb3/ptp?b/sseg3/key4 pb?/sseg?/key3 pb1/sseg1/key? pb0/sseg0/key1 bs86b12a-3/bs86bv12a 20 sop-a ?4 ?3 ?? ?1 ?0 19 18 17 1? 1? 14 13 1 ? 3 4 ? ? 7 8 9 10 11 1? pa3/sdi/sda/rx pa0/sdo/ptck1/scom?/icpda/ocdsda bs86b12a-3/bs86bv12a 24 sop-a pa?/scs/ptp1i/scom3/icpck/ocdsck pa7/sck/scl/tx vdd vss pa1/scom0 pa4/int/ctck0/scom1 pc7/ctp0/sseg1?/an7 pc?/ptp1/sseg14/an? pc?/ctp0b/sseg13/an? pc4/ptp1b/sseg1?/an4 pc3/sseg11/key1?/an3 pc?/sseg10/key11/an? pc1/sseg9/key10/an1 pc0/sseg8/key9/an0/vref pb7/ptp?i/sseg7/key8 pb?/ptp?/sseg?/key7 pb?/ptck?/sseg?/key? pb4/[ptp?i]/sseg4/key? pb3/ptp?b/sseg3/key4 pb?/sseg?/key3 pb1/sseg1/key? pb0/sseg0/key1 rev. 1.40 10 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 11 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ?4 ?3 ?? ?1 ?0 19 18 17 1? 1? 14 13 1 ? 3 4 ? ? 7 8 9 10 11 1? pa 3/ sdi / sda / rx pa 0/ sdo / ptck 1/ scom ?/ icpda / ocdsda bs 86 c 16 a-3/ bs 86 cv 16 a-3 24 sop -a pa ?/ scs / ptp 1i/ scom 3/ icpck / ocdsck pa 7/ sck / scl / tx vdd vss pa 1/ scom 0 pa 4/ int / ctck 0/ scom 1 pc 7/ ctp 0/ sseg 1?/ key 1?/ an 7 pc ?/ ptp 1/ sseg 14 / key 1?/ an ? pc ?/ sseg 13/ key 14/ an ? pc 4/ sseg 1?/ key 13/ an 4 pc 3/ sseg 11/ key 1?/ an 3 pc ?/ sseg 10/ key 11/ an ? pc 1/ sseg 9/ key 10/ an 1 pc 0/ sseg 8/ key 9/ an 0/ vref pb 7/ ptp ?i/ sseg 7/ key 8 pb ?/ ptp ?/ sseg ?/ key 7 pb ?/ ptck ?/ sseg ?/ key ? pb 4/ sseg 4/ key ? pb 3/ sseg 3/ key 4 pb ?/ sseg ?/ key 3 pb 1/ sseg 1/ key ? pb 0/ sseg 0/ key 1 ?8 ?7 ?? ?? ?4 ?3 ?? ?1 ?0 19 18 17 1? 1? 1 ? 3 4 ? ? 7 8 9 10 11 1? 13 14 pa 3/ sdi / sda / rx pa 0/ sdo / ptck 1/ scom ?/ icpda / ocdsda bs 86c 16 a-3/ bs 86 cv 16 a-3 28 sop -a pa ?/ scs / ptp 1i/ scom 3/ icpck / ocdsck pa 7/ sck / scl / tx vdd vss pa 1/ scom 0 pa 4/ int / ctck 0/ scom 1 pc 7/ ctp 0/ sseg 1?/ key 1?/ an 7 pc ?/ ptp 1/ sseg 14/ key 1?/ an ? pc ?/ sseg 13/ key 14/ an ? pc 4/ sseg 1?/ key 13/ an 4 pc 3/ sseg 11/ key 1?/ an 3 pc ?/ sseg 10/ key 11/ an ? pc 1/ sseg 9/ key 10/ an 1 pc 0/ sseg 8/ key 9/ an 0/ vref pb 7/ ptp ?i/ sseg 7/ key 8 pb ?/ ptp ?/ sseg ?/ key 7 pb ?/ ptck ?/ sseg ?/ key ? pb 4/ sseg 4/ key ? pb 3/ sseg 3/ key 4 pb ?/ sseg ?/ key 3 pb 1/ sseg 1/ key ? pb 0/ sseg 0/ key 1 pd 1/ ctp 0b/ sseg 17/ xt ? pd 0/ ptp 1b/ sseg 1? / xt 1 pd ?/ sseg 18 pd 3/ ptp ?b/ sseg 19 rev. 1.40 10 de?e??e? 0?? ?01? rev. 1.40 11 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ?4 ?3 ?? ?1 ?0 19 18 17 1? 1? 14 13 1 ? 3 4 ? ? 7 8 9 10 11 1? pa 3/ sdi / sda / rx pa 0/ sdo / ptck 1/ scom ?/ icpda / ocdsda bs 86d 20 a-3/ bs 86dv 20 a-3 24 sop -a pa ?/ scs / ptp 1i/ scom 3/ icpck / ocdsck pa 7/ sck / scl / tx vdd vss pa 1/ scom 0/ key ?0 pa 4/ int / ctck 0/ scom 1/ key 19 pc 7/ ctp 0/ sseg 1?/ key 18/ an 7 pc ?/ ptp 1/ sseg 14 / key 17/ an ? pc ?/ sseg 13/ key 1?/ an ? pc 4/ sseg 1?/ key 1?/ an 4 pc 3/ sseg 11 / key 14/ an 3 pc ?/ sseg 10 / key 13/ an ? pc 1/ sseg 9/ key 1?/ an 1 pc 0/ sseg 8/ key 11/ an 0/ vref pb 7/ ptp ?i/ sseg 7/ key8 pb ?/ ptp ?/ sseg ?/ key7 pb ?/ ptck ?/ sseg ?/ key? pb 4/ sseg 4/ key? pb 3/ sseg 3/ key4 pb ?/ sseg ?/ key3 pb 1/ sseg 1/ key? pb 0/ sseg 0/ key1 ?8 ?7 ?? ?? ?4 ?3 ?? ?1 ?0 19 18 17 1? 1? 1 ? 3 4 ? ? 7 8 9 10 11 1? 13 14 pa 3/ sdi / sda / rx pa 0/ sdo / ptck 1/ scom ?/ icpda / ocdsda bs 86d 20 a-3/ bs 86 dv 20 a-3 28 sop -a pa ?/ scs / ptp 1i/ scom 3/ icpck / ocdsck pa 7/ sck / scl / tx vdd vss pa 1/ scom 0/ key ?0 pa 4/ int / ctck 0/ scom 1/ key19 pc 7/ ctp 0/ sseg 1?/ key 18/ an 7 pc ?/ ptp 1/ sseg 14/ key 17/ an ? pc ?/ sseg 13/ key 1?/ an ? pc 4/ sseg 1?/ key 1?/ an 4 pc 3/ sseg 11/ key 14/ an 3 pc ?/ sseg 10 / key 13/ an ? pc 1/ sseg 9/ key 1? / an 1 pc 0/ sseg 8/ key 11/ an 0/ vref pb 7/ ptp ?i/ sseg 7/ key8 pb ?/ ptp ?/ sseg ?/ key 7 pb ?/ ptck ?/ sseg ?/ key ? pb 4/ sseg 4/ key ? pb 3/ sseg 3/ key 4 pb ?/ sseg ?/ key 3 pb 1/ sseg 1/ key ? pb 0/ sseg 0/ key 1 pd 1/ ctp 0b/ sseg 17/ xt ? pd 0/ ptp 1b/ sseg 1? / xt 1 pd ?/ sseg 18/ key 10 pd 3/ ptp ?b/ sseg 19/ key9 note: 1. if the pin-shared pin functions have multiple outputs simultaneously, its pin names at the right side of the / sign can be used for higher priority. 2. the ocdsda and ocdsck pins are the ocds dedicated pins and only available for the bs86bv12a/ bs86cv16a-3/bs86dv20a-3 devices, which are the ocds ev chips for the bs86b12a-3/bs86c16a-3/ BS86D20A-3 devices respectively. rev. 1.40 1 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 13 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin description s with the exception of the power pins and some relevant transformer control pins, all pins on the device can be referenced by their port name, e.g. p a0, p a1, etc, which refer to the digital i/o function of the pins. however these port pins are also shared with other function such as the t ouch key function, t imer modules, etc. the function of each pin is listed in the following table s , however the details behind how each pin is confgured is contained in other sections of the datasheet. as the pin description table shows the situation for the package with the most pins, not all pins in the table will be available on smaller package sizes. bs86b12a-3 pin name function op i/t o/t description pa0/sdo/ ptck1/ scom ? /icpda/ ocdsda pa0 pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdo simc0 cmos spi data output ptck1 ptm1c0 st ptm1 ? lo ? k input scom ? slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpda st cmos in- ? i ?? uit p ? og ? a ?? ing add ? ess/data pin ocdsda st cmos on- ? hip de ? ug suppo ? t data/add ? ess pin ? fo ? ev ? hip only. pa1/scom0 pa1 pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scom0 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on pa ? / scs/ptp1i/ scom3/icpck/ ocdsck pa ? pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scs simc0 st cmos spi slave sele ? t ptp1i ptm1c0 ptm1c1 st ptm1 input scom3 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpck st in- ? i ?? uit p ? og ? a ?? ing ? lo ? k pin ocdsck st on- ? hip de ? ug suppo ? t ? lo ? k pin ? fo ? ev ? hip only. pa3/sdi/sda/ rx pa3 pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdi simc0 st spi data input sda simc0 st nmos i ? c data rx ucr1 st uart ? e ? eive ? data input pa4/int/ctck0/ scom1 pa4 pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. int intc0 integ st exte ? nal inte ?? upt ctck0 ctm0c0 st ctm0 ? lo ? k input scom1 slcdc0 st scom lcd d ? ive ? output fo ? lcd panel ? o ?? on pa7/sck/scl/ tx pa7 pawu papu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sck simc0 st cmos spi se ? ial ? lo ? k scl simc0 st nmos i ? c clo ? k tx ucr1 cmos uart t ? ans ? itte ? data output pb0/sseg0/ key1 pb0 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg0 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 tkm0c1 nsi tou ? h key input rev. 1.40 1? de?e??e? 0?? ?01? rev. 1.40 13 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin name function op i/t o/t description pb1/sseg1/ key ? pb1 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg1 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm0c1 nsi tou ? h key input pb ? /sseg ? / key3 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key3 tkm0c1 nsi tou ? h key input pb3/ptp ? b/ sseg3/key4 pb3 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? b tmpc cmos ptm ? output sseg3 slcdc1 lcd d ? ive ? output fo ? lcd panel seg ? ent key4 tkm0c1 nsi tou ? h key input pb4/[ptp ? i]/ sseg4/key ? pb4 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? i ptm ? c0 ptm ? c1 ifs st ptm ? input sseg4 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptck ? / sseg ? /key ? pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptck ? ptm ? c0 st ptm ? ? lo ? k input sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptp ? / sseg ? /key7 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? tmpc cmos ptm ? output sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key7 tkm1c1 nsi tou ? h key input pb7/ptp ? i/ sseg7/key8 pb7 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? i ptm ? c0 ptm ? c1 ifs st ptm ? input sseg7 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key8 tkm1c1 nsi tou ? h key input pc0/sseg8/ key9/an0/vref pc0 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg8 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key9 tkm ? c1 nsi tou ? h key input an0 acerl an a/d conve ? te ? intput vref adcr1 an a/d conve ? te ? ? efe ? en ? e input pc1/sseg9/ key10/an1 pc1 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg9 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key10 tkm ? c1 nsi tou ? h key input an1 acerl an a/d conve ? te ? intput pc ? /sseg10/ key11/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg10 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key11 tkm ? c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc3/sseg11/ key1 ? /an3 pc3 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg11 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm ? c1 nsi tou ? h key input an3 acerl an a/d conve ? te ? intput rev. 1.40 14 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 1? de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin name function op i/t o/t description pc4/ptp1b/ sseg1 ? /an4 pc4 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1b tmpc cmos ptm1 output sseg1 ? slcdc ? lcd d ? ive ? output fo ? lcd panel seg ? ent an4 acerl an a/d conve ? te ? intput pc ? /ctp0b/ sseg13/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0b tmpc cmos ctm0 output sseg13 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent an ? acerl an a/d conve ? te ? intput pc ? /ptp1/ sseg14/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1 tmpc cmos ptm1 output sseg14 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent an ? acerl an a/d conve ? te ? intput pc7/ctp0/ sseg1 ? /an7 pc7 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0 tmpc cmos ctm0 output sseg1 ? slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent an7 acerl an a/d conve ? te ? intput vdd vdd pwr powe ? supply vss vss pwr g ? ound legend: i/t: input type; o/t: output type op: optional by register selection pwr: power; st: schmitt t rigger input cmos: cmos output; nmos: nmos output; scom: scom output an: analog signal; nsi: non-standard input bs86c16a-3 pin name function op i/t o/t description pa0/ sdo/ ptck1/ scom ? /icpda/ ocdsda pa0 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdo simc0 cmos spi data output ptck1 ptm1c0 st ptm1 ? lo ? k input scom ? slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpda st cmos in- ? i ?? uit p ? og ? a ?? ing add ? ess/data pin ocdsda st cmos on- ? hip de ? ug suppo ? t data/add ? ess pin ? fo ? ev ? hip only. pa1/ scom0 pa1 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scom0 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on pa ? / scs/ptp1i/ scom3/icpck/ ocdsck pa ? pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scs simc0 st cmos spi slave sele ? t ptp1i ptm1c0 ptm1c1 st ptm1 input scom3 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpck st in- ? i ?? uit p ? og ? a ?? ing ? lo ? k pin ocdsck st on- ? hip de ? ug suppo ? t ? lo ? k pin ? fo ? ev ? hip only. rev. 1.40 14 de?e??e? 0?? ?01? rev. 1.40 1 ? de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin name function op i/t o/t description pa 3/sdi/sda/rx pa 3 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdi simc0 st spi data input sda simc0 st nmos i ? c data rx ucr1 st uart ? e ? eive ? data input pa4/int/ctck0/ scom1 pa4 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. int intc0 integ st exte ? nal inte ?? upt ctck0 ctm0c0 st ctm0 ? lo ? k input scom1 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on pa7/sck/scl/tx pa7 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sck simc0 st cmos spi se ? ial ? lo ? k scl simc0 st nmos i ? c clo ? k tx ucr1 cmos uart t ? ans ? itte ? data output pb0/sseg0/ key1 pb0 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg0 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 tkm0c1 nsi tou ? h key input pb1/sseg1/ key ? pb1 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg1 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm0c1 nsi tou ? h key input pb ? /sseg ? / key3 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key3 tkm0c1 nsi tou ? h key input pb3/sseg3/ key4 pb3 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg3 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key4 tkm0c1 nsi tou ? h key input pb4/sseg4/ key ? pb4 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg4 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptck ? / sseg ? /key ? pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptck ? ptm ? c0 st ptm ? ? lo ? k input sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptp ? / sseg ? /key7 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? tmpc cmos ptm ? output sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key7 tkm1c1 nsi tou ? h key input pb7/ptp ? i/ sseg7/key8 pb7 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? i ptm ? c0 ptm ? c1 st ptm ? input sseg7 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key8 tkm1c1 nsi tou ? h key input rev. 1.40 1 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 17 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin name function op i/t o/t description pc0/sseg8/ key9/an0/vref pc0 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg8 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key9 tkm ? c1 nsi tou ? h key input an0 acerl an a/d conve ? te ? intput vref adcr1 an a/d conve ? te ? ? efe ? en ? e input pc1/sseg9/ key10/an1 pc1 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg9 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key10 tkm ? c1 nsi tou ? h key input an1 acerl an a/d conve ? te ? intput pc ? /sseg10/ key11/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg10 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key11 tkm ? c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc3/sseg11/ key1 ? /an3 pc3 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg11 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm ? c1 nsi tou ? h key input an3 acerl an a/d conve ? te ? intput pc4/sseg1 ? / key13/an4 pc4 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg1 ? slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key13 tkm3c1 nsi tou ? h key input an4 acerl an a/d conve ? te ? intput pc ? /sseg13/ key14/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg13 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key14 tkm3c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc ? /ptp1/ sseg14/ key1 ? /an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1 tmpc cmos ptm1 output sseg14 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm3c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc7/ctp0/ sseg1 ? / key1 ? /an7 pc7 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0 tmpc cmos ctm0 output sseg1 ? slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm3c1 nsi tou ? h key input an7 acerl an a/d conve ? te ? intput pd0/ptp1b/ sseg1 ? /xt1 pd0 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1b tmpc cmos ptm1 output sseg1 ? slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent xt1 co lxt lxt pin rev. 1.40 1? de?e??e? 0?? ?01? rev. 1.40 17 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin name function op i/t o/t description pd1/ctp0b/ sseg17/xt ? pd1 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0b tmpc cmos ctm0 output sseg17 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent xt ? co lxt lxt pin pd ? /sseg18 pd ? pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg18 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent pd3/ptp ? b/ sseg19 pd3 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? b tmpc cmos ptm ? output sseg19 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent vdd vdd pwr powe ? supply vss vss pwr g ? ound legend: i/t : input type ; o/t : output type op: optional by confguration option (co) or register selection pwr : power ; st : s chmitt t rigger input c mos : cmos output ; nmos : nmos output ; scom: scom output an: analog signal; nsi: no n-standard input lxt: low frequency crystal oscillator BS86D20A-3 pin na ? e fun ? tion op i/t o/t des ?? iption pa0/ sdo/ptck1/ scom ? /icpda/ ocdsda pa0 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdo simc0 cmos spi data output ptck1 ptm1c0 st ptm1 ? lo ? k input scom ? slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpda st cmos in- ? i ?? uit p ? og ? a ?? ing add ? ess/data pin ocdsda st cmos on- ? hip de ? ug suppo ? t data/add ? ess pin ? fo ? ev ? hip only. pa1/ scom0/ key ? 0 pa1 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scom0 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on key ? 0 tkm4c1 nsi tou ? h key input pa ? / scs/ptp1i/ scom3/icpck/ ocdsck pa ? pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. scs simc0 st cmos spi slave sele ? t ptp1i ptm1c0 ptm1c1 st ptm1 input scom3 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on icpck st in- ? i ?? uit p ? og ? a ?? ing ? lo ? k pin ocdsck st on- ? hip de ? ug suppo ? t ? lo ? k pin ? fo ? ev ? hip only. pa 3/sdi/sda/rx pa 3 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sdi simc0 st spi data input sda simc0 st nmos i ? c data rx ucr1 st uart ? e ? eive ? data input rev. 1.40 18 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 19 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin na ? e fun ? tion op i/t o/t des ?? iption pa4/int/ctck0/ scom1/key19 pa4 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. int intc0 integ st exte ? nal inte ?? upt ctck0 ctm0c0 st ctm0 ? lo ? k input scom1 slcdc0 scom lcd d ? ive ? output fo ? lcd panel ? o ?? on key19 tkm4c1 nsi tou ? h key input pa7/sck/scl/tx pa7 pa wu pa pu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up and wake-up. sck simc0 st cmos spi se ? ial ? lo ? k scl simc0 st nmos i ? c clo ? k tx ucr1 cmos uart t ? ans ? itte ? data output pb0/sseg0/ key1 pb0 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg0 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 tkm0c1 nsi tou ? h key input pb1/sseg1/ key ? pb1 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg1 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm0c1 nsi tou ? h key input pb ? /sseg ? / key3 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key3 tkm0c1 nsi tou ? h key input pb3/sseg3/ key4 pb3 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg3 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key4 tkm0c1 nsi tou ? h key input pb4/sseg4/ key ? pb4 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg4 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptck ? / sseg ? /key ? pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptck ? ptm ? c0 st ptm ? ? lo ? k input sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key ? tkm1c1 nsi tou ? h key input pb ? /ptp ? / sseg ? /key7 pb ? pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? tmpc cmos ptm ? output sseg ? slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key7 tkm1c1 nsi tou ? h key input pb7/ptp ? i/ sseg7/key8 pb7 pbpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? i ptm ? c0 ptm ? c1 st ptm ? input sseg7 slcdc1 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key8 tkm1c1 nsi tou ? h key input rev. 1.40 18 de?e??e? 0?? ?01? rev. 1.40 19 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin na ? e fun ? tion op i/t o/t des ?? iption pc0/sseg8/ key11/an0/ vref pc0 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg8 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key11 tkm ? c1 nsi tou ? h key input an0 acerl an a/d conve ? te ? intput vref adcr1 an a/d conve ? te ? ? efe ? en ? e input pc1/sseg9/ key1 ? /an1 pc1 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg9 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm ? c1 nsi tou ? h key input an1 acerl an a/d conve ? te ? intput pc ? /sseg10/ key13/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg10 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key13 tkm ? c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc3/sseg11/ key14/an3 pc3 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg11 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key14 tkm3c1 nsi tou ? h key input an3 acerl an a/d conve ? te ? intput pc4/sseg1 ? / key1 ? /an4 pc4 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg1 ? slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm3c1 nsi tou ? h key input an4 acerl an a/d conve ? te ? intput pc ? /sseg13/ key1 ? /an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg13 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key1 ? tkm3c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc ? /ptp1/ sseg14/ key17/an ? pc ? pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1 tmpc cmos ptm1 output sseg14 slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key17 tkm4c1 nsi tou ? h key input an ? acerl an a/d conve ? te ? intput pc7/ctp0/ sseg1 ? / key18/an7 pc7 pcpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0 tmpc cmos ctm0 output sseg1 ? slcdc ? cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key18 tkm4c1 nsi tou ? h key input an7 acerl an a/d conve ? te ? intput pd0/ptp1b/ sseg1 ? /xt1 pd0 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp1b tmpc cmos ptm1 output sseg1 ? slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent xt1 co lxt lxt pin rev. 1.40 ? 0 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?1 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver pin na ? e fun ? tion op i/t o/t des ?? iption pd1/ctp0b/ sseg17/xt ? pd1 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ctp0b tmpc cmos ctm0 output sseg17 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent xt ? co lxt lxt pin pd ? /sseg18/ key10 pd ? pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. sseg18 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key10 tkm ? c1 nsi tou ? h key input pd3/ptp ? b/ sseg19/key9 pd3 pdpu st cmos gene ? al pu ? pose i/o. registe ? ena ? led pull-up. ptp ? b tmpc cmos ptm ? output sseg19 slcdc3 cmos lcd d ? ive ? output fo ? lcd panel seg ? ent key9 tkm ? c1 nsi tou ? h key input vdd vdd pwr powe ? supply vss vss pwr g ? ound legend: i/t : input type ; o/t : output type op: optional by confguration option (co) or register selection pwr : power ; st : s chmitt t rigger input c mos : cmos output ; nmos : nmos output ; scom: scom output an: analog signal; nsi: no n-standard input lxt: low frequency crystal oscillator absolute maximum ratings supply v oltage .............. .................................................................................. v ss ?0.3v to v ss +6.0v input v oltage .............. .................................................................................... v ss ? 0.3v to v dd +0.3v storage t emperature ............... ..................................................................................... -50? c to 125?c operating t emperature .............. .................................................................................... -40? c to 85 ?c i ol t otal .............. ................................................................................................... .................... 80ma i oh t otal .............. ...................................................................................................................... -80ma total power dissipation .............. ........................................................................................... 500mw note: t hese a re st ress ra tings onl y. st resses e xceeding t he ra nge spe cified und er "absol ute ma ximum ratings" m ay c ause su bstantial d amage t o t hese d evices. fu nctional o peration o f t hese d evices a t other c onditions be yond t hose l isted i n t he spe cifcation i s no t i mplied a nd pr olonged e xposure t o extreme conditions may affect devices reliability. rev. 1.40 ?0 de?e??e? 0?? ?01? rev. 1.40 ? 1 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver d.c. characteristics ta= ?? c symbol parameter test conditions min. typ. max. unit v dd conditions v dd ope ? ating voltage (hirc) f sys = 8mhz ? .7 ? . ? v f sys = 1 ? mhz ? .7 ? . ? v f sys = 1 ? mhz 4. ? ? . ? v i dd ope ? ating cu ?? ent (no ?? al) (hirc ? f sys =f h ? f s =f sub ) 3v no load ? f h = 8mhz ? adc off ? wdt ena ? le ? lvr ena ? le 1. ? 1.8 ? a ? v ? . ? 3.3 ? a 3v no load ? f h = 1 ? mhz ? adc off ? wdt ena ? le ? lvr ena ? le 1. ? ? .4 ? a ? v 3.3 ? .0 ? a ? v no load ? f h = 1 ? mhz ? adc off ? wdt ena ? le ? lvr ena ? le 4.0 ? .0 ? a ope ? ating cu ?? ent (no ?? al) (hirc ? f sys =f l ? f s =f sub ) 3v no load ? f h = 1 ? mhz ? f l = f h / ?? adc off ? wdt ena ? le ? lvr ena ? le 1. ? ? .0 ? a ? v ? . ? 3.3 ? a ? v no load ? f h = 1 ? mhz ? f l = f h / ? 4 ? adc off ? wdt ena ? le ? lvr ena ? le 0.8 1. ? ? a 3v 1. ? ? .3 ? a ope ? ating cu ?? ent (slow) (lxt/lirc ? f sys =f l ? f s =f sub ) (bs8 ? c1 ? a-3/bs8 ? d ? 0a-3 only) 3v no load ? f sys =lxt ? adc off ? wdt ena ? le ? lvr ena ? le ? lxtlp=0 19 38 a ? v 48 9 ? a 3v no load ? f sys =lxt ? adc off ? wdt ena ? le ? lvr ena ? le ? lxtlp=1 1 ? 3 ? a ? v 3 ? 7 ? a 3v no load ? f sys =lirc ? adc off ? wdt ena ? le ? lvr ena ? le 1 ? 3 ? a ? v 3 ? 7 ? a ope ? ating cu ?? ent (slow) (lirc ? f sys =f l ? f s =f sub ) (bs8 ? b1 ? a-3 only) 3v no load ? f sys =lirc ? adc off ? wdt ena ? le ? lvr ena ? le 1 ? 3 ? a ? v 3 ? 7 ? a rev. 1.40 ?? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?3 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver symbol parameter test conditions min. typ. max. unit v dd conditions i stb idle1 mode stand ? y cu ?? ent (hirc ? f sys =f h ? f s =f sub ) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? f sys = 1 ? mhz 0.9 1.4 ? a ? v 1.4 ? .1 ? a idle0 mode stand ? y cu ?? ent (hirc ? f sys =off ? f s =f sub ) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? f sys = 1 ? mhz 1.4 3.0 a ? v ? .7 ? .0 a idle1 mode stand ? y cu ?? ent (hirc ? f sys = f l ? f s =f sub ) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? f sys = 1 ? mhz / ? 4 0.7 1.1 ? a ? v 1.4 ? .1 ? a idle0 mode stand ? y cu ?? ent (hirc ? f sys =off ? f s =f sub ) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? f sys = 1 ? mhz / ? 4 1.3 3.0 a ? v ? .3 ? .0 a idle1 mode stand ? y cu ?? ent (lirc ? f sys = f l =f lirc ? f s = f sub =f lirc ) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? f sys = lirc 1.9 4.0 a ? v 3.3 7.0 a idle0 mode stand ? y cu ?? ent (lxt/lirc ? f sys =off ? f s =f sub ) (bs8 ? c1 ? a-3/bs8 ? d ? 0a-3 only) 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? lxtlp=0 (lxt on) ? 10 a ? v 18 30 a 3v no load ? syste ? halt ? adc off ? wdt ena ? le ? lxtlp=1 (lxt on) ? . ? ? a ? v ? 10 a 3v no load ? syste ? halt ? adc off ? wdt ena ? le (lirc on) 1.3 3.0 a ? v ? .4 ? .0 a idle0 mode stand ? y cu ?? ent (lirc ? f sys =off ? f s =f sub ) (bs8 ? b1 ? a-3 only) 3v no load ? syste ? halt ? adc off ? wdt ena ? le (lirc on) 1.3 3.0 a ? v ? .4 ? .0 a sleep mode stand ? y cu ?? ent (hirc ? f sys =off ? f s =f sub = off) 3v no load ? syste ? halt ? adc off ? wdt dis a ? le (lxt and lirc off) 0.1 1 a ? v 0.3 ? a sleep mode stand ? y cu ?? ent (lxt/lirc ? f sys =off ? f s =f sub = off) (bs8 ? c1 ? a-3/bs8 ? d ? 0a-3 only) 3v no load ? syste ? halt ? adc off ? wdt dis a ? le (lxt and lirc off) 0.1 1 a ? v 0.3 ? a v il input low voltage fo ? i/o po ? ts o ? input pins ? v 0 1. ? v 0 0. ? v dd v v ih input high voltage fo ? i/o po ? ts o ? input pins ? v 3. ? ? .0 v 0.8v dd v dd v v lvr low voltage reset voltage lvr ena ? le ? ? . ?? v - ? % ? . ?? + ? % v v lv d low voltage dete ? to ? voltage lvden = 1 ? v lvd = ? . 7v - ? % ? .7 + ? % v lvden = 1 ? v lvd = 3.0v - ? % 3.0 + ? % v lvden = 1 ? v lvd = 3.3v - ? % 3.3 + ? % v lvden = 1 ? v lvd = 3. ? v - ? % 3. ? + ? % v lvden = 1 ? v lvd = 4.0v - ? % 4.0 + ? % v i ol i/o po ? t sink cu ?? ent 3v v ol =0.1v dd 1 ? 3 ? ? a ? v v ol =0.1v dd 3 ? ? 4 ? a rev. 1.40 ?? de?e??e? 0?? ?01? rev. 1.40 ? 3 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver symbol parameter test conditions min. typ. max. unit v dd conditions i oh i/o po ? t sou ?? e cu ?? ent 3v v oh = 0.9v dd ? pxps=00 -1.0 - ? .0 ? a ? v v oh = 0.9v dd ? pxps=00 - ? .0 -4.0 ? a 3v v oh = 0.9v dd ? pxps=01 -1.7 ? -3. ? ? a ? v v oh = 0.9v dd ? pxps=01 -3. ? -7.0 ? a 3v v oh = 0.9v dd ? pxps=10 - ? . ? - ? .0 ? a ? v v oh = 0.9v dd ? pxps=10 - ? .0 -10 ? a 3v v oh = 0.9v dd ? pxps=11 - ? . ? -11 ? a ? v v oh = 0.9v dd ? pxps=11 -11 - ?? ? a r ph pull-high resistan ? e fo ? i/o po ? ts 3v ? 0 ? 0 100 k ? v 10 30 ? 0 k a.c. characteristics ta= ?? c symbol parameter test conditions min. typ. max. unit v dd conditions f sys syste ? clo ? k (hirc) 3v/ ? v ta= ?? c - ? % 8 + ? % mhz - ? % 1 ? + ? % mhz ? v - ? % 1 ? + ? % mhz t timer ti ? e ? input pulse width 0.3 s f lirc syste ? clo ? k (3 ? khz) ? v ta = ? ? c -10% 3 ? +10% khz f lxt syste ? clo ? k (lxt) 3 ? 7 ? 8 hz t int inte ?? upt pulse width 10 s t lvr low voltage width to reset 1 ? 0 ? 40 480 s t lv d low voltage width to inte ?? upt ? 0 1 ? 0 ? 40 s t lv ds lvdo sta ? le ti ? e 1 ? s t eerd eeprom read ti ? e 1 ? 4 t sys t eewr eeprom w ? ite ti ? e 1 ? 4 ? s t rstd syste ? reset delay ti ? e (powe ? on ? eset ? lvr ? eset ? wdt s/w ? eset (wdtc)) ?? ? 0 100 ? s syste ? reset delay ti ? e (wdt no ?? al ? eset) 8.3 1 ? .7 33.3 ? s t sst syste ? sta ? t-up ti ? e ? pe ? iod (wake-up f ? o ? halt) f sys =lxt 10 ? 4 t sys f sys =hirc 1 ? f sys =lirc ? syste ? sta ? t-up ti ? e ? pe ? iod (wake-up f ? o ? halt ? f sys on at halt state ) ? 1rwh t sys sys rev. 1.40 ? 4 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?? de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver sensor oscillator electrical characteristics ta= ?? c touch key rc osc=500khz symbol parameter test conditions min. typ. max. unit v dd condition i keyosc only senso ? (key) os ? illato ? ope ? ating cu ?? ent 3v *f senosc = ? 00khz 30 ? 0 a ? v ? 0 1 ? 0 i refosc only refe ? en ? e os ? illato ? ope ? ating cu ?? ent 3v *f refosc = ? 00khz ? m ntss=0 30 ? 0 a ? v ? 0 1 ? 0 3v *f refosc = ? 00khz ? m ntss=1 30 ? 0 a ? v ? 0 1 ? 0 c keyosc senso ? (key) os ? illato ? exte ? nal capa ? itan ? e ? v *f senosc = ? 00khz ? 10 ? 0 pf c refosc refe ? en ? e os ? illato ? inte ? nal capa ? itan ? e ? v *f senosc = ? 00khz ? 10 ? 0 pf f keyosc senso ? (key) os ? illato ? ope ? ating f ? equen ? y ? v * exte ? nal capa ? itan ? e =7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 100 ? 00 1000 khz f refyosc refe ? en ? e os ? illato ? ope ? ating f ? equen ? y ? v * inte ? nal capa ? itan ? e =7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 100 ? 00 1000 khz 1rwh i ?(1??& n+] dgmxvw wkh .(q fdsdflwru wr pdnh wkh ?hqvru ?vfloodwru iuhtxhqf = 56 dmx h 5hhuhfh floodu lhudo fdsdflu pdh h 5hhuhfh floodu uhtxhf = touch key rc osc =1000khz symbol parameter test conditions min. typ. max. unit v dd condition i keyosc only senso ? (key) os ? illato ? ope ? ating cu ?? ent 3v *f senosc =1000khz 40 80 a ? v 80 1 ? 0 i refosc only refe ? en ? e os ? illato ? ope ? ating cu ?? ent 3v *f refosc =10 00khz ? m ntss=0 40 80 a ? v 80 1 ? 0 3v *f refosc =10 00khz ? m ntss=1 40 80 a ? v 80 1 ? 0 c keyosc senso ? (key) os ? illato ? exte ? nal capa ? itan ? e ? v *f senosc =1000khz ? 10 ? 0 pf c refosc refe ? en ? e os ? illato ? inte ? nal capa ? itan ? e ? v *f senosc =1000khz ? 10 ? 0 pf f keyosc senso ? (key) os ? illato ? ope ? ating f ? equen ? y ? v * exte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 1000 ?? 00 khz f refyosc refe ? en ? e os ? illato ? ope ? ating f ? equen ? y ? v * inte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 1000 ?? 00 khz 1rwh i ?(1??& = dmx h fdsdflu pdh h 6hu floodu uhtxhf 56 = dmx h 5hhuhfh floodu lhudo fdsdflu pdh h 5hhuhfh floodu uhtxhf rev. 1.40 ?4 de?e??e? 0?? ?01? rev. 1.40 ?? de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver touch key rc osc=1500khz symbol parameter test conditions min. typ. max. unit v dd condition i keyosc only senso ? (key) os ? illato ? ope ? ating cu ?? ent 3v *f senosc = 1 ? 00khz ? 0 1 ? 0 a ? v 1 ? 0 ? 4 0 i refosc only refe ? en ? e os ? illato ? ope ? ating cu ?? ent 3v *f refosc = 1 ? 00khz ? m ntss=0 ? 0 1 ? 0 a ? v 1 ? 0 ? 4 0 3v *f refosc = 1 ? 00khz ? m ntss=1 ? 0 1 ? 0 a ? v 1 ? 0 ? 4 0 c keyosc senso ? (key) os ? illato ? exte ? nal capa ? itan ? e 3v *f senosc = 1 ? 00khz 4 8 1 ? pf ? v ? 10 ? 0 c refosc refe ? en ? e os ? illato ? inte ? nal capa ? itan ? e 3v *f senosc = 1 ? 00khz 4 8 1 ? pf ? v ? 10 ? 0 f keyosc senso ? (key) os ? illato ? ope ? ating f ? equen ? y 3v * exte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 1 ? 00 3000 khz ? v 1 ? 0 1 ? 00 3000 f refyosc refe ? en ? e os ? illato ? ope ? ating f ? equen ? y 3v * inte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 1 ? 00 3000 khz ? v 1 ? 0 1 ? 00 3000 1rwh i ?(1??& =15 dmx h fdsdflu pdh h 6hu floodu uhtxhf =15 56 = 15 dmx h 5hhuhfh floodu lhudo fdsdflu pdh h 5hhuhfh floodu uhtxhf =15 touch key rc osc=2000khz symbol parameter test conditions min. typ. max. unit v dd condition i keyosc only senso ? (key) os ? illato ? ope ? ating cu ?? ent 3v *f senosc = ? 0 00khz 80 1 ? 0 a ? v 1 ? 0 3 ? 0 i refosc only refe ? en ? e os ? illato ? ope ? ating cu ?? ent 3v *f refosc = ? 0 00khz ? m ntss=0 80 1 ? 0 a ? v 1 ? 0 3 ? 0 3v *f refosc = ? 0 00khz ? m ntss=1 80 1 ? 0 a ? v 1 ? 0 3 ? 0 c keyosc senso ? (key) os ? illato ? exte ? nal capa ? itan ? e 3v *f senosc = ? 0 00khz 4 8 1 ? pf ? v ? 10 ? 0 c refosc refe ? en ? e os ? illato ? inte ? nal capa ? itan ? e 3v *f senosc = ? 0 00khz 4 8 1 ? pf ? v ? 10 ? 0 f keyosc senso ? (key) os ? illato ? ope ? ating f ? equen ? y 3v * exte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 ? 0 00 4000 khz ? v 1 ? 0 ? 000 4000 f refyosc refe ? en ? e os ? illato ? ope ? ating f ? equen ? y 3v * inte ? nal capa ? itan ? e = 1 ??? 3 ? 4 ????? 7 ? 8 ? 9 ? 10 ? 11 ? 1 ?? 13 ? 14 ? 1 ?? ? 0pf 1 ? 0 ? 0 00 4000 khz ? v 1 ? 0 ? 000 4000 1rwh i ?(1??& = dmx h fdsdflu pdh h 6hu floodu uhtxhf 56 = dmx h 5hhuhfh floodu lhudo fdsdflu pdh h 5hhuhfh floodu uhtxhf rev. 1.40 ?? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?7 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver a/d converter electrical characteristics ta= ?? c symbol parameter test conditions min. typ. max. unit v dd conditions av dd a/d conve ? te ? ope ? ating voltage ? .7 ? . ? v v adi a/d conve ? te ? input voltage 0 v ref v v ref a/d conve ? te ? refe ? en ? e voltage ? av dd v v bg bandgap refe ? en ? e with buffe ? voltage -3% 1.09 +3% v dnl diffe ? ential non-linea ? ity 3v v ref =av dd =v dd t adck =0. ? s ta= ?? c -3 +3 lsb ? v 3v v ref =av dd =v dd t adck =0. ? s ta= -40 c~8 ? c - ? + ? lsb ? v inl integ ? al non-linea ? ity 3v v ref =av dd =v dd t adck =0. ? s ta= ?? c -4 +4 lsb ? v 3v v ref =av dd =v dd t adck =0. ? s ta= -40 c~8 ? c -8 +8 lsb ? v i adc additional powe ? consu ? ption if a/d conve ? te ? is used 3v no load (t adck =0.5s ) 0.9 1.3 ? ? a ? v no load (t adck =0.5s ) 1. ? 1.8 ? a i bg additional powe ? consu ? ption if v bg refe ? en ? e with buffe ? is used ? 00 300 a t adck a/d conve ? te ? clo ? k pe ? iod 0. ? 10 s t adc a/d conve ? sion ti ? e (in ? lude sa ? ple and hold ti ? e) 1 ? -bit adc 1 ? t adck t ads a/d conve ? te ? sa ? pling ti ? e 4 t adck t on ? st a/d conve ? te ? on-to-sta ? t ti ? e ? s t bg v bg tu ? n-on sta ? le ti ? e ? 00 s rev. 1.40 ?? de?e??e? 0?? ?01? rev. 1.40 ? 7 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver lcd electrical characteristics ta= ?? c symbol parameter test conditions min. typ. max. unit v dd conditions i bias v dd /3 ? ias cu ?? ent fo ? lcd ? v isel[1:0] = 00b ? .8 8.3 10.8 a isel[1:0] = 01b 11.7 1 ? .7 ? 1.7 isel[1:0] = 10b 3 ? ? 0 ?? isel[1:0] = 11b 70 100 130 v scom 1/3 ? ias lcd com output (1/3 v dd ) ? . ? v~ ? . ? v no load 0.317v dd (1/3)v dd 0.3 ? v dd v 1/3 ? ias lcd com output ( ? /3 v dd ) ? . ? v~ ? . ? v no load 0. ? 34 v dd ( ? /3) v dd 0.7v dd v v sseg 1/3 ? ias lcd seg output (1/3 v dd ) ? . ? v~ ? . ? v no load 0.317v dd (1/3)v dd 0.3 ? v dd v 1/3 ? ias lcd seg output ( ? /3 v dd ) ? . ? v~ ? . ? v no load 0. ? 34 v dd ( ? /3) v dd 0.7v dd v power-on reset characteristics symbol parameter test conditions min. typ. max. unit v dd conditions v por v dd sta ? t voltage to ensu ? e powe ? -on reset 100 ? v rr vdd v dd raising rate to ensu ? e powe ? -on reset 0.03 ? v/ ? s t por mini ? u ? ti ? e fo ? v dd stays at v por to ensu ? e powe ? -on reset 1 ? s rev. 1.40 ? 8 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?9 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver system architecture a key factor in the high-performan ce features of the holtek range of microcontrollers is attributed to their internal system architecture. the range of devices take advantag e of the usual features found within risc microcontrollers providing increased speed of operation and periodic performance. the pipelining scheme is implemented in such a way that instruction fetching and instruction execution are overlapped, hence instructions are ef fectively executed in one or two cycles for most of the standard or e xtended i nstructions re spectively, wi th t he e xception of br anch or c all i nstructions which need one moe cycle. an 8-bit wide alu is used in practically all instruction set operations, which carries out arithmetic operations, logic operations, rotation, increment, decrement, branch decisions, etc. the internal data path is simplified by moving data through the accumulator and the alu. certain internal registers are implemented in the data memory and can be directly or indirectly addresse d. the simple addressi ng methods of these registers along with additi onal architectural features ensure that a minimum of external components is required to provide a functional i/ o and a/ d control syst em wi th m aximum re liability a nd fe xibility. t his m akes t h ese device s suitable for low-cost, high-volume production for controller applications. clocking and pipelining the main system clock, derived from either a lxt, hirc or lirc oscillator is subdivided into four internally generated non-overlapping clocks, t1~t4. the program counter is incremented at the beginning of the t1 clock during which time a new instruction is fetched. the remaining t2~t4 clocks carry out the decoding and execution functions. in this way , one t1~t4 clock cycle forms one instruction cycle. although the fetching and execution of instructio ns takes place in consecutive instruction c ycles, t he pi pelining st ructure of t he m icrocontroller e nsures t hat i nstructions a re effectively executed in one instruction cycle. the exception to this are instructions where the contents of the program counter are changed, such as subroutine calls or jumps, in which case the instruction will take one more instruction cycle to execute. ? ? ? ? ? system clock and pipelining rev. 1.40 ?8 de?e??e? 0?? ?01? rev. 1.40 ? 9 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver for instructions involving branches, such as jump or call instructions, two machine cycles are required to complete instruction execution. an extra cycle is required as the program takes one cycle t o frst obt ain t he a ctual j ump or c all a ddress a nd t hen a nother c ycle t o a ctually e xecute t he branch. the requirement for this extra cycle should be taken into account by programmers in timing sensitive applications. ? ? ? ? ? ? ? ? ? ? instruction fetching program counter during pro gram e xecution, t he progr am co unter i s use d t o ke ep t rack of t he a ddress of t he next instruction to be executed. it is automatically incremented by one each time an instruction is executed except for instructions, such as jmp or call that demand a jump to a non- consecutive program memory address. only the lower 8 bits, known as the program counter low register, are directly addressable by the application program. when executi ng instructions re quiring jumps to non-consecutive addresses suc h as a jump instruction, a subrout ine c all, i nterrupt or re set, e tc., t he m icrocontroller m anages progra m c ontrol by loading the required address into the program counter . for conditional skip instructions, once the condition has been met, the next instruction, which has already been fetched during the present instruction execut ion, is discarded and a dummy cycle takes its place while the correct instruction is obtained. device program counter program counter high byte pcl register bs8 ? b1 ? a-3 pc10~pc8 pcl7~pcl0 bs8 ? c1 ? a-3 pc11~pc8 bs8 ? d ? 0a-3 pc1 ? ~pc8 the lower byte of the program counter , known as the program counter low register or pcl, is available for program control and is a readable and writeable register . by transferring data directly into t his r egister, a sh ort p rogram j ump c an b e e xecuted d irectly, h owever, a s o nly t his l ow b yte is available for manipulation, the jum ps are limited to the present page of memory , that is 256 locations. when such program jumps are executed it should also be noted that a dummy cycle will be inserted. manipulating the pcl register may cause program branching, so an extra cycle is needed to pre-fetch. rev. 1.40 30 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 31 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver stack this is a special part of the memory which is used to save the contents of the program counter only. the stack is neither part of the data nor part of the program space, and is neither readable nor writeable. the activated level is indexed by the stack pointer , and is neither readable nor writeable. at a subroutine call or interrupt acknowledge signal, the contents of the program counter are pushed onto the stack. at the end of a subroutine or an interrupt routine, signaled by a return instruction, ret or reti, the program counter is restored to its previous value from the stack. after a device reset, the stack pointer will point to the top of the stack. if the stack is full and an enabled interrupt takes place, the interrupt request fag will be recorded but t he a cknowledge si gnal wi ll b e i nhibited. w hen t he st ack po inter i s d ecremented, b y r et o r reti, the interrupt will be serviced. this feature prevents stack overfow allowing the programmer to use the structure more easily . however , when the stack is full, a call subroutine instruction can still be exec uted whic h wi ll result in a st ack overfow . prec autions should be ta ken to avoid such cases which might cause unpredictable program branching. if the stack is overfow , the frst program counter save in the stack will be lost. device stack levels bs8 ? b1 ? a-3 ? bs8 ? c1 ? a-3 ? bs8 ? d ? 0a-3 8 arithmetic and logic unit C alu the arith metic-logic unit or alu is a critical area of the microcontrol ler that carries out arithmetic and logic operations of the instructi on set. connected to the main micro controller data bus, the alu receives related ins truction codes and performs the required arithmetic or logical operations after which the result will be placed in the specifed register . as these alu calculation or operations may result in carry , borrow or other status changes, the status register will be correspondingly updated to refect these changes. the alu supports the following functions: ? arithmetic operations: add, addm, adc, adcm, sub, subm, sbc, sbcm, daa, ladd, laddm, ladc, ladcm, lsub, lsubm, lsbc, lsbcm, ldaa ? logic operations: and, or, xor, andm, orm, xorm, cpl, cpla, land, landm, lor, lorm, lxor, lxorm, lcpl, lcpla ? rotation : rra, rr, rrca, rrc, rla, rl, rlca, rlc, lrr, lrra, lrrca, lrrc, lrla, lrl, lrlca, lrlc ? increment and decrement : inca, inc, deca, dec, linca, linc, ldeca, ldec ? branch d ecision : jmp , sz , sz a, snz , si z, sdz , si za, sdz a, c all, r et, r eti, l snz, l sz, lsza, lsiz, lsiz, lsdz, lsdza rev. 1.40 30 de?e??e? 0?? ?01? rev. 1.40 31 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver flash program memory the program memory is the location where the user code or program is stored. for this device series the program memory is flash type, which means it can be programmed and re-programmed a l arge num ber of t imes, a llowing t he use r t he c onvenience of c ode m odification on t he sa me device. by using the appropriate programming tools, these flash device s of fer users the fexibility to conveniently debug and develop their applications while also of fering a means of feld programming and updating. structure the program memory has a capacity of 2 k16 bits to 8 k16 bits. the program memory is addressed by the program counter and also contains data, tabl e informati on and interrupt entries. table data, which can be setup in any location within the program memory , is addressed by a separate table pointer register. device capacity bs8 ? b1 ? a-3 ? kx1 ? bs8 ? c1 ? a-3 4k1 ? bs8 ? d ? 0 a-3 8k1 ? 0000h 0004h 003ch 0fffh reset inte??upt ve?to? 1? ?its reset inte??upt ve?to? 1? ?its 1fffh bs8?c1?a-3 bs8?d?0a-3 reset inte??upt ve?to? 1? ?its 07ffh bs8?b1?a-3 program memory structure special vectors within the program memory , certai n locations are reserved for the reset and interrupts. the location 0 000h i s reserved for use by t he de vice re set for progra m i nitialisation. aft er a de vice re set i s initiated, the program will jump to this location and begin execution. rev. 1.40 3 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 33 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver look-up table any location within the program memory can be defned as a look-up table where programmers can store fxed data. t o use the look-up table, the table pointer must frst be setup by placing the address of the look up data to be retrieved in the table pointer register , tblp and tbhp . these registers defne the total address of the look-up table. after setting up the table pointer pair , the table data can be retrieved from the program memory using t he tabrd[m] o r tabrdl[m] i nstructions respectively wh en t he m emory [ m] i s l ocated in data memory sector 0 . if the memory [m] is located in data memory other sectors, the data can be retrieved from the program memory using the ltabrd[m] or ltabrdl[m] instructions respectively. when the instruction is executed, the lower order table byte from the program memory will be transferred to the user defned data memory register [m] as specifed in the instruction. the higher o rder t able d ata b yte f rom t he pr ogram me mory wi ll b e t ransferred t o t he t blh sp ecial register. the accompanying diagram illustrates the addressing data fow of the look-up table. table program example the following example shows how the table pointer and table data is defned and retrieved from the microcontroller. this example uses raw table data located in the program memory which is stored there usi ng t he org statement. t he va lue a t t his org st atement i s 0f 00h whi ch re fers t o t he start address of the last page within the 4 k words program memory of the bs86c16a-3 . the table pointer is setup here to have an initial value of 06h. this will ensure that the frst data read from the data table will be at the program memory address 0f 06h or 6 locations after the start of the last page. note that the value for the table pointer is referenced to the frst address of the specifc page if the t abrd [m] ins truction is being used. the high byte of the table data which in this case is equal to zero will be transferred to the tblh register automatically when the t abrd [m] instruction is executed. because the tblh register is a read /write register and can be restored, care should be taken to ensure its protection if both the main routine and interrupt s ervice routine us e table read instructions. if using the table read instructions, the interrupt service routines may change the value of the tblh and subsequently cause errors if used again by the main routine. as a rule it is recommended that simultaneous use of the table read instructions should be avoided. however , in situations where simultaneous use cannot be avoided, the interrupts should be disabled prior to the execution of any main routine table-read instructions. note that all table related instructions require two instruction cycles to complete their operation. rev. 1.40 3? de?e??e? 0?? ?01? rev. 1.40 33 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver table read program example tempreg1 db ? ; temporary register #1 tempreg2 db ? ; temporary register #2 : : mov a,06h ; initialise low table pointer - note that this address is referenced mov tblp,a mov a,0 f h ; initialise high table pointer mov tbhp,a : : tabrd tempreg1 ; transfers value in table referenced by table pointer , ; data at program memory address f 06h transferred to tempreg1 and tblh dec tblp ; reduce value of table pointer by one tabrd tempreg2 ; transfers value in table referenced by table pointer , ; data at program memory address f 05h transferred to tempreg2 and tblh ; in this example the data 1ah is transferred to tempreg1 and data 0fh to ; register tempreg2 : : org 0f 00h ; sets initial address of program memory dc 00ah, 00bh, 00ch, 00dh, 00eh, 00fh, 01ah, 01bh : : in circuit programming C icp the provision of flash type program memory provides the user with a means of convenient and easy upgrades a nd m odifcations t o t heir p rograms o n t he sa me d evice. as a n a dditional c onvenience, holtek has provided a means of programming the microcontroller in-circuit using a -pin interface. this provides manufacturers with the possibility of manufacturing their circuit boards complete with a programmed or un-programmed microcontroller , and then programming or upgrading the program at a later stage. this enables product manufacturers to easily keep their manufactured products supplied with the latest program releases without removal and re-insertion of the device. the holtek flash mcu to w riter programming pin correspondence table is as follows: holtek write pins mcu programming pins function icpda pa 0 se ? ial data/a dd ? ess input/output icpck pa ? se ? ial clo ? k input vdd vdd powe ? supply vss vss g ? ound the program memory and eeprom data memory can both be programmed serially in-circuit using this -wire inte rface. dat a is downloaded and upl oaded serial ly on a single pin wit h an additi onal line for t he c lock. t wo a dditional l ines a re re quired for t he powe r suppl y. t he t echnical de tails regarding the in-circuit programming of the device are beyond the scope of this document and will be supplied in supplementary literature. during the programming process the p a0 and p a2 i/o pins for data and clock programming purposes. the user must there take care to ensure that no other outputs are connected to these two pins. rev. 1.40 34 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 3? de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver note: * may be resistor or capacitor . the resistance of * must be greate r than 1k or the capacitance of * must be less than 1nf. on-chip debug support C ocds there are three ev chips named bs86bv12a, bs86cv16a-3 and bs86dv20a-3, which are used t o e mulate t he b s86b12a-3, b s86c16a-3 a nd b s86d20a-3 d evices r espectively. e ach e v chip device also provide s an on-chip debug function to debug the corresponding mcu device during t he de velopment proc ess. t he e v c hip a nd t he a ctual mcu de vice a re a lmost func tionally compatible except for the on-chip debug function. users can use the ev chip device to emulate the real chip device behavior by connecting the ocdsda and ocdsck pins to the holtek ht - ide development tools. the ocdsda pin is the ocds data/address input/output pin while the ocdsck pin is the ocds clock input pin. when users use the ev chip for debugging, other functions which are shared with the ocdsda and ocdsck pins in the actual mcu device will have no e ffect i n t he e v c hip. howe ver, t he t wo ocds pi ns whi ch a re pi n-shared wi th t he icp programming pins are still used as the flash memory programming pins for icp. for a more detailed ocds description, refer to the corresponding document named holtek e-link for 8-bit mcu ocds users guide. holtek e-link pins ev chip pins pin description ocdsda ocdsda on- ? hip de ? ug suppo ? t data /add ? ess input/output ocdsck ocdsck on- ? hip de ? ug suppo ? t clo ? k input vdd vdd powe ? supply gnd vss g ? ound rev. 1.40 34 de?e??e? 0?? ?01? rev. 1.40 3 ? de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ram data memory the data memory is a volatile area of 8-bit wide ram internal mem ory and is the location where temporary information is stored. structure divided into two type s, the frst of these is an area of ram, known as the special function data memory. he re a re l ocated r egisters wh ich a re n ecessary f or c orrect o peration o f t he d evice. ma ny of these registers can be read from and written to directly under program control, however , some remain protected from user manipulation. the second area of data memory is known as the general purpose data memory , which is reserved for general purpose use. all locations within this area are read and write accessible under program control. the overall data memory is subdivided into several sectors for the devices . the special purpose data memory registers addressed from 00h~7fh in data memory are common and accessible in all sector s, with the exception of the eec register at address 40h which is only accessible in sector 1. switching betwee n the dif ferent data memory sector s is achieved by properly setting the memory pointers to the correct value. the start address of the data memory for all devices is the address 00h. device special puroise data memory general puroise data memory capacity sectors capacity sectors bs8 ? b1 ? a-3 384 8 se ? to ? 0~ ? : 00h~7fh (eec ? egiste ? at 40h only a ?? essi ? le in se ? to ? 1) 384 8 se ? to ? 0: 80h~ffh se ? to ? 1: 80h~ffh se ? to ? ? : 80h~ffh bs8 ? c1 ? a-3 ? 1 ? 8 se ? to ? 0~3: 00h~7fh (eec ? egiste ? at 40h only a ?? essi ? le in se ? to ? 1) ? 1 ? 8 se ? to ? 0: 80h~ffh se ? to ? 1 : 80h~ffh se ? to ? ? : 80h~ffh se ? to ? 3 : 80h~ffh bs8 ? d ? 0a-3 7 ? 8 8 se ? to ? 0 ~ ? : 00h~7fh (eec ? egiste ? at 40h only a ?? essi ? le in se ? to ? 1) 7 ? 8 8 se ? to ? 0: 80h~ffh se ? to ? 1 : 80h~ffh se ? to ? ? : 80h~ffh se ? to ? 3 : 80h~ffh se ? to ? 4 : 80h~ffh se ? to ? ? : 80h~ffh data memory sturcture spe?ial fun?tion data me?o?y gene?al pu?pose data me?o?y 00h 7fh 80h ffh 40h in se?to? 1 se?to? 0 se?to? 1 eec se?to? n n=? fo? bs8?b1?a-3; n=3 fo? bs8?c1?a-3; n=? fo? bs8?d?0a-3 data memory structure rev. 1.40 3 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 37 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver data memory addressing for th ese device s that support the extended instructions, there is no bank pointer for data memory . for data memory the desired sector is pointed by the mp1h or mp2h register and the certain data memory address in the selected sector is specifed by the mp1l or mp2l register when using indirect addressing access. direct addressing can be used in all sectors using the corresponding instruction which can address all available data memory space. for the accessed data memory which is located in any data memory s ectors except s ector 0, the extended ins tructions can be us ed to acces s the data memory instead o f u sing t he i ndirect a ddressing a ccess. t he m ain d ifference b etween st andard i nstructions and extended instructions is that the data memory address m in the extended instructions can be composed of two bytes , the high byte indicates a sector and the low byte indicates a specifc address. general purpose data memory all microcontroller programs require an area of read/write memory where temporary data can be stored and retrieve d for use later . it is this area of ram memory that is known as general purpose data memory . this area of data memory is fully accessible by the user programing for both reading and writing operations. by using the bit operation instructions individual bits can be set or reset under program control giving the user a lar ge range of fexibility for bit manipulation in the data memory. special purpose data memory this area of data memory is where registers, necessary for the correct operation of the microcontroller, are stored. most of the registers are both readable and writeable but some are protected and are readable only , the details of which are located under the relevant special function register section. note that for locat ions that are unused, any read instruction to these addresses will return the value 00h. rev. 1.40 3? de?e??e? 0?? ?01? rev. 1.40 37 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver 00h iar0 01h mp0 0?h iar1 03h mp1l 04h 0?h acc 0?h pcl 07h tblp 08h tblh 09h tbhp 0ah status 0bh 0ch ctrl 0dh pc 0eh 0fh 10h adcr1 11h acerl 1?h 19h intc1 18h intc0 1bh 1ah 1dh 1ch 1fh intc? intc3 13h 14h slcdc1 1?h slcdc? 1?h 17h : unused? ?ead as 00h tmpc ?0h ?1h ??h ?9h ?8h ?bh ?ah ?dh ?ch ?fh ?eh ?3h ?4h ??h ??h ?7h 40h 41h 4?h 43h 44h 4?h 4?h 47h 48h 49h 4ah 4bh 4ch 4dh 4eh 4fh ?0h ?1h ??h ?3h ?4h lvdc 1eh slcdc0 eec se?to? 0~? se?to? 0? ? se?to? 1 ??h ??h ?0h ?1h ??h ?3h ?4h ??h ??h ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh 70h 30h 31h 3?h 38h 3ch 33h 34h 3?h 3?h 37h 3bh 39h 3ah 71h 7?h 73h 74h 7?h 7?h 77h pawu pac papu 3dh 3fh 3eh 7fh mp1h iar? mp?l mp?h pcc adcr0 ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh smod tbc sledc1 wdtc eed eea simtoc pbc pbpu simc?/sima simc1 simd ucr? brg pcpu 78h 79h 7ah 7bh 7ch 7dh 7eh integ pa sledc0 pscr pb simc0 usr ucr1 txr_rxr adrl adrh ifs tktmr tkc0 tk1?dl tk1?dh tkc1 tkm01?dl tkm01?dh tkm0rol tkm0roh tkm0c0 tkm0c1 tkm11?dl tkm11?dh tkm1rol tkm1roh tkm1c0 tkm1c1 tkm?1?dl tkm?1?dh tkm?rol tkm?roh tkm?c0 tkm?c1 ctm0c0 ctm0c1 ctm0dl ctm0dh ctm0al ctm0ah ptm1c0 ptm1c1 ptm1dl ptm1dh ptm1al ptm1ah ptm1rpl ptm1rph ptm?c0 ptm?c1 ptm?dl ptm?dh ptm?al ptm?ah ptm?rpl ptm?rph bs86b12a-3 special purpose data memory rev. 1.40 38 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 39 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver 00h iar0 01h mp0 0?h iar1 03h mp1l 04h 0?h acc 0?h pcl 07h tblp 08h tblh 09h tbhp 0ah status 0bh 0ch ctrl 0dh pc 0eh 0fh 10h adcr1 11h acerl 1?h 19h intc1 18h intc0 1bh 1ah 1dh 1ch 1fh intc? intc3 13h 14h slcdc1 1?h slcdc? 1?h 17h : unused? ?ead as 00h tmpc slcdc3 ?0h ?1h ??h ?9h ?8h ?bh ?ah ?dh ?ch ?fh ?eh ?3h ?4h ??h ??h ?7h 40h 41h 4?h 43h 44h 4?h 4?h 47h 48h 49h 4ah 4bh 4ch 4dh 4eh 4fh ?0h ?1h ??h ?3h ?4h lvdc 1eh slcdc0 eec se?to? 0~3 se?to? 0? ?? 3 se?to? 1 ??h ??h ?0h ?1h ??h ?3h ?4h ??h ??h ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh 70h 30h 31h 3?h 38h 3ch 33h 34h 3?h 3?h 37h 3bh 39h 3ah 71h 7?h 73h 74h 7?h 7?h 77h pawu pac papu 3dh 3fh 3eh 7fh mp1h iar? mp?l mp?h pcc adcr0 ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh smod tbc sledc1 wdtc eed eea simtoc pbc pbpu simc?/sima simc1 simd ucr? brg pcpu 78h 79h 7ah 7bh 7ch 7dh 7eh integ pa sledc0 pscr pb simc0 usr ucr1 txr_rxr adrl adrh pd pdc pdpu tktmr tkc0 tk1?dl tk1?dh tkc1 tkm01?dl tkm01?dh tkm0rol tkm0roh tkm0c0 tkm0c1 tkm11?dl tkm11?dh tkm1rol tkm1roh tkm1c0 tkm1c1 tkm?1?dl tkm?1?dh tkm?rol tkm?roh tkm?c0 tkm?c1 tkm31?dl tkm31?dh tkm3rol tkm3roh tkm3c0 tkm3c1 ctm0c0 ctm0c1 ctm0dl ctm0dh ctm0al ctm0ah ptm1c0 ptm1c1 ptm1dl ptm1dh ptm1al ptm1ah ptm1rpl ptm1rph ptm?c0 ptm?c1 ptm?dl ptm?dh ptm?al ptm?ah ptm?rpl ptm?rph bs86c16a-3 special purpose data memory rev. 1.40 38 de?e??e? 0?? ?01? rev. 1.40 39 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver 00h iar0 01h mp0 0?h iar1 03h mp1l 04h 0?h acc 0?h pcl 07h tblp 08h tblh 09h tbhp 0ah status 0bh 0ch ctrl 0dh pc 0eh 0fh 10h adcr1 11h acerl 1?h 19h intc1 18h intc0 1bh 1ah 1dh 1ch 1fh intc? intc3 13h 14h slcdc1 1?h slcdc? 1?h 17h : unused? ?ead as 00h tmpc slcdc3 ?0h ?1h ??h ?9h ?8h ?bh ?ah ?dh ?ch ?fh ?eh ?3h ?4h ??h ??h ?7h 40h 41h 4?h 43h 44h 4?h 4?h 47h 48h 49h 4ah 4bh 4ch 4dh 4eh 4fh ?0h ?1h ??h ?3h ?4h lvdc 1eh slcdc0 eec se?to? 0~? se?to? 0? ?~? se?to? 1 ??h ??h ?0h ?1h ??h ?3h ?4h ??h ??h ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh 70h 30h 31h 3?h 38h 3ch 33h 34h 3?h 3?h 37h 3bh 39h 3ah 71h 7?h 73h 74h 7?h 7?h 77h pawu pac papu 3dh 3fh 3eh 7fh mp1h iar? mp?l mp?h pcc adcr0 ?7h ?8h ?9h ?ah ?bh ?ch ?dh ?eh ?fh smod tbc sledc1 wdtc eed eea simtoc pbc pbpu simc?/sima simc1 simd ucr? brg pcpu 78h 79h 7ah 7bh 7ch 7dh 7eh integ pa sledc0 pscr pb simc0 usr ucr1 txr_rxr adrl adrh pd pdc pdpu tktmr tkc0 tk1?dl tk1?dh tkc1 tkm01?dl tkm01?dh tkm0rol tkm0roh tkm0c0 tkm0c1 tkm11?dl tkm11?dh tkm1rol tkm1roh tkm1c0 tkm1c1 tkm?1?dl tkm?1?dh tkm?rol tkm?roh tkm?c0 tkm?c1 tkm31?dl tkm31?dh tkm3rol tkm3roh tkm3c0 tkm3c1 ctm0c0 ctm0c1 ctm0dl ctm0dh ctm0al ctm0ah ptm1c0 ptm1c1 ptm1dl ptm1dh ptm1al ptm1ah ptm1rpl ptm1rph tkm41?dl tkm41?dh tkm4rol tkm4roh tkm4c0 tkm4c1 ptm?c0 ptm?c1 ptm?dl ptm?dh ptm?al ptm?ah ptm?rpl ptm?rph BS86D20A-3 special purpose data memory rev. 1.40 40 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 41 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver special function register description most of the special function register details will be described in the relevant functional section, however several registers require a separate description in this section. indirect addressing registers C iar0, iar1, iar2 the indirect addressing registers, iar0 , iar1 and iar 2 , although having their locations in normal ram r egister sp ace, d o n ot a ctually p hysically e xist a s n ormal r egisters. t he m ethod o f i ndirect addressing for ram da ta m anipulation use s t hese indi rect addre ssing re gisters a nd me mory pointers, i n c ontrast t o di rect m emory a ddressing, where t he a ctual m emory a ddress i s spe cifed. actions on t he iar0 , iar1 a nd iar 2 re gisters wi ll re sult i n no a ctual re ad or writ e ope ration t o these registers but rather to the memory location specifed by their corresponding memory pointers, mp0 , mp1l/mp1h or mp 2l/mp2h . acting as a pair , iar0 and mp0 can together access data from sector 0 while the iar1 register together with mp1l/mp1h register pair and iar2 register together with mp2l/mp2h register pair can access data from any sector. as the indirect addressing registers are not physically implemented, reading the indirect addressing registers directly will return a result of 00h and writing to the registers directly will result in no operation. memory pointers C mp0, mp1l/mp1h, mp2l/mp2h five me mory po inters, k nown a s mp0 , mp1 l, mp1 h, mp2 l a nd mp 2h a re p rovided. t hese memory pointers are physically implemented in the data memory and can be manipulated in the same way as normal registers providing a convenient way with which to address and track data. when any operation to the relevant indirect addressing registers is carried out, the actual address that the microcontroller is directed to is the address specifed by the related memory pointer . mp0, together with indirect addressing register, iar0, are used to access data from sector 0, while mp1 l/ mp1h together with iar1 and mp2l/mp2h together with iar2 are used to access data from all sector s according to the corresponding mp1h or mp2h register . direct addressing can be used in all sector s using the correspongding instruction which can address all available data memory space . the following example shows how to clear a section of four data memory locations already defned as locations adres1 to adres4. indirect addressing program example example 1 data .section data adres1 d b adres2 d b adres3 d b adres4 d b block d b code .section at 0 code org00h start : m ov a , 04h setup size of block m ov block , a m ov a , offset adres1 ; accumulator loaded with frst ram address a ; setup memory pointer with frst ram address c lr iar0 ; clear the data at address defned by mp0 rev. 1.40 40 de?e??e? 0?? ?01? rev. 1.40 41 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ? example 2 data .section data adres1 db ? adres2 db ? adres3 db ? adres4 db ? block db ? code .section at 0 code org 00h start: m ov a,04h ; setup size of block m ov block,a m ov a,01h ; setup the memory sector m ov mp1h,a dhdh ffddhlk50dh d hhlhlk50dh loop: f ,5 1 fhdkhddddhhhe03 l f lfhhhlh03 s dz block ; check if last memory location has been cleared j mp loop continue: : the important point to note here is that in the example shown above, no reference is made to specifc data memory addresses. direct addressing program example using extended instructions data .section data temp db ? code .section at 0 code org 00h start: lmov a ,[m] ; move [m] data to acc lsub a , [m+1] ; compare [m] and [m+1] data snz c ; [m]>[m+1]? jmp continue ; no lmov a ,[m] ; yes, exchange [m] and [m+1] data mov temp,a lmov a,[m+1] lmov [m],a mov a,temp lmov [m+1],a continue: : note: here m is a data memory address located in any data memory sectors. for example, m=1f0h, it indicates address 0f0h in sector 1. rev. 1.40 4 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 43 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver accumulator C acc the a ccumulator is central to the operation of any microcontroller and is clos ely related w ith operations carried out by the alu. the accumulator is the place where all intermediate results from the alu are stored. w ithout the accumulator it would be necessary to write the result of each c alculation or l ogical ope ration suc h a s a ddition, subt raction, shi ft, e tc., t o t he da ta me mory resulting i n highe r program ming and t iming overheads. da ta t ransfer operat ions usual ly i nvolve the t emporary st orage func tion of t he ac cumulator; for e xample, whe n t ransferring da ta be tween one user - defined register and another , it is necessary to do this by passing the data through the accumulator as no direct transfer between two registers is permitted. program counter low register C pcl to provide additional program control functions, the low byte of the program counter is made accessible to programmers by locating it within the special purpose area of the data memory . by manipulating this register , direct jumps to other program locations are easily implemented. loading a value directly into this pcl register will cause a jump to the specifed program memory location, however, as the register is only 8-bit wide, only jumps within the current program memory page are permitted. when such operations are used, note that a dummy cycle will be inserted. look-up table registers C tblp, tbhp, tblh these three special function registers are used to cont rol operation of the look-up table which is stored i n t he progra m me mory. t blp a nd t bhp a re t he t able poi nter s a nd i ndicate t he l ocation where the table data is located. their value must be setup before any table read commands are executed. their value can be changed, for example using the inc or dec instructions, allowing for easy table data pointing and reading. tblh is the location where the high order byte of the table data is stored afte r a table read data instruction has been executed. note that the lower order table data byte is transferred to a user defned location. status register C status this 8-bit register contains the zero fag (z), carry fag (c), auxiliary carry fag (ac), overfow fag (ov), sc fag, cz fag, power down fag (pdf), and watchdog time-out fag (t o). these arithmetic/ logical o peration a nd sy stem m anagement fa gs a re u sed t o r ecord t he st atus a nd o peration o f t he microcontroller. with the exception of the to and pdf fags, bits in the status register can be altered by instructions like most other registers. any data written into the status register will not change the t o or pdf fag. in addition, operations related to the status register may give dif ferent results due to the dif ferent instruction operati ons. the t o fag can be af fected only by a system power -up, a wdt time-out or by executing the clr wdt or hal t instruction. the pdf fag is af fected only by executing the halt or clr wdt instruction or during a system power-up. the z, ov, ac , c sc and cz fags generally refect the status of the latest operations. ? c is set if an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation; otherwise c is cleared. c is also affected by a rotate through carry instruction. ? ac is set if an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction; otherwise ac is cleared. ? z is set if the result of an arithmetic or logical operation is zero; otherwise z is cleared. ? ov is set if an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit, or vice versa; otherwise ov is cleared. rev. 1.40 4? de?e??e? 0?? ?01? rev. 1.40 43 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ? pdf is cleared by a system power-up or executing the clr wdt instruction. pdf is set by executing the halt instruction. ? to is cleared by a system power-up or executing the clr wdt or halt instruction. t o is set by a wdt time-out. ? sc is the result of the xor operation which is performed by the ov fag and the msb of the current instruction operation result. ? cz is the operational result of different fags for different instructions. refer to register defnitions for more details. in additio n, on entering an interrup t sequence or executing a subroutine call, the status register will not be pushed onto the stack automatically . if the contents of the status registers are important and if the subroutine can corrupt the status register, precautions must be taken to correctly save it. status register bit 7 6 5 4 3 2 1 0 na ? e sc cz to pdf ov z ac c r/w r r r r r/w r/w r/w r/w por x x 0 0 x x x x x unknown bit 7 sc : the result of the xor operation which is performed by the ov fag and the msb of the instruction operation result. bit 6 cz : the the operational result of different fags for different instuctions. for sub/subm/lsub/lsubm instructions, the cz fag is equal to the z fag. for sbc/sbcm/lsbc/lsbcm instructions, the cz flag is the and operation result which is performed by the previous operation cz fag and current operation zero fag. for other instructions, the cz fag willl not be affected. b it 5 to : w atchdog t ime-out fag 0: after power up or executing the clr wdt or halt instruction 1: a watchdog time-out occurred. b it 4 pdf : power down fag 0: after power up or executing the clr wdt instruction 1: by executing the halt instruction b it 3 ov : overfow fag 0: no overfow 1: an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit or vice versa. b it 2 z : zero fag 0: the result of an arithmetic or logical operation is not zero 1: the result of an arithmetic or logical operation is zero b it 1 ac : auxiliary fag 0: no auxiliary carry 1: an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction b it 0 c : carry fag 0: no carry-out 1: an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation c is also affected by a rotate through carry instruction. rev. 1.40 44 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 4? de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver eeprom data memory t he device s contain an area of internal eeprom data memory . eeprom, which stands for electrically erasable programmable read only memory , is by its nature a non-volatile form of memory, with data retention even when its power supply is removed. by incorporating this kind of d ata m emory, a wh ole n ew h ost o f a pplication p ossibilities a re m ade a vailable t o t he d esigner. the a vailability o f e eprom st orage a llows i nformation su ch a s p roduct i dentifcation n umbers, calibration values , s pecifc us er data, s ystem s etup data or other product information to be s tored directly within the product microcontroller . the process of reading and writing data to the eeprom memory has been reduced to a very trivial affair. eeprom data memory structure the eeprom data memory capacity is 648 bits. unlike the program memory and ram data memory, the eeprom data memory is not directly mapped and is therefore not directly accessible in the same w ay as the other types of memory . read and w rite operations to the eep rom are carried o ut i n single b yte o perations u sing a n a ddress a nd d ata r egister i n sector 0 a nd a si ngle control register in sector 1. device capacity address bs8 ? b1 ? a-3 ? 48 00h~3fh bs8 ? c1 ? a-3 bs8 ? d ? 0a-3 eeprom registers three registers control the overall operation of the internal eeprom data memory . these are the address register , eea, the data register , eed and a single control register , eec. as both the eea and eed registers are located in sector 0, they can be directly accessed in the same way as any other special function register . the eec register however , being located in sector 1, cannot be directly addressed directly and can only be read from or written to indirectly using the mp1 h/mp1l or mp2h/mp2l memory pointer and indirect addressing register , iar1 or iar2 . because the eec control register is located at address 40h in sector 1, the memory pointer low byte register , mp1l or mp2l, must frst be set to the value 40h and the memory pointer high byte register , mp1h or mp2h , set to the value, 01h, before any operations on the eec register are executed. eeprom control registers list name bit 7 6 5 4 3 2 1 0 eea d ? d4 d3 d ? d1 d0 eed d7 d ? d ? d4 d3 d ? d1 d0 eec wren wr rden rd eea register bit 7 6 5 4 3 2 1 0 na ? e d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 b it 7 ~ 6 unimplemented, read as 0 b it 5 ~ 0 data eeprom address data eeprom address bit 5 ~ bit 0 rev. 1.40 44 de?e??e? 0?? ?01? rev. 1.40 4 ? de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver eed register bit 7 6 5 4 3 2 1 0 na ? e d7 d ? d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 b it 7 ~ 0 data eeprom data data eeprom data bit 7 ~ bit 0 eec register bit 7 6 5 4 3 2 1 0 na ? e wren wr rden rd r/w r/w r/w r/w r/w por 0 0 0 0 b it 7 ~ 4 unimplemented, read as 0 b it 3 wren : data eeprom w rite enable 0: disable 1: enable this is the d ata eep rom w rite enable bit w hich mus t be s et high before d ata eeprom write operations are carried out. clearing this bit to zero will inhibit data eeprom write operations. b it 2 wr : eeprom w rite control 0: w rite cycle has fnished 1: activate a write cycle this i s t he da ta e eprom w rite c ontrol b it a nd wh en se t h igh b y t he a pplication program will activate a write cycle. this bit will be automatically reset to zero by the hardware after the write cycle has fnished. setting this bit high will have no ef fect if the wren has not frst been set high. b it 1 rden : data eeprom read enable 0: disable 1: enable this is the data eeprom read enable bit which must be set high before data eeprom read operations are carried out. clearing this bit to zero will inhibit data eeprom read operations. b it 0 rd : eeprom read control 0: read cycle has fnished 1: activate a read cycle this is the data eeprom read control bit and when set high by the applic ation program will activate a read cycle. this bit will be automatically reset to zero by the hardware after the read cycle has fnished. setting this bit high will have no ef fect if the rden has not frst been set high. note: the wren, wr, rden and rd can not be set to 1 at the same time in one instruction. the wr and rd can not be set to 1 at the same time. rev. 1.40 4 ? de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 47 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver reading data from the eeprom to read data from the eeprom, the read enable bit, rden, in the eec register must frst be set high to enable the read function. the eeprom address of the data to be read must then be placed in the eea registe r. if the rd bit in the eec register is now set high, a read cycle will be initiated. setting the rd bit high will not initiate a read operation if the rden bit has not been set. when the read cycle term inates, the rd bit will be automatically cleared to zero, after which the data can be read from the eed register . the data will remain in the eed register until another read or write operation is executed. the application program can poll the rd bit to determine when the data is valid for reading. writing data to the eeprom to write data to the eeprom, the eeprom address of the data to be written must frst be placed in the eea register and the data placed in the eed register . then the write enable bit, wren, in the eec register must first be set high to enable the write function. after this, the wr bit in the e ec r egister m ust b e i mmediately se t h igh t o i nitial a wr ite c ycle. t hese t wo i nstructions must be executed consecutively . the global interrupt bit emi should also frst be cleared before implementing any write operations, and then set again after the write cycle has started. note that s etting t he w r bi t hi gh wi ll not i nitiate a wr ite c ycle i f t he w ren bi t ha s not be en se t. as t he eeprom write cycle is controlled using an internal timer whose operation is asynchronous to microcontroller system clock, a certain time will elapse before the data will have been written into the eeprom. detecting when the write cycle has fnished can be implemented either by polling the wr bit in the eec register or by using the eeprom interrupt. when the write cycle terminates, the wr bit will be automatically cleared to zero by the microcontroller , informing the user that the data has been written to the eeprom. the application program can therefore poll the wr bit to determine when the write cycle has ended. write protection protection against inadvertent write operation is provided in several ways. after the device is powered-on t he w rite e nable bi t i n t he c ontrol re gister wi ll be c leared pre venting a ny wri te operations. also at power -on the memory pointer high byte register , mp1h or mp2h , will be reset to zero, which means that data memory sector 0 will be selected. as the eeprom control register is located in sector 1, this adds a further measure of protection against spurious write operations. during normal program operation, ensuring that the w rite enable bit in the control register is cleared will safeguard against incorrect write operations. eeprom interrupt the eeprom write interrupt is generated when an eeprom write cycle has ended. the eeprom interrupt m ust frst be enable d by set ting the dee bit in the rele vant int errupt regist er. when an eeprom write cycle ends, the def request flag will be set. if the global and eeprom write interrupts is enabled and the stack is not full, a jump to the associated interrupt vector will take place. when the interrupt is serviced, the eeprom interrupt fag will be automatically reset. rev. 1.40 4? de?e??e? 0?? ?01? rev. 1.40 47 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver programming considerations care must be taken that data is not inadvertently written to the eeprom. protection can be enhanced by ensuring that the w rite enable bit is normally cleared to zero when not writing. also the memory po inter hi gh byt e re gister could be norm ally c leared t o z ero a s t his woul d i nhibit access to sector 1 where the eeprom control register exist. although certainly not necessary , consideration might be given in the application program to the checking of the validity of new write data by a simple read back process. when writing data the wr bit must be set high immediately after the wren bit has been set high, to ensure the write cycle executes correctly . the global interrupt bit emi should also be cleared before a write cycle is executed and then re-enabled after the write cycle starts. note that the devices should not enter the idle or sleep mode until the eeprom read or write operation is totally completed. otherwise, the eeprom read or write operation will fail. programming examples reading data from the eeprom C polling method mov a, eeprom_adres ; user defned address mov eea, a mov a, 040h ; setup memory pointer low byte mp1l mov mp1l, a ; mp1l points to eec register mov a, 01h ; setup memory pointer high byte mp1h mov mp1h, a set iar1.1 ; set rden bit, enable read operations set iar1.0 ; start read cycle - set rd bit back: sz iar1.0 ; check for read cycle end jmp back clr iar1 ; disable eeprom read/write clr mp1h mov a, eed ; move read data to register mov read_data, a writing data to the eeprom - polling method mov a, eeprom_adres ; user defned address mov eea, a mov a, eeprom_data ; user defned data mov eed, a mov a, 040h ; setup memory pointer low byte mp1l mov mp1l, a ; mp1l points to eec register mov a, 01h ; setup memory pointer high byte mp1h mov mp1h, a clr emi set iar1.3 ; set wren bit, enable write operations set iar1.2 ; start write cycle - set wr bit C executed immediately after ; set wren bit set emi back: sz iar1.2 ; check for write cycle end jmp back clr iar1 ; disable eeprom read/write clr mp1h rev. 1.40 48 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 49 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver oscillators various osc illator opti ons of fer t he use r a wi de ra nge of funct ions a ccording t o t heir va rious application r equirements. t he f lexible f eatures o f t he o scillator f unctions e nsure t hat t he b est optimisation can be achieved in terms of speed and power saving. oscillator selections and operation are selected through a combination of confguration options and registers. oscillator overview all the devices include two internal oscillators and some devices also include an external oscillator . in addition to being the source of the main system clock the oscillators also provide clock sources for the watchdog t imer , t ime base s and tms . external oscillator requiring some external components as well as f ully integrated internal oscillators requiring no external components, are provided to form a wide range of both fast and slow system oscillators. for the bs86c16a-3 and BS86D20A-3 devices, the low speed oscillators are selected through the confguration option. the higher frequency oscillators provide higher performance but carry with it the disadvantage of higher power re quirements, whi le t he op posite i s of c ourse t rue fo r t he l ower fre quency osc illators. w ith the capability of dynamically switching between fast and slow system clock, the device s ha ve the fexibility to optimize the performance/power ratio, a feature especially important in power sensitive portable applications. device type name freq. pins all th ? ee devi ? es inte ? nal high speed rc hirc 8/1 ? /1 ? mhz inte ? nal low speed rc lirc 3 ? khz bs8 ? c1 ? a-3/bs8 ? d ? 0a-3 exte ? nal low speed c ? ystal lxt 3 ? 7 ? 8hz xt1/xt ? oscillator types 6vwhp&orfn&rjxudwlrv there are three methods of generating the system clock, a high speed oscillator and two low speed oscillator s . the high speed oscillator is the internal 8mhz, 1 2mhz, 16 mhz rc oscillator . the two low spe ed osc illator s are t he i nternal 32 khz oscillator , l irc, a nd t he e xternal 32 .768khz c rystal oscillator, lxt . selecting whether the low or high speed oscillator is used as the system oscillator is implemented using the hlclk bit and cks2 ~ cks0 bits in the smod register and as the system clock can be dynamically selected. the a ctual sou rce c lock use d fo r t he l ow spe ed o scillator c omes fr om t he l irc osc illator o r i s chosen via confguration option depending on the selected device. the frequency of the slow speed or high speed system clock is also determined using the hlclk bit and cks2 ~ cks0 bits in the smod register . note that two oscillator selections must be made namely one high speed and one low speed system oscillators. it is not possible to choose a no-oscillator selection for either the high or low speed oscillator. internal rc oscillator C hirc the internal rc oscillator is a fully integrated system oscillator requiring no external components. the internal rc os cillator has a pow er on default frequency of 8 m hz but can be s elected to be either 8mhz, 12mhz or 16mhz via a confguration option and the hircs1 and hircs0 bits in the ctrl register . device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. rev. 1.40 48 de?e??e? 0?? ?01? rev. 1.40 49 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver ? ?? ? ? ? ? ? - ? ? ? ? ? ? ? note: for the bs86b12a-3 device, f sub is directly sourced from the lirc oscillator without confguration option. system clock confgurations internal 32khz oscillator C lirc the internal 32khz system oscillat or is one of the low frequency oscillator s . it is a fully integrated rc osc illator wi th a t ypical fre quency of 32khz a t 5v , re quiring no e xternal c omponents for i ts implementation. device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. external 32.768khz crystal oscillator C lxt for the bs86c16a-3 and BS86D20A-3 devices, the external 32.768khz crystal system oscillator is one of t he l ow fre quency osc illator c hoices, whi ch i s sel ected vi a c onfiguration opt ion. t his clock source has a fxed frequency of 32.768khz and requires a 32.768khz crystal to be connected between pi ns xt 1 a nd xt 2. t he e xternal re sistor a nd c apacitor c omponents c onnected t o t he 32.768khz crystal are necessary to provide oscillation. for applications where precise frequencies are essential, these components may be required to provide frequency compensation due to dif ferent crystal m anufacturing t olerances. duri ng po wer-up t here i s a t ime de lay a ssociated wi th t he l xt oscillator waiting for it to start-up. when the microco ntroller enters the sleep or idle mode, the system clock is switched of f to stop microcontroller a ctivity a nd t o c onserve powe r. howe ver, i n m any m icrocontroller a pplications it may be necessary to keep the internal timers operational even when the microcontroller is in the sleep or idle mode. t o do this, another clock, independent of the system clock, must be provided. however, for some crystals, to ensure oscillation and accurate frequency generation, it is necessary to add two small value external capacitors, c1 and c2. the exact values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturer specification. the external parallel feedback resistor, rp, is required. rev. 1.40 ? 0 de ? e ?? e ? 0 ?? ? 01 ? rev. 1.40 ?1 de?e??e? 0?? ?01? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver the confguration option determine s if the xt1/xt2 pins are used for the lxt oscillator or as i/o pins or other pin-shared functions . ? if the lxt oscillator is not used for any clock source, the xt1/xt2 pins can be used as normal i/ o pins or other pin-shared functions . ? if the lxt oscillator is used for any clock source, the 32.768khz crystal should be connected to the xt1/xt2 pins. for osci llator st ability and t o minimize t he ef fects of noise and crosst alk, i t i s i mportant t o ensure that the crystal and any associated resistors and capacitors along with interconnecting lines are all located as close to the mcu as possible. ? ? ? ? ? ?- ? ? ? external lxt oscillator lxt oscillator c1 and c2 values crystal frequency c1 c2 3 ? .7 ? 8khz 10pf 10pf note: 1. c1 and c ? values a ? e fo ? guidan ? e only. ? . r p = ? m ~100 is ? e ? o ?? ended. 32.768khz crystal recommended capacitor values lxt oscillator low power function the lxt oscillator can function in one of two modes, the quick start mode and the low power mode. the mode selection is executed using the lxtlp bit in the ctrl register. lxtlp bit lxt mode 0 qui ? k sta ? t 1 low-powe ? after pow er on , the lx tlp bit w ill be automatically cleared to zero ens uring that the lx t oscillator is in the quick start operating mode. in the quick start mode the lxt oscillator will power up a nd st abilise q uickly. ho wever, a fter t he l xt o scillator h as fu lly po wered u p i t c an be placed into the low-power mode by setting the lxtlp bit high. the oscillator will continue to run but with reduced current consumption, as the higher current consumption is only required during the lxt oscillator start-up. in power sensitive applications, such as battery applications, where power consumption must be kept to a minimum, it is therefore recommended that the application program sets the lxtlp bit high about 2 seconds after power-on. it should be noted that, no matter what condition the lxtlp bit is set to, the lxt oscillator will always function normally , the only dif ference is that it will take more time to start up if in the low- power mode. rev. 1.40 ?0 de?e??e? 0?? ?01? rev. 1.40 ? 1 de ? e ?? e ? 0 ?? ? 01 ? bs86b12a-3/bs86c16 a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver bs86b12a-3/bs86c1 6a-3/BS86D20A-3 touch a/d flash mcu with led/lcd driver operating modes and system clocks present day appl ications require that their mi crocontrollers have high performance but often sti ll demand that they consume as little power as possible, conficting requirements that are especially true i n ba ttery powe red por table a pplications. t he fa st c locks re quired for hi gh pe rformance wi ll by t heir na ture i ncrease c urrent c onsumption a nd of c ourse vi ce-versa, l ower spe ed c locks re duce current consumption. as holtek has provided these device s with both high and low speed clock sources and the means to switch between them dynamically , the user can optimise the operation of their microcontroller to achieve the best performance/power ratio. system clocks the main system clock, can come from either a high frequency , f h , or low frequency , f sub , source, and is selected using the hlclk bit and cks2~cks0 bits in the smod register . the high speed system clock is s ourced from the h irc os cillator . the low s peed s ystem clock s ource can be sourced from internal clock f sub . if f sub is selected then it can be sourced by either the lxt or lirc oscillators, selected via a confguration option. the other choice, which is a divided version of the high speed system oscillator has a range of f h /2~f h /64. ? ? ? ? ? ?- ? ? ? ? ?? ? ? ? ? ? ? ? ?? ??? ? ? ? ? ? ? ? ? ?? ???? ? ? ? ? ? ?? ? ? ? ? 6 \ v w h p & |