Part Number Hot Search : 
BZX55B43 S30S20PT A67P9318 Z2641 D75116GF PA3124D2 56000 MD203
Product Description
Full Text Search
 

To Download MC68HC05X16 Datasheet File

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


  Datasheet File OCR Text:
  hc05 MC68HC05X16/d rev. 1 MC68HC05X16 mc68hc05x32 mc68hc705x32 technical data MC68HC05X16 technical data

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 introduction modes of operation and pin descriptions memory and registers input/output ports motorola can module (mcan) programmable timer serial communications interface pulse length d/a converters analog to digital converter resets and interrupts cpu core and instruction set electrical specifications mechanical data ordering information appendices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 introduction modes of operation and pin descriptions memory and registers input/output ports motorola can module (mcan) programmable timer serial communications interface pulse length d/a converters analog to digital converter resets and interrupts cpu core and instruction set electrical specifications mechanical data ordering information appendices 2
all products are sold on motorola? terms & conditions of supply. in ordering a product covered by this document the customer agrees to be bound by those terms & conditions and nothing contained in this document constitutes or forms part of a contract (with the exception of the contents of this notice). a copy of motorola? terms & conditions of supply is availab le on request. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, in cluding without limitation consequential or incidental damages. ?ypical?parameters can and do vary in different applications. all operating parameters, including ?ypicals? must be validated for each customer application by customer? technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/affirmative action employer.
4 conventions where abbreviations are used in the text, an explanation can be found in the glossary, at the back of this manual. register and bit mnemonics are de?ed in the paragraphs describing them. an overbar is used to designate an active-low signal, eg: reset . unless otherwise stated, a shaded cell in a register diagram indicates that the bit is either unused or reserved; ? is used to indicate an unde?ed state (on reset). unless otherwise stated, a pin labelled as ?u should be tied to v ss in an electrically noisy environment. pins labelled ?c can be left ?ating, since they are not bonded to any part of the device.
customer feedback questionnaire (MC68HC05X16/d) motorola wishes to continue to improve the quality of its documentation. we would welcome your feedback on the publication you have just received. having used the document, please complete this card (or a photocopy of it, if you prefer). 1. how would you rate the quality of the document? check one box in each category. excellent poor excellent poor organization oooo tables oooo readability oooo table of contents oooo understandability oooo index oooo accuracy oooo page size/binding oooo illustrations oooo overall impression oooo comments: 2. what is your intended use for this document? if more than one option applies, please rank them (1, 2, 3). selection of device for new application o other o please specify: system design o training purposes o 3. how well does this manual enable you to perform the task(s) outlined in question 2? completely not at all comments: oooo 4. how easy is it to ?d the information you are looking for? easy dif?ult comments: oooo 5. is the level of technical detail in the following sections suf?ient to allow you to understand how the device functions? too little detail too much detail ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo comments: 6. have you found any errors? if so, please comment: 7. from your point of view, is anything missing from the document? if so, please say what: ?cut along this line to remove " section 1 introduction section 2 modes of operation and pin descriptions section 3 memory and registers section 4 input/output ports section 5 motorola can module (mcan) section 6 programmable timer section 7 serial communications interface section 8 pulse length d/a converters section 9 analog to digital converter section 10 resets and interrupts section 11 cpu core and instruction set section 12 electrical specifications section 13 mechanical data section 14 ordering information section 15 appendices 5
13. currently there is some discussion in the semiconductor industry regarding a move towards providing data sheets in electron ic form. if you have any opinion on this subject, please comment. 14. we would be grateful if you would supply the following information (at your discretion), or attach your card. name: phone no: position: fax no: department: company: address: thank you for helping us improve our documentation, graham forbes, technical publications manager, motorola ltd., scotland . ?cut along this line to remove ?third fold back along this line 8. how could we improve this document? 9. how would you rate motorolas documentation? excellent poor ?in general oooo ?against other semiconductor suppliers oooo 10. which semiconductor manufacturer provides the best technical documentation? 11. which company (in any ?ld) provides the best technical documentation? 12. how many years have you worked with microprocessors? less than 1 year o 1? years o 3? years o more than 5 years o by air mail par avion ne pas affranchir ibrs number phq-b/207/g ccri numero phq-b/207/g reponse payee grande-bretagne motorola ltd., colvilles road, kelvin industrial estate, east kilbride, g75 8br. great britain. f.a.o. technical publications manager (re: MC68HC05X16/d) no stamp required ?first fold back along this line semiconductor products sector ?second fold back along this line ? finally, tuck this edge into opposite ?p " 6
MC68HC05X16 rev. 1 motorola i table of contents paragraph number page number title table of contents 1 introduction 1.1 features ................................................................................................................ 1-2 1.2 mask options for the MC68HC05X16 .................................................................... 1-3 2 modes of operation and pin descriptions 2.1 modes of operation................................................................................................ 2-1 2.1.1 single-chip mode ............................................................................................. 2-1 2.1.2 bootstrap mode ............................................................................................... 2-2 2.1.2.1 serial ram loader ...................................................................................... 2-3 2.1.2.2 jump to ram + 1 ....................................................................................... 2-3 2.1.2.3 ?ump to any address ................................................................................ 2-3 2.2 low power modes ................................................................................................. 2-6 2.2.1 stop mode ..................................................................................................... 2-6 2.2.2 wait mode ...................................................................................................... 2-7 2.2.2.1 power consumption during wait mode ..................................................... 2-8 2.2.3 slow mode .................................................................................................... 2-8 2.2.3.1 miscellaneous register .............................................................................. 2-10 2.3 pin descriptions ..................................................................................................... 2-11 2.3.1 vdd and vss .................................................................................................. 2-11 2.3.2 irq .................................................................................................................. 2-11 2.3.3 reset............................................................................................................. 2-11 2.3.4 mds................................................................................................................. 2-12 2.3.5 tcap1 ............................................................................................................. 2-12 2.3.6 tcap2 ............................................................................................................. 2-12 2.3.7 tcmp1............................................................................................................. 2-12 2.3.8 tcmp2............................................................................................................. 2-12 2.3.9 rdi (receive data in)....................................................................................... 2-12 2.3.10 tdo (transmit data out) .................................................................................. 2-12 2.3.11 sclk ............................................................................................................... 2-13 7
motorola ii MC68HC05X16 rev. 1 table of contents paragraph number page number title 2.3.12 osc1, osc2 ................................................................................................... 2-13 2.3.12.1 crystal........................................................................................................ 2-13 2.3.12.2 ceramic resonator ..................................................................................... 2-13 2.3.12.3 external clock............................................................................................. 2-13 2.3.12.4 oscillator division ....................................................................................... 2-15 2.3.13 plma ............................................................................................................... 2-15 2.3.14 plmb ............................................................................................................... 2-15 2.3.15 vpp1 ............................................................................................................... 2-16 2.3.16 vrh ................................................................................................................. 2-16 2.3.17 vrl.................................................................................................................. 2-16 2.3.18 pa0 ?pa7/pb0 ?pb7/pc0 ?pc7 .................................................................. 2-16 2.3.19 nwoi ............................................................................................................... 2-16 2.3.20 pd0/an0?d7/an7......................................................................................... 2-16 2.3.21 vdd1 ............................................................................................................... 2-17 2.3.22 vss1 ............................................................................................................... 2-17 2.3.23 vddh .............................................................................................................. 2-17 2.3.24 rx0/rx1.......................................................................................................... 2-17 2.3.25 tx0/tx1 .......................................................................................................... 2-17 3 memory and registers 3.1 registers ............................................................................................................... 3-1 3.2 ram ...................................................................................................................... 3-1 3.3 rom ...................................................................................................................... 3-1 3.4 bootstrap rom...................................................................................................... 3-3 3.5 eeprom............................................................................................................... 3-4 3.5.1 eeprom control register ................................................................................ 3-4 3.5.2 eeprom read operation ................................................................................. 3-6 3.5.3 eeprom erase operation ............................................................................... 3-6 3.5.4 eeprom programming operation ................................................................... 3-7 3.5.5 options register (optr) .................................................................................. 3-7 3.6 eeprom during stop mode ............................................................................... 3-8 3.7 eeprom during wait mode ................................................................................ 3-8 3.8 miscellaneous register.......................................................................................... 3-11 4 input/output ports 4.1 input/output programming ..................................................................................... 4-1 4.2 ports a and b ........................................................................................................ 4-2 4.3 port c .................................................................................................................... 4- 3 4.4 port d .................................................................................................................... 4- 4 4.5 port registers ......................................................................................................... 4-4 8
MC68HC05X16 rev. 1 motorola iii table of contents paragraph number page number title 4.5.1 port data registers a and b (porta and portb) .......................................... 4-4 4.5.2 port data register c (portc).......................................................................... 4-5 4.5.3 port data register d (portd).......................................................................... 4-5 4.5.4 a/d status/control register ............................................................................... 4-5 4.5.5 data direction registers (ddra, ddrb and ddrc)........................................ 4-6 4.6 other port considerations ...................................................................................... 4-6 5 motorola can module (mcan) 5.1 tbf ?transmit buffer ............................................................................................ 5-4 5.2 rbf ?receive buffer ............................................................................................ 5-4 5.3 interface to the MC68HC05X16 cpu.................................................................... 5-4 5.3.1 mcan control register (ccntrl) ................................................................... 5-6 5.3.2 mcan command register (ccom) .................................................................. 5-7 5.3.3 mcan status register (cstat) ........................................................................ 5-10 5.3.4 mcan interrupt register (cint) ....................................................................... 5-12 5.3.5 mcan acceptance code register (cacc)........................................................ 5-13 5.3.6 mcan acceptance mask register (cacm) ...................................................... 5-14 5.3.7 mcan bus timing register 0 (cbt0) ................................................................ 5-14 5.3.8 mcan bus timing register 1 (cbt1) ................................................................ 5-16 5.3.9 mcan output control register (cocntrl)...................................................... 5-18 5.3.10 transmit buffer identi?r register (tbi)............................................................. 5-20 5.3.11 remote transmission request and data length code register (trtdl)............ 5-20 5.3.12 transmit data segment registers (tds) 1 ?8 .................................................. 5-21 5.3.13 receive buffer identi?r register (rbi) ............................................................. 5-21 5.3.14 remote transmission request and data length code register (rrtdl) ........... 5-22 5.3.15 receive data segment registers (rds) 1 ?8 .................................................. 5-22 5.4 interface to the mcan bus .................................................................................... 5-22 5.4.1 single wire operation ....................................................................................... 5-24 5.5 sleep mode ........................................................................................................... 5-24 5.5.1 sleep comparator reference ............................................................................ 5-25 6 programmable timer 6.1 counter.................................................................................................................. 6-1 6.1.1 counter register and alternate counter register ............................................... 6-3 6.2 timer control and status ........................................................................................ 6-4 6.2.1 timer control register (tcr) ............................................................................ 6-4 6.2.2 timer status register (tsr) ............................................................................. 6-6 6.3 input capture.......................................................................................................... 6-7 6.3.1 input capture register 1 (icr1) ........................................................................ 6-7 6.3.2 input capture register 2 (icr2) ........................................................................ 6-8 9
motorola iv MC68HC05X16 rev. 1 table of contents paragraph number page number title 6.4 output compare..................................................................................................... 6-9 6.4.1 output compare register 1 (ocr1) ................................................................. 6-9 6.4.2 output compare register 2 (ocr2) ................................................................. 6-10 6.4.3 software force compare................................................................................... 6-11 6.5 pulse length modulation (plm) ............................................................................. 6-11 6.5.1 pulse length modulation registers a and b (plma/plmb).............................. 6-11 6.6 timer during stop mode ..................................................................................... 6-12 6.7 timer during wait mode ...................................................................................... 6-12 6.8 timer state diagrams............................................................................................. 6-12 7 serial communications interface 7.1 sci two-wire system features................................................................................ 7-1 7.2 sci receiver features............................................................................................. 7-3 7.3 sci transmitter features......................................................................................... 7-3 7.4 functional description ........................................................................................... 7-3 7.5 data format............................................................................................................ 7-5 7.6 receiver wake-up operation.................................................................................. 7-5 7.6.1 idle line wake-up.............................................................................................. 7-6 7.6.2 address mark wake-up .................................................................................... 7-6 7.7 receive data in (rdi) ............................................................................................ 7-6 7.8 start bit detection .................................................................................................. 7-6 7.9 transmit data out (tdo)........................................................................................ 7-8 7.10 sci synchronous transmission.............................................................................. 7-9 7.11 sci registers.......................................................................................................... 7-10 7.11.1 serial communications data register (scdr) .................................................. 7-10 7.11.2 serial communications control register 1 (sccr1) ......................................... 7-10 7.11.3 serial communications control register 2 (sccr2) ......................................... 7-14 7.11.4 serial communications status register (scsr) ............................................... 7-16 7.11.5 baud rate register (baud) ............................................................................... 7-18 7.12 baud rate selection................................................................................................ 7-20 7.13 sci during stop mode......................................................................................... 7-21 7.14 sci during wait mode.......................................................................................... 7-21 8 pulse length d/a converters 8.1 miscellaneous register........................................................................................... 8-3 8.2 plm clock selection............................................................................................... 8-4 8.3 plm during stop mode ....................................................................................... 8-4 8.4 plm during wait mode ........................................................................................ 8-4 10
MC68HC05X16 rev. 1 motorola v table of contents paragraph number page number title 9 analog to digital converter 9.1 a/d converter operation......................................................................................... 9-1 9.2 a/d registers.......................................................................................................... 9-3 9.2.1 port d data register (portd).......................................................................... 9-3 9.2.2 a/d result data register (addata) ................................................................... 9-3 9.2.3 a/d status/control register (adstat)............................................................... 9-4 9.3 a/d converter during stop mode......................................................................... 9-5 9.4 a/d converter during wait mode.......................................................................... 9-6 9.5 port d analog input................................................................................................ 9-6 10 resets and interrupts 10.1 resets ................................................................................................................. 10-1 10.1.1 power-on reset............................................................................................... 10-2 10.1.2 miscellaneous register .................................................................................. 10-2 10.1.3 reset pin ..................................................................................................... 10-3 10.1.4 computer operating properly (cop) watchdog reset .................................... 10-3 10.1.4.1 cop watchdog during stop mode ......................................................... 10-5 10.1.4.2 cop watchdog during wait mode .......................................................... 10-5 10.1.5 functions affected by reset............................................................................ 10-5 10.2 interrupts ............................................................................................................. 10-7 10.2.1 interrupt priorities........................................................................................... 10-9 10.2.2 nonmaskable software interrupt (swi) .......................................................... 10-9 10.2.3 maskable hardware interrupts........................................................................ 10-9 10.2.3.1 miscellaneous register ............................................................................. 10-10 10.2.3.2 external interrupts.................................................................................... 10-11 10.2.3.3 mcan interrupt (cirq) ............................................................................ 10-11 10.2.3.4 timer interrupts ........................................................................................ 10-12 10.2.3.5 serial communications interface (sci) interrupts..................................... 10-12 10.2.4 hardware controlled interrupt sequence........................................................ 10-13 11 cpu core and instruction set 11.1 registers ............................................................................................................. 11-1 11.1.1 accumulator (a) ............................................................................................. 11-1 11.1.2 index register (x) ........................................................................................... 11-2 11.1.3 program counter (pc).................................................................................... 11-2 11.1.4 stack pointer (sp).......................................................................................... 11-2 11.1.5 condition code register (ccr)....................................................................... 11-2 11.2 instruction set ...................................................................................................... 11-3 11
motorola vi MC68HC05X16 rev. 1 table of contents paragraph number page number title 11.2.1 register/memory instructions........................................................................ 11-4 11.2.2 branch instructions ........................................................................................ 11-4 11.2.3 bit manipulation instructions.......................................................................... 11-4 11.2.4 read/modify/write instructions....................................................................... 11-4 11.2.5 control instructions........................................................................................ 11-4 11.2.6 tables ............................................................................................................ 11-4 11.3 addressing modes............................................................................................... 11-11 11.3.1 inherent ......................................................................................................... 11-11 11.3.2 immediate ...................................................................................................... 11-11 11.3.3 direct ............................................................................................................. 11-11 11.3.4 extended ....................................................................................................... 11-12 11.3.5 indexed, no offset .......................................................................................... 11-12 11.3.6 indexed, 8-bit offset ....................................................................................... 11-12 11.3.7 indexed, 16-bit offset ..................................................................................... 11-12 11.3.8 relative.......................................................................................................... 11-13 11.3.9 bit set/clear .................................................................................................... 11-13 11.3.10 bit test and branch......................................................................................... 11-13 12 electrical specifications 12.1 absolute maximum ratings .................................................................................. 12-1 12.2 dc electrical characteristics ............................................................................... 12-2 12.3 a/d converter characteristics .............................................................................. 12-4 12.4 control timing ...................................................................................................... 12-5 12.5 mcan bus interface dc electrical characteristics ............................................... 12-6 12.6 mcan bus interface control timing characteristics .............................................. 12-6 13 mechanical data 13.1 64-pin quad ?t pack (qfp) pinout ..................................................................... 13-1 13.2 64-pin quad ?t pack (qfp) mechanical dimensions.......................................... 13-2 14 ordering information 14.1 eproms............................................................................................................. 14-2 14.2 veri?ation media ................................................................................................ 14-2 14.3 rom veri?ation units (rvu) .............................................................................. 14-2 12
MC68HC05X16 rev. 1 motorola vii table of contents paragraph number page number title a mc68hc05x32 a.1 features ................................................................................................................a-1 a.2 memory map, register outline and block diagram..................................................a-2 a.3 electrical speci?ations .........................................................................................a-6 a.3.1 maximum ratings..............................................................................................a-6 a.3.2 dc electrical characteristics ...........................................................................a-7 a.3.3 a/d converter characteristics...........................................................................a-9 a.3.4 control timing...................................................................................................a-10 a.3.5 mcan bus interface dc electrical characteristics .................................................a-11 a.3.6 mcan bus interface control timing characteristics ................................................a-12 b mc68hc705x32 b.1 features ................................................................................................................b-2 b.2 vpp6 .....................................................................................................................b-2 b.3 cane.....................................................................................................................b-2 b.4 block diagram, memory map and register outline .................................................b-3 b.5 eprom .................................................................................................................b-7 b.5.1 eprom read operation....................................................................................b-7 b.5.2 eprom program operation .............................................................................b-8 b.5.3 eprom/eeprom/eclk control register ........................................................b-8 b.6 eeprom options register (optr) ........................................................................b-11 b.7 mask option register (mor) ..................................................................................b-12 b.8 bootstrap mode .....................................................................................................b-14 b.8.1 erased eprom veri?ation and eeprom erasure ........................................b-17 b.8.2 eprom/eeprom parallel bootstrap...............................................................b-17 b.8.3 serial ram loader............................................................................................b-20 b.8.3.1 jump to start of ram ($0051) ....................................................................b-20 b.9 electrical speci?ations .........................................................................................b-23 b.9.1 maximum ratings..............................................................................................b-23 b.9.2 dc electrical characteristics ............................................................................b-24 b.9.3 eprom electrical characteristics ....................................................................b-26 b.9.4 control timing...................................................................................................b-27 b.9.5 a/d converter characteristics...........................................................................b-28 b.9.6 mcan bus interface dc electrical characteristics ...........................................b-29 b.9.7 mcan bus interface control timing characteristics ..........................................b-29 13
motorola viii MC68HC05X16 rev. 1 table of contents paragraph number page number title c mc68hc05x32 high speed operation c.1 dc electrical characteristics ..................................................................................c-1 c.2 control timing .......................................................................................................c-2 14
MC68HC05X16 rev. 1 motorola ix list of figures figure number page number title list of figures 1-1 MC68HC05X16 block diagram ............................................................................... 1-4 2-1 bootstrap mode function selection ?w chart......................................................... 2-2 2-2 MC68HC05X16 ?ump to any address schematic diagram..................................... 2-4 2-3 MC68HC05X16 ?oad program in ram and execute schematic diagram............... 2-5 2-4 stop and wait ?w charts................................................................................... 2-9 2-5 slow mode divider block diagram ........................................................................... 2-10 2-6 oscillator connections ............................................................................................ 2-14 2-7 oscillator divider block diagram.............................................................................. 2-15 3-1 memory map of the MC68HC05X16 ...................................................................... 3-2 3-2 mcan module memory map .................................................................................. 3-3 4-1 standard i/o port structure..................................................................................... 4-2 4-2 eclk timing diagram ............................................................................................. 4-3 4-3 port logic levels ...................................................................................................... 4-7 5-1 mcan block diagram.............................................................................................. 5-1 5-2 mcan frame formats.............................................................................................. 5-2 5-3 mcan module memory map .................................................................................. 5-5 5-4 oscillator block diagram ......................................................................................... 5-15 5-5 segments within the bit time .................................................................................. 5-16 5-6 a typical physical interface between the mcan and the mcan bus lines ............. 5-23 6-1 16-bit programmable timer block diagram .............................................................. 6-2 6-2 timer state timing diagram for reset....................................................................... 6-13 6-3 timer state timing diagram for input capture .......................................................... 6-13 6-4 timer state timing diagram for output compare...................................................... 6-14 6-5 timer state timing diagram for timer over?w......................................................... 6-14 7-1 serial communications interface block diagram ..................................................... 7-2 7-2 sci rate generator division ..................................................................................... 7-4 7-3 data format............................................................................................................. 7-5 7-4 sci examples of start bit sampling technique ........................................................ 7-7 7-5 sci sampling technique used on all bits ................................................................ 7-7 7-6 arti?ial start following a framing error ................................................................... 7-8 7-7 sci start bit following a break................................................................................. 7-8 7-8 sci example of synchronous and asynchronous transmission .............................. 7-9 7-9 sci data clock timing diagram (m=0) ..................................................................... 7-12 15
motorola x MC68HC05X16 rev. 1 list of figures figure number page number title 7-10 sci data clock timing diagram (m=1) ......................................................................7-13 8-1 plm system block diagram .....................................................................................8-1 8-2 plm output waveform examples .............................................................................8-2 8-3 plm clock selection ................................................................................................8-4 9-1 a/d converter block diagram ...................................................................................9-2 9-2 electrical model of an a/d input pin ........................................................................9-6 10-1 reset timing diagram ............................................................................................10-1 10-2 reset external rc pull-down ..............................................................................10-3 10-3 watchdog system block diagram...........................................................................10-4 10-4 interrupt ?w chart ................................................................................................10-8 11-1 programming model ..............................................................................................11-1 11-2 stacking order .......................................................................................................11-2 12-1 timer relationship..................................................................................................12-5 13-1 64-pin qfp pinout .................................................................................................13-1 13-2 64-pin qfp mechanical dimensions .....................................................................13-2 a-1 mc68hc05x32 block diagram............................................................................... a-2 a-2 memory map of the mc68hc05x32 ...................................................................... a-3 a-3 timer relationship................................................................................................... a-11 b-1 mc68hc705x32 block diagram............................................................................. b-3 b-2 memory map of the mc68hc705x32 .................................................................... b-5 b-3 modes of operation ?w chart ................................................................................ b-15 b-4 timing diagram with handshake............................................................................. b-18 b-5 parallel eprom loader timing diagram.................................................................. b-18 b-6 eprom parallel bootstrap schematic diagram ...................................................... b-19 b-7 ram load and execute schematic diagram ............................................................ b-21 b-8 parallel ram loader timing diagram ....................................................................... b-22 b-9 timer relationship................................................................................................... b-27 16
MC68HC05X16 rev. 1 motorola xi list of tables ta b l e number page number title list of tables 1-1 data sheet appendices........................................................................................... 1-1 2-1 mode of operation selection ................................................................................... 2-1 3-1 eeprom control bits description ........................................................................... 3-6 3-2 MC68HC05X16 register outline.............................................................................. 3-9 3-3 mcan register outline ............................................................................................ 3-10 3-4 irq and woi sensitivity ......................................................................................... 3-11 4-1 i/o pin states .......................................................................................................... 4-2 5-1 synchronization jump width.................................................................................... 5-15 5-2 baud rate prescaler ................................................................................................ 5-15 5-3 time segment values ............................................................................................. 5-17 5-4 output control modes ............................................................................................. 5-18 5-5 mcan driver output levels...................................................................................... 5-19 5-6 data length codes .................................................................................................. 5-21 7-1 method of receiver wake-up ................................................................................... 7-11 7-2 sci clock on sclk pin ........................................................................................... 7-13 7-3 first prescaler stage............................................................................................... 7-18 7-4 second prescaler stage (transmitter) ..................................................................... 7-18 7-5 second prescaler stage (receiver) ......................................................................... 7-19 7-6 sci baud rate selection with cpu clock frequency = f osc /2.................................. 7-20 7-7 sci baud rate selection with cpu clock frequency = f osc /8.................................. 7-20 7-8 sci baud rate selection with cpu clock frequency = f osc /10................................ 7-20 7-9 sci transmit baud rate output for a given prescaler output .................................... 7-21 9-1 a/d clock selection ................................................................................................. 9-4 9-2 a/d channel assignment ........................................................................................ 9-5 10-1 effect of reset , por, stop and wait.............................................................. 10-6 10-2 interrupt priorities ................................................................................................. 10-9 10-3 irq and woi sensitivity ....................................................................................... 10-10 11-1 mul instruction .................................................................................................... 11-5 11-2 register/memory instructions............................................................................... 11-5 11-3 branch instructions............................................................................................... 11-6 11-4 bit manipulation instructions................................................................................. 11-6 11-5 read/modify/write instructions ............................................................................. 11-7 11-6 control instructions............................................................................................... 11-7 17
motorola xii MC68HC05X16 rev. 1 list of tables ta b l e number page number title 11-7 instruction set........................................................................................................11-8 11-8 m68hc05 opcode map .........................................................................................11-10 12-1 absolute maximum ratings ....................................................................................12-1 12-2 dc electrical characteristics..................................................................................12-2 12-3 a/d characteristics ................................................................................................12-4 12-4 control timing ........................................................................................................12-5 12-5 mcan bus interface dc electrical characteristics.................................................12-6 12-6 mcan bus interface control timing characteristics................................................12-6 14-1 mc order numbers ................................................................................................14-1 14-2 eproms for pattern generation ............................................................................14-2 a-1 register outline ...................................................................................................... a-5 a-2 maximum ratings .................................................................................................... a-6 a-3 dc electrical characteristics................................................................................... a-7 a-4 a/d characteristics ................................................................................................. a-9 a-5 control timing ......................................................................................................... a-10 1-6 mcan bus interface dc electrical characteristics.................................................. a-11 1-7 mcan bus interface control timing characteristics................................................. a-12 b-1 register outline ...................................................................................................... b-4 b-2 eprom control bits description ............................................................................. b-9 b-3 eeprom1 control bits description......................................................................... b-10 b-4 clock divide ratio selection..................................................................................... b-12 b-5 mode of operation selection ................................................................................... b-14 b-6 bootstrap vector targets in ram ............................................................................ b-20 b-7 maximum ratings .................................................................................................... b-23 b-8 dc electrical characteristics................................................................................... b-24 b-9 eprom electrical characteristics........................................................................... b-26 b-10 control timing ......................................................................................................... b-27 b-11 a/d characteristics ................................................................................................. b-28 b-12 mcan bus interface dc electrical characteristics.................................................. b-29 b-13 mcan bus interface control timing characteristics................................................. b-29 c-1 dc electrical characteristics................................................................................... c-1 c-2 control timing ......................................................................................................... c-2 18
MC68HC05X16 rev. 1 motorola 1-1 introduction 1 1 introduction the MC68HC05X16 microcomputer (mcu) is a member of motorolas mc68hc05 family of low-cost single chip microcomputers. this 8-bit mcu contains an on-board controller area network module (mcan), complete with interface circuitry, comprising output drivers, input comparators and a v dd /2 generator. in addition, the device contains an on-chip oscillator, cpu, ram, rom, eeprom, a/d converter, pulse length modulated outputs, i/o, serial communications interface, programmable timer system and watchdog. the fully static design allows operation at frequencies down to dc, reducing power consumption to a few micro-amps. this data sheet is structured such that devices similar to the MC68HC05X16 are described in a set of appendices (see table 1-1 ). note: appendix c contains only electrical characteristics exclusive to the high speed operation of the mc68hc05x32. for all other information concerning this device, refer to appendix a . table 1-1 data sheet appendices device appendix differences from MC68HC05X16 mc68hc05x32 a 32k bytes rom; increased ram mc68hc705x32 b 32k bytes eprom; increased ram; bootstrap ?mware replaced mc68hc05x32 c 32k bytes rom; increased ram; high speed operation 19
motorola 1-2 MC68HC05X16 rev. 1 introduction 1 1.1 features hardware features fully static design featuring the industry standard m68hc05 family cpu core on chip crystal oscillator with divide-by -2, -4, -8 or -10, or a software selectable divide-by -32, -64, -128 or -160 option (slow mode) 352 bytes of ram 15102 bytes of user rom plus 16 bytes of user vectors 256 bytes of byte erasable eeprom with internal charge pump and security bit write/erase protect bit for 224 of the 256 bytes eeprom bootstrap ?mware power saving stop, wait and slow modes three 8-bit parallel i/o ports and one 8-bit input-only port; wired-or interrupt capability on all port b pins motorola controller area network (mcan) with line interface circuitry software option available to output the internal e-clock to port pin pc2 16-bit timer with 2 input captures and 2 output compares computer operating properly (cop) watchdog timer serial communications interface system (sci) with independent transmitter/receiver baud rate selection; receiver wake-up function for use in multi-receiver systems 8 channel a/d converter 2 pulse length modulation systems which can be used as d/a converters one interrupt request input plus 4 on-board hardware interrupt sources 2.2 mhz bus speed ?0 to +125 c temperature range available in 64-pin quad ?t pack (qfp) package complete development system support available using the mmds05 or m68mmpfb0508 development station with the m68eml05x32 emulation module or the m68hc05xevs evaluation system 20
MC68HC05X16 rev. 1 motorola 1-3 introduction 1 1.2 mask options for the MC68HC05X16 the MC68HC05X16 has six mask options that are programmed during manufacture and must be speci?d on the order form. oscillator division ratio selection (divide-by-2, -4, -8 or -10) oscillator start-up delay following power-on or stop (t porl ) = 16 or 4064 cycles automatic watchdog enable/disable following a power-on or external reset watchdog enable/disable during wait mode wired-or interrupt enable resistive pull-downs on ports b and/or c note: it is recommended that an external clock is always used if t porl is set to 16 cycles. this will prevent any problems arising from oscillator stability when the device is put into stop mode. 21
motorola 1-4 MC68HC05X16 rev. 1 introduction 1 figure 1-1 MC68HC05X16 block diagram port a pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 port b pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 port c pc0 pc1 pc2/eclk pc3 pc4 pc5 pc6 pc7 16-bit programmable timer port d pd0/an0 pd1/an1 pd2/an2 pd3/an3 pd4/an4 pd5/an5 pd6/an6 pd7/an7 oscillator 352 bytes ram cop watchdog reset irq vdd vss osc1 osc2 m68hc05 cpu sci a/d converter plm tcap1 tcap2 tcmp1 tcmp2 vrh vrl rdi sclk tdo vpp1 256 bytes eeprom charge pump ? 2 / ? 4 / ? 8 / ? 10 plma d/a plmb d/a 8-bit 576 bytes user rom 15118 bytes bootstrap rom (including 16 bytes user vectors) line interface mcan vddh tx0 tx1 rx0 rx1 vdd1 vss1 mds nwoi 22
MC68HC05X16 rev. 1 motorola 2-1 modes of operation and pin descriptions 2 2 modes of operation and pin descriptions 2.1 modes of operation the MC68HC05X16 mcu has two modes of operation, single-chip mode and bootstrap mode. in the MC68HC05X16 the single-chip mode is the normal user operating frequency table 2-1 shows the conditions required to enter each mode on the rising edge of reset . note: on the rising edge of reset , holding the irq pin at 2 x v dd is equivalent to holding the mds pin at v dd . the device cannot enter single-chip mode unless mds is tied to v ss (or left ?ating) and irq is below v dd . 2.1.1 single-chip mode this is the normal user operating mode of the MC68HC05X16. in this mode the device functions as a self-contained microcomputer (mcu) with all on-board peripherals, including the three 8-bit i/o ports and the 8-bit input-only port, available to the user. all address and data activity occurs within the mcu. table 2-1 mode of operation selection mds irq tcap1 tcap2 pd3 pd4 mode v ss and v ss to v dd v ss to v dd x x x single-chip v dd or 2v dd v ss x 0 0 reserved for motorola use bootstrap mode: v dd or 2v dd v dd v ss 1 1 serial ram loader v dd or 2v dd v dd v ss 1 0 jump to ram + 1 v dd or 2v dd v dd v ss 0 1 jump to any address 23
motorola 2-2 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 2.1.2 bootstrap mode to place the part in bootstrap mode, the following conditions must be met during transition of the reset pin from low to high: 1) irq pin at 2xv dd or mds pin at v dd 2) tcap1 pin at v dd 3) tcap2 pin at v ss pd4 and pd3 are connected according to the values given in table 2-1 to select the devices function from the following three functions: execute serial ram loader program jump to ram + 1 jump to any address if the sec bit in the option register is set, on ?st entering bootstrap mode the ram and the eeprom are completely erased. the option register which contains the security bit is erased last, before any program can be executed. the bootstrap software is implemented in the following locations: ram load and execute from $03b0 to $03fd vectors and program select from $7f80 to $7fef figure 2-1 bootstrap mode function selection ?w chart save pd in ram. erase whole eeprom + ram and check eprom + sec bit. entry pd4 set ? pd3 set ? sec bit active? jump to address de?ed by ports a, b and c. no yes yes no no pd4 set ? reserved for motorola use. serial ram bootstrap loader. jump to ram + 1. yes no yes 24
MC68HC05X16 rev. 1 motorola 2-3 modes of operation and pin descriptions 2 note: oscillator divide-by-two is forced in bootstrap mode; all other mask options are selected by the customer (see section 1.2 ). 2.1.2.1 serial ram loader in the ?oad program in ram and execute routine, user programs are loaded into mcu ram via the sci port and then executed. data is loaded sequentially, starting at ram location $0050, until the last byte is loaded. the ?st byte loaded is the count of the total number of bytes in the program plus the count byte. after completion of ram loading, control can be transferred either to the second byte in ram, $0051, by executing a jump to ram + 1 function, or it can be transferred to any address by executing a jump to any address function. during the ?mware initialization stage, the sci is con?ured for the nrz data format (idle line, start bit, eight data bits and stop bit). the baud rate is 9600 with a 4 mhz crystal. a program to convert ascii s-records to the format required by the ram loader is available from motorola. when the last byte is loaded, the ?mware halts operation expecting additional data to arrive. at this point, the reset switch is placed in the reset position which resets the mcu, but keeps the ram program intact. all routines loaded in ram can now be entered from this state, including the one which executes the program in ram (see section 2.1.2.2 and section 2.1.2.3 ). to load a program in the eeprom, the ?oad program in ram and execute function is also used. in this instance the process involves two distinct steps. firstly, the ram is loaded with a program which controls the loading of the eeprom, and when the ram contents are executed, the mcu is instructed to load the eeprom. the erased state of the eeprom is $ff. figure 2-3 shows the schematic diagram of the circuit required for the serial ram loader. 2.1.2.2 jump to ram + 1 after the serial ram loader program is completed this function can be used to execute a program loaded in ram starting at the second ram address, $0051. it must be noted that the lowest ram address, $0050, is used by the ram loader program to store the total number of bytes in the program. 2.1.2.3 ?ump to any address this function allows execution of programs previously loaded in ram or eeprom using the methods outlined in section 2.1.2.1 . to execute the ?ump to any address function, data input at port a has to be $cc and data input at port b and port c should represent the msb and lsb respectively, of the address to jump to for execution of the user program. a schematic diagram of the circuit required is shown in figure 2-2 . 25
motorola 2-4 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 figure 2-2 MC68HC05X16 ?ump to any address schematic diagram osc1 osc2 irq tcap2 tcmp2 tcap1 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 vss pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 reset vdd 10 k w 0.01 mf 10 nf 47 mf 4 mhz 22 pf 10 k w 22 pf p1 gnd +5v 2xv dd reset vrh vrl vpp1 plma plmb tcmp1 rdi tdo sclk 10 k w 10 k w 10 k w optional 3 x 10 k w connect as required for the application 8 x 10 k w optional (see note) 8 x 10 k w 8 x 10 k w msb lsb select required address note: these eight resistors are optional; direct connection is possible if pins pa0-pa7, pb0-pb7 and pc0-pc7 are kept in input mode during application. MC68HC05X16 26
MC68HC05X16 rev. 1 motorola 2-5 modes of operation and pin descriptions 2 figure 2-3 MC68HC05X16 ?oad program in ram and execute schematic diagram osc1 osc2 irq tcap2 tcmp2 tcap1 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 vss pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 reset vdd 10 k w 0.01 mf 10 nf 47 mf 4 mhz 22 pf 10 k w 22 pf p1 gnd +5v 2xv dd reset vrh vrl vpp1 plma plmb tcmp1 rdi tdo rs232 level translator suggested: mc145406 or max232 9600 bd rs232 sclk 10 k w 10 k w 10 k w optional 3 x 10 k w connect as required for the application connect as required for the application MC68HC05X16 27
motorola 2-6 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 2.2 low power modes the stop and wait instructions have different effects on the programmable timer, the serial communications interface, the watchdog system, the eeprom and the a/d converter. these different effects are described in the following sections. 2.2.1 stop mode the stop instruction places the mcu in its lowest power consumption mode. in stop mode, the internal oscillator is turned off (providing the mcan is ?sleep? see section 5.5 ) halting all internal processing including timer, serial communications interface and the a/d converter (see ?w chart in figure 2-4 ). the mcu will wake up from stop mode only by receipt of an mcan external interrupt or by the detection of a reset (logic low on reset pin or a power-on reset. the stop instruction can be executed (i.e. the oscillator can be turned off) only when the mcan module is in sleep mode. see section 5.5 . during stop mode, the i-bit in the ccr is cleared to enable external interrupts (see section 11.1.5 ). the sm bit is cleared to allow nominal speed operation for the 4064 cycles count while exiting stop mode (see section 2.2.3 ). all other registers and memory remain unaltered and all input/output lines remain unchanged. this continues until a mcan interrupt, wired-or interrupt, external interrupt (irq ) or reset is sensed, at which time the internal oscillator is turned on. the interrupt or reset causes the program counter to vector to the corresponding locations ($3ffa, b and $3ffe, f respectively). when leaving stop mode, a t porl internal cycles delay is provided to give the oscillator time to stabilise before releasing cpu operation. this delay is selectable via a mask option to be either 16 or 4064 cycles. the cpu will resume operation by servicing the interrupt that wakes it up, or by fetching the reset vector, if reset wakes it up. note: if t porl is selected to be 16 cycles, it is recommended that an external clock signal is used to avoid problems with oscillator stability while the device is in stop mode. the stacking corresponding to an eventual interrupt to go out of stop mode will only be executed when going out of stop mode. the following list summarizes the effect of stop mode on the modules of the MC68HC05X16. the watchdog timer is reset; see section 10.1.4.1 the eeprom acts as read-only memory (rom); see section 3.6 all sci activity stops; see section 7.13 the timer stops counting; see section 6.6 the plm outputs remain at current levels; see section 8.3 the a/d converter is disabled; see section 9.3 the i-bit in the ccr is cleared 28
MC68HC05X16 rev. 1 motorola 2-7 modes of operation and pin descriptions 2 2.2.2 wait mode the wait instruction places the mcu in a low power consumption mode, but wait mode consumes more power than stop mode. all cpu action is suspended and the watchdog is disabled, but the timer, a/d and sci and mcan systems remain active and operate as normal (see ?w chart in figure 2-4 ). all other memory and registers remain unaltered and all parallel input/output lines remain unchanged. the programming or erase mechanism of the eeprom is also unaffected, as well as the charge pump high voltage generator. during wait mode the i-bit in the ccr is cleared to enable all interrupts. the inte bit in the miscellaneous register ( section 2.2.3.1 ) is not affected by wait mode. when any interrupt or reset is sensed, the program counter vectors to the locations containing the start address of the interrupt or reset service routine. any interrupt or reset condition causes the processor to exit wait mode. if an interrupt exit from wait mode is performed, the state of the remaining systems will be unchanged. if a reset exit from wait mode is performed the entire system reverts to the disabled reset state. note: the stacking corresponding to an eventual interrupt to leave wait mode will only be executed when leaving wait mode. 29
motorola 2-8 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 the following list summarizes the effect of wait mode on the modules of the MC68HC05X16. the watchdog timer functions according to the mask option selected; see section 10.1.4.2 the eeprom is not affected; see section 3.7 the sci is not affected; see section 7.14 the timer is not affected; see section 6.7 the plm is not affected; see section 8.4 the a/d converter is not affected; see section 9.4 the i-bit in the ccr is cleared the mcan module is unaffected 2.2.2.1 power consumption during wait mode power consumption during wait mode depends on how many systems are active. the power consumption will be highest when all the systems (a/d, timer, eeprom, sci and mcan) are active, and lowest when the eeprom erase and programming mechanism, sci and a/d are disabled and the mcan is in sleep mode. the timer cannot be disabled in wait mode. it is important that before entering wait mode, the programmer sets the relevant control bits for the individual modules to re?ct the desired functionality during wait mode. power consumption may be further reduced by the use of slow mode. (see section 2.2.3 ). 2.2.3 slow mode the slow mode function is controlled by the sm bit in the miscellaneous register at location $000c. it allows the user to insert, under software control, an extra divide-by-16 between the oscillator and the internal clock driver (see figure 2-5 ). this feature allows all the internal operations to slow down and thus reduces power consumption. warning: the slow mode function should not be enabled while using the a/d converter or while erasing/programming the eeprom unless the internal a/d rc oscillator is turned on. 30
MC68HC05X16 rev. 1 motorola 2-9 modes of operation and pin descriptions 2 figure 2-4 stop and wait ?w charts generate watchdog interrupt timer interrupt ? sci ? stop oscillator and all clocks. clear i bit. stop wait reset ? cirq, wired-or, external interrupt? reset ? watchdog active? (1) fetch reset vector or (2) service interrupt: a. stack b. set i-bit c. vector to interrupt routine (1) fetch reset vector or (2) service interrupt: a. stack b. set i-bit c. vector to interrupt routine turn on oscillator. wait for time delay to stabilise restart processor clock yes no yes yes yes yes yes yes no no no no no no oscillator active. timer, sci, a/d, eeprom clocks active. processor clocks stopped. clear i-bit woi ? cirq ? yes no 31
motorola 2-10 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 2.2.3.1 miscellaneous register sm ?slow mode 1 (set) the system runs at a bus speed 16 times lower than normal (f osc /32, /64, /128 or /160). slow mode affects all sections of the device (including sci, a/d and timer) except for the mcan module. 0 (clear) the system runs at normal bus speed (f osc /2, /4, /8 or /10). the sm bit is cleared by external or power-on reset. the sm bit is automatically cleared when entering stop mode. note: the bits shown shaded in the above representation are explained individually in the relevant sections of this manual. the complete register plus an explanation of each bit can be found in section 3.8 . figure 2-5 slow mode divider block diagram address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset miscellaneous $000c por intp intn inte sfa sfb sm wdog u001 000u osc1 pin osc2 pin oscillator f osc control logic sm?it ? 2, 4, main internal clock (bit 1, $000c) mcan note: the mcan module clock is unaffected during slow mode. 8 and 10 ? 2 ? 16 32
MC68HC05X16 rev. 1 motorola 2-11 modes of operation and pin descriptions 2 2.3 pin descriptions 2.3.1 vdd and vss power is supplied to the microcontroller using these two pins. vdd is the positive supply and vss is ground. it is in the nature of cmos designs that very fast signal transitions occur on the mcu pins. these short rise and fall times place very high short-duration current demands on the power supply. to prevent noise problems, special care must be taken to provide good power supply bypassing at the mcu. bypass capacitors should have good high-frequency characteristics and be as close to the mcu as possible. bypassing requirements vary, depending on how heavily the mcu pins are loaded. 2.3.2 irq this is an input-only pin for external interrupt sources. interrupt triggering is selected using the intp and intn bits in the miscellaneous register, to be one of four options detailed in table 10-3 . in addition, the external interrupt facility (irq ) can be disabled using the inte bit in the miscellaneous register (see section 3.8 ). it is only possible to change the interrupt option bits in the miscellaneous register while the i-bit is set. selecting a different interrupt option will automatically clear any pending interrupts. further details of the external interrupt procedure can be found in section 10.2.3.2 . the irq pin contains an internal schmitt trigger as part of its input to improve noise immunity. a high voltage detector is provided on this pin to select modes of operation other than single-chip mode. see section 2.1 . 2.3.3 reset this active low i/o pin is used to reset the mcu. applying a logic zero to this pin forces the device to a known start-up state. an external rc-circuit can be connected to this pin to generate a power-on reset (por) if required. in this case, the time constant must be great enough (at least 100ms) to allow the oscillator circuit to stabilise. this input has an internal schmitt trigger to improve noise immunity. when a reset condition occurs internally, i.e. from the cop watchdog, the reset pin provides an active-low open drain output signal that may be used to reset external hardware. 33
motorola 2-12 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 2.3.4 mds a pull-down device is activated on this pin each time the reset pin is pulled low. even after the reset pin is pulled high, the pull-down on the mds pin will remain active until the pin is pulled high. in single-chip mode mds can be connected to vss or left ?ating. when mds is tied to v dd at the end of reset, it is used to select any mode of operation other than single-chip mode. this has the same effect as tying irq to 2v dd . see section 2.1 . note: although this pin can be left ?ating to select single-chip mode, it is advisable to hard-connect it to vss, especially in an electrically noisy environment. 2.3.5 tcap1 the tcap1 input controls the input capture 1 function of the on-chip programmable timer system. 2.3.6 tcap2 the tcap2 input controls the input capture 2 function of the on-chip programmable timer system. 2.3.7 tcmp1 the tcmp1 pin is the output of the output compare 1 function of the timer system. 2.3.8 tcmp2 the tcmp2 pin is the output of the output compare 2 function of the timer system. 2.3.9 rdi (receive data in) the rdi pin is the input pin of the sci receiver. 2.3.10 tdo (transmit data out) the tdo pin is the output pin of the sci transmitter. 34
MC68HC05X16 rev. 1 motorola 2-13 modes of operation and pin descriptions 2 2.3.11 sclk the sclk pin is the clock output pin of the sci transmitter. 2.3.12 osc1, osc2 these pins provide control input for an on-chip oscillator circuit. a crystal, ceramic resonator or external clock signal connected to these pins supplies the oscillator clock. the oscillator frequency (f osc ) is divided by two, four, eight or ten to give the internal bus frequency (f op ). there is also a software option which introduces an additional divide by 16 into the oscillator clock, giving an internal bus frequency of f osc /32, /64, /128 or /160. 2.3.12.1 crystal the circuit shown in figure 2-6 (a) is recommended when using either a crystal or a ceramic resonator. an internal feedback resistor is provided on-chip between osc1 and osc2. figure 2-6 (d) lists the recommended capacitance values. the internal oscillator is designed to interface with an at-cut parallel-resonant quartz crystal resonator in the frequency range speci?d for f osc (see section 12.4 ). use of an external cmos oscillator is recommended when crystals outside the speci?d ranges are to be used. the crystal and associated components should be mounted as close as possible to the input pins to minimise output distortion and start-up stabilization time. the manufacturer of the particular crystal being considered should be consulted for speci? information. 2.3.12.2 ceramic resonator a ceramic resonator may be used instead of a crystal in cost sensitive applications for frequencies up to 8mhz external. the circuit shown in figure 2-6 (a) is recommended when using either a crystal or a ceramic resonator. figure 2-6 (d) lists the recommended capacitance and feedback resistance values. the manufacturer of the particular ceramic resonator being considered should be consulted for speci? information. this option is recommended only for applications that operate at an external clock frequency of 8mhz or less. any application requiring an external operating frequency greater that 8mhz should use either a crystal oscillator or an external cmos compatible clock source. 2.3.12.3 external clock when using an external clock the osc1 and osc2 pins should be driven in antiphase, as shown in figure 2-6 (c). the t oxov or t ilch speci?ations (see section 12.4 ) do not apply when using an external clock input. the equivalent speci?ation of the external clock source should be used in lieu of t oxov or t ilch . 35
motorola 2-14 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 figure 2-6 oscillator connections ceramic resonator 2 ?4mhz unit r s (typ) 10 w c 0 40 pf c 1 4.3 pf c osc1 30 pf c osc2 30 pf q 1250 crystal 2mhz 4mhz unit r s (max) 400 75 w c 0 57pf c 1 812f c osc1 15 ?40 15 ?30 pf c osc2 15 ?30 15 ?25 pf q 30 000 40 000 osc1 osc2 mcu cosc2 cosc1 osc1 osc2 mcu nc external clock osc1 osc2 rs c1 l c0 (d) typical crystal and ceramic resonator parameters (c) external clock source connections (b) crystal equivalent circuit (a) crystal/ceramic resonator oscillator connections 36
MC68HC05X16 rev. 1 motorola 2-15 modes of operation and pin descriptions 2 2.3.12.4 oscillator division the external oscillator can run up to 22mhz. for this reason an additional clock predivider is provided; its division ratio is selected via a mask option (see section 1.2 ). this allows a cpu clock two, four, eight or ten times slower than the external clock, provided that slow mode has not been entered. if the device is in slow mode, a further divide-by-16 oscillator predivider reduces the cpu clock frequency to a frequency 32, 64, 128 or 160 times slower than the oscillator clock. the mcan is directly clocked with the external oscillator frequency divided by two. a block diagram of the oscillator divider circuit is given in figure 2-7 . 2.3.13 plma the plma pin is the output of pulse length modulation converter a. 2.3.14 plmb the plmb pin is the output of pulse length modulation converter b. figure 2-7 oscillator divider block diagram osc1 pin osc2 pin oscillator mcan module ? 16 contr ol logic ? 2 sm bit ? 1 , ? 2, ? 4, or ? 5 f osc /2, /4, /8 or /10 f osc /32, /64, /128 or /160 mcan clock main internal clock mask option ? 2 37
motorola 2-16 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 2.3.15 vpp1 the vpp1 pin is the output of the charge pump for the eeprom1 array. 2.3.16 vrh the vrh pin is the positive reference voltage for the a/d converter. 2.3.17 vrl the vrl pin is the negative reference voltage for the a/d converter. 2.3.18 pa0 ?pa7/pb0 ?pb7/pc0 ?pc7 these 24 i/o lines comprise ports a, b and c. the state of any pin is software programmable, and all the pins are con?ured as inputs during power-on or reset. under software control the pc2 pin can output the internal e-clock (see section 4.2 ). resistive pull downs are provided on port b and/or port c and can be enabled via a mask option (see section 1.2 ). wired-or interrupt capability is provided on all pins of port b (see section 10.2.3.3 ). 2.3.19 nwoi this pin provides another wired-or interrupt capability in addition to port b. wired-or interrupts are requested when this pin is pulled high (if wired-or interrupts are enabled), i.e. interrupt sensitivity on this pin is complementary to sensitivity on the irq pin (see table 10-3 in section 10.2.3.1 ). when this pin is not in use it is recommended that it be tied to v ss in noisy conditions. it is not necessary to tie nwoi to v ss when there is a negligible amount of noise present. 2.3.20 pd0/an0?d7/an7 this 8-bit input only port (d) shares its pins with the a/d converter. when enabled, the a/d converter uses pins pd0/an0 ?pd7/an7 as its analog inputs. on reset, the a/d converter is disabled which forces the port d pins to be input only port pins (see section 9.5 ). 38
MC68HC05X16 rev. 1 motorola 2-17 modes of operation and pin descriptions 2 2.3.21 vdd1 this pin is the power input for the input comparator of the mcan module. 2.3.22 vss1 this pin is the ground connection for the input comparator of the mcan bus. 2.3.23 vddh this pin provides the high voltage reference output for the mcan bus. the output voltage is equal to vdd ? 2. 2.3.24 rx0/rx1 these input pins connect the physical bus lines to the input comparator (receive). when the mcan is in sleep mode, a dominant level on these pins will wake it up. 2.3.25 tx0/tx1 these output pins connect the output drivers of the mcan bus to the physical bus lines (transmit). mcan bus lines. the bus can have one of two complementary values: dominant or recessive. during simultaneous transmission of dominant and recessive bits the resulting bus value will be dominant. for example with a positive logic wired-and implementation of the bus, the dominant level would correspond to a logic 0 and the recessive level to a logic 1. 39
motorola 2-18 MC68HC05X16 rev. 1 modes of operation and pin descriptions 2 this page left blank intentionally 40
MC68HC05X16 rev. 1 motorola 3-1 memory and registers 3 3 memory and registers the MC68HC05X16 mcu is capable of addressing 16384 bytes of memory and registers with its program counter. the memory map includes 15118 bytes of user rom (including user vectors), 576 bytes of bootstrap rom, 352 bytes of ram and 256 bytes of eeprom. 3.1 registers all the i/o, control and status registers of the MC68HC05X16 are contained within the ?st 32-byte block of the memory map, as shown in figure 3-1 . mcan registers are contained in the next 30 bytes of memory. the miscellaneous register is shown in section 3.8 as this register contains bits which are relevant to several modules. 3.2 ram the user ram comprises 176 bytes of memory, from $0050 to $00ff. this is shared with a 64 byte stack area. the stack begins at $00ff and may extend down to $00c0. the user ram also comprises 176 bytes from $0250 to $02ff which is completely free for the user. note: using the stack area for data storage or temporary work locations requires care to prevent the data from being overwritten due to stacking from an interrupt or subroutine call. 3.3 rom the user rom consists of 15118 bytes of rom mapped as follows: 15102 bytes of user rom from $0300 to $3dfd 16 bytes of user vectors from $3ff0 to $3fff 41
motorola 3-2 MC68HC05X16 rev. 1 memory and registers 3 figure 3-1 memory map of the MC68HC05X16 user vectors port b data register port c data register port d input data register port a data register $0000 compare low register 2 a/d data register port a data direction register port b data direction register port c data direction register e/eeprom/eclk control register a/d status/control register pulse length modulation a pulse length modulation b miscellaneous register sci baud rate register sci control register 1 sci control register 2 sci status register sci data register timer control register timer status register capture high register 1 capture low register 1 compare high register 1 compare low register 1 counter high register counter low register alternate counter high register alternate counter low register capture high register 2 capture low register 2 compare high register 2 $0001 $0002 $0003 $0004 $0005 $0006 $0007 $0008 $0009 $000a $000b $000c $000d $000e $000f $0010 $0011 $0012 $0013 $0014 $0015 $0016 $0017 $0018 $0019 $001a $001b $001c $001d $001e $001f $0100 options register reserved registers $3ffe? $3ff6? $0000 i/o (32 bytes) $0020 $00c0 $0100 $3ff0? stack ram i (176 bytes) $0250 $0200 $3dfe $003e bootstrap rom i (80 bytes) rom (15102 bytes) bootstrap rom ii (498 bytes) $0300 $3ff2? optr (1 byte) non protected (31 bytes) protected (224 bytes) eeprom (256 bytes) $0101 $0120 MC68HC05X16 sci timer over?w timer output compare 1& 2 timer input capture 1& 2 woi, external irq swi reset/power-on reset $3ff4? $3ff8? $3ffa? $3ffc? ram ii 176 bytes mcan registers $0050 cirq mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes ports 7 bytes eeprom/eclk control 1 byte plm system 2 bytes a/d converter 2 bytes miscellaneous 1 byte sci 5 bytes timer 14 bytes $3dfe mask options register $3e00 42
MC68HC05X16 rev. 1 motorola 3-3 memory and registers 3 3.4 bootstrap rom there are two areas of bootstrap rom (romi and romii) located from $0200 to $024f (80 bytes) and $3dfe to $3fef (498 bytes) respectively. figure 3-2 mcan module memory map mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes command register status register interrupt register control register $0020 output control register acceptance code register acceptance mask register bus timing register 1 bus timing register 2 test register identi?r rtr-bit, data length code data segment byte 1 data segment byte 2 data segment byte 3 data segment byte 4 data segment byte 5 data segment byte 6 data segment byte 7 data segment byte 8 $0021 $0022 $0023 $0024 $0025 $0026 $0027 $0028 $0029 $002a $002b $002c $002d $002e $002f $0030 $0031 $0032 $0033 identi?r rtr-bit, data length code data segment byte 1 data segment byte 2 data segment byte 3 data segment byte 4 data segment byte 5 data segment byte 6 data segment byte 7 data segment byte 8 $0034 $0035 $0036 $0037 $0038 $0039 $003a $003b $003c $003d mcan registers mcan register blocks $0020 $0029 $002a $0033 $0034 $003d 43
motorola 3-4 MC68HC05X16 rev. 1 memory and registers 3 3.5 eeprom the user eeprom consists of 256 bytes of memory located from address $0100 to $01ff. 255 bytes are general purpose and 1 byte is used by the option register. the non-volatile eeprom is byte erasable. an internal charge pump provides the eeprom voltage (v pp1 ), which removes the need to supply a high voltage for erase and programming functions. the charge pump is a capacitor/diode ladder network which will give a very high impedance output of around 20-30 m w . the voltage of the charge pump is visible at the vpp1 pin. during normal operation of the device, where programming/erasing of the eeprom array will occur, vpp1 should never be connected to either vdd or vss as this could prevent the charge pump reaching the necessary programming voltage. where it is considered dangerous to leave vpp1 unconnected for reasons of excessive noise in a system, it may be tied to v dd ; this will protect the eeprom data but will also increase power consumption, and therefore it is recommended that the protect bit function is used for regular protection of eeprom data (see section 3.5.5 ). in order to achieve a higher degree of security for stored data, there is no capability for bulk or row erase operations. the eeprom control register ($0007) provides control of the eeprom programming and erase operations. warning: the vpp1 pin should never be connected to vss, as this could cause permanent damage to the device. 3.5.1 eeprom control register woie ?wired-or interrupt enable this bit is used to enable wired-or interrupts on the nwoi pin and on all port b pins which have been programmed as inputs. wired-or interrupts can only be enabled if the woi mask option is selected (see section 1.2 ). woie is forced to zero if this mask option is not selected. power-on reset clears the woie bit. 1 (set) wired-or interrupts are enabled (provided that wired-or interrupts have been selected as a mask option). 0 (clear) wired-or interrupts are disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom/eclk control $0007 woie caf 0 0 eclk e1era e1lat e1pgm 0000 0000 44
MC68HC05X16 rev. 1 motorola 3-5 memory and registers 3 caf ?mcan asleep ?g this ?g is set by the mcu when the mcan module enters sleep mode. this is the only indication that the mcan is asleep (see section 5.5 ). the bit is cleared when the mcan wakes up. 1 (set) the mcan module is in sleep mode. 0 (clear) the mcan module is not in sleep mode. eclk ?external clock option bit see section 4.3 for a description of this bit. e1era ?eeprom erase/programming bit providing the e1lat and e1pgm bits are at logic one, this bit indicates whether the access to the eeprom is for erasing or programming purposes. 1 (set) an erase operation will take place. 0 (clear) a programming operation will take place. once the program/erase eeprom address has been selected, e1era cannot be changed. e1lat ?eeprom programming latch enable bit 1 (set) address and data can be latched into the eeprom for further program or erase operations, providing the e1pgm bit is cleared. 0 (clear) data can be read from the eeprom. the e1era bit and the e1pgm bit are reset to zero when e1lat is ?? stop, power-on and external reset clear the e1lat bit. note: after the t era1 erase time or t prog1 programming time, the e1lat bit has to be reset to zero in order to clear the e1era bit and the e1pgm bit. e1pgm ?eeprom charge pump enable/disable 1 (set) internal charge pump generator switched on. 0 (clear) internal charge pump generator switched off. when the charge pump generator is on, the resulting high voltage is applied to the eeprom array. this bit cannot be set before the data is selected, and once this bit has been set it can only be cleared by clearing the e1lat bit. a summary of the effects of setting/clearing bits 0, 1 and 2 of the control register are give in table 3-1 . note: not all combinations are shown in table 3-1 , since the e1pgm and e1era bits are cleared when the e1lat bit is at zero, resulting in a read condition. 45
motorola 3-6 MC68HC05X16 rev. 1 memory and registers 3 3.5.2 eeprom read operation to be able to read from eeprom, the e1lat bit has to be at logic zero, as shown in table 3-1 . while this bit is at logic zero, the e1pgm bit and the e1era bit are permanently reset to zero and the 256 bytes of eeprom may be read as if it were a normal rom area. the internal charge pump generator is automatically switched off since the e1pgm bit is reset. if a read operation is executed while the e1lat bit is set (erase or programming sequence), data resulting from the operation will be $ff. note: when not performing any programming or erase operation, it is recommended that eeprom should remain in the read mode (e1lat = 0) 3.5.3 eeprom erase operation to erase the contents of a byte of the eeprom, the following steps should be taken: 1 set the e1lat bit. 2 set the e1era bit (1& 2 may be done simultaneously with the same instruction). 3 write address/data to the eeprom address to be erased. 4 set the e1pgm bit. 5 wait for a time t era1 . 6 reset the e1lat bit (to logic zero). while an erase operation is being performed, any access of the eeprom array will not be successful. the erased state of the eeprom is $ff and the programmed state is $00. note: data written to the address to be erased is not used, therefore its value is not signi?ant. table 3-1 eeprom control bits description e1era e1lat e1pgm description 0 0 0 read condition 0 1 0 ready to load address/data for program/erase 0 1 1 byte programming in progress 1 1 0 ready for byte erase (load address) 1 1 1 byte erase in progress 46
MC68HC05X16 rev. 1 motorola 3-7 memory and registers 3 if a second word is to be erased, it is important that the e1lat bit be reset before restarting the erasing sequence, otherwise any write to a new address will have no effect. this condition provides a higher degree of security for the stored data. user programs must be running from the ram or rom as the eeprom will have its address and data buses latched. 3.5.4 eeprom programming operation to program a byte of eeprom, the following steps should be taken: 1 set the e1lat bit. 2 write address/data to the eeprom address to be programmed. 3 set the e1pgm bit. 4 wait for time t prog1 . 5 reset the e1lat bit (to logic zero). while a programming operation is being performed, any access of the eeprom array will not be successful. warning: to program a byte correctly, it has to have been previously erased. if a second word is to be programmed, it is important that the e1lat bit be reset before restarting the programming sequence otherwise any write to a new address will have no effect. this condition provides a higher degree of security for the stored data. user programs must be running from the ram or rom as the eeprom will have its address and data buses latched. note: 224 bytes of eeprom (address $0120 to $01ff) can be program and erase protected under the control of bit 1 of the optr register detailed in section 3.5.5 . 3.5.5 options register (optr) this register (optr), located at $0100, contains the secure and protect functions for the eeprom and allows the user to select options in a non-volatile manner. the contents of the optr register are loaded into data latches with each power-on or external reset. (1) this register is implemented in eeprom; therefore reset has no effect on the individual bits. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset options (optr) (1) $0100 ee1p sec not affected 47
motorola 3-8 MC68HC05X16 rev. 1 memory and registers 3 ee1p ?eeprom protect bit in order to achieve a higher degree of protection, the eeprom is effectively split into two parts, both working from the vpp1 charge pump. part 1 of the eeprom array (32 bytes from $0100 to $011f) cannot be protected; part 2 (224 bytes from $0120 to $01ff) is protected by the ee1p bit of the options register. 1 (set) part 2 of the eeprom array is not protected; all 256 bytes of eeprom can be accessed for any read, erase or programming operations 0 (clear) part 2 of the eeprom array is protected; any attempt to erase or program a location will be unsuccessful when this bit is set (erased), the protection will remain until the next power-on or external reset. ee1p can only be written to ? when the elat bit in the eeprom control register is set. sec ?security bit this high security bit allows the user to secure the eeprom data from external accesses. when the sec bit is at ?? the eeprom contents are secured by preventing any entry to test mode. the only way to erase the sec bit to ? externally is to enter bootstrap mode, at which time the entire eeprom contents will be erased. when the sec bit is changed, its new value will have no effect until the next external or power-on reset. 3.6 eeprom during stop mode when entering stop mode, the eeprom is automatically set to the read mode and the vpp1 high voltage charge pump generator is automatically disabled. 3.7 eeprom during wait mode the eeprom is not affected by wait mode. any program/erase operation will continue as in normal operating mode. the charge pump is not affected by wait mode, therefore it is possible to wait the t era1 erase time or t prog1 programming time in wait mode. under normal operating conditions, the charge pump generator is driven by the internal cpu clocks. when the operating frequency is low, e.g. during slow mode (see figure 3.8 ) or during wait mode, the clocking should be done by the internal a/d rc oscillator. the rc oscillator is enabled by setting the adrc bit of the a/d status/control register at $0009. 48
MC68HC05X16 rev. 1 motorola 3-9 memory and registers 3 (1) the por bit is set each time there is a power-on reset. (2) the state of the wdog bit after reset is dependent on the mask option selected; 1=watchdog enabled, 0=watchdog disabled. (3) this register is implemented in eeprom; therefore reset has no effect on the individual bits. table 3-2 MC68HC05X16 register outline register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 unde?ed port b data (portb) $0001 unde?ed port c data (portc) $0002 pc2/ eclk unde?ed port d data (portd) $0003 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed port a data direction (ddra) $0004 0000 0000 port b data direction (ddrb) $0005 0000 0000 port c data direction (ddrc) $0006 0000 0000 eeprom/eclk control $0007 woie caf 0 0 eclk e1era e1lat e1pgm 0000 0000 a/d data (addata) $0008 0000 0000 a/d status/control (adstat) $0009 coco adrc adon 0 ch3 ch2 ch1 ch0 0000 0000 pulse length modulation a (plma) $000a 0000 0000 pulse length modulation b (plmb) $000b 0000 0000 miscellaneous $000c por (1) intp intn inte sfa sfb sm wdog (2) u001 000u sci baud rate (baud) $000d spc1 spc0 sct1 sct0 sct0 scr2 scr1 scr0 00uu uuuu sci control 1 (sccr1) $000e r8 t8 m wake cpol cpha lbcl unde?ed sci control 2 (sccr2) $000f tie tcie rie ilie te re rwu sbk 0000 0000 sci status (scsr) $0010 tdre tc rdrf idle or nf fe 1100 000u sci data (scdr) $0011 0000 0000 timer control (tcr) $0012 icie ocie toie folv2 folv1 olv2 iedg1 olvl1 0000 00u0 timer status (tsr) $0013 icf1 ocf1 tof icf2 ocf2 unde?ed input capture high 1 $0014 unde?ed input capture low 1 $0015 unde?ed output compare high 1 $0016 unde?ed output compare low 1 $0017 unde?ed timer counter high $0018 1111 1111 timer counter low $0019 1111 1100 alternate counter high $001a 1111 1111 alternate counter low $001b 1111 1100 input capture high 2 $001c unde?ed input capture low 2 $001d unde?ed output compare high 2 $001e unde?ed output compare low 2 $001f unde?ed options (optr) (3) $0100 ee1p sec not affected 49
motorola 3-10 MC68HC05X16 rev. 1 memory and registers 3 (1) these registers can only be accessed when the reset request bit in the control register is set. table 3-3 mcan register outline register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset control (ccntrl) $0020 mode spd oie eie tie rie rr 0u - u uuu1 command (ccom) $0021 rx0 rx1 compsel sleep cos rrb at tr 00u0 0000 status (cstat) $0022 bs es ts rs tcs tba do rbs uu00 1100 interrupt (cint) $0023 wif oif eif tif rif - - - 0 0000 acceptance code (cacc) (1) $0024 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 unde?ed acceptance mask (cacm) (1) $0025 am7 am6 am5 am4 am3 am2 am1 am0 unde?ed bus timing 0 (cbt0) (1) $0026 sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 unde?ed bus timing 1 (cbt1) (1) $0027 samp tseg22tseg21tseg20tseg13tseg12tseg11tseg10 unde?ed output control (cocntrl) (1) $0028 octp1 octn1 ocpol1 octp0 octn0 ocpol0 ocm1 ocm0 unde?ed (reserved) $0029 transmit buffer identi?r (tbi) $002a id10 id9 id8 id7 id6 id5 id4 id3 unde?ed rtr-bit, data length code (trtdl) $002b id2 id1 id0 rtr dlc3 dlc2 dlc1 dlc0 unde?ed transmit data segment 1 (tds1) $002c db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 2 (tds2) $002d db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 3 (tds3) $002e db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 4 (tds4) $002f db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 5 (tds5) $0030 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 6 (tds6) $0031 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 7 (tds7) $0032 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed transmit data segment 8 (tds8) $0033 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive buffer identi?r (rbi) $0034 id10 id9 id8 id7 id6 id5 id4 id3 unde?ed rtr-bit, data length code (rrtdl) $0035 id2 id1 id0 rtr dlc3 dlc2 dlc1 dlc0 unde?ed receive data segment 1 (rds1) $0036 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 2 (rds2) $0037 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 3 (rds3) $0038 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 4 (rds4) $0039 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 5 (rds5) $003a db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 6 (rds6) $003b db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 7 (rds7) $003c db7 db6 db5 db4 db3 db2 db1 db0 unde?ed receive data segment 8 (rds8) $003d db7 db6 db5 db4 db3 db2 db1 db0 unde?ed 50
MC68HC05X16 rev. 1 motorola 3-11 memory and registers 3 3.8 miscellaneous register por ?power-on reset bit (see section 10.1 ) this bit is set each time the device is powered on. therefore, the state of the por bit allows the user to make a software distinction between a power-on and an external reset. this bit cannot be set by software and is cleared by writing it to zero. 1 (set) a power-on reset has occurred. 0 (clear) no power-on reset has occurred. intp, intn ?external interrupt sensitivity options (see section 10.2 ) these two bits allow the user to select which edge the irq pin and woi will be sensitive to (see table 3-4 ). both bits can be written to only while the i-bit is set, and are cleared by power-on or external reset, thus the device is initialised with negative edge and low level sensitivity. inte ?external interrupt enable (see section 10.2 ) 1 (set) external interrupt function (irq ) enabled. 0 (clear) external interrupt function (irq ) disabled. the inte bit can be written to only while the i-bit is set, and is set by power-on or external reset, thus enabling the external interrupt function. sfa ?slow or fast mode selection for plma (see section 8.1 ) 1 (set) slow mode plma (4096 x timer clock period). 0 (clear) fast mode plma (256 x timer clock period). (1) the por bit is set each time there is a power-on reset. (2) the state of the wdog bit after reset is dependent on the mask option selected; 1=watchdog enabled, 0=watchdog disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset miscellaneous $000c por (1) intp intn inte sfa sfb sm wdog (2) u001 000u table 3-4 irq and woi sensitivity intp intn irq sensitivity woi interrupt options 0 0 negative edge and low level sensitive positive edge and high level sensitive 0 1 negative edge only positive edge only 1 0 positive edge only negative edge only 1 1 positive and negative edge sensitive positive and negative edge sensitive 51
motorola 3-12 MC68HC05X16 rev. 1 memory and registers 3 sfb ?slow or fast mode selection for plmb (see section 8.1 ) 1 (set) slow mode plmb (4096 x timer clock period). 0 (clear) fast mode plmb (256 x timer clock period). note: the highest speed of the plm system corresponds to the frequency of the tof bit being set, multiplied by 256. the lowest speed of the plm system corresponds to the frequency of the tof bit being set, multiplied by 16. warning: because the sfa bit and sfb bit are not double buffered, it is mandatory to set the sfa bit and the sfb bit to the desired values before writing to the plm registers; not doing so could temporarily give incorrect values at the plm outputs. sm ?slow mode (see section 2.2.3 ) 1 (set) the system runs at a bus speed 16 times lower than normal (f osc /32). slow mode affects all sections of the device, including sci, a/d and timer. 0 (clear) the system runs at normal bus speed (f osc /2). the sm bit is cleared by external or power-on reset. the sm bit is automatically cleared when entering stop mode. wdog ?watchdog enable/disable (see section 10.1.4 ) the wdog bit can be used to enable the watchdog timer previously disabled by a mask option. following a watchdog reset the state of the wdog bit is as de?ed by the mask option speci?d. 1 (set) watchdog counter cleared and enabled. 0 (clear) the watchdog cannot be disabled by software; writing a zero to this bit has no effect. 52
MC68HC05X16 rev. 1 motorola 4-1 input/output ports 4 4 input/output ports in single-chip mode, the MC68HC05X16 has a total of 24 i/o lines, arranged as three 8-bit ports (a, b and c), and eight input-only lines, arranged as one 8-bit port (d). each i/o line is individually programmable as either input or output, under the software control of the data direction registers. the 8-bit input-only port (d) shares its pins with the a/d converter, when the a/d converter is enabled. to avoid glitches on the output pins, data should be written to the i/o port data register before writing ones to the corresponding data direction register bits to set the pins to output mode. 4.1 input/output programming the bidirectional port lines may be programmed as inputs or outputs under software control. the direction of each pin is determined by the state of the corresponding bit in the port data direction register (ddr). each port has an associated ddr. any i/o port pin is con?ured as an output if its corresponding ddr bit is set to a logic one. a pin is con?ured as an input if its corresponding ddr bit is cleared to a logic zero. at power-on or reset, all ddrs are cleared, thus con?uring all port pins as inputs. the data direction registers can be written to or read by the mcu. during the programmed output state, a read of the data register actually reads the value of the output data latch and not the i/o pin. the operation of the standard port hardware is shown schematically in figure 4-1 . 53
motorola 4-2 MC68HC05X16 rev. 1 input/output ports 4 table 4-1 shows the effect of reading from or writing to an i/o pin in various circumstances. note that the read/write signal shown is internal and not available to the user. 4.2 ports a and b these ports are standard m68hc05 bidirectional i/o ports, each comprising a data register and a data direction register. reset does not affect the state of the data register, but clears the data direction register, thereby returning all port pins to input mode. writing a ? to any ddr bit sets the corresponding port pin to output mode. wired-or interrupts are provided on all pins of port b. if woie is enabled, any combination of high logic levels on port b pins which are programmed as inputs will trigger an external interrupt. see section 10.2.3.2 . figure 4-1 standard i/o port structure table 4-1 i/o pin states r/w ddrn action of mcu write to/read of data bit 0 0 the i/o pin is in input mode. data is written into the output data latch. 0 1 data is written into the output data latch, and output to the i/o pin. 1 0 the state of the i/o pin is read. 1 1 the i/o pin is in output mode. the output data latch is read. latched data register bit ddrn data input buffer output buffer o/p data buffer m68hc05 internal connections ddrn data i/o pin 100 111 0 0 tristate 0 1 tristate i/o pin output ? input data direction register bit ? 54
MC68HC05X16 rev. 1 motorola 4-3 input/output ports 4 a mask option is provided to enable resistive pull downs on all port b pins that are programmed as inputs. 4.3 port c in addition to the standard port functions described for ports a and b, port c pin 2 can be con?ured, using the eclk bit of the eeprom/eclk control register, to output the cpu clock. if this is selected the corresponding ddr bit is automatically set and bit 2 of port c will always read the output data latch. the other port c pins are not affected by this feature. a mask option is provided to enable resistive pull downs on all port c pins that are programmed as inputs. eclk ?external clock option bit 1 (set) eclk cpu clock is output on pc2. 0 (clear) eclk cpu clock is not output on pc2; port c acts as a normal i/o port. the eclk bit is cleared by power-on or external reset. it is not affected by the execution of a stop or wait instruction. the timing diagram of the clock output is shown in figure 4-2 . address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom/eclk control $0007 0000 eclk e1era e1lat e1pgm 0000 0000 figure 4-2 eclk timing diagram internal clock (phi2) external clock (eclk/pc2) output port (if write to output port) 55
motorola 4-4 MC68HC05X16 rev. 1 input/output ports 4 4.4 port d this 8-bit input-only port shares its pins with the a/d converter subsystem. when the a/d converter is enabled, pins pd0-pd7 read the eight analog inputs to the a/d converter. port d can be read at any time, however, if it is read during an a/d conversion sequence noise, may be injected on the analog inputs, resulting in reduced accuracy of the a/d. furthermore, performing a digital read of port d with levels other than v dd or v ss on the port d pins will result in greater power dissipation during the read cycle. as port d is an input-only port there is no ddr associated with it. also, at power up or external reset, the a/d converter is disabled, thus the port is con?ured as a standard input-only port. note: it is recommended that all unused input ports and i/o ports be tied to an appropriate logic level (i.e. either v dd or v ss ). 4.5 port registers the following sections explain in detail the individual bits in the data and control registers associated with the ports. 4.5.1 port data registers a and b (porta and portb) each bit can be con?ured as input or output via the corresponding data direction bit in the port data direction register (ddrx). the state of the port data registers following reset is not de?ed. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 unde?ed port b data (portb) $0001 unde?ed 56
MC68HC05X16 rev. 1 motorola 4-5 input/output ports 4 4.5.2 port data register c (portc) each bit can be con?ured as input or output via the corresponding data direction bit in the port data direction register (ddrx). in addition, bit 2 of port c is used to output the cpu clock if the eclk bit in the eeprom ctl/eclk register is set (see section 4.3 ). the state of the port data registers following reset is not de?ed. 4.5.3 port data register d (portd) all the port d bits are input-only and are shared with the a/d converter. the function of each bit is determined by the adon bit in the a/d status/control register. the state of the port data registers following reset is not de?ed. 4.5.4 a/d status/control register adon ?a/d converter on 1 (set) a/d converter is switched on; all port d pins act as analog inputs for the a/d converter. 0 (clear) a/d converter is switched off; all port d pins act as input only pins. reset clears the adon bit, thus con?uring port d as an input only port. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port c data (portc) $0002 pc2/ eclk unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port d data (portd) $0003 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d status/control $0009 coco adrc adon 0 ch3 ch2 ch1 ch0 0000 0000 57
motorola 4-6 MC68HC05X16 rev. 1 input/output ports 4 4.5.5 data direction registers (ddra, ddrb and ddrc) writing a ? to any bit con?ures the corresponding port pin as an output; conversely, writing any bit to ? con?ures the corresponding port pin as an input. reset clears these registers, thus con?uring all ports as inputs. 4.6 other port considerations all output ports can emulate ?pen-drain outputs. this is achieved by writing a zero to the relevant output port latch. by toggling the corresponding data direction bit, the port pin will either be an output zero or tri-state (an input). this is shown diagrammatically in figure 4-3 . when using a port pin as an ?pen-drain output, certain precautions must be taken in the user software. if a read-modify-write instruction is used on a port where the ?pen-drain is assigned and the pin at this time is programmed as an input, it will read it as a ?ne? the read-modify-write instruction will then write this ?ne into the output data latch on the next cycle. this would cause the ?pen-drain pin not to output a ?ero when desired. note: ?pen-drain outputs should not be pulled above v dd . address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data direction (ddra) $0004 0000 0000 port b data direction (ddrb) $0005 0000 0000 port c data direction (ddrc) $0006 0000 0000 58
MC68HC05X16 rev. 1 motorola 4-7 input/output ports 4 figure 4-3 port logic levels ddrn a y (b) 100 normal operation ?tri state 111 0 0 tri state 0 1 tri state 1 0 low ?pen-drain 11 0 0 high 0 1 high y t ? ? y t ? ? y a read buffer output data direction register bit ddrn px0 vdd v dd ddrx, bit 0 = 0 portx, bit 0 = 0 ddrx, bit 0 = 0 portx, bit 0 = 0 (c) (a) ?pen-drain output 59
motorola 4-8 MC68HC05X16 rev. 1 input/output ports 4 this page left blank intentionally 60
MC68HC05X16 rev. 1 motorola 5-1 motorola can module (mcan) 5 5 motorola can module (mcan) the mcan includes all hardware modules necessary to implement the can transfer layer, which represents the kernel of the can bus protocol as de?ed by bosch gmbh, the originators of the can speci?ation. for full details of the can protocol please refer to the published speci?ations. up to the message level, the mcan is totally compatible with the full can implementation. functional differences are related to the object layer only. whereas a full can controller provides dedicated hardware for handling a set of messages, the mcan is restricted to receiving and/or transmitting messages on a message by message basis. the mcan will never initiate an overload frame. if the mcan starts to receive a valid message (one that passes the acceptance ?ter) and there is no receive buffer available for it then the overrun ?g in the cpu status register will be set. the mcan will respond to overload frames generated by other can nodes, as required by the can protocol. a summary of all the mcan frame formats is given in figure 5-2 for reference. a diagram of the major blocks of the mcan is shown in figure 5-1 . figure 5-1 mcan block diagram interface management logic transmit buffer receive buffer 0 receive buffer 1 bit timing logic transceive logic bit stream processor error management logic line interface logic microprocessor related logic bus line related logic mcan bus line 61
motorola 5-2 MC68HC05X16 rev. 1 motorola can module (mcan) 5 figure 5-2 mcan frame formats start of frame id10 id0 rtr rb1 rb0 dlc3 dlc0 crc del acknowledge ack del d d d d r r r r r r r r r identi?r acceptance stored in buffers reserved bits data stored in transmit/receive buffers bit stuf?g arbitration ?ld control ?ld crc ?ld crc end of frame data frame (number of bits = 44 + 8n) 11 4 6 12 8 8 16 7 15 8n (0 n 8) data ?ld ?tering length code start of frame id10 id0 rtr rb1 rb0 dlc3 dlc0 crc del acknowledge ack del d r d d r r r r r r r r r arbitration ?ld control ?ld crc ?ld crc end of frame remote frame (number of bits = 44) 11 4 6 12 16 7 15 note: a remote frame is identical to a data frame, except that the rtr bit is recessive, and there is no data ?ld. 62
MC68HC05X16 rev. 1 motorola 5-3 motorola can module (mcan) 5 figure 5-2 mcan frame formats (continued) error ?g error frame note: an error frame can start anywhere in the middle of a frame. r r r r r r r r d d d d d d d d d 8 6 6 echo error ?g error delimiter inter-frame space or overload frame data frame or remote frame int inter-frame space r r r r d r r r r r r r r r r r r r r 8 3 suspend transmit bus idle r r r r r data frame or remote frame any frame start of frame note: int = intermission suspend transmission is only for error passive nodes. overload ?g overload frame r r r d d d d d d d r r r r r 8 6 overload delimiter inter-frame space or error frame end of frame or error delimiter note: an overload frame can only start at the end of a frame. maximum echo of overload ag is one bit. or overload delimiter 63
motorola 5-4 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.1 tbf ?transmit buffer the transmit buffer is an interface between the cpu and the bit stream processor (bsp) and is able to store a complete message. the buffer is written by the cpu and read by the bsp. the cpu may access this buffer whenever transmit buffer access is set to released. on requesting a transmission (by setting transmission request in the mcan command register to present) transmit buffer access is set to locked, giving the bsp exclusive access to this buffer. the transmit buffer is released after the message transfer has been completed or aborted. the tbf is 10 bytes long and holds the identi?r (1 byte), the control ?ld (1 byte) and the data ?ld (maximum length 8 bytes). the buffer is implemented as a single-ported ram, with mutually exclusive access by the cpu and the bsp. 5.2 rbf ?receive buffer the receive buffer is an interface between the bsp and the cpu and stores a message received from the bus line. once ?led by the bsp and allocated to the cpu (by the iml), the receive buffer cannot be used to store subsequent received messages until the cpu has acknowledged the reading of the buffers contents. thus, unless the cpu releases a receive buffer within a protocol de?ed time frame, future messages to be received may be lost. to reduce the requirements on the cpu, two receive buffers (rbf0 and rbf1) are implemented. while one receive buffer is allocated to the cpu, the bsp may write to the other buffer. rbf0 and rbf1 are each 10 bytes long and hold the identi?r (1 byte), the control ?ld (1 byte) and the data ?ld (maximum length 8 bytes). the buffers are implemented as single-ported rams with mutually exclusive access from the cpu and the bsp. the bsp signals the mcu to read the receive buffer only when the message being received has an identi?r that passes the acceptance ?ter. note that a message being transmitted will be automatically written to the receive buffer if the identi?r passes the acceptance ?ter. this is because it cannot be known, until after the ?st byte has been stored, whether or not the transmitting node will lose arbitration to another node. 5.3 interface to the MC68HC05X16 cpu the mcan handles all the communication transactions ?wing across the serial bus. for example, the cpu merely places a message to be transmitted into the transmit buffer and sets the tr bit. the mcan will begin transmitting the message when it has determined that the bus is idle. in the event of a transmission error, the mcan will initiate a repeated transmission automatically. 64
MC68HC05X16 rev. 1 motorola 5-5 motorola can module (mcan) 5 in a similar manner, the cpu module is noti?d that a message has been received only if it was error free. if any error occurs, the mcan signals the error within the can protocol without cpu intervention. the mcan within the MC68HC05X16 is controlled using a block of 30 registers. this comprises 10 control registers, 10 transmit buffer registers and 10 receive buffer registers. these registers are memory mapped between $20 and $3d (see figure 5-3 ). note: there is an offset of $20 between the MC68HC05X16 addresses and the mcan internal addresses, i.e. mcan addresses $00 to $1d, as de?ed in the bosch can speci?ation, are mapped to MC68HC05X16 addresses $20 to $3d. figure 5-3 mcan module memory map mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes command register status register interrupt register control register $0020 output control register acceptance code register acceptance mask register bus timing register 1 bus timing register 2 test register identi?r rtr-bit, data length code data segment byte 1 data segment byte 2 data segment byte 3 data segment byte 4 data segment byte 5 data segment byte 6 data segment byte 7 data segment byte 8 $0021 $0022 $0023 $0024 $0025 $0026 $0027 $0028 $0029 $002a $002b $002c $002d $002e $002f $0030 $0031 $0032 $0033 identi?r rtr-bit, data length code data segment byte 1 data segment byte 2 data segment byte 3 data segment byte 4 data segment byte 5 data segment byte 6 data segment byte 7 data segment byte 8 $0034 $0035 $0036 $0037 $0038 $0039 $003a $003b $003c $003d mcan registers mcan register blocks $0020 $0029 $002a $0033 $0034 $003d 65
motorola 5-6 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.1 mcan control register (ccntrl) this register may be read or written to by the mcu; only the rr bit is affected by the mcan. mode ?unde?ed mode this bit must never be set by the cpu as this would result in the transmit and receive buffers being mapped out of memory. the bit is cleared on reset, and should be left in this state for normal operation. spd ?speed mode 1 (set) slow ?bus line transitions from both ?ecessive to ?ominant and from ?ominant to ?ecessive will be used for resynchronization. 0 (clear) fast ?only transitions from ?ecessive to ?ominant will be used for resynchronization. oie ?overrun interrupt enable 1 (set) enabled ?the cpu will get an interrupt request whenever the overrun status bit gets set. 0 (clear) disabled ?the cpu will get no overrun interrupt request. eie ?error interrupt enable 1 (set) enabled ?the cpu will get an interrupt request whenever the error status or bus status bits in the cstat register change. 0 (clear) disabled ?the cpu will get no error interrupt request. tie ?transmit interrupt enable 1 (set) enabled ?the cpu will get an interrupt request whenever a message has been successfully transmitted, or when the transmit buffer is accessible again following an abort command. 0 (clear) disabled ?the cpu will get no transmit interrupt request. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reset condition state on reset mcan control (ccntrl) $0020 mode spd oie eie tie rie rr external reset 0u - u uuu1 rr bit set 0u - u uuu1 66
MC68HC05X16 rev. 1 motorola 5-7 motorola can module (mcan) 5 rie ?receive interrupt enable 1 (set) enabled ?the cpu will get an interrupt request whenever a message has been received free of errors. 0 (clear) disabled ?the cpu will get no receive interrupt request. rr ?reset request when the mcan detects that rr has been set it aborts the current transmission or reception of a message and enters the reset state. a reset request may be generated by either an external reset or by the cpu or by the mcan. the rr bit can be cleared only by the cpu. after the rr bit has been cleared, the mcan will start normal operation in one of two ways. if rr was generated by an external reset or by the cpu, then the mcan starts normal operation after the ?st occurrence of 11 recessive bits. if, however, the rr was generated by the mcan due to the bs bit being set (see section 5.3.3 ) the mcan waits for 128 occurrences of 11 recessive bits before starting normal operation. a reset request should not be generated by the cpu during a message transmission. ensure that a message is not being transmitted as follows: if tcs in cstat is clear ?set at in ccom (use sta or stx), read cs tat. if ts in cstat is set ?wait until ts is clear. note that a cpu-generated reset request does not change the values in the transmit and receive error counters. 1 (set) present ?mcan will be reset. 0 (clear) absent ?mcan will operate normally. note: the following registers may only be accessed when reset request = present: cacc, cacm, cbt0, cbt1, and cocntrl. 5.3.2 mcan command register (ccom) this is a write only register; a read of this location will always return the value $ff. this register may be written only when the rr bit in ccntrl is clear. do not use read-modify-write instructions on this register (e.g. bset, bclr). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reset condition state on reset mcan command (ccom) $0020 rx0 rx1 compsel sleep cos rrb at tr external reset 00u0 0000 rr bit set 00u0 0000 67
motorola 5-8 MC68HC05X16 rev. 1 motorola can module (mcan) 5 rx0 ?receive pin 0 (passive) (refer to figure 5-6 ) 1 (set) vdd/2 will be connected to the input comparator. the rx0 pin is disconnected. 0 (clear) the rx0 pin will be connected to the input comparator. vdd/2 is disconnected. rx1 ?receive pin 1 (passive) (refer to figure 5-6 ) 1 (set) vdd/2 will be connected to the input comparator. the rx1 pin is disconnected. 0 (clear) the rx1 pin will be connected to the input comparator. vdd/2 is disconnected. note: if both rx0 and rx1 are set, or both are clear, then neither of the rx pins will be disconnected. compsel ?comparator selector 1 (set) rx0 and rx1 will be compared with vdd/2 during sleep mode (see figure 5-6 ). 0 (clear) rx0 will be compared with rx1 during sleep mode. sleep ?go to sleep 1 (set) sleep ?the mcan will go into sleep mode, as long as there are no interrupts pending and there is no activity on the bus. otherwise the mcan will issue a wake-up interrupt. 0 (clear) wake-up ?the mcan will function normally. if sleep is cleared by the cpu then the mcan will waken up, but will not issue a wake-up interrupt. note: if sleep is set during the reception or transmission of a message, the mcan will generate an immediate wake-up interrupt. (this allows for a more orthogonal software implementation on the cpu.) this will have no effect on the transfer layer, i.e. no message will be lost or corrupted. the caf ?g in the eeprom control register indicates whether or not sleep mode was entered successfully. a node that was sleeping and has been awakened by bus activity will not be able to receive any messages until its oscillator has started and it has found a valid end of 68
MC68HC05X16 rev. 1 motorola 5-9 motorola can module (mcan) 5 frame sequence (11 recessive bits). the designer must take this into consideration when planning to use the sleep command. cos ?clear overrun status 1 (set) this clears the read-only data overrun status bit in the cstat register (see section 5.3.3 ). it may be written at the same time as rrb. 0 (clear) no action. rrb ?release receive buffer when set this releases the receive buffer currently attached to the cpu, allowing the buffer to be reused by the mcan. this may result in another message being received, which could cause another receive interrupt request (if rie is set). this bit is cleared automatically when a message is received, i.e. when the rs bit (see section 5.3.3 ) becomes set. 1 (set) released ?receive buffer is available to the mcan. 0 (clear) no action. at ?abort transmission when this bit is set a pending transmission will be cancelled if it is not already in progress, allowing the transmit buffer to be loaded with a new (higher priority) message when the buffer is released. if the cpu tries to write to the buffer when it is locked, the information will be lost without being signalled. the status register can be checked to see if transmission was aborted or is still in progress. 1 (set) present ?abort transmission of any pending messages. 0 (clear) no action. tr ?transmission request 1 (set) present ?depending on the transmission buffers content, a data frame or a remote frame will be transmitted. 0 (clear) no action. this will not cancel a previously requested transmission; the abort transmission command must be used to do this. 69
motorola 5-10 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.3 mcan status register (cstat) this is a read only register; only the mcan can change its contents. bs ?bus status this bit is set (off-bus) by the mcan when the transmit error counter reaches 256. the mcan will then set rr and will remain off-bus until the cpu clears rr again. at this point the mcan will wait for 128 successive occurrences of a sequence of 11 recessive bits before clearing bs and resetting the read and write error counters. while off-bus the mcan does not take part in bus activities. 1 (set) off-bus ?the mcan is not participating in bus activities. 0 (clear) on-bus ?the mcan is operating normally. es ?error status 1 (set) error ?either the read or the write error counter has reached the cpu warning limit of 96. 0 (clear) neither of the error counters has reached 96. ts ?transmit status 1 (set) transmit ?the mcan has started to transmit a message. 0 (clear) idle ?if the receive status bit is also clear then the mcan is idle; otherwise it is in receive mode. rs ?receive status 1 (set) receive ?the mcan entered receive mode from idle, or by losing arbitration during transmission. 0 (clear) idle ?if the transmit status bit is also clear then the mcan is idle; otherwise it is in transmit mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reset condition state on reset mcan status (cstat) $0022 bs es ts rs tcs tba do rbs external reset 0000 1100 rr bit set uu00 1100 70
MC68HC05X16 rev. 1 motorola 5-11 motorola can module (mcan) 5 tcs ?transmission complete status this bit is cleared by the mcan when tr becomes set. when tcs is set it indicates that the last requested transmission was successfully completed. if, after tcs is cleared, but before transmission begins, an abort transmission command is issued then the transmit buffer will be released and tcs will remain clear. tcs will then only be set after a further transmission is both requested and successfully completed. 1 (set) complete ?last requested transmission successfully completed. 0 (clear) incomplete ?last requested transmission not complete. tba ?transmit buffer access when clear, the transmit buffer is locked and cannot be accessed by the cpu. this indicates that either a message is being transmitted, or is awaiting transmission. if the cpu writes to the transmit buffer while it is locked, then the bytes will be lost without this being signalled. 1 (set) released ?the transmit buffer may be written to by the cpu. 0 (clear) locked ?the cpu cannot access the transmit buffer. do ?data overrun this bit is set when both receive buffers are full and there is a further message to be stored. in this case the new message is dropped, but the internal logic maintains the correct protocol. the mcan does not receive the message, but no warning is sent to the transmitting node. the mcan clears do when the cpu sets the cos bit in the ccom register. note that data overrun can also be caused by a transmission, since the mcan will temporarily store an outgoing frame in a receive buffer in case arbitration is lost during transmission. 1 (set) overrun ?both receive buffers were full and there was another message to be stored. 0 (clear) normal operation. rbs ?receive buffer status this bit is set by the mcan when a new message is available. when clear this indicates that no message has become available since the last rrb command. the bit is cleared when rrb is set. however, if the second receive buffer already contains a message, then control of that buffer is given to the cpu and rbs is immediately set again. the ?st receive buffer is then available for the next incoming message from the mcan. 1 (set) full ?a new message is available for the cpu to read. 0 (clear) empty ?no new message is available. 71
motorola 5-12 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.4 mcan interrupt register (cint) all bits of this register are read only; all are cleared by a read of the register. this register must be read in the interrupt handling routine in order to enable further interrupts. wif ?wake-up interrupt ?g if the mcan detects bus activity whilst it is asleep, it clears the sleep bit in the ccom register; the wif bit will then be set. wif is cleared by reading the mcan interrupt register (cint), or by an external reset. 1 (set) mcan has detected activity on the bus and requested wake-up. 0 (clear) no wake-up interrupt has occurred. oif ?overrun interrupt ?g when oie is set then this bit will be set when a data overrun condition is detected. like all the bits in this register, oif is cleared by reading the register, or when reset request is set. 1 (set) a data overrun has been detected. 0 (clear) no data overrun has occurred. eif ?error interrupt ?g when eie is set then this bit will be set by a change in the error or bus status bits in the mcan status register. like all the bits in this register, eif is cleared by reading the register, or by an external reset. 1 (set) there has been a change in the error or bus status bits in cs tat. 0 (clear) no error interrupt has occurred. tif ?transmit interrupt ?g the tif bit is set at the end of a transmission whenever both the tba and tie bits are set. like all the bits in this register, tif is cleared by reading the register, or when reset request is set. 1 (set) transmission complete, the transmit buffer is accessible. 0 (clear) no transmit interrupt has occurred. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 reset condition state on reset mcan interrupt (cint) $0023 wif oif eif tif rif external reset - - - 0 0000 rr bit set - - - u 0u00 72
MC68HC05X16 rev. 1 motorola 5-13 motorola can module (mcan) 5 rif ?receive interrupt ?g the rif bit is set by the mcan when a new message is available in the receive buffer, and the rie bit in ccntrl is set. at the same time rbs is set. like all the bits in this register, rif is cleared by reading the register, or when reset request is set. 1 (set) a new message is available in the receive buffer. 0 (clear) no receive interrupt has occurred. 5.3.5 mcan acceptance code register (cacc) on reception each message is written into the current receive buffer. the mcu is only signalled to read the message however, if it passes the criteria in the acceptance code and acceptance mask registers (accepted); otherwise, the message will be overwritten by the next message (dropped). note: this register can only be accessed when the reset request bit in the ccntrl register is set. ac7 ?ac0 ?acceptance code bits ac7 ?ac0 comprise a user de?ed sequence of bits with which the 8 most signi?ant bits of the data identi?r (id10 ?id3) are compared. the result of this comparison is then masked with the acceptance mask register. once a message has passed the acceptance criterion the respective identi?r, data length code and data are sequentially stored in a receive buffer, providing there is one free. if there is no free buffer, the data overrun condition will be signalled. on acceptance the receive buffer status bit is set to full and the receive interrupt bit is set (provided rie = enabled). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mcan acceptance code (cacc) $0024 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 unde?ed 73
motorola 5-14 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.6 mcan acceptance mask register (cacm) the acceptance mask register speci?s which of the corresponding bits in the acceptance code register are relevant for acceptance ?tering. note: this register can only be accessed when the reset request bit in the ccntrl register is set. am0 ?am7 ?acceptance mask bits when a particular bit in this register is clear this indicates that the corresponding bit in the acceptance code register must be the same as its identi?r bit, before a match will be detected. the message will be accepted if all such bits match. when a bit is set, it indicates that the state of the corresponding bit in the acceptance code register will not affect whether or not the message is accepted. 1 (set) ignore corresponding acceptance code register bit. 0 (clear) match corresponding acceptance code register and identi?r bits. 5.3.7 mcan bus timing register 0 (cbt0) note: this register can only be accessed when the reset request bit in the ccntrl register is set. sjw1, sjw0 ?synchronization jump width bits the synchronization jump width de?es the maximum number of system clock (t scl ) cycles by which a bit may be shortened, or lengthened, to achieve resynchronization on data transitions on the bus (see table 5-1 ). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mcan acceptance mask (cacm) $0025 am7 am6 am5 am4 am3 am2 am1 am0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mcan bus timing 0 (cbt0) $0026 sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 unde?ed 74
MC68HC05X16 rev. 1 motorola 5-15 motorola can module (mcan) 5 brp5 ?brp0 ?baud rate prescaler bits these bits determine the mcan system clock cycle time (t scl ), which is used to build up the individual bit timing, according to table 5-2 and the formula in figure 5-4 . table 5-1 synchronization jump width sjw1 sjw0 synchronization jump width 0 0 1 t scl cycle 0 1 2 t scl cycles 1 0 3 t scl cycles 1 1 4 t scl cycles table 5-2 baud rate prescaler brp5 brp4 brp3 brp2 brp1 brp0 prescaler value (p) 0 00000 1 0 00001 2 0 00010 3 0 00011 4 : ::::: : : ::::: : 1 11111 64 figure 5-4 oscillator block diagram osc1 f osc f osc /2 f op mcu bus clock mcan module system clock t scl = f osc 2p divide by 2 divide by 10, 8, 4 or 2 prescaler (p) 75
motorola 5-16 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.8 mcan bus timing register 1 (cbt1) this register can only be accessed when the reset request bit in the ccntrl register is set. samp ?sampling this bit determines the number of samples of the serial bus to be taken per bit time. when set three samples per bit are taken. this sample rate gives better rejection of noise on the bus, but introduces a one bit delay to the bus sampling. for higher bit rates samp should be cleared, which means that only one sample will be taken per bit. 1 (set) three samples per bit. 0 (clear) one sample per bit. tseg22 ?tseg10 ?time segment bits time segments within the bit time ? the number of clock cycles per bit time, and the location of the sample point. sync_seg system expects transitions to occur on the bus during this period. transmit point a node in transmit mode will transfer a new value to the mcan bus at this point. sample point a node in receive mode will sample the bus at this point. if the three samples per bit option is selected then this point marks the position of the third sample. time segment 1 (tseg1) and time segment 2 (tseg2) are programmable as shown in table 5-3 . the bit time is determined by the oscillator frequency, the baud rate prescaler, and the number of bus clock cycles ( t scl ) per bit (as shown above). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mcan bus timing 1 (cbt1) $0027 samp tseg22tseg21tseg20tseg13tseg12tseg11tseg10 unde?ed figure 5-5 segments within the bit time tseg 1 bit_time sync_seg tseg 2 sync_seg 1 clock cycle t scl sample point transmit point transmit point 76
MC68HC05X16 rev. 1 motorola 5-17 motorola can module (mcan) 5 calculation of the bit time note: tseg2 must be at least 2 t scl , i.e. the con?uration bits must not be 000. (if three samples per bit mode is selected then tseg2 must be at least 3 t scl .) tseg1 must be at least as long as tseg2. the synchronization jump width (sjw) may not exceed tseg2, and must be at least t scl shorter than tseg1 to allow for physical propagation delays. i.e. in terms of t scl : sync_seg = 1 tseg1 3 sjw + 1 tseg1 3 tseg2 tseg2 3 sjw and tseg2 3 2 (samp = 0) or tseg2 3 3 (samp = 1) these boundary conditions result in minimum bit times of 5 t scl , for one sample, and 7 t scl , for three samples per bit. table 5-3 time segment values tseg13 tseg12 tseg11 tseg10 time segment 1 tseg22 tseg21 tseg20 time segment 2 00012 t scl cycles 0 0 1 2 t scl cycles 00103 t scl cycles . . . . 00114 t scl cycles . . . . .... . 1118 t scl cycles .... . 1 1 1 1 16 t scl cycles bit_time sync_seg tseg1 tseg2 ++ = 77
motorola 5-18 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.9 mcan output control register (cocntrl) this register allows the setup of different output driver con?urations under software control. the user may select active pull-up, pull-down, ?at or push-pull output. note: this register can only be accessed when the reset request bit in the ccntrl register is set. ocm1 and ocm0 ?output control mode bits the values of these two bits determine the output mode, as shown in table 5-4 . note: the transmit clock (t xclk ) is used to indicate the end of the bit time and will be high during the sync_seg. for all the following modes of operation, a dominant bit is internally coded as a zero, a recessive as a one. the other output control bits are used to determine the actual voltage levels transmitted to the mcan bus for dominant and recessive bits. biphase mode if the can modules are isolated from the bus lines by a transformer then the bit stream has to be coded so that there is no resulting dc component. there is a ?p-?p within the mcan that keeps the last dominant con?uration; its direct output goes to tx0 and its complement to tx1. the ?p-?p is toggled for each dominant bit; dominant bits are thus sent alternately on tx0 and tx1; i.e. the ?st dominant bit is sent on tx0, the second on tx1, the third on tx0 and so on. during recessive bits, all output drivers are deactivated (i.e. high impedance). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mcan output control (cocntrl) $0028 octp1 octn1 ocpol1 octp0 octn0 ocpol0 ocm1 ocm0 unde?ed table 5-4 output control modes ocm1 ocm0 function 0 0 biphase mode 0 1 not used 10 normal mode 1 bit stream transmitted on both tx0 and tx1 11 normal mode 2 tx0 - bit sequence tx1 - bus clock (t xclk ) 78
MC68HC05X16 rev. 1 motorola 5-19 motorola can module (mcan) 5 normal mode 1 in contrast to biphase mode the bit representation is time invariant and not toggled. normal mode 2 for the tx0 pin this is the same as normal mode 1, however the data stream to tx1 is replaced by the transmit clock. the rising edge of the transmit clock marks the beginning of a bit time. the clock pulse will be t scl long. other output control bits the other six bits in this register control the output driver con?urations, to determine the format of the output signal for a given data value (see figure 5-6 ). octp0/1 ?these two bits control whether the p-type output control transistors are enabled. octn0/1 ?these two bits control whether the n-type output control transistors are enabled. ocpol0/1 ?these two bits determine the driver output polarity for each of the mcan bus lines (tx0, tx1). tp0/1 and tn0/1 ?these are the resulting states of the output transistors. td ?this is the internal value of the data bit to be transferred across the mcan bus. (a zero corresponds to a dominant bit, a one to a recessive.) the actions of these bits in the output control register are as shown in table 5-5 . table 5-5 mcan driver output levels mode td ocpoli octpi octni tpi tni txi output level float 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 off off off off off off off off float float float float pull-down 0 1 0 1 0 0 1 1 0 0 0 0 1 1 1 1 off off off off on off off on low float float low pull-up 0 1 0 1 0 0 1 1 1 1 1 1 0 0 0 0 off on on off off off off off float high high float push-pull 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 off on on off on off off on low high high low 79
motorola 5-20 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.10 transmit buffer identi?r register (tbi) id10 ?id3 ?identi?r bits the identi?r consists of 11 bits (id10 ?id0). id10 is the most signi?ant bit and is transmitted ?st on the bus during the arbitration procedure. the priority of an identi?r is de?ed to be highest for the smallest binary number. the three least signi?ant bits are contained in the trtdl register. the seven most signi?ant bits must not all be recessive. 5.3.11 remote transmission request and data length code register (trtdl) id2 ?id0 ?identi?r bits these bits contain the least signi?ant bits of the transmit buffer identi?r. rtr ?remote transmission request 1 (set) a remote frame will be transmitted. 0 (clear) a data frame will be transmitted. dlc3 ?dlc0 ?data length code bits. the data length code contains the number of bytes (data byte count) of the respective message. at transmission of a remote frame, the data length code is ignored, forcing the number of bytes to be 0. the data byte count ranges from 0 to 8 for a data frame. table 5-6 shows the effect of setting the dlc bits. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset transmit buffer identi?r (tbi) $002a id10 id9 id8 id7 id6 id5 id4 id3 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset rtr and data length code (trtdl) $002b id2 id1 id0 rtr dlc3 dlc2 dlc1 dlc0 unde?ed 80
MC68HC05X16 rev. 1 motorola 5-21 motorola can module (mcan) 5 5.3.12 transmit data segment registers (tds) 1 ?8 db7 ?db0 ?data bits these data bits in the eight data segment registers make up the bytes of data to be transmitted. the number of bytes to be transmitted is determined by the data length code. 5.3.13 receive buffer identi?r register (rbi) the layout of this register is identical to the tbi register (see section 5.3.10 ). (note that there are actually two receive buffer register sets, but switching between them is handled internally by the mcan.) table 5-6 data length codes data length code data byte count dlc3 dlc2 dlc1 dlc0 00000 00011 00102 00113 01004 01015 01106 01117 10008 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset transmit data segment (tds) $002c ? $0033 db7 db6 db5 db4 db3 db2 db1 db0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset receive buffer identi?r (rbi) $0034 id10 id9 id8 id7 id6 id5 id4 id3 unde?ed 81
motorola 5-22 MC68HC05X16 rev. 1 motorola can module (mcan) 5 5.3.14 remote transmission request and data length code register (rrtdl) the layout of this register is identical to the trtdl register (see section 5.3.11 ). 5.3.15 receive data segment registers (rds) 1 ?8 the layout of these registers is identical to the tdsx registers (see section 5.3.12 ). (note that there are actually two receive buffer register sets, but switching between them is handled internally by the mcan.) 5.4 interface to the mcan bus physically, the mcan bus may be composed of two wires. the bus can take on one of two values: dominant or recessive. during simultaneous transmission of dominant and recessive bits by two or more can modules the resulting bus value will be dominant. (for example, with a wired-and implementation of the bus, the dominant level would correspond to a logic 0, and the recessive level to a logic 1.) the two wires of the mcan bus are designated canh and canl. the voltage levels appearing on these lines are designated v canh and v canl . a simple termination network is required for each wire. figure 5-6 shows the physical interface circuitry within the mcan module, and its connection to the mcan bus with a typical low speed (<125 kbaud) hardware interface. (note that the suggested values shown in the diagram are subject to change in the future.) for the voltage and resistor values shown in figure 5-6 the voltages on the mcan bus are: recessive level: v canh = 3.25 v v canl = 1.75 v dominant level: v canh = 1.00 v v canl = 4.00 v address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset rtr and data length code (rrtdl) $0035 id2 id1 id0 rtr dlc3 dlc2 dlc1 dlc0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset receive data segment (rds) $0036 ? $003d db7 db6 db5 db4 db3 db2 db1 db0 unde?ed 82
MC68HC05X16 rev. 1 motorola 5-23 motorola can module (mcan) 5 figure 5-6 a typical physical interface between the mcan and the mcan bus lines & + sc ac sc sc + + + txp0 txn0 txp1 txn1 rx0 passive data rx1 passive compsel wake-up vdd/2 internal to the MC68HC05X16 mcan module 680 w 680 w 150k w 150k w 2 x 30k w 2 k w 2 k w 1.75v 3.25v termination network tx0 tx1 rx0 rx1 canl canh vddh mcan bus lines 83
motorola 5-24 MC68HC05X16 rev. 1 motorola can module (mcan) 5 if several can modules are driving a dominant level on the bus at the same time then the values for v canh and v canl can go to 0.3 and 4.7 volts respectively. the residual 0.3 v is due to the voltage drop across the diodes and driver transistors in the transmission circuit. the receiver part of the network uses two identical voltage divider networks, with a divide ratio of 6:1 (resistor values of 150k w and 30k w ) referenced to v dd /2. this increases the common mode range of the input comparator on the physical bus lines. if the common mode range of the comparator at its inputs is 1.5 to 3.5 volts then, for v dd = 5.0 v, the common mode range will be increased to ?.5 to +8.5 volts on the bus lines. 5.4.1 single wire operation in the event of a bus fault occurring, limited operation of the mcan bus may still be possible, depending on the nature of the fault. if the fault is due to a short circuit between the two bus lines or between one of the lines and ground, battery voltage or some other potential, it is possible to identify (using a special software procedure) the line on which the fault exists and to switch the corresponding comparator input from the faulty line to the v dd /2 reference supply. at the same time the driver transistors to the faulty line should also be switched off. this will allow communication to continue on the bus. one result of this mode of one wire transmission is a signi?ant reduction in the common mode range of the input comparator. switching to one wire operation is achieved using the control bits rx0-passive and rx1-passive in the mcan command register, located at address $21. setting either of these bits will result in the corresponding input being disconnected from the bus and connected to v dd /2. 5.5 sleep mode if the sleep bit in the mcan command register is set by the processor the mcan will go to sleep, unless it is active. if there is activity on the mcan bus lines, or there is an interrupt pending, the mcan is deemed to be active and will not go to sleep; a wake-up interrupt will be generated by the mcan in these circumstances. the sleep bit may also be cleared by the processor, in which case no wake-up interrupt will be generated. note that this bit is write-only by the cpu, and it is not possible therefore to check whether sleep mode has been entered by reading it. however, the caf bit in the eeprom control register is set when the mcan is asleep, and cleared when it is woken up (see section 3.5.1 ). in order to minimize power consumption, the active comparator is switched off and the sleep comparator circuitry is used to detect activity on the bus. when in sleep mode the mcan stops its own clocks, leaving the mcu in normal run mode. (similarly a stop instruction will stop the processor clocks, leaving the mcan in run mode.) the on-chip oscillator will stop only if the mcan is in sleep mode and the mcu executes a stop instruction. there is a time delay between the stop instruction being executed and the oscillator stopping. during this time it is possible that the mcan will come out of sleep mode, and hence prevent the oscillator from stopping. 84
MC68HC05X16 rev. 1 motorola 5-25 motorola can module (mcan) 5 when a dominant level is detected on the mcan bus, the mcan is woken up and a wake-up interrupt is generated. under normal operation the two mcan bus lines are forced to complementary logic levels. the level of one of the two wires can be disregarded and replaced by v dd /2 by setting one of the control bits, rx0 or rx1. 5.5.1 sleep comparator reference when the compsel bit in the mcan command register ($21) is cleared the sleep comparator inputs are the same as for the active comparator. however, when the compsel bit is set each input is compared with v dd /2 (vddh ?see figure 5-6 ) to detect a dominant level. for further details of the active comparator, the sleep comparator and vddh, refer to section 12 . 85
motorola 5-26 MC68HC05X16 rev. 1 motorola can module (mcan) 5 this page left blank intentionally 86
MC68HC05X16 rev. 1 motorola 6-1 programmable timer 6 6 programmable timer the programmable timer on the mc68hc05x32 consists of a 16-bit read-only free-running counter, with a ?ed divide-by-four prescaler, plus the input capture/output compare circuitry. the timer can be used for many purposes including measuring pulse length of two input signals and generating two output signals. pulse lengths for both input and output signals can vary from several microseconds to many seconds. in addition, it works in conjunction with the pulse width modulation (pwm) system to execute two 8-bit d/a plm (pulse length modulation) conversions, with a choice of two repetition rates. the timer is also capable of generating periodic interrupts or indicating passage of an arbitrary multiple of four cpu cycles. a block diagram is shown in figure 6-1 , and timing diagrams are shown in figure 6-2 , figure 6-3 , figure 6-4 and figure 6-5 . the timer has a 16-bit architecture, hence each speci? functional segment is represented by two 8-bit registers (except the plma and plmb which use one 8-bit register for each). these registers contain the high and low byte of that functional segment. accessing the low byte of a speci? timer function allows full control of that function; however, an access of the high byte inhibits that speci? timer function until the low byte is also accessed. the 16-bit programmable timer is monitored and controlled by a group of sixteen registers, full details of which are contained in this section. note: a problem may arise if an interrupt occurs in the time between the high and low bytes being accessed. to prevent this, the i-bit in the condition code register (ccr) should be set while manipulating both the high and low byte register of a speci? timer function, ensuring that an interrupt does not occur. 6.1 counter the key element in the programmable timer is a 16-bit, free-running counter or counter register, preceded by a prescaler that divides the internal processor clock by four. the prescaler gives the timer a resolution of 2 m s if the internal bus clock is 2 mhz. the counter is incremented during the low portion of the internal bus clock. software can read the counter at any time without affecting its value. 87
motorola 6-2 MC68HC05X16 rev. 1 programmable timer 6 figure 6-1 16-bit programmable timer block diagram internal internal bus 8 output compare register 1 processor clock + + 8-bit buffer ? 4 high low 16-bit free-running counter counter alternate register register 1 register 2 input capture internal timer bus over?w detect circuit edge detect tcap1 tcmp2 tcmp1 latch d c q compare output register 2 input capture byte byte high byte low byte high byte low byte high byte low byte low byte high byte circuit 1 compare output circuit 2 compare output circuit 1 edge detect circuit 2 tcap2 pin pin pin pin d c q latch 76543 timer status register timer control $0013 $0012 $0018 $0019 $001a $001b $001c $0016 $0017 $0014 $0015 $001e $001f $001d to plm register icf1 ocf1 tof icf2 ocf2 icie ocie toie folv2 olvl2 iedg1 olvl1 folv1 interrupt circuit input capture interrupt vector $3ff8,9 output compare interrupt vector $3ff6,7 over?w interrupt vector cop watchdog counter input $3ff4,5 88
MC68HC05X16 rev. 1 motorola 6-3 programmable timer 6 6.1.1 counter register and alternate counter register the double-byte, free-running counter can be read from either of two locations, $18-$19 (counter register) or $1a-$1b (alternate counter register). a read from only the less signi?ant byte (lsb) of the free-running counter ($19 or $1b) receives the count value at the time of the read. if a read of the free-running counter or alternate counter register ?st addresses the more signi?ant byte (msb) ($18 or $1a), the lsb is transferred to a buffer. this buffer value remains ?ed after the ?st msb read, even if the user reads the msb several times. this buffer is accessed when reading the free-running counter or alternate counter register lsb and thus completes a read sequence of the total counter value. in reading either the free-running counter or alternate counter register, if the msb is read, the lsb must also be read to complete the sequence. if the timer over?w ?g (tof) is set when the counter register lsb is read then a read of the timer status register (tsr) will clear the ?g. the alternate counter register differs from the counter register only in that a read of the lsb does not clear tof. therefore, where it is critical to avoid the possibility of missing timer over?w interrupts due to clearing of tof, the alternate counter register should be used. the free-running counter is set to $fffc during power-on and external reset and is always a read-only register. during a power-on reset, the counter begins running after the oscillator start-up delay. because the free-running counter is 16 bits preceded by a ?ed divide-by-4 prescaler, the value in the free-running counter repeats every 262,144 internal bus clock cycles. tof is set when the counter over?ws (from $ffff to $0000); this will cause an interrupt if toie is set. in some particular timing control applications it may be desirable to reset the 16-bit free running counter under software control. when the low byte of the counter ($19 or $1b) is written to, the counter is con?ured to its reset value ($fffc). the divide-by-4 prescaler is also reset and the counter resumes normal counting operation. all of the ?gs and enable bits remain unaltered by this operation. if access has previously been made to the high byte of the free-running counter ($18 or $1a), then the reset counter operation terminates the access sequence. warning: this operation may affect the function of the watchdog system (see section 10.1.4 ). the plm results will also be affected while resetting the counter. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer counter high $0018 1111 1111 timer counter low $0019 1111 1100 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset alternate counter high $001a 1111 1111 alternate counter low $001b 1111 1100 89
motorola 6-4 MC68HC05X16 rev. 1 programmable timer 6 6.2 timer control and status the various functions of the timer are monitored and controlled using the timer control and status registers described below. 6.2.1 timer control register (tcr) the timer control register ($0012) is used to enable the input captures (icie), output compares (ocie), and timer over?w (toie) functions as well as forcing output compares (folv1 and folv2), selecting input edge sensitivity (iedg1) and levels of output polarity (olv1 and olv2). icie ?input captures interrupt enable if this bit is set, a timer interrupt is enabled whenever the icf1 or icf2 status ?g (in the timer status register) is set. 1 (set) interrupt enabled. 0 (clear) interrupt disabled. ocie ?output compares interrupt enable if this bit is set, a timer interrupt is enabled whenever the ocf1 or ocf2 status ?g (in the timer status register) is set. 1 (set) interrupt enabled. 0 (clear) interrupt disabled. toie ?timer over?w interrupt enable if this bit is set, a timer interrupt is enabled whenever the tof status ?g (in the timer status register) is set. 1 (set) interrupt enabled. 0 (clear) interrupt disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control (tcr) $0012 icie ocie toie folv2 folv1 olv2 iedg1 olv1 0000 00u0 90
MC68HC05X16 rev. 1 motorola 6-5 programmable timer 6 folv2 ?force output compare 2 this bit always reads as zero, hence writing a zero to this bit has no effect. writing a one at this position will force the olv2 bit to the corresponding output level latch, thus appearing at the tcmp2 pin. note that this bit does not affect the ocf2 bit of the status register (see section 6.4.3 ). 1 (set) olv2 bit forced to output level latch. 0 (clear) no effect. folv1 ?force output compare 1 this bit always reads as zero, hence writing a zero to this bit has no effect. writing a one at this position will force the olv1 bit to the corresponding output level latch, thus appearing at the tcmp1 pin. note that this bit does not affect the ocf1 bit of the status register (see section 6.4.3 ). 1 (set) olv1 bit forced to output level latch. 0 (clear) no effect. olv2 ?output level 2 when olv2 is set a high output level will be clocked into the output level register by the next successful output compare, and will appear on the tcmp2 pin. when clear, it will be a low level which will appear on the tcmp2 pin. 1 (set) a high output level will appear on the tcmp2 pin. 0 (clear) a low output level will appear on the tcmp2 pin. iedg1 ?input edge 1 when iedg1 is set, a positive-going edge on the tcap1 pin will trigger a transfer of the free-running counter value to the input capture register 1. when clear, a negative-going edge triggers the transfer. 1 (set) tcap1 is positive-going edge sensitive. 0 (clear) tcap1 is negative-going edge sensitive. note: there is no need for an equivalent bit for the input capture register 2 as tcap2 is negative-going edge sensitive only. olv1 ?output level 1 when olv1 is set a high output level will be clocked into the output level register by the next successful output compare, and will appear on the tcmp1 pin. when clear, it will be a low level which will appear on the tcmp1 pin. 1 (set) a high output level will appear on the tcmp1 pin. 0 (clear) a low output level will appear on the tcmp1 pin. 91
motorola 6-6 MC68HC05X16 rev. 1 programmable timer 6 6.2.2 timer status register (tsr) the timer status register ($13) contains the status bits corresponding to the timer interrupt conditions ?icf1, ocf1, tof, icf2 and ocf2. accessing the timer status register satis?s the ?st condition required to clear the status bits. the remaining step is to access the register corresponding to the status bit. icf1 ?input capture ?g 1 this bit is set when the selected polarity of edge is detected by the input capture edge detector 1 at tcap1; an input capture interrupt will be generated, if icie is set. icf1 is cleared by reading the tsr and then the input capture low register 1 ($15). 1 (set) a valid input capture has occurred. 0 (clear) no input capture has occurred. ocf1 ?output compare ?g 1 this bit is set when the output compare 1 register contents match those of the free-running counter; an output compare interrupt will be generated if ocie is set. ocf1 is cleared by reading the tsr and then the output compare 1 low register ($17). 1 (set) a valid output compare has occurred. 0 (clear) no output compare has occurred. tof ?timer over?w status ?g this bit is set when the free-running counter over?ws from $ffff to $0000; a timer over?w interrupt will occur if toie is set. tof is cleared by reading the tsr and the counter low register ($19). 1 (set) timer over?w has occurred. 0 (clear) no timer over?w has occurred. when using the timer over?w function and reading the free-running counter at random times to measure an elapsed time, a problem may occur whereby the timer over?w ?g is unintentionally cleared if: 1 the timer status register is read or written when tof is set, and 2 the lsb of the free-running counter is read, but not for the purpose of servicing the ?g. reading the alternate counter register instead of the counter register will avoid this potential problem. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer status (tsr) $0013 icf1 ocf1 tof icf2 ocf2 unde?ed 92
MC68HC05X16 rev. 1 motorola 6-7 programmable timer 6 icf2 ?input capture ?g 2 this bit is set when a negative edge is detected by the input capture edge detector 2 at tcap2; an input capture interrupt will be generated if icie is set. icf2 is cleared by reading the tsr and then the input capture low register 2 ($1d). 1 (set) a valid (negative) input capture has occurred. 0 (clear) no input capture has occurred. ocf2 ?output compare ?g 2 this bit is set when the output compare 2 register contents match those of the free-running counter; an output compare interrupt will be generated if ocie is set. ocf2 is cleared by reading the tsr and then the output compare 2 low register ($1f). 1 (set) a valid output compare has occurred. 0 (clear) no output compare has occurred. 6.3 input capture ?nput capture is a technique whereby an external signal is used to trigger a read of the free running counter. in this way it is possible to relate the timing of an external signal to the internal counter value, and hence to elapsed time. there are two input capture registers: input capture register 1 (icr1) and input capture register 2 (icr2). the same input capture interrupt enable bit (icie) is used for the two input captures. 6.3.1 input capture register 1 (icr1) the two 8-bit registers that make up the 16-bit input capture register 1 are read-only, and are used to latch the value of the free-running counter after the input capture edge detector circuit 1 senses a valid transition at tcap1. the level transition that triggers the counter transfer is de?ed by the input edge bit (iedg1). when an input capture 1 occurs, the corresponding ?g icf1 in tsr is set. an interrupt can also accompany an input capture 1 provided the icie bit in tcr is set. the 8 most signi?ant bits are stored in the input capture high 1 register at $14, the 8 least signi?ant bits in the input capture low 1 register at $15. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset input capture high 1 $0014 unde?ed input capture low 1 $0015 unde?ed 93
motorola 6-8 MC68HC05X16 rev. 1 programmable timer 6 the result obtained from an input capture will be one greater than the value of the free-running counter on the rising edge of the internal bus clock preceding the external transition. this delay is required for internal synchronization. resolution is one count of the free-running counter, which is four internal bus clock cycles. the free-running counter contents are transferred to the input capture register 1 on each valid signal transition whether the input capture 1 ?g (icf1) is set or clear. the input capture register 1 always contains the free-running counter value that corresponds to the most recent input capture 1. after a read of the input capture 1 register msb ($14), the counter transfer is inhibited until the lsb ($15) is also read. this characteristic causes the time used in the input capture software routine and its interaction with the main program to determine the minimum pulse period. a read of the input capture 1 register lsb ($15) does not inhibit the free-running counter transfer since the two actions occur on opposite edges of the internal bus clock. reset does not affect the contents of the input capture 1 register, except when exiting stop mode (see section 6.6 ). 6.3.2 input capture register 2 (icr2) the two 8-bit registers that make up the 16-bit input capture register 2 are read-only, and are used to latch the value of the free-running counter after the input capture edge detector circuit 2 senses a negative transition at pin tcap2. when an input capture 2 occurs, the corresponding ?g icf2 in tsr is set. an interrupt can also accompany an input capture 2 provided the icie bit in tcr is set.the 8 most signi?ant bits are stored in the input capture 2 high register at $1c, the 8 least signi?ant bits in the input capture 2 low register at $1d. the result obtained from an input capture will be one greater than the value of the free-running counter on the rising edge of the internal bus clock preceding the external transition. this delay is required for internal synchronization. resolution is one count of the free-running counter, which is four internal bus clock cycles. the free-running counter contents are transferred to the input capture register 2 on each negative signal transition whether the input capture 2 ?g (ic2f) is set or clear. the input capture register 2 always contains the free-running counter value that corresponds to the most recent input capture 2. after a read of the input capture register 2 msb ($1c), the counter transfer is inhibited until the lsb ($1d) is also read. this characteristic causes the time used in the input capture software routine and its interaction with the main program to determine the minimum pulse period. a read of the input capture register 2 lsb ($1c) does not inhibit the free-running counter transfer since the two actions occur on opposite edges of the internal bus clock. reset does not affect the contents of the input capture 2 register, except when exiting stop mode (see section 6.6 ). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset input capture high 2 $001c unde?ed input capture low 2 $001d unde?ed 94
MC68HC05X16 rev. 1 motorola 6-9 programmable timer 6 6.4 output compare ?utput compare is a technique which may be used, for example, to generate an output waveform, or to signal when a speci? time period has elapsed, by presetting the output compare register to the appropriate value. there are two output compare registers: output compare register 1 (ocr1) and output compare register 2 (ocr2). note: the same output compare interrupt enable bit (ocie) is used for the two output compares. 6.4.1 output compare register 1 (ocr1) the 16-bit output compare register 1 is made up of two 8-bit registers at locations $16 (msb) and $17 (lsb). the contents of the output compare register 1 are compared with the contents of the free-running counter continually and, if a match is found, the corresponding output compare ?g (ocf1) in the timer status register is set and the output level (olvl1) is transferred to pin tcmp1. the output compare register 1 values and the output level bit should be changed after each successful comparison to establish a new elapsed timeout. an interrupt can also accompany a successful output compare provided the corresponding interrupt enable bit (ocie) is set. (the free-running counter is updated every four internal bus clock cycles.) after a processor write cycle to the output compare register 1 containing the msb ($16), the output compare function is inhibited until the lsb ($17) is also written. the user must write both bytes (locations) if the msb is written ?st. a write made only to the lsb ($17) will not inhibit the compare 1 function. the processor can write to either byte of the output compare register 1 without affecting the other byte. the output level (olvl1) bit is clocked to the output level register and hence to the tcmp1 pin whether the output compare ?g 1 (ocf1) is set or clear. the minimum time required to update the output compare register 1 is a function of the program rather than the internal hardware. because the output compare ?g 1 and the output compare register 1 are not de?ed at power on, and not affected by reset, care must be taken when initializing output compare functions with software. the following procedure is recommended: write to output compare high 1 to inhibit further compares; read the timer status register to clear ocf1 (if set); write to output compare low 1 to enable the output compare 1 function. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare high 1 $0016 unde?ed output compare low 1 $0017 unde?ed 95
motorola 6-10 MC68HC05X16 rev. 1 programmable timer 6 the purpose of this procedure is to prevent the ocf1 bit from being set between the time it is read and the write to the corresponding output compare register. all bits of the output compare register are readable and writable and are not altered by the timer hardware or reset. if the compare function is not needed, the two bytes of the output compare register can be used as storage locations. 6.4.2 output compare register 2 (ocr2) the 16-bit output compare register 2 is made up of two 8-bit registers at locations $1e (msb) and $1f (lsb). the contents of the output compare register 2 are compared with the contents of the free-running counter continually and, if a match is found, the corresponding output compare ?g (ocf2) in the timer status register is set and the output level (olvl2) is transferred to pin tcmp2. the output compare register 2 values and the output level bit should be changed after each successful comparison to establish a new elapsed timeout. an interrupt can also accompany a successful output compare provided the corresponding interrupt enable bit (ocie) is set. (the free-running counter is updated every four internal bus clock cycles.) after a processor write cycle to the output compare register 2 containing the msb ($1e), the output compare function is inhibited until the lsb ($1f) is also written. the user must write both bytes (locations) if the msb is written ?st. a write made only to the lsb ($1f) will not inhibit the compare 2 function. the processor can write to either byte of the output compare register 2 without affecting the other byte. the output level (olvl2) bit is clocked to the output level register and hence to the tcmp2 pin whether the output compare ?g 2 (ocf2) is set or clear. the minimum time required to update the output compare register 2 is a function of the program rather than the internal hardware. because the output compare ?g 2 and the output compare register 2 are not de?ed at power on, and not affected by reset, care must be taken when initializing output compare functions with software. the following procedure is recommended: write to output compare high 2 to inhibit further compares; read the timer status register to clear ocf2 (if set); write to output compare low 2 to enable the output compare 2 function. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare high 2 $001e unde?ed output compare low 2 $001f unde?ed 96
MC68HC05X16 rev. 1 motorola 6-11 programmable timer 6 the purpose of this procedure is to prevent the ocf1 bit from being set between the time it is read and the write to the corresponding output compare register. all bits of the output compare register are readable and writable and are not altered by the timer hardware or reset. if the compare function is not needed, the two bytes of the output compare register can be used as storage locations. 6.4.3 software force compare a software force compare is required in many applications. to achieve this, bit 3 (folv1 for ocr1) and bit 4 (folv2 for ocr2) in the timer control register are used. these bits always read as ?ero? but a write to ?ne causes the respective olvl1 or olvl2 values to be copied to the respective output level (tcmp1 and tcmp2 pins). internal logic is arranged such that in a single instruction, one can change olvl1 and/or olvl2, at the same time causing a forced output compare with the new values of olvl1 and olvl2. in conjunction with normal compare, this function allows a wide range of applications including ?ed frequency generation. note: a software force compare will affect the corresponding output pin tcmp1 and/or tcmp2, but will not affect the compare ?g, thus it will not generate an interrupt. 6.5 pulse length modulation (plm) the programmable timer works in conjunction with the plm system to execute two 8-bit d/a plm conversions, with a choice of two repetition rates (see section 8 ). 6.5.1 pulse length modulation registers a and b (plma/plmb) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse length modulation a (plma) $000a 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse length modulation b (plmb) $000b 0000 0000 97
motorola 6-12 MC68HC05X16 rev. 1 programmable timer 6 6.6 timer during stop mode when the mcu enters stop mode, the timer counter stops counting and remains at that particular count value until stop mode is exited by an interrupt. if stop mode is exited by power-on or external reset, the counter is forced to $fffc but if it is exited by external interrupt (irq ) then the counter resumes from its stopped value. another feature of the programmable timer is that if at least one valid input capture edge occurs at one of the tcap pins while in stop mode, the corresponding input capture detect circuitry is armed. this action does not wake the mcu or set any timer ?gs, but when the mcu does wake-up there will be an active input capture ?g (and data) from that ?st valid edge which occurred during stop mode. if stop mode is exited by an external reset then no such input capture ?g or data action takes place even if there was a valid input capture edge (at one of the tcap pins) during stop mode. 6.7 timer during wait mode the timer system is not affected by wait mode and continues normal operation. any valid timer interrupt will wake-up the system. 6.8 timer state diagrams the relationships between the internal clock signals, the counter contents and the status of the ?g bits are shown in the following ?ures. it should be noted that the signals labelled ?nternal (processor clock, timer clocks and reset) are not available to the user. 98
MC68HC05X16 rev. 1 motorola 6-13 programmable timer 6 figure 6-2 timer state timing diagram for reset figure 6-3 timer state timing diagram for input capture internal processor clock internal reset 16-bit counter external reset or end of por internal timer clocks ? ? ? $fffc $fffd $fffe $ffff note: the counter and timer control registers are the only ones affected by power-on or external reset. t00 t01 t11 t10 internal processor clock 16-bit counter $f123 $f124 $f125 $f126 internal timer clocks ? ? ? t00 t01 t11 t10 internal capture latch $f124 $???? input capture register input capture ?g input edge } } } } note: if the input edge occurs in the shaded area from one timer state t10 to the next timer state t10, then the input capture ?g will be set during the next t11 state. 99
motorola 6-14 MC68HC05X16 rev. 1 programmable timer 6 figure 6-4 timer state timing diagram for output compare figure 6-5 timer state timing diagram for timer over?w internal processor clock 16-bit counter $f456 $f457 $f458 $f459 internal timer clocks ? ? ? t00 t01 t11 t10 $f457 cpu writes $f457 output compare ?g and tcmp1,2 note: the cpu write to the compare registers may take place at any time, but a compare only occurs at timer state t01. thus a four cycle difference may exist between the write to the compare register and the actual compare. output compare register compare register latch (note 2) (note 1) (note 1) internal processor clock 16-bit counter $ffff $0000 $0001 $0002 internal timer clocks ? ? ? t00 t01 t11 t10 note: the timer over?w ?g is set at timer state t11 (transition of counter from $ffff to $0000). it is cleared by a read of the timer status register during the internal processor clock high time, followed by a read of the counter low register. timer over?w ?g 100
MC68HC05X16 rev. 1 motorola 7-1 serial communications interface 7 7 serial communications interface a full-duplex asynchronous serial communications interface (sci) is provided with a standard non-return-to-zero (nrz) format and a variety of baud rates. the sci transmitter and receiver are functionally independent and have their own baud rate generator; however they share a common baud rate prescaler and data format. the serial data format is standard mark/space (nrz) and provides one start bit, eight or nine data bits, and one stop bit. the sclk pin is the output of the transmitter clock. it outputs the transmitter data clock for synchronous transmission (no clocks on start bit and stop bit, and a software option to send clock on last data bit). this allows control of peripherals containing shift registers (e.g. lcd drivers). phase and polarity of these clocks are software programmable. any sci bidirectional communication requires a two-wire system: receive data in (rdi) and transmit data out (tdo). ?aud and ?it rate are used synonymously in the following description. 7.1 sci two-wire system features standard nrz (mark/space) format advanced error detection method with noise detection for noise duration of up to 1/16th bit time full-duplex operation (simultaneous transmit and receive) 32 software selectable baud rates different baud rates for transmit and receive; for each transmit baud rate, 8 possible receive baud rates software selectable word length (eight or nine bits) separate transmitter and receiver enable bits capable of being interrupt driven transmitter clocks available without altering the regular transmitter or receiver functions four separate enable bits for interrupt control 101
motorola 7-2 MC68HC05X16 rev. 1 serial communications interface 7 figure 7-1 serial communications interface block diagram & & & & + + internal bus sci interrupt transmit receive tdo pin rdi transmitter control receiver control clock clock extraction phase and polarity control pin receiver clock transmitter flag control data register data register tie tcie rie ilie te re sbk rwu 7 6 5 4 3 2 1 0 $000f sccr2 scsr $0010 sccr1 $000e trde tc rdrf idle or nf fe te sbk $0011 (see note) (see note) r8 t8 m wake cpol cpha lbcl 0 1 2 4 3 6 5 7 765 2 3 4 1 sclk pin wake up unit receive data shift register transmit data shift register $0011 note: the serial communications data register (sci scdr) is controlled by the internal r/w signal. it is the transmit data register when written to and the receive data register when read. 7 102
MC68HC05X16 rev. 1 motorola 7-3 serial communications interface 7 7.2 sci receiver features receiver wake-up function (idle line or address bit) idle line detection framing error detection noise detection overrun detection receiver data register full ?g 7.3 sci transmitter features transmit data register empty ?g transmit complete ?g send break 7.4 functional description a block diagram of the sci is shown in figure 7-1 . option bits in serial control register1 (sccr1) select the ?ake-up method (wake bit) and data word length (m bit) of the sci. sccr2 provides control bits that individually enable the transmitter and receiver, enable system interrupts and provide the wake-up enable bit (rwu) and the send break code bit (sbk). control bits in the baud rate register (baud) allow the user to select one of 32 different baud rates for the transmitter and receiver (see section 7.11.5 ). data transmission is initiated by writing to the serial communications data register (scdr). provided the transmitter is enabled, data stored in the scdr is transferred to the transmit data shift register. this transfer of data sets the transmit data register empty ?g (tdre) in the sci status register (scsr) and generates an interrupt (if transmitter interrupts are enabled). the transfer of data to the transmit data shift register is synchronized with the bit rate clock (see figure 7-2 ). all data is transmitted least signi?ant bit ?st. upon completion of data transmission, the transmission complete ?g (tc) in the scsr is set (provided no pending data, preamble or break is to be sent) and an interrupt is generated (if the transmit complete interrupt is enabled). if the transmitter is disabled, and the data, preamble or break (in the transmit data shift register) has been sent, the tc bit will also be set. this will also generate an interrupt if the transmission complete interrupt enable bit (tcie) is set. if the transmitter is disabled during a transmission, the character being transmitted will be completed before the transmitter gives up control of the tdo pin. 103
motorola 7-4 MC68HC05X16 rev. 1 serial communications interface 7 when scdr is read, it contains the last data byte received, provided that the receiver is enabled. the receive data register full ?g bit (rdrf) in the scsr is set to indicate that a data byte has been transferred from the input serial shift register to the scdr; this will cause an interrupt if the receiver interrupt is enabled. the data transfer from the input serial shift register to the scdr is synchronized by the receiver bit rate clock. the or (overrun), nf (noise), or fe (framing) error ?gs in the scsr may be set if data reception errors occurred. an idle line interrupt is generated if the idle line interrupt is enabled and the idle bit (which detects idle line transmission) in scsr is set. this allows a receiver that is not in the wake-up mode to detect the end of a message or the preamble of a new message, or to resynchronize with the transmitter. a valid character must be received before the idle line condition or the idle bit will not be set and idle line interrupt will not be generated. the scp0 and scp1 bits function as a prescaler for scr0?cr2 to generate the receiver baud rate and for sct0?ct2 to generate the transmitter baud rate. together, these eight bits provide multiple transmitter/receiver rate combinations for a given crystal frequency (see figure 7-2 ). this register should only be written to while both the transmitter and receiver are disabled (te=0, re=0). figure 7-2 sci rate generator division scp1 spc0 sct2 sct1 sct0 scr2 scr1 scr0 internal processor clock scp0 ?scp1 prescaler rate control ( ? np) scr0 ?scr2 receiver ( ? nr) sct0 ?sct2 transmitter rate control ( ? nt) ? 16 transmitter clock receiver clock rate control 76543210 $000d baud rate register note: there is a ?ed rate divide-by-16 before the transmitter to compensate for the inherent divide-by-16 of the receiver (sampling). this means that by loading the same value for both the transmitter and receiver baud rate selector, the same baud rates can be obtained. 104
MC68HC05X16 rev. 1 motorola 7-5 serial communications interface 7 7.5 data format receive data or transmit data is the serial data that is transferred to the internal data bus from the receive data input pin (rdi) or from the internal bus to the transmit data output pin (tdo). the non-return-to-zero (nrz) data format shown in figure 7-3 is used and must meet the following criteria: the idle line is brought to a logic one state prior to transmission/reception of a character. a start bit (logic zero) is used to indicate the start of a frame. the data is transmitted and received least signi?ant bit ?st. a stop bit (logic one) is used to indicate the end of a frame. a frame consists of a start bit, a character of eight or nine data bits, and a stop bit. a break is de?ed as the transmission or reception of a low (logic zero) for at least one complete frame time (10 zeros for 8-bit format, 11 zeros for 9-bit). 7.6 receiver wake-up operation the receiver logic hardware also supports a receiver wake-up function which is intended for systems having more than one receiver. with this function a transmitting device directs messages to an individual receiver or group of receivers by passing addressing information as the initial byte(s) of each message. the wake-up function allows receivers not addressed to remain in a dormant state for the remainder of the unwanted message. this eliminates any further software overhead to service the remaining characters of the unwanted message and thus improves system performance. the receiver is placed in wake-up mode by setting the receiver wake-up bit (rwu) in the sccr2 register. while rwu is set, all of the receiver related status ?gs (rdrf, idle, or, nf, and fe) are inhibited (cannot become set). note that the idle line detect function is inhibited while the rwu bit is set. although rwu may be cleared by a software write to sccr2, it would be unusual to do so. normally rwu is set by software and is cleared automatically in hardware by one of the two methods described below. figure 7-3 data format start stop control bit m selects 8 or 9 bit data start idle line 012345678 ? 0 105
motorola 7-6 MC68HC05X16 rev. 1 serial communications interface 7 7.6.1 idle line wake-up in idle line wake-up mode, a dormant receiver wakes up as soon as the rdi line becomes idle. idle is de?ed as a continuous logic high level on the rdi line for ten (or eleven) full bit times. systems using this type of wake-up must provide at least one character time of idle between messages to wake up sleeping receivers, but must not allow any idle time between characters within a message. 7.6.2 address mark wake-up in address mark wake-up, the most signi?ant bit (msb) in a character is used to indicate whether it is an address (1) or data (0) character. sleeping receivers will wake up whenever an address character is received. systems using this method for wake-up would set the msb of the ?st character of each message and leave it clear for all other characters in the message. idle periods may be present within messages and no idle time is required between messages for this wake-up method. 7.7 receive data in (rdi) receive data is the serial data that is applied through the input line and the sci to the internal bus. the receiver circuitry clocks the input at a rate equal to 16 times the baud rate. this time is referred to as the rt rate in figure 7-4 and as the receiver clock in figure 7-2 . the receiver clock generator is controlled by the baud rate register, as shown in figure 7-1 and figure 7-2 ; however, the sci is synchronized by the start bit, independent of the transmitter. once a valid start bit is detected, the start bit, each data bit and the stop bit are sampled three times at rt intervals 8 rt, 9 rt and 10 rt (1 rt is the position where the bit is expected to start), as shown in figure 7-5 . the value of the bit is determined by voting logic which takes the value of the majority of the samples. a noise ?g is set when all three samples on a valid start bit or data bit or the stop bit do not agree. 7.8 start bit detection when the input (idle) line is detected low, it is tested for three more sample times (referred to as the start edge veri?ation samples in figure 7-4 ). if at least two of these three veri?ation samples detect a logic zero, a valid start bit has been detected, otherwise the line is assumed to be idle. a noise ?g is set if one of the three veri?ation samples detect a logic one, thus a valid start bit could be assumed with a set noise ?g present. if there has been a framing error without detection of a break (10 zeros for 8 bit format or 11 zeros for 9 bit format), the circuit continues to operate as if there actually was a stop bit, and the start 106
MC68HC05X16 rev. 1 motorola 7-7 serial communications interface 7 edge will be placed arti?ially. the last bit received in the data shift register is inverted to a logic one, and the three logic one start quali?rs (shown in figure 7-4 ) are forced into the sample shift register during the interval when detection of a start bit is anticipated (see figure 7-6 ); therefore, the start bit will be accepted no sooner than it is anticipated. figure 7-4 sci examples of start bit sampling technique figure 7-5 sci sampling technique used on all bits 111 1 11 1 1 1 11 0000 1rt 2rt 3rt 5rt 7rt 4rt 6rt 8rt start quali?rs idle start edge veri?ation samples 16x internal sampling clock rt clock edges for all three examples noise start 111 1 11 1 1 1 0 1 0000 111 1 11 1 1 1 1 1 0010 start start noise rdi rdi rdi < < < samples present bit next bit previous bit 16rt 1rt 8rt 9rt 10rt 16rt 1rt rdi 107
motorola 7-8 MC68HC05X16 rev. 1 serial communications interface 7 if the receiver detects that a break (rdrf = 1, fe = 1, receiver data register = $0000) produced the framing error, the start bit will not be arti?ially induced and the receiver must actually detect a logic one before the start bit can be recognised (see figure 7-7 ). 7.9 transmit data out (tdo) transmit data is the serial data from the internal data bus that is applied through the sci to the output line. data format is as discussed in section 7.5 and shown in figure 7-3 . the transmitter generates a bit time by using a derivative of the rt clock, thus producing a transmission rate equal to 1/16th that of the receiver sample clock (assuming the same baud rate is selected for both the receiver and transmitter). figure 7-6 arti?ial start following a framing error figure 7-7 sci start bit following a break data expected stop data samples arti?ial edge start bit data rdi data expected stop data samples start edge start bit data rdi a) case 1: receive line low during arti?ial edge b) case 2: receive line high during expected start edge expected stop data samples detected as valid start edge start bit rdi break ? ? ? ? ? ? ? ? ? ? ? start quali?rs start edge veri?ation samples 108
MC68HC05X16 rev. 1 motorola 7-9 serial communications interface 7 7.10 sci synchronous transmission the sci transmitter allows the user to control a one way synchronous serial transmission. the sclk pin is the clock output of the sci transmitter. no clocks are sent to that pin during start bit and stop bit. depending on the state of the lbcl bit (bit 0 of sccr1), clocks will or will not be activated during the last valid data bit (address mark). the cpol bit (bit 2 of sccr1) allows the user to select the clock polarity, and the cpha bit (bit 1 of sccr1) allows the user to select the phase of the external clock (see figure 7-8 , figure 7-9 and figure 7-10 ). during idle, preamble and send break, the external sclk clock is not activated. these options allow the user to serially control peripherals which consist of shift registers, without losing any functions of the sci transmitter which can still talk to other sci receivers. these options do not affect the sci receiver which is independent of the transmitter. the sclk pin works in conjunction with the tdo pin. when the sci transmitter is disabled (te = 0), the sclk and tdo pins go to the high impedance state. note: the lbcl, cpol and cpha bits have to be selected before enabling the transmitter to ensure that the clocks function correctly. these bits should not be changed while the transmitter is enabled. figure 7-8 sci example of synchronous and asynchronous transmission rdi tdo sclk output port data out data in data in clock enable asynchronous MC68HC05X16 (e.g. modem) synchronous (e.g. shift register, display driver, etc.) 109
motorola 7-10 MC68HC05X16 rev. 1 serial communications interface 7 7.11 sci registers the sci system is con?ured and controlled by ?e registers: scdr, sccr1, sccr2, scsr, and baud. 7.11.1 serial communications data register (scdr) the scdr is controlled by the internal r/w signal and performs two functions in the sci. it acts as the receive data register (rdr) when it is read and as the transmit data register (tdr) when it is written. figure 7-1 shows this register as two separate registers, rdr and tdr. the rdr provides the interface from the receive shift register to the internal data bus and the tdr provides the parallel interface from the internal data bus to the transmit shift register. the receive data register is a read-only register containing the last byte of data received from the shift register for the internal data bus. the rdr full bit (rdrf) in the serial communications status register is set to indicate that a byte has been transferred from the input serial shift register to the scdr. the transfer is synchronized with the receiver bit rate clock (from the receiver control) as shown in figure 7-1 . all data is received with the least signi?ant bit ?st. the transmit data register (tdr) is a write-only register containing the next byte of data to be applied to the transmit shift register from the internal data bus. as long as the transmitter is enabled, data stored in the scdr is transferred to the transmit shift register (after the current byte in the shift register has been transmitted). the transfer is synchronized with the transmitter bit rate clock (from the transmitter control) as shown in figure 7-1 . all data is received with the least signi?ant bit ?st. 7.11.2 serial communications control register 1 (sccr1) the sci control register 1 (sccr1) contains control bits related to the nine data bit character format, the receiver wake-up feature and the options to output the transmitter clocks for synchronous transmissions. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci data (scdr) $0011 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci control 1 (sccr1) $000e r8 t8 m wake cpol cpha lbcl unde?ed 110
MC68HC05X16 rev. 1 motorola 7-11 serial communications interface 7 r8 ?receive data bit 8 this read-only bit is the ninth serial data bit received when the sci system is con?ured for nine data bit operation (m = 1). the most signi?ant bit (bit 8) of the received character is transferred into this bit at the same time as the remaining eight bits (bits 0?) are transferred from the serial receive shift register to the sci receive data register. t8 ?transmit data bit 8 this read/write bit is the ninth data bit to be transmitted when the sci system is con?ured for nine data bit operation (m = 1). when the eight low order bits (bits 0?) of a transmit character are transferred from the sci data register to the serial transmit shift register, this bit (bit 8) is transferred to the ninth bit position of the shift register. m ?mode (select character format) the read/write m-bit controls the character length for both the transmitter and receiver at the same time. the 9th data bit is most commonly used as an extra stop bit or it can also be used as a parity bit (see table 7-1 ). 1 (set) start bit, 9 data bits, 1 stop bit. 0 (clear) start bit, 8 data bits, 1 stop bit. wake ?wake-up mode select this bit allows the user to select the method for receiver wake-up. the wake bit can be read or written to any time. see table 7-1 . 1 (set) wake-up on address mark; if rwu is set, sci will wake-up if the 8th (if m=0) or the 9th (if m=1) bit received on the rx line is set. 0 (clear) wake-up on idle line; if rwu is set, sci will wake-up after 11 (if m=0) or 12 (if m=1) consecutive ?s on the rx line. table 7-1 method of receiver wake-up wake m method of receiver wake-up 0x detection of an idle line allows the next data type received to cause the receive data register to ?l and produce an rdrf ?g. 10 detection of a received one in the eighth data bit allows an rdrf ?g and associated error ?gs. 11 detection of a received one in the ninth data bit allows an rdrf ?g and associated error ?gs. x = don? care 111
motorola 7-12 MC68HC05X16 rev. 1 serial communications interface 7 cpol ?clock polarity this bit allows the user to select the polarity of the clocks to be sent to the sclk pin. it works in conjunction with the cpha bit to produce the desired clock-data relation (see figure 7-9 and figure 7-10 ). 1 (set) steady high value at sclk pin outside transmission window. 0 (clear) steady low value at sclk pin outside transmission window. this bit should not be manipulated while the transmitter is enabled. cpha ?clock phase this bit allows the user to select the phase of the clocks to be sent to the sclk pin. this bit works in conjunction with the cpol bit to produce the desired clock-data relation (see figure 7-9 and figure 7-10 ). 1 (set) sclk clock line activated at beginning of data bit. 0 (clear) sclk clock line activated in middle of data bit. this bit should not be manipulated while the transmitter is enabled. figure 7-9 sci data clock timing diagram (m=0) idle or preceding transmission clock stop start lsb data m = 0 (8 data bits) idle or next lbcl bit controls last data clock transmission clock clock clock * * * * * start stop 0123456 msb 7 (cpol = 0, cpha = 0) (cpol = 0, cpha = 1) (cpol = 1, cpha = 0) (cpol = 1, cpha = 1) 112
MC68HC05X16 rev. 1 motorola 7-13 serial communications interface 7 lbcl ?last bit clock this bit allows the user to select whether the clock associated with the last data bit transmitted (msb) has to be output to the sclk pin. the clock of the last data bit is output to the sclk pin if the lbcl bit is a logic one, and is not output if it is a logic zero. the last bit is the 8th or 9th data bit transmitted depending on the 8 or 9 bit format selected by m-bit (see table 7-2 ). this bit should not be manipulated while the transmitter is enabled. figure 7-10 sci data clock timing diagram (m=1) table 7-2 sci clock on sclk pin data format m-bit lbcl bit number of clocks on sclk pin 8 bit 0 0 7 8 bit 0 1 8 9 bit 1 0 8 9 bit 1 1 9 idle or preceding transmission clock stop start lsb data m = 1 (9 data bits) idle or next lbcl bit controls last data clock transmission clock clock clock * * * * start stop 0123456 msb 7 * 8 (cpol = 0, cpha = 0) (cpol = 0, cpha = 1) (cpol = 1, cpha = 0) (cpol = 1, cpha = 1) 113
motorola 7-14 MC68HC05X16 rev. 1 serial communications interface 7 7.11.3 serial communications control register 2 (sccr2) the sci control register 2 (sccr2) provides the control bits that enable/disable individual sci functions. tie ?transmit interrupt enable 1 (set) tdre interrupts enabled. 0 (clear) tdre interrupts disabled. tcie ?transmit complete interrupt enable 1 (set) tc interrupts enabled. 0 (clear) tc interrupts disabled. rie ?receiver interrupt enable 1 (set) rdrf and or interrupts enabled. 0 (clear) rdrf and or interrupts disabled. ilie ?idle line interrupt enable 1 (set) idle interrupts enabled. 0 (clear) idle interrupts disabled. te ?transmitter enable when the transmit enable bit is set, the transmit shift register output is applied to the tdo line and the corresponding clocks are applied to the sclk pin. depending on the state of control bit m (sccr1), a preamble of 10 (m = 0) or 11 (m = 1) consecutive ones is transmitted when software sets the te bit from a cleared state. if a transmission is in progress and a zero is written to te, the transmitter will wait until after the present byte has been transmitted before placing the tdo and the sclk pin in the idle, high impedance state. if the te bit has been written to a zero and then set to a one before the current byte is transmitted, the transmitter will wait for that byte to be transmitted and will then initiate transmission of a new preamble. after this latest transmission, and provided the tdre bit is set (no new data to transmit), the line remains idle (driven high while te = 1); otherwise, normal transmission occurs. this function allows the user to neatly terminate a transmission sequence. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci control (sccr2) $000f tie tcie rie ilie te re rwu sbk 0000 0000 114
MC68HC05X16 rev. 1 motorola 7-15 serial communications interface 7 after loading the last byte in the serial communications data register and receiving the tdre ?g, the user should clear te. transmission of the last byte will then be completed and the line will go idle. 1 (set) transmitter enabled. 0 (clear) transmitter disabled. re ?receiver enable 1 (set) receiver enabled. 0 (clear) receiver disabled. when re is clear (receiver disabled) all the status bits associated with the receiver (rdrf, idle, or, nf and fe) are inhibited. rwu ?receiver wake-up when the receiver wake-up bit is set by the user software, it puts the receiver to sleep and enables the wake-up function. the type of wake-up mode for the receiver is determined by the wake bit discussed above (in the sccr1). when the rwu bit is set, no status ?gs will be set. flags which were set previously will not be cleared when rwu is set. if the wake bit is cleared, rwu is cleared by the sci logic after receiving 10 (m = 0) or 11 (m =1) consecutive ones. under these conditions, rwu cannot be set if the line is idle. if the wake bit is set, rwu is cleared after receiving an address bit. the rdrf ?g will then be set and the address byte stored in the receiver data register. sbk ?send break if the send break bit is toggled set and cleared, the transmitter sends 10 (m = 0) or 11 (m = 1) zeros and then reverts to idle sending data. if sbk remains set, the transmitter will continually send whole blocks of zeros (sets of 10 or 11) until cleared. at the completion of the break code, the transmitter sends at least one high bit to guarantee recognition of a valid start bit. 115
motorola 7-16 MC68HC05X16 rev. 1 serial communications interface 7 7.11.4 serial communications status register (scsr) the serial communications status register (scsr) provides inputs to the interrupt logic circuits for generation of the sci system interrupt. in addition, a noise ?g bit and a framing error bit are also contained in the scsr. tdre ?transmit data register empty ?g this bit is set when the contents of the transmit data register are transferred to the serial shift register. new data will not be transmitted unless the scsr register is read before writing to the transmit data register to clear the tdre ?g. if the tdre bit is clear, this indicates that the transfer has not yet occurred and a write to the serial communications data register will overwrite the previous value. the tdre bit is cleared by accessing the serial communications status register (with tdre set) followed by writing to the serial communications data register. tc ?transmit complete ?g this bit is set to indicate that the sci transmitter has no meaningful information to transmit (no data in shift register, no preamble, no break). when tc is set the serial line will go idle (continuous mark). the tc bit is cleared by accessing the serial communications status register (with tc set) followed by writing to the serial communications data register. it does not inhibit the transmitter function in any way. rdrf ?receive data register full ?g this bit is set when the contents of the receiver serial shift register are transferred to the receiver data register. if multiple errors are detected in any one received word, the nf and rdrf bits will be affected as appropriate during the same clock cycle. the rdrf bit is cleared when the serial communications status register is accessed (with rdrf set) followed by a read of the serial communications data register. idle ?idle line detected ?g this bit is set when a receiver idle line is detected (the receipt of a minimum of ten/eleven consecutive ?s). this bit will not be set by the idle line condition when the rwu bit is set. this allows a receiver that is not in the wake-up mode to detect the end of a message, detect the preamble of a new message or resynchronize with the transmitter. the idle bit is cleared by accessing the serial communications status register (with idle set) followed by a read of the serial communications data register. once cleared, idle will not be set again until after rdrf has been set, (i.e. until after the line has been active and becomes idle again). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci status (scsr) $0010 tdre tc rdrf idle or nf fe 1100 000u 116
MC68HC05X16 rev. 1 motorola 7-17 serial communications interface 7 or ?overrun error ?g this bit is set when a new byte is ready to be transferred from the receiver shift register to the receiver data register and the receive data register is already full (rdrf bit is set). data transfer is inhibited until the rdrf bit is cleared. data in the serial communications data register is valid in this case, but additional data received during an overrun condition (including the byte causing the overrun) will be lost. the or bit is cleared when the serial communications status register is accessed (with or set) followed by a read of the serial communications data register. nf ?noise error ?g this bit is set if there is noise on a ?alid start bit, any of the data bits or on the stop bit. the nf bit is not set by noise on the idle line nor by invalid start bits. if there is noise, the nf bit is not set until the rdrf ?g is set. each data bit is sampled three times as described in section 7.7 . the nf bit represents the status of the byte in the serial communications data register. for the byte being received (shifted in) there will be also a ?orking noise ?g, the value of which will be transferred to the nf bit when the serial data is loaded into the serial communications data register. the nf bit does not generate an interrupt because the rdrf bit gets set with nf and can be used to generate the interrupt. the nf bit is cleared when the serial communications status register is accessed (with nf set) followed by a read of the serial communications data register. fe ?framing error ?g this bit is set when the word boundaries in the bit stream are not synchronized with the receiver bit counter (generated by the reception of a logic zero bit where a stop bit was expected). the fe bit re?cts the status of the byte in the receive data register and the transfer from the receive shift register to the receive data register is inhibited by an overrun. the fe bit is set during the same cycle as the rdrf bit but does not get set in the case of an overrun (or). the framing error ?g inhibits further transfer of data into the receive data register until it is cleared. the fe bit is cleared when the serial communications status register is accessed (with fe set) followed by a read of the serial communications data register. 117
motorola 7-18 MC68HC05X16 rev. 1 serial communications interface 7 7.11.5 baud rate register (baud) the baud rate register provides the means to select two different or equivalent baud rates for the transmitter and receiver. scp1, scp0 ?serial prescaler select bits these read/write bits determine the prescale factor, np, by which the internal processor clock is divided before it is applied to the transmitter and receiver rate control dividers, nt and nr. this common prescaled output is used as the input to a divider that is controlled by the scr0?cr2 bits for the sci receiver, and by the sct0?ct2 bits for the transmitter. sct2, sct1, sct0 ?sci rate select bits (transmitter) these three read/write bits select the baud rates for the transmitter. the prescaler output is divided by the factors shown in table 7-4 . address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci baud rate (baud) $000d scp1 scp0 sct2 sct1 sct0 scr2 scr1 scr0 00uu uuuu table 7-3 first prescaler stage scp1 scp0 prescaler division ratio (np) 00 1 01 3 10 4 11 13 table 7-4 second prescaler stage (transmitter) sct2 sct1 sct0 transmitter division ratio (nt) 000 1 001 2 010 4 011 8 100 16 101 32 110 64 111 128 118
MC68HC05X16 rev. 1 motorola 7-19 serial communications interface 7 scr2, scr1, scr0 ?sci rate select bits (receiver) these three read/write bits select the baud rates for the receiver. the prescaler output described above is divided by the factors shown in table 7-5 . the following equations are used to calculate the receiver and transmitter baud rates: where: np = prescaler divide ratio nt = transmitter baud rate divide ratio nr = receiver baud rate divide ratio baudtx = transmitter baud rate baudrx = receiver baud rate f clk = cpu clock frequency table 7-5 second prescaler stage (receiver) scr2 scr1 scr0 receiver division ratio (nr) 000 1 001 2 010 4 011 8 100 16 101 32 110 64 111 128 baudtx f clk 16 np nr ----------------------------------- = baudrx f clk 16 np nr ----------------------------------- = 119
motorola 7-20 MC68HC05X16 rev. 1 serial communications interface 7 7.12 baud rate selection the ?xibility of the baud rate generator allows many different baud rates to be selected, depending on the cpu clock frequency. a particular baud rate may be generated by manipulating the various prescaler and division ratio bits. table 7-6 , table 7-7 and table 7-8 show the highest baud rates that can be achieved for ?e typical crystal frequencies, for each of the cpu clock frequency options and only using the prescaler bits. table 7-9 shows how lower transmitter or receiver baud rates may be obtained using a further division ratio provided by the sci rate select bits. note that the ?e examples given in table 7-9 are representative samples only. note: the clock in the ?lock divided by column refers to the internal processor clock. table 7-6 sci baud rate selection with cpu clock frequency = f osc /2 clock divided by crystal frequency ?f osc (mhz) scp1 scp0 4.194304 4.00 2.4576 2.00 1.8432 0 0 1 131072 125000 76800 62500 57600 0 1 3 43691 41667 25600 20833 19200 1 0 4 32768 31250 19200 15625 14400 1 1 13 10082 9600 5907 4800 4430 table 7-7 sci baud rate selection with cpu clock frequency = f osc /8 clock divided by crystal frequency ?f osc (mhz) scp1 scp0 16.00 8.00 4.9152 4.194304 2.4576 0 0 1 125000 62500 38400 32768 19200 0 1 3 41667 20833 12800 10082 14400 1 0 4 31250 15625 9600 8192 4430 1 1 13 9600 4800 2954 2521 1477 table 7-8 sci baud rate selection with cpu clock frequency = f osc /10 clock divided by crystal frequency ?f osc (mhz) scp1 scp0 20.00 18.432 10.00 6.144 5.0 0 0 1 125000 115200 62500 38400 31250 0 1 3 41667 38400 20833 12800 10417 1 0 4 31250 28800 15625 9600 7813 1 1 13 9600 8861 4800 2954 2400 120
MC68HC05X16 rev. 1 motorola 7-21 serial communications interface 7 note: the examples shown in table 7-6 , table 7-7 , table 7-8 and table 7-9 do not apply when the part is operating in slow mode (see section 2.2.3 ). for the receiver, the internal clock frequency is 16 times higher than the selected baud rate. 7.13 sci during stop mode when the mcu enters stop mode, the baud rate generator driving the receiver and transmitter is shut down. this stops all sci activity. both the receiver and the transmitter are unable to operate. if the stop instruction is executed during a transmitter transfer, that transfer is halted. when stop mode is exited as a result of an external interrupt, that particular transmission resumes. if the receiver is receiving data when the stop instruction is executed, received data sampling is stopped (baud generator stops) and the rest of the data is lost. warning: for the above reasons, all sci transactions should be in the idle state when the stop instruction is executed. 7.14 sci during wait mode the sci system is not affected by wait mode and continues normal operation. any valid sci interrupt will wake-up the system. if required, the sci system can be disabled prior to entering wait mode by writing a zero to the transmitter and receiver enable bits in the serial communication control register 2 at $000f. this action will result in a reduction of power consumption during wait mode. table 7-9 sci transmit baud rate output for a given prescaler output sct/scr bits divide by representative highest prescaler baud rate output bit 2 bit 1 bit 0 131072 32768 38400 19200 9600 0 0 0 1 131072 32768 38400 19200 9600 0 0 1 2 65536 16384 19200 9600 4800 0 1 0 4 32768 8192 9600 4800 2400 0 1 1 8 16384 4096 4800 2400 1200 1 0 0 16 8192 2048 2400 1200 600 1 0 1 32 4096 1024 1200 600 300 1 1 0 64 2048 512 600 300 150 1 1 1 128 1024 256 300 150 75 121
motorola 7-22 MC68HC05X16 rev. 1 serial communications interface 7 this page left blank intentionally 122
MC68HC05X16 rev. 1 motorola 8-1 pulse length d/a converters 8 8 pulse length d/a converters the pulse length d/a converter (plm) system works in conjunction with the timer to execute two 8-bit d/a conversions, with a choice of two repetition rates. (see figure 8-1 .) figure 8-1 plm system block diagram plma register plmb ? register buffer ? register ? comparator ? latch zero detector sfa bit sfb d/a pin timer bus from timer data bus 8 16 multiplexer ? ? buffer register comparator multiplexer plma plmb d/a r s bit zero detector 8 16 88 pin latch r s 123
motorola 8-2 MC68HC05X16 rev. 1 pulse length d/a converters 8 the d/a converter has two data registers associated with it, plma and plmb. this is a dual 8-bit resolution d/a converter associated with two output pins (plma and plmb). the outputs are pulse length modulated signals whose duty cycle ratio may be modi?d. these signals can be used directly as plms, or the ?tered average may be used as general purpose analog outputs. the longest repetition period is 4096 times the programmable timer clock period (cpu clock multiplied by four), and the shortest repetition period is 256 times the programmable timer clock period (the repetition rate frequencies for a 4 mhz crystal are 122 hz and 1953 hz respectively). registers plma ($0a) and plmb ($0b) are associated with the pulse length values of the two counters. a value of $00 loaded into these registers results in a continuously low output on the corresponding d/a output pin. a value of $80 results in a 50% duty cycle output, and so on, to the maximum value $ff corresponding to an output which is at ? for 255/256 of the cycle. when the mcu makes a write to register plma or plmb the new value will only be picked up by the d/a converters at the end of a complete cycle of conversion. this results in a monotonic change of the dc component at the output without overshoots or vicious starts (a vicious start is an output which gives totally erroneous plm during the period immediately following an update of the plm d/a registers). this feature is achieved by double buffering of the plm d/a registers. examples of pwm output waveforms are shown in figure 8-2 . address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse length modulation a (plma) $000a 0000 0000 pulse length modulation b (plmb) $000b 0000 0000 figure 8-2 plm output waveform examples 256 t 255 t 128 t t $80 $ff t = 4 cpu clocks in fast mode and 64 cpu clocks in slow mode 128 t t $00 $01 255 t 124
MC68HC05X16 rev. 1 motorola 8-3 pulse length d/a converters 8 note: since the plm system uses the timer counter, plm results will be affected while resetting the timer counter. both d/a registers are reset to $00 during power-on or external reset. wait mode does not affect the output waveform of the d/a converters. 8.1 miscellaneous register sfa ?slow or fast mode selection for plma this bit allows the user to select the slow or fast mode of the plma pulse length modulation output. 1 (set) slow mode plma (4096 x timer clock period). 0 (clear) fast mode plma (256 x timer clock period). sfb ?slow or fast mode selection for plmb this bit allows the user to select the slow or fast mode of the plmb pulse length modulation output. 1 (set) slow mode plmb (4096 x timer clock period). 0 (clear) fast mode plmb (256 x timer clock period). the highest speed of the plm system corresponds to the frequency of the tof bit being set, multiplied by 256. the lowest speed of the plm system corresponds to the frequency of the tof bit being set, multiplied by 16. because the sfa bit and sfb bit are not double buffered, it is mandatory to set them to the desired values before writing to the plm registers; not doing so could temporarily give incorrect values at the plm outputs. sm ?slow mode 1 (set) the system runs at a bus speed 16 times lower than normal (f osc /32). slow mode affects all sections of the device, including sci, a/d and timer. 0 (clear) the system runs at normal bus speed (f osc /2). the sm bit is cleared by external or power-on reset. the sm bit is automatically cleared when entering stop mode. note: the bits that are shown shaded in the above representation are explained individually in the relevant sections of this manual. the complete register plus an explanation of each bit can be found in section 3.8 . address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset miscellaneous $000c por intp intn inte sfa sfb sm wdog u001 000u 125
motorola 8-4 MC68HC05X16 rev. 1 pulse length d/a converters 8 8.2 plm clock selection the slow/fast mode of the plm d/a converters is selected by bits 1, 2, and 3 of the miscellaneous register at address $000c (sfa bit for plma and sfb bit for plmb). the slow/fast mode has no effect on the d/a converters 8-bit resolution (see figure 8-3 ). 8.3 plm during stop mode on entering stop mode, the plm outputs remain at their particular level. when stop mode is exited by an interrupt, the plm systems resume regular operation. if stop mode is exited by power-on or external reset the registers values are forced to $00. 8.4 plm during wait mode the plm system is not affected by wait mode and continues normal operation. figure 8-3 plm clock selection f osc ? 2 ? 32 sm bit = 0 sm bit = 1 ? 4 x4096 x256 sf bit = 1 sf bit = 0 timer clock plm clock bus frequency (f op ) 126
MC68HC05X16 rev. 1 motorola 9-1 analog to digital converter 9 9 analog to digital converter the analog to digital converter system consists of a single 8-bit successive approximation converter and a sixteen channel multiplexer. eight of the channels are connected to the pd0/an0 ?pd7/an7 pins of the MC68HC05X16 and the other eight channels are dedicated to internal reference points for test functions. the channel input pins do not have any internal output driver circuitry connected to them because such circuitry would load the analog input signals due to output buffer leakage current. there is one 8-bit result data register (address $08) and one 8-bit status/control register (address $09). the a/d converter is ratiometric and two dedicated pins, vrh and vrl, are used to supply the reference voltage levels for all analog inputs. these pins are used in preference to the system power supply lines because any voltage drops in the bonding wires of the heavily loaded supply pins could degrade the accuracy of the a/d conversion. an input voltage equal to or greater than v rh converts to $ff (full scale) with no over?w indication and an input voltage equal to v rl converts to $00. the a/d converter can operate from either the bus clock or an internal rc type oscillator. the internal rc type oscillator is activated by the adrc bit in the a/d status/control register (adstat) and can be used to give a suf?iently high clock rate to the a/d converter when the bus speed is too low to provide accurate results. when the a/d converter is not being used it can be disconnected, by clearing the adon bit in the adstat register, in order to save power (see section 9.2.3 ). for further information on a/d converter operation please refer to the m68hc11 reference manual ?m68hc11rm/ad. 9.1 a/d converter operation the a/d converter consists of an analog multiplexer, an 8-bit digital to analog converter capacitor array, a comparator and a successive approximation register (sar) (see figure 9-1 ). there are eleven options that can be selected by the multiplexer; an0?n7, vrh, (vrh+vrl)/2 or vrl. selection is done via the chx bits in the adstat register (see section 9.2.3 ). an0?n7 are the only input points for a/d conversion operations; the others are reference points that can be used for test purposes. 127
motorola 9-2 MC68HC05X16 rev. 1 analog to digital converter 9 the a/d reference input (an0?n7) is applied to a precision internal d/a converter. control logic drives this d/a converter and the analog output is successively compared with the analog input sampled at the beginning of the conversion. the conversion is monotonic with no missing codes. the result of each successive comparison is stored in the sar and, when the conversion is complete, the contents of the sar are transferred to the read-only result data register ($08), and the conversion complete ?g, coco, is set in the a/d status/control register ($09). warning: any write to the a/d status/control register will abort the current conversion, reset the conversion complete ?g and start a new conversion on the selected channel. at power-on or external reset, both the adrc and adon bits are cleared; thus the a/d is disabled. figure 9-1 a/d converter block diagram an0 vrh (vrh+vrl)/2 vrl analog mux a/d result register (addata) $08 8-bit capacitive dac with sample and hold vrh vrl result a/d status/control register (adstat)$09 (channel assignment) coco adrc adon 0 ch3 ch2 ch1 ch0 an1 an2 an3 an4 an5 an6 an7 successive approximation register (sar) and control 128
MC68HC05X16 rev. 1 motorola 9-3 analog to digital converter 9 9.2 a/d registers 9.2.1 port d data register (portd) port d is an input-only port which routes the eight analog inputs to the a/d converter. when the a/d converter is disabled, the pins are con?ured as standard input-only port pins, which can be read via the port d data register. note: when the a/d function is enabled, pins pd0?d7 will act as analog inputs. using a pin or pins as a/d inputs does not affect the ability to read port d as static inputs; however, reading port d during an a/d conversion sequence may inject noise on the analog inputs and result in reduced accuracy of the a/d result. performing a digital read of port d with levels other than v dd or v ss on the pins will result in greater power dissipation during the read cycle, and may give unpredictable results on the corresponding port d pins. 9.2.2 a/d result data register ( addata ) addata is a read-only register which is used to store the results of a/d conversions. each result is loaded into the register from the sar and the conversion complete ?g, coco, in the adstat register is set. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port d data (portd) $0003 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d data (addata) $0008 0000 0000 129
motorola 9-4 MC68HC05X16 rev. 1 analog to digital converter 9 9.2.3 a/d status/control register (adstat) coco ?conversion complete ?g 1 (set) coco is set each time a conversion is complete, allowing the new result to be read from the a/d result data register ($08). the converter then starts a new conversion. 0 (clear) coco is cleared by reading the result data register or writing to the status/control register. reset clears the coco ?g. adrc ?a/d rc oscillator control the adrc bit allows the user to control the a/d rc oscillator, which is used to provide a suf?iently high clock rate to the a/d to ensure accuracy when the chip is running at low speeds. 1 (set) when the adrc bit is set, the a/d rc oscillator is turned on and, if adon is set, the a/d runs from the rc oscillator clock. see table 9-1 . 0 (clear) when the adrc bit is cleared, the a/d rc oscillator is turned-off and, if adon is set, the a/d runs from the cpu clock. when the a/d rc oscillator is turned on, it takes a time t adrc to stabilize (see table 12-3 ). during this time a/d conversion results may be inaccurate. note: if the mcu bus clock falls below 1mhz, the a/d rc oscillator should be switched on. power-on or external reset clears the adrc bit. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d status/control (adstat) $0009 coco adrc adon 0 ch3 ch2 ch1 ch0 0000 0000 table 9-1 a/d clock selection adrc adon rc oscillator a/d converter comments 0 0 off off a/d switched off. 0 1 off on a/d using cpu clock. 1 0 on off allows the rc oscillator to stabilize. 1 1 on on a/d using rc oscillator clock. 130
MC68HC05X16 rev. 1 motorola 9-5 analog to digital converter 9 adon ?a/d converter on the adon bit allows the user to enable/disable the a/d converter. 1 (set) a/d converter is switched on. 0 (clear) a/d converter is switched off. when the a/d converter is switched on, it takes a time t adon for the current sources to stabilize (see table 12-3 ). during this time a/d conversion results may be inaccurate. power-on or external reset will clear the adon bit, thus disabling the a/d converter. ch3?h0 ?a/d channels 3, 2, 1 and 0 the ch3?h0 bits allow the user to determine which channel of the a/d converter multiplexer is selected. see table 9-2 for channel selection. reset clears the ch0?h3 bits. 9.3 a/d converter during stop mode when the mcu enters stop mode with the a/d converter turned on, the a/d clocks are stopped and the a/d converter is disabled for the duration of stop mode, including the 4064 cycles start-up time. if the a/d rc oscillator is in operation it will also be disabled. table 9-2 a/d channel assignment ch3 ch2 ch1 ch0 channel selected 0000 an0 0001 an1 0010 an2 0011 an3 0100 an4 0101 an5 0110 an6 0111 an7 1 0 0 0 vrh pin (high) 1 0 0 1 (vrh + vrl) / 2 1 0 1 0 vrl pin (low) 1 0 1 1 vrl pin (low) 1 1 0 0 vrl pin (low) 1 1 0 1 vrl pin (low) 1 1 1 0 vrl pin (low) 1 1 1 1 vrl pin (low) 131
motorola 9-6 MC68HC05X16 rev. 1 analog to digital converter 9 9.4 a/d converter during wait mode the a/d converter is not affected by wait mode and continues normal operation. in order to reduce power consumption the a/d converter can be disconnected, under software control using the adon bit and the adrc bit in the a/d status/control register at $0009, before entering wait mode. 9.5 port d analog input the external analog voltage value to be processed by the a/d converter is sampled on an internal capacitor through a resistive path, provided by input-selection switches and a sampling aperture time switch, as shown in figure 9-2 . sampling time is limited to 12 bus clock cycles. after sampling, the analog value is stored on the capacitor and held until the end of conversion. during this hold time, the analog input is disconnected from the internal a/d system and the external voltage source sees a high impedance input. the equivalent analog input during sampling is an rc low-pass ?ter with a minimum resistance of 50 k w and a capacitance of at least 10pf. it should be noted that these are typical values measured at room temperature. figure 9-2 electrical model of an a/d input pin analog input pin input protection device v rl < 2pf + ~20v - ~0.7v 400 na junction leakage 3 50k w 3 10pf dac capacitance note: the analog switch is closed during the 12 cycle sample time only. 132
MC68HC05X16 rev. 1 motorola 10-1 resets and interrupts 10 10 resets and interrupts 10.1 resets the mc68hc05x32 can be reset in three ways: by the initial power-on reset function, by an active low input to the reset pin or by a computer operating properly (cop) watchdog reset. any of these resets will cause the program to go to its starting address, speci?d by the contents of memory locations $3ffe and $3fff, and cause the interrupt mask bit in the condition code register to be set. figure 10-1 reset timing diagram v dd reset 3fff new 3fff 3ffe pc osc1 new pc internal internal processor clock op code new pcl new pch t vddr op code new pcl new pch address bus internal data bus t oxov t cyc t porl 3ffe program execution begins program execution begins t rl (or t dogl ) (internal power-on reset) (external hardware reset) v dd threshold (1-2v typical) reset sequence reset sequence 3dfe mask options 3dfe mask options 133
motorola 10-2 MC68HC05X16 rev. 1 resets and interrupts 10 10.1.1 power-on reset a power-on reset occurs when a positive transition is detected on vdd. the power-on reset function is strictly for power turn-on conditions and should not be used to detect drops in the power supply voltage. the power-on circuitry provides a stabilization delay (t porl ) from when the oscillator becomes active. if the external reset pin is low at the end of this delay then the processor remains in the reset state until reset goes high. the user must ensure that the voltage on vdd has risen to a point where the mcu can operate properly by the time t porl has elapsed. if there is doubt, the external reset pin should remain low until the voltage on vdd has reached the speci?d minimum operating voltage. this may be accomplished by connecting an external rc circuit to this pin to generate a power-on reset (por). in this case, the time constant must be great enough to allow the oscillator circuit to stabilize. during power-on reset, the reset pin is driven low during a t porl delay start-up sequence. t porl is de?ed by a user speci?d mask option to be either 16 cycles or 4064 cycles (see section 1.2 ). a software distinction between a power-on reset and an external reset can be made using the por bit in the miscellaneous register (see section 10.1.2 ). 10.1.2 miscellaneous register por ?power-on reset bit this bit is set each time the device is powered on. therefore, the state of the por bit allows the user to make a software distinction between a power-on and an external reset. this bit cannot be set by software and is cleared by writing it to zero. 1 (set) a power-on reset has occurred. 0 (clear) no power-on reset has occurred. note: the bits shown shaded in the above representation are explained individually in the relevant sections of this manual. the complete register plus an explanation of each bit can be found in section 3.8 . (1) the por bit is set each time there is a power-on reset. (2) the state of the wdog bit after reset is dependent on the mask option selected; 1=watchdog enabled, 0=watchdog disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset miscellaneous $000c por (1) intp intn inte sfa sfb sm wdog (2) u001 000u 134
MC68HC05X16 rev. 1 motorola 10-3 resets and interrupts 10 10.1.3 reset pin when the oscillator is running in a stable condition, the mcu is reset when a logic zero is applied to the reset input for a minimum period of 1.5 machine cycles (t cyc ). an internal schmitt trigger is used to improve noise immunity on this pin. when the reset pin goes high, the mcu will resume operation on the following cycle. when a reset condition occurs internally, i.e. from por or the cop watchdog, the reset pin provides an active-low open drain output signal which may be used to reset external hardware. current limitation to protect the pull-down device is provided in case an rc type external reset circuit is used. note: if an external rc is connected to reset , turning on the reset pull-down transistor may discharge the capacitor. the device will then remain in reset until the capacitor has recharged, after turning off the pull-down device. 10.1.4 computer operating properly (cop) watchdog reset the watchdog counter system consists of a divide-by-7 counter, preceded by a ?ed divide-by-4 and a ?ed divide-by-256 prescaler, plus control logic as shown in figure 10-3 . the divide-by-7 counter can be reset by software. note: the input to the watchdog system is derived from the carry output of bit 7 of the free running timer counter. therefore, a reset of the timer may affect the period of the watchdog timeout. figure 10-2 reset external rc pull-down reset vdd pin pin MC68HC05X16 135
motorola 10-4 MC68HC05X16 rev. 1 resets and interrupts 10 the watchdog system can be automatically enabled, following power-on or external reset, via a mask option (see section 1.2 ), or it can be enabled by software by writing a ? to the wdog bit in the miscellaneous register at $000c (see section 10.1.2 ). once enabled, the watchdog system cannot be disabled by software (writing a ?ero to the wdog bit has no effect at any time). in addition, the wdog bit acts as a reset mechanism for the watchdog counter. writing a ? to this bit clears the counter to its initial value and prevents a watchdog timeout. wdog ?watchdog enable/disable the wdog bit can be used to enable the watchdog timer previously disabled by a mask option. following a watchdog reset the state of the wdog bit is as de?ed by the mask option speci?d. 1 (set) watchdog enabled and counter cleared. 0 (clear) the watchdog cannot be disabled by software; writing a zero to this bit has no effect. the divide-by-7 watchdog counter will generate a main reset of the chip when it reaches its ?al state; seven clocks are necessary to bring the watchdog counter from its clear state to its ?al state. this reset appears after time t dog since the last clear or since the enable of the watchdog counter system. the watchdog counter, therefore, has to be cleared periodically, by software, with a period less than t dog . the reset generated by the watchdog system is apparent at the reset pin (see figure 10-3 ). the reset pin level is re-entered in the control logic, and when it has been maintained at level ?ero for a minimum of t dogl , the reset pin is released. figure 10-3 watchdog system block diagram ? 256 (bit 7 of free f osc /2 f osc /32 main cpu ? 7 watchdog counter wdog bit control logic latch + reset schmitt input protection trigger pin power-on s r enable reset clock ? 4 prescaler running counter) 136
MC68HC05X16 rev. 1 motorola 10-5 resets and interrupts 10 10.1.4.1 cop watchdog during stop mode the stop instruction is inhibited when the watchdog system is enabled. if a stop instruction is executed while the watchdog system is enabled, then a watchdog reset will occur as if there were a watchdog timeout. in the case of a watchdog reset due to a stop instruction, the oscillator will not be affected, thus there will be no t porl cycles start-up delay. on start-up, the watchdog will be con?ured according to the user speci?d mask option. 10.1.4.2 cop watchdog during wait mode the state of the watchdog during wait mode is selected via a mask option (see section 1.2 ) to be one of the options below: watchdog enabled ?the watchdog counter will continue to operate during wait mode and a reset will occur after time t dog . watchdog disabled ?on entering wait mode, the watchdog counter system is reset and disabled. on exiting wait mode the counter resumes normal operation. 10.1.5 functions affected by reset when processing stops within the mcu for any reason, i.e. power-on reset, external reset or the execution of a stop or wait instruction, various internal functions of the mcu are affected. table 10-1 shows the resulting action of any type of system reset, but not necessarily in the order in which they occur. note: reset action on individual mcan registers is described in section 5 and is also summarised in table 3-2 . 137
motorola 10-6 MC68HC05X16 rev. 1 resets and interrupts 10 table 10-1 effect of reset , por, stop and wait function/effect reset por wait stop timer prescaler cleared x x timer counter set to $fffc x x all timer enable bits cleared (disable) x x data direction registers cleared (inputs) x x stack pointer set to $00ff x x internal address bus forced to restart x x vector $3ffe, $3fff x x interrupt mask bit (i-bit ccr) set x x interrupt mask bit (i-bit ccr) cleared x x interrupt enable bit (inte) set x x por bit in miscellaneous register set x stop latch reset x x irq latch reset x x wait latch reset x x sci disabled x x sci status bits cleared (except tdre and tc) xx sci interrupt enable bits cleared x x sci status bits tdre and tc set x x oscillator disabled for 4064 cycles x x timer clock cleared x x sci clock cleared x x a/d disabled x x x sm bit in the miscellaneous register cleared x x? watchdog counter reset x x x x wdog bit in the miscellaneous register reset x x? eeprom control bits set or cleared (as per section 3.5.1 ) x x? x = described action takes place ?= described action does not take place 138
MC68HC05X16 rev. 1 motorola 10-7 resets and interrupts 10 10.2 interrupts the mcu can be interrupted by ?e different sources: three maskable hardware interrupts, one non maskable software interrupt and one maskable mcan interrupt: external signal on the irq pin, woi on port b pins or nwoi pin serial communications interface (sci) programmable timer software interrupt instruction (swi) mcan interrupt (cirq) interrupts cause the processor to save the register contents on the stack and to set the interrupt mask (i-bit) to prevent additional interrupts. the rti instruction (return from interrupt) causes the register contents to be recovered from the stack and normal processing to resume. while executing the rti instruction, the value of the i-bit is replaced by the corresponding i-bit stored on the stack. unlike reset, hardware interrupts do not cause the current instruction execution to be halted, but are considered pending until the current instruction is complete. the current instruction is the one already fetched and being operated on. when the current instruction is complete, the processor checks all pending hardware interrupts. if interrupts are not masked (i-bit clear) and the corresponding interrupt enable bit is set, the processor proceeds with interrupt processing; otherwise, the next instruction is fetched and executed. note: power-on and external reset clear all interrupt enable bits to prevent interrupts during the reset sequence, but set the inte bit (see section 3.8 ). 139
motorola 10-8 MC68HC05X16 rev. 1 resets and interrupts 10 figure 10-4 interrupt ?w chart irq or woi external interrupt? reset is i-bit set? cirq mcan interrupt? timer internal interrupt? sci internal interrupt? fetch next instruction execute instruction clear irq request latch stack pc, x, a, cc set i-bit load pc from: irq: $3ffa-$3ffb timer ic: $3ff8-$3ff9 timer oc: $3ff6-$3ff7 timer ovf:$3ff4-$3ff5 sci: $3ff2-$3ff3 mcan: $3ff0-$3ff1 complete interrupt routine and execute rti yes no yes yes yes no no no no 140
MC68HC05X16 rev. 1 motorola 10-9 resets and interrupts 10 10.2.1 interrupt priorities each potential interrupt source is assigned a priority level, which means that if more than one interrupt is pending at the same time, the processor will service the one with the highest priority ?st. for example, if both an external interrupt and a timer interrupt are pending after an instruction execution, the external interrupt is serviced ?st. table 10-2 shows the relative priority of all the possible interrupt sources. figure 10-4 shows the interrupt processing ?w. 10.2.2 nonmaskable software interrupt (swi) the software interrupt (swi) is an executable instruction and a nonmaskable interrupt: it is executed regardless of the state of the i-bit in the ccr. if the i-bit is zero (interrupts enabled), swi is executed after interrupts that were pending when the swi was fetched, but before interrupts generated after the swi was fetched. the swi interrupt service routine address is speci?d by the contents of memory locations $3ffc and $3ffd. 10.2.3 maskable hardware interrupts if the interrupt mask bit in the ccr is set, all maskable interrupts (internal and external) are masked. clearing the i-bit allows interrupt processing to occur. note: the internal interrupt latch is cleared in the ?st part of the interrupt service routine; therefore, one external interrupt pulse could be latched and serviced as soon as the i-bit is cleared. table 10-2 interrupt priorities source register flags vector address priority reset $3ffe, $3fff highest software interrupt (swi) $3ffc, $3ffd external interrupt (irq ) or woi $3ffa, $3ffb timer input captures tsr icf1, icf2 $3ff8, $3ff9 timer output compares tsr ocf1, ocf2 $3ff6, $3ff7 timer over?w tsr tof $3ff4, $3ff5 serial communications interface (sci) scsr tdre, tc, or, rdrf, idle $3ff2, $3ff3 mcan cint wif,oif,eif, tif, rif $3ff0, $3ff1 lowest 141
motorola 10-10 MC68HC05X16 rev. 1 resets and interrupts 10 10.2.3.1 miscellaneous register note: the bits shown shaded in the above representation are explained individually in the relevant sections of this manual. the complete register plus an explanation of each bit can be found in section 3.8 . intp, intn ?external interrupt sensitivity options these two bits allow the user to select which edge the irq and woi pins are sensitive to as shown in table 10-3 . both bits can be written to only while the i-bit is set, and are cleared by power-on or external reset. therefore the device is initialised with negative edge and low level sensitivity. interrupt sensitivity options selected by intp and intn of the miscellaneous register apply to external interrupt signal, ei. ei is an or function of all enabled woi pins (port b and nwoi) and of the inverted value of the irq pin. when one woi pin is high, it masks any subsequent edge or level on any other ei pin (irq , port b or nwoi). inte ?external interrupt enable 1 (set) external interrupt (irq ) and wired-or interrupt (woi) enabled. 0 (clear) external interrupt (irq ) and wired-or interrupt (woi) disabled. the inte bit can be written to only while the i-bit is set, and is set by power-on or external reset, thus enabling the external interrupt function. table 10-3 describes the various triggering options available for the irq and woi pins, however it is important to re-emphasize here that in order to avoid any con?ct and spurious interrupt, it is possible to change the external interrupt options only while the i-bit is set. any attempt to change the external interrupt option while the i-bit is clear will be unsuccessful. if an external interrupt is pending, it will automatically be cleared when selecting a different interrupt option. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset miscellaneous $000c por intp intn inte sfa sfb sm wdog u001 000u table 10-3 irq and woi sensitivity intp intn irq sensitivity woi interrupt sensitivity 00 negative edge and low level sensitive positive edge and high level sensitive 0 1 negative edge only positive edge only 1 0 positive edge only negative edge only 11 positive and negative edge sensitive positive and negative edge sensitive 142
MC68HC05X16 rev. 1 motorola 10-11 resets and interrupts 10 note: if the external interrupt function is disabled by the inte bit and an external interrupt is sensed by the edge detector circuitry, then the interrupt request is latched and the interrupt stays pending until the inte bit is set. the internal latch of the external interrupt is cleared in the ?st part of the service routine (except for the low level interrupt which is not latched); therefore, only one external interrupt pulse can be latched during t ilil and serviced as soon as the i-bit is cleared. 10.2.3.2 external interrupts irq interrupt if the interrupt mask in the condition code register has been cleared and the interrupt enable bit (inte) is set and the signal on the external interrupt pin (irq ) satis?s the condition selected by the option control bits (intp and intn), then the external interrupt is recognized. inte, intp and intn are all bits contained in the miscellaneous register at $000c. when the interrupt is recognized, the current state of the cpu is pushed onto the stack and the i-bit is set. this masks further interrupts until the present one is serviced. the external interrupt service routine address is speci?d by the content of memory locations $3ffa and $3ffb. wired-or interrupt (woi) an external woi capability is provided on all port b i/o pins when they are programmed as inputs, and on the nwoi pin. a woi is activated only if woie in the eeprom control register is set and if wired-or interrupts have been chosen as an option on the device (see section 1.2 ). if wired-or interrupts are enabled on a given input pin (nwoi pin or port b pins; refer to section 2.3.19 and section 4.2 ), an external interrupt is requested when this pin is pulled high. the request is serviced by the interrupt routine whose start address is contained in memory locations $3ffa and $3ffb. external and power-on reset clear the woie bit. a woi interrupt will cause the mcu to exit stop mode. the interrupt enable bit (inte) in the miscellaneous register enables both wired-or interrupts and the irq interrupt. irq and woi are internally or-ed before interrupt sensitivity selection (see section 10.2.3.1 ). 10.2.3.3 mcan interrupt (cirq) several sources can trigger a cirq. the mcan interrupt register at $0023 is used to identify the source. each cirq source can be individually enabled (except the wake-up interrupt, which is always enabled) by different bits of the mcan control register at $0020. the cirq sources are (also see section 5.3.4 ): receive irq: this signals successful reception of a complete message. transmit irq: this signals successful transmission of a complete message. 143
motorola 10-12 MC68HC05X16 rev. 1 resets and interrupts 10 error irq: this is set when either the error status or bus status bits in the mcan status register change state (see section 5.3.3 ). data overrun: an incoming message on the bus cannot be received because both receive buffers are tied up. wake-up irq: this signals activity on the bus while the mcan is in sleep mode. this is the only nonmaskable cirq. cirq interrupts are serviced by the routine located at the address speci?d by the contents of $3ff0 and $3ff1. 10.2.3.4 timer interrupts there are ?e different timer interrupt ?gs (icf1, icf2, ocf1, ocf2 and tof) that will cause a timer interrupt whenever they are set and enabled. these ?e interrupt ?gs are found in the ?e most signi?ant bits of the timer status register (tsr) at location $0013. icf1 and icf2 will vector to the service routine de?ed by $3ff8-$3ff9, ocf1 and ocf2 will vector to the service routine de?ed by $3ff6?3ff7 and tof will vector to the service routine de?ed by $3ff4?3ff5 as shown in figure 6-1 . there are three corresponding enable bits; icie for icf1 and icf2, ocie for ocf1 and ocf2, and toie for tof. these enable bits are located in the timer control register (tcr) at address $0012. see section 6.2.1 and section 6.2.2 for further information. 10.2.3.5 serial communications interface (sci) interrupts there are ?e different interrupt ?gs (tdre, tc, or, rdrf and idle) that cause sci interrupts whenever they are set and enabled. these ?e interrupt ?gs are found in the ?e most signi?ant bits of the sci status register (scsr) at location $0010. there are four corresponding enable bits: tie for tdre, tcie for tc, rie for or and rdrf, and ilie for idle. these enable bits are located in the serial communications control register 2 (sccr2) at address $000f. see section 7.11.3 and section 7.11.4 . the sci interrupt causes the program counter to vector to the address pointed to by memory locations $3ff2 and $3ff3 which contain the starting address of the interrupt service routine. software in the sci interrupt service routine must determine the priority and cause of the interrupt by examining the interrupt ?gs and the status bits located in the serial communications status register scsr (address $0010). the general sequence for clearing an interrupt is a software sequence of accessing the serial communications status register while the ?g is set followed by a read or write of an associated register. refer to section 7 for a description of the sci system and its interrupts. 144
MC68HC05X16 rev. 1 motorola 10-13 resets and interrupts 10 10.2.4 hardware controlled interrupt sequence the following three functions: reset, stop and wait, are not in the strictest sense interrupts. however, they are acted upon in a similar manner. flowcharts for stop and wait are shown in figure 2-4 . reset: a reset condition causes the program to vector to its starting address, which is contained in memory locations $3ffe (msb) and $3fff (lsb). the i-bit in the condition code register is also set, to disable interrupts. stop: the stop instruction puts the processor to ?leep and, if the mcan module is already in sleep mode, it causes the oscillator to be turned off until an external, woi or cirq interrupt occurs or the device is reset. wait: the wait instruction causes all processor clocks to stop, but leaves the timer clocks running. this ?est state of the processor can be cleared by reset, an external or woi interrupt, a timer interrupt or an sci interrupt. there are no special wait vectors for these individual interrupts. 145
motorola 10-14 MC68HC05X16 rev. 1 resets and interrupts 10 this page left blank intentionally 146
MC68HC05X16 rev. 1 motorola 11-1 cpu core and instruction set 11 11 cpu core and instruction set this section provides a description of the cpu core registers, the instruction set and the addressing modes of the MC68HC05X16. 11.1 registers the mcu contains ?e registers, as shown in the programming model of figure 11-1. the interrupt stacking order is shown in figure 11-2. 11.1.1 accumulator (a) the accumulator is a general purpose 8-bit register used to hold operands and results of arithmetic calculations or data manipulations. figure 11-1 programming model accumulator index register program counter stack pointer condition code register carry / borrow zero negative interrupt mask half carry 70 70 15 7 0 0 15 7 0 0 0 0 0 0 0 0 1 1 70 1 1 1 h i n z c 0 0 147
motorola 11-2 MC68HC05X16 rev. 1 cpu core and instruction set 11 11.1.2 index register (x) the index register is an 8-bit register, which can contain the indexed addressing value used to create an effective address. the index register may also be used as a temporary storage area. 11.1.3 program counter (pc) the program counter is a 16-bit register, which contains the address of the next byte to be fetched. although the m68hc05 cpu core can address 64k bytes of memory, the actual address range of the mc68hc05x32 is limited to 16k bytes. the two most signi?ant bits of the program counter are therefore not used and are permanently set to zero. 11.1.4 stack pointer (sp) the stack pointer is a 16-bit register, which contains the address of the next free location on the stack. during an mcu reset or the reset stack pointer (rsp) instruction, the stack pointer is set to location $00ff. the stack pointer is then decremented as data is pushed onto the stack and incremented as data is pulled from the stack. when accessing memory, the ten most signi?ant bits are permanently set to 0000000011. these ten bits are appended to the six least signi?ant register bits to produce an address within the range of $00c0 to $00ff. subroutines and interrupts may use up to 64 (decimal) locations. if 64 locations are exceeded, the stack pointer wraps around and overwrites the previously stored information. a subroutine call occupies two locations on the stack; an interrupt uses ?e locations. 11.1.5 condition code register (ccr) the ccr is a 5-bit register in which four bits are used to indicate the results of the instruction just executed, and the ?th bit indicates whether interrupts are masked. these bits can be individually tested by a program, and speci? actions can be taken as a result of their state. each bit is explained in the following paragraphs. figure 11-2 stacking order condition code register accumulator index register program counter high program counter low 70 stack unstack decreasing memory address increasing memory address interrupt return 148
MC68HC05X16 rev. 1 motorola 11-3 cpu core and instruction set 11 half carry (h) this bit is set during add and adc operations to indicate that a carry occurred between bits 3 and 4. interrupt (i) when this bit is set, all maskable interrupts are masked. if an interrupt occurs while this bit is set, the interrupt is latched and remains pending until the interrupt bit is cleared. negative (n) when set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was negative. zero (z) when set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was zero. carry/borrow (c) when set, this bit indicates that a carry or borrow out of the arithmetic logical unit (alu) occurred during the last arithmetic operation. this bit is also affected during bit test and branch instructions and during shifts and rotates. 11.2 instruction set the mcu has a set of 62 basic instructions. they can be grouped into ?e different types as follows: register/memory read/modify/write branch bit manipulation control the following paragraphs brie? explain each type. all the instructions within a given type are presented in individual tables. this mcu uses all the instructions available in the m146805 cmos family plus one more: the unsigned multiply (mul) instruction. this instruction allows unsigned multiplication of the contents of the accumulator (a) and the index register (x). the high-order product is then stored in the index register and the low-order product is stored in the accumulator. a detailed definition of the mul instruction is shown in table 11-1 . 149
motorola 11-4 MC68HC05X16 rev. 1 cpu core and instruction set 11 11.2.1 register/memory instructions most of these instructions use two operands. the ?st operand is either the accumulator or the index register. the second operand is obtained from memory using one of the addressing modes. the jump unconditional (jmp) and jump to subroutine (jsr) instructions have no register operand. refer to table 11-2 for a complete list of register/memory instructions. 11.2.2 branch instructions these instructions cause the program to branch if a particular condition is met; otherwise, no operation is performed. branch instructions are two-byte instructions. refer to table 11-3 . 11.2.3 bit manipulation instructions the mcu can set or clear any writable bit that resides in the ?st 256 bytes of the memory space (page 0). all port data and data direction registers, timer and serial interface registers, control/status registers and a portion of the on-chip ram reside in page 0. an additional feature allows the software to test and branch on the state of any bit within these locations. the bit set, bit clear, bit test and branch functions are all implemented with single instructions. for the test and branch instructions, the value of the bit tested is also placed in the carry bit of the condition code register. refer to table 11-4 . 11.2.4 read/modify/write instructions these instructions read a memory location or a register, modify or test its contents, and write the modi?d value back to memory or to the register. the test for negative or zero (tst) instruction is an exception to this sequence of reading, modifying and writing, since it does not modify the value. refer to table 11-5 for a complete list of read/modify/write instructions. 11.2.5 control instructions these instructions are register reference instructions and are used to control processor operation during program execution. refer to table 11-6 for a complete list of control instructions. 11.2.6 tables tables for all the instruction types listed above follow. in addition there is a complete alphabetical listing of all the instructions (see table 11-7 ), and an opcode map for the instruction set of the m68hc05 mcu family (see table 11-8 ). 150
MC68HC05X16 rev. 1 motorola 11-5 cpu core and instruction set 11 table 11-1 mul instruction operation x:a x*a description multiplies the eight bits in the index register by the eight bits in the accumulator and places the 16-bit result in the concatenated accumulator and index register. condition codes h : cleared i : not affected n : not affected z : not affected c : cleared source mul form addressing mode cycles bytes opcode inherent 11 1 $42 table 11-2 register/memory instructions addressing modes immediate direct extended indexed (no offset) indexed (8-bit offset) indexed (16-bit offset) function mnemonic opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles load a from memory lda a6 2 2 b6 2 3 c6 3 4 f6 1 3 e6 2 4 d6 3 5 load x from memory ldx ae 2 2 be 2 3 ce 3 4 fe 1 3 ee 2 4 de 3 5 store a in memory sta b7 2 4 c7 3 5 f7 1 4 e7 2 5 d7 3 6 store x in memory stx bf 2 4 cf 3 5 ff 1 4 ef 2 5 df 3 6 add memory to a add ab 2 2 bb 2 3 cb 3 4 fb 1 3 eb 2 4 db 3 5 add memory and carry to a adc a9 2 2 b9 2 3 c9 3 4 f9 1 3 e9 2 4 d9 3 5 subtract memory sub a0 2 2 b0 2 3 c0 3 4 f0 1 3 e0 2 4 d0 3 5 subtract memory from a with borrow sbc a2 2 2 b2 2 3 c2 3 4 f2 1 3 e2 2 4 d2 3 5 and memory with a and a4 2 2 b4 2 3 c4 3 4 f4 1 3 e4 2 4 d4 3 5 or memory with a ora aa 2 2 ba 2 3 ca 3 4 fa 1 3 ea 2 4 da 3 5 exclusive or memory with a eor a8 2 2 b8 2 3 c8 3 4 f8 1 3 e8 2 4 d8 3 5 arithmetic compare a with memory cmp a1 2 2 b1 2 3 c1 3 4 f1 1 3 e1 2 4 d1 3 5 arithmetic compare x with memory cpx a3 2 2 b3 2 3 c3 3 4 f3 1 3 e3 2 4 d3 3 5 bit test memory with a (logical compare) bit a5 2 2 b5 2 3 c5 3 4 f5 1 3 e5 2 4 d5 3 5 jump unconditional jmp bc 2 2 cc 3 3 fc 1 2 ec 2 3 dc 3 4 jump to subroutine jsr bd 2 5 cd 3 6 fd 1 5 ed 2 6 dd 3 7 151
motorola 11-6 MC68HC05X16 rev. 1 cpu core and instruction set 11 table 11-3 branch instructions relative addressing mode function mnemonic opcode # bytes # cycles branch always bra 20 2 3 branch never brn 21 2 3 branch if higher bhi 22 2 3 branch if lower or same bls 23 2 3 branch if carry clear bcc 24 2 3 (branch if higher or same) (bhs) 24 2 3 branch if carry set bcs 25 2 3 (branch if lower) (blo) 25 2 3 branch if not equal bne 26 2 3 branch if equal beq 27 2 3 branch if half carry clear bhcc 28 2 3 branch if half carry set bhcs 29 2 3 branch if plus bpl 2a 2 3 branch if minus bmi 2b 2 3 branch if interrupt mask bit is clear bmc 2c 2 3 branch if interrupt mask bit is set bms 2d 2 3 branch if interrupt line is low bil 2e 2 3 branch if interrupt line is high bih 2f 2 3 branch to subroutine bsr ad 2 6 table 11-4 bit manipulation instructions addressing modes bit set/clear bit test and branch function mnemonic opcode # bytes # cycles opcode # bytes # cycles branch if bit n is set brset n (n=0?) 2? 3 5 branch if bit n is clear brclr n (n=0?) 01+2? 3 5 set bit n bset n (n=0?) 10+2? 2 5 clear bit n bclr n (n=0?) 11+2? 2 5 152
MC68HC05X16 rev. 1 motorola 11-7 cpu core and instruction set 11 table 11-5 read/modify/write instructions addressing modes inherent (a) inherent (x) direct indexed (no offset) indexed (8-bit offset) function mnemonic opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles opcode # bytes # cycles increment inc 4c 1 3 5c 1 3 3c 2 5 7c 1 5 6c 2 6 decrement dec 4a 1 3 5a 1 3 3a 2 5 7a 1 5 6a 2 6 clear clr 4f 1 3 5f 1 3 3f 2 5 7f 1 5 6f 2 6 complement com 43 1 3 53 1 3 33 2 5 73 1 5 63 2 6 negate (twos complement) neg 40 1 3 50 1 3 30 2 5 70 1 5 60 2 6 rotate left through carry rol 49 1 3 59 1 3 39 2 5 79 1 5 69 2 6 rotate right through carry ror 46 1 3 56 1 3 36 2 5 76 1 5 66 2 6 logical shift left lsl 48 1 3 58 1 3 38 2 5 78 1 5 68 2 6 logical shift right lsr 44 1 3 54 1 3 34 2 5 74 1 5 64 2 6 arithmetic shift right asr 47 1 3 57 1 3 37 2 5 77 1 5 67 2 6 test for negative or zero tst 4d 1 3 5d 1 3 3d 2 4 7d 1 4 6d 2 5 multiply mul 42 1 11 set bit n bset n (n=0?) 10+2? 2 5 clear bit n bclr n (n=0?) 11+2? 2 5 table 11-6 control instructions inherent addressing mode function mnemonic opcode # bytes # cycles transfer a to x tax 97 1 2 transfer x to a txa 9f 1 2 set carry bit sec 99 1 2 clear carry bit clc 98 1 2 set interrupt mask bit sei 9b 1 2 clear interrupt mask bit cli 9a 1 2 software interrupt swi 83 1 10 return from subroutine rts 81 1 6 return from interrupt rti 80 1 9 reset stack pointer rsp 9c 1 2 no-operation nop 9d 1 2 stop stop 8e 1 2 wait wait 8f 1 2 153
motorola 11-8 MC68HC05X16 rev. 1 cpu core and instruction set 11 table 11-7 instruction set mnemonic addressing modes condition codes inh imm dir ext rel ix ix1 ix2 bsc btb h i n z c adc add and asl asr bcc bclr bcs beq bhcc bhcs bhi bhs bih bil bit blo bls bmc bmi bms bne bpl bra brn brclr brset bset bsr clc 0 cli 0 clr 01 cmp condition code symbols h half carry (from bit 3) tested and set if true, cleared otherwise i interrupt mask not affected n negate (sign bit) ? load ccr from stack z zero 0 cleared c carry/borrow 1 set not implemented address mode abbreviations bs c bit set/clear imm immediate btb bit test & branch ix indexed (no offset) dir direct ix1 indexed, 1 byte offset ext extended ix2 indexed, 2 byte offset 154
MC68HC05X16 rev. 1 motorola 11-9 cpu core and instruction set 11 com 1 cpx dec eor inc jmp jsr lda ldx lsl lsr 0 mul 00 neg nop ora rol ror rsp rti ????? rts sbc sec 1 sei 1 sta stop 0 stx sub swi 1 tax tst txa wait 0 table 11-7 instruction set (continued) mnemonic addressing modes condition codes inh imm dir ext rel ix ix1 ix2 bsc btb h i n z c condition code symbols h half carry (from bit 3) tested and set if true, cleared otherwise i interrupt mask not affected n negate (sign bit) ? load ccr from stack z zero 0 cleared c carry/borrow 1 set not implemented address mode abbreviations bs c bit set/clear imm immediate btb bit test & branch ix indexed (no offset) dir direct ix1 indexed, 1 byte offset ext extended ix2 indexed, 2 byte offset 155
motorola 11-10 MC68HC05X16 rev. 1 cpu core and instruction set 11 table 11-8 m68hc05 opcode map bit manipulation branch read/modify/write control register/memory btb bsc rel dir inh inh ix1 ix inh inh imm dir ext ix2 ix1 ix high 0123456789abcdef high low 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 low 0 0000 553533659 234543 0 0000 brset0 bset0 bra neg nega negx neg neg rti sub sub sub sub sub sub 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 1 0001 553 6 234543 1 0001 brclr0 bclr0 brn rts cmp cmp cmp cmp cmp cmp 3 btb 2 bsc 2 rel 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 2 0010 553 11 234543 2 0010 brset1 bset1 bhi mul sbc sbc sbc sbc sbc sbc 3 btb 2 bsc 2 rel 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 3 0011 5535336510 234543 3 0011 brclr1 bclr1 bls com coma comx com com swi cpx cpx cpx cpx cpx cpx 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 4 0100 55353365 234543 4 0100 brset2 bset2 bcc lsr lsra lsrx lsr lsr and and and and and and 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 5 0101 553 234543 5 0101 brclr2 bclr2 bcs bit bit bit bit bit bit 3 btb 2 bsc 2 rel 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 6 0110 55353365 234543 6 0110 brset3 bset3 bne ror rora rorx ror ror lda lda lda lda lda lda 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 7 0111 55353365 2 45654 7 0111 brclr3 bclr3 beq asr asra asrx asr asr tax sta sta sta sta sta 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 dir 3 ext 3 ix2 2 ix1 1 ix 8 1000 55353365 2234543 8 1000 brset4 bset4 bhcc lsl lsla lslx lsl lsl clc eor eor eor eor eor eor 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix 9 1001 55353365 2234543 9 1001 brclr4 bclr4 bhcs rol rola rolx rol rol sec adc adc adc adc adc adc 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix a 1010 55353365 2234543 a 1010 brset5 bset5 bpl dec deca decx dec dec cli ora ora ora ora ora ora 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix b 1011 553 2234543 b 1011 brclr5 bclr5 bmi sei add add add add add add 3 btb 2 bsc 2 rel 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix c 1100 55353365 2 23432 c 1100 brset6 bset6 bmc inc inca incx inc inc rsp jmp jmp jmp jmp jmp 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 dir 3 ext 3 ix2 2 ix1 1 ix d 1101 55343354 2656765 d 1101 brclr6 bclr6 bms tst tsta tstx tst tst nop bsr jsr jsr jsr jsr jsr 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 2 rel 2 dir 3 ext 3 ix2 2 ix1 1 ix e 1110 553 2 234543 e 1110 brset7 bset7 bil stop ldx ldx ldx ldx ldx ldx 3 btb 2 bsc 2 rel 1 inh 2 imm 2 dir 3 ext 3 ix2 2 ix1 1 ix f 1111 5535336522 45654 f 1111 brclr7 bclr7 bih clr clra clrx clr clr wait txa stx stx stx stx stx 3 btb 2 bsc 2 rel 2 dir 1 inh 1 inh 2 ix1 1 ix 1 inh 1 inh 2 dir 3 ext 3 ix2 2 ix1 1 ix f 1111 3 0 0000 sub 1ix opcode in hexadecimal opcode in binary address mode cycles bytes mnemonic legend abbreviations for address modes and registers bsc btb dir ext inh imm ix ix1 ix2 rel a x bit set/clear bit test and branch direct extended inherent immediate indexed (no offset) indexed, 1 byte (8-bit) offset indexed, 2 byte (16-bit) offset relative accumulator index register not implemented 156
MC68HC05X16 rev. 1 motorola 11-11 cpu core and instruction set 11 11.3 addressing modes ten different addressing modes provide programmers with the ?xibility to optimize their code for all situations. the various indexed addressing modes make it possible to locate data tables, code conversion tables and scaling tables anywhere in the memory space. short indexed accesses are single byte instructions; the longest instructions (three bytes) enable access to tables throughout memory. short absolute (direct) and long absolute (extended) addressing are also included. one or two byte direct addressing instructions access all data bytes in most applications. extended addressing permits jump instructions to reach all memory locations. the term ?ffective address (ea) is used in describing the various addressing modes. the effective address is de?ed as the address from which the argument for an instruction is fetched or stored. the ten addressing modes of the processor are described below. parentheses are used to indicate ?ontents of the location or register referred to. for example, (pc) indicates the contents of the location pointed to by the pc (program counter). an arrow indicates ?s replaced by and a colon indicates concatenation of two bytes. for additional details and graphical illustrations, refer to the m6805 hmos/m146805 cmos family microcomputer/ microprocessor user's manual or to the m68hc05 applications guide . 11.3.1 inherent in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. operations specifying only the index register or accumulator, as well as the control instruction, with no other arguments are included in this mode. these instructions are one byte long. 11.3.2 immediate in the immediate addressing mode, the operand is contained in the byte immediately following the opcode. the immediate addressing mode is used to access constants that do not change during program execution (e.g. a constant used to initialize a loop counter). ea = pc+1; pc ? pc+2 11.3.3 direct in the direct addressing mode, the effective address of the argument is contained in a single byte following the opcode byte. direct addressing allows the user to directly address the lowest 256 bytes in memory with a single two-byte instruction. ea = (pc+1); pc ? pc+2 address bus high ? 0; address bus low ? (pc+1) 157
motorola 11-12 MC68HC05X16 rev. 1 cpu core and instruction set 11 11.3.4 extended in the extended addressing mode, the effective address of the argument is contained in the two bytes following the opcode byte. instructions with extended addressing mode are capable of referencing arguments anywhere in memory with a single three-byte instruction. when using the motorola assembler, the user need not specify whether an instruction uses direct or extended addressing. the assembler automatically selects the short form of the instruction. ea = (pc+1):(pc+2); pc ? pc+3 address bus high ? (pc+1); address bus low ? (pc+2) 11.3.5 indexed, no offset in the indexed, no offset addressing mode, the effective address of the argument is contained in the 8-bit index register. this addressing mode can access the ?st 256 memory locations. these instructions are only one byte long. this mode is often used to move a pointer through a table or to hold the address of a frequently referenced ram or i/o location. ea = x; pc ? pc+1 address bus high ? 0; address bus low ? x 11.3.6 indexed, 8-bit offset in the indexed, 8-bit offset addressing mode, the effective address is the sum of the contents of the unsigned 8-bit index register and the unsigned byte following the opcode. therefore the operand can be located anywhere within the lowest 511 memory locations. this addressing mode is useful for selecting the mth element in an n element table. ea = x+(pc+1); pc ? pc+2 address bus high ? k; address bus low ? x+(pc+1) where k = the carry from the addition of x and (pc+1) 11.3.7 indexed, 16-bit offset in the indexed, 16-bit offset addressing mode, the effective address is the sum of the contents of the unsigned 8-bit index register and the two unsigned bytes following the opcode. this address mode can be used in a manner similar to indexed, 8-bit offset except that this three-byte instruction allows tables to be anywhere in memory. as with direct and extended addressing, the motorola assembler determines the shortest form of indexed addressing. ea = x+[(pc+1):(pc+2)]; pc ? pc+3 address bus high ? (pc+1)+k; address bus low ? x+(pc+2) where k = the carry from the addition of x and (pc+2) 158
MC68HC05X16 rev. 1 motorola 11-13 cpu core and instruction set 11 11.3.8 relative the relative addressing mode is only used in branch instructions. in relative addressing, the contents of the 8-bit signed byte (the offset) following the opcode are added to the pc if, and only if, the branch conditions are true. otherwise, control proceeds to the next instruction. the span of relative addressing is from ?26 to +129 from the opcode address. the programmer need not calculate the offset when using the motorola assembler, since it calculates the proper offset and checks to see that it is within the span of the branch. ea = pc+2+(pc+1); pc ? ea if branch taken; otherwise ea = pc ? pc+2 11.3.9 bit set/clear in the bit set/clear addressing mode, the bit to be set or cleared is part of the opcode. the byte following the opcode speci?s the address of the byte in which the speci?d bit is to be set or cleared. any read/write bit in the ?st 256 locations of memory, including i/o, can be selectively set or cleared with a single two-byte instruction. ea = (pc+1); pc ? pc+2 address bus high ? 0; address bus low ? (pc+1) 11.3.10 bit test and branch the bit test and branch addressing mode is a combination of direct addressing and relative addressing. the bit to be tested and its condition (set or clear) is included in the opcode. the address of the byte to be tested is in the single byte immediately following the opcode byte (ea1). the signed relative 8-bit offset in the third byte (ea2) is added to the pc if the speci?d bit is set or cleared in the speci?d memory location. this single three-byte instruction allows the program to branch based on the condition of any readable bit in the ?st 256 locations of memory. the span of branch is from ?25 to +130 from the opcode address. the state of the tested bit is also transferred to the carry bit of the condition code register. ea1 = (pc+1); pc ? pc+2 address bus high ? 0; address bus low ? (pc+1) ea2 = pc+3+(pc+2); pc ? ea2 if branch taken; otherwise pc ? pc+3 159
motorola 11-14 MC68HC05X16 rev. 1 cpu core and instruction set 11 this page left blank intentionally 160
MC68HC05X16 rev. 1 motorola 12-1 electrical specifications 12 12 electrical specifications this section contains the electrical speci?ations and associated timing information for the MC68HC05X16. 12.1 absolute maximum ratings note: this device contains circuitry designed to protect against damage due to high electrostatic voltages or electric ?lds. however, it is recommended that normal precautions be taken to avoid the application of any voltages higher than those given in the maximum ratings table to this high impedance circuit. for maximum reliability all unused inputs should be tied to either v ss or v dd . (1) all voltages are with respect to v ss . (2) maximum current drain per pin is for one pin at a time, limited by an external resistor. table 12-1 absolute maximum ratings rating symbol value unit supply voltage (1) v dd ?0.5 to +7.0 v input voltage v in v ss ?0.5 to v dd + 0.5 v input voltage ?bootstrap mode (irq pin only) v in v ss ?0.5 to 2v dd + 0.5 v operating temperature range t a t l to t h ?0 to +125 c storage temperature range t stg ?65 to +150 c current drain per pin (2) (excluding vdd, vss, vdd1 and vss1) ?source ?sink i d i s 25 45 ma ma external oscillator frequency f osc 22 mhz 161
motorola 12-2 MC68HC05X16 rev. 1 electrical specifications 12 12.2 dc electrical characteristics table 12-2 dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic (1) symbol min typ (2) max unit output voltage i load = ?10 m a i load = +10 m a v oh v ol v dd ?0.1 0.1 v output high voltage (i load = 0.8ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, output high voltage (i load = 1.6ma) tdo, sclk, plma, plmb output high voltage (i load = ?300 m a) osc2 v oh v oh v oh v dd ?0.8 v dd ?0.8 v dd ?0.8 v dd ?0.2 v dd ?0.2 v dd ?0.3 v output low voltage (i load = 1.6ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, tdo, sclk, plma, plmb output low voltage (i load = 1.6ma) reset output low voltage (i load = ?100 m a) osc2 v ol v ol v ol 0.1 0.2 0.2 0.4 0.6 0.4 v input high voltage pa0?, pb0?, pc0?, pd0?, osc1, irq , reset , tcap1, tcap2, rdi, mds, nwoi v ih 0.7 v dd ? dd v input low voltage pa0?, pb0?, pc0?, pd0?, osc1, irq , reset , tcap1, tcap2, rdi, mds, nwoi v il v ss 0.2v dd v can comparator i dd (i dd1 ) (3)(4)(5) supply current run: can active (6) stop: can active wait: can asleep (7) stop: can asleep i dd1 i dd1 i dd1 i dd1 360 360 32 10 900 900 100 30 m a m a m a m a mcu i dd (3)(4)(8) supply current in div2 mode run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 3.6 1.6 1.8 1.5 0.8 0.4 0.5 90 7 3.6 4 3.7 1.4 1.1 1.5 300 ma ma ma ma ma ma ma m a mcu i dd (3)(5)(8) supply current in div10 mode run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 6.6 4.6 4.6 4.5 1.2 0.8 0.5 90 13 8 8.5 8 1.8 1.4 1.5 300 ma ma ma ma ma ma ma m a high-z leakage current pa0?, pb0?, pc0?, tdo, reset , sclk i il 0.2 1 m a 162
MC68HC05X16 rev. 1 motorola 12-3 electrical specifications 12 (1) all i dd measurements taken with suitable decoupling capacitors across the power supply to suppress the transient switching currents inherent in cmos designs (see section 2). (2) typical values are at mid point of voltage range and at 25 c only. (3) run and wait i dd : measured using an external square-wave clock source, refer to figure 2-6 (c); all inputs 0.2 v from rail; no dc loads; maximum load on outputs 50pf (20pf on osc2). stop/wait i dd : all ports con?ured as inputs; v il = 0.2 v and v ih = v dd ?0.2 v: stop i dd measured with osc1 = v dd . wait i dd is affected linearly by the osc2 capacitance. (4) f osc = 4.4 mhz; f bus = 2.2 mhz; f can = 2.2 mhz (5) f osc = 22 mhz; f bus = 2.2 mhz; f can = 11 mhz (6) these limits are also applicable under the following conditions: mcu run mode/slow mode/can active mcu wait mode/slow mode/can active mcu wait mode/can active (7) these limits are also applicable under the following conditions: mcu wait mode/slow mode/can asleep (8) these currents are the summation of the mcu current + can current (i dd + i dd1 ) (9) current injection is guaranteed but not tested. functionality of the mcu is guaranteed during injection of dc current up to the maximum speci?d level. the maximum speci?d current for each port is the sum of the magnitudes of the currents on each side of the individual port pins. some disturbance of the a/d accuracy is possible during an injection event and is dependent on board layout, power supply decoupling and reference voltage decoupling con?urations. input current osc1=v dd (osc2=v ss ) input current osc1=v ss (osc2=v dd ) i fh i fl ?10 +10 m a input current irq , tcap1, tcap2, rdi, pd0/an0-pd7/an7 (channel not selected) i in 0.2 1 m a capacitance ports (as input or output), reset , tdo, sclk irq , tcap1, tcap2, osc1, rdi pd0/an0?d7/an7 (a/d off) pd0/an0?d7/an7 (a/d on) c out c in c in c in 12 22 12 8 pf pf pf pf dc injection current (9) port a (pa0?a7) port b (pb0?b7) |i inj | |i inj | 10 10 ma ma table 12-2 dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic (1) symbol min typ (2) max unit 163
motorola 12-4 MC68HC05X16 rev. 1 electrical specifications 12 12.3 a/d converter characteristics (1) performance veri?d down to 2.5v d vr, but accuracy is tested and guaranteed at d vr = 5v 10%. (2) source impedances greater than 10k w will adversely affect internal charging time during input sampling. (3) the external system error caused by input leakage current is approximately equal to the product of r source and input current. input current to a/d channel will be dependent on external source impedance (see figure 9-2 ). table 12-3 a/d characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic parameter min max unit resolution number of bits resolved by the a/d 8 bit non-linearity max deviation from the best straight line through the a/d transfer characteristics (v rh = v dd and v rl = 0v) 0.5 lsb quantization error uncertainty due to converter resolution 0.5 lsb absolute accuracy difference between the actual input voltage and the full-scale equivalent of the binary code output code for all errors 1 lsb conversion range analog input voltage range v rl v rh v v rh maximum analog reference voltage v rl v dd + 0.1 v v rl minimum analog reference voltage v ss ?0.1 v rh v d v r (1) minimum difference between v rh and v rl 3v conversion time total time to perform a single analog to digital conversion a. external clock (osc1, osc2) b. internal rc oscillator 32 32 t cyc m s monotonicity conversion result never decreases with an increase in input voltage and has no missing codes guaranteed zero input reading conversion result when v in = v rl 00 hex full scale reading conversion result when v in = v rh ?fhex sample acquisition time analog input acquisition sampling a. external clock (osc1, osc2) b. internal rc oscillator (2) 12 12 t cyc m s sample/hold capacitance input capacitance on pd0/an0?d7/an7 12 pf input leakage (3) input leakage on a/d pins pd0/an0?d7/an7, vrl, vrh 1 m a 164
MC68HC05X16 rev. 1 motorola 12-5 electrical specifications 12 12.4 control timing (1) for bus frequencies less than 2 mhz, the internal rc oscillator should be used when programming the eeprom. (2) since a 2-bit prescaler in the timer must count four external cycles (t cyc ), this is the limiting factor in determining the timer resolution. (3) the minimum period t tltl should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 t cyc . (4) the minimum period t ilil should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 t cyc . (5) at a temperature of 85 c. (6) refer to reliability monitor report (currrent quarterly issue) for current failure rate information. table 12-4 control timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit frequency of operation oscillator frequency mcan module clock frequency mcu bus frequency f osc f can f mcu 0 0 0 22 11 2.2 mhz mhz mhz cycle time (see figure 10-1 )t cyc 455 ns crystal oscillator start-up time (see figure 10-1 )t oxov 100 ms stop recovery start-up time (crystal oscillator) t ilch 100 ms a/d converter stabilization time t adon 500 m s external reset input pulse width t rl 1.5 t cyc power-on reset output pulse width (mask option) 4064 cycle 16 cycle t porl t porl 4064 16 t cyc t cyc watchdog reset output pulse width t dogl 1.5 t cyc watchdog time-out t dog 6144 7168 t cyc eeprom byte erase time t era 10 10 ms eeprom byte program time (1) t prog 10 10 ms timer (see figure 12-1 ) resolution (2) input capture pulse width input capture pulse period t resl t th , t tl t tltl 4 125 (3) t cyc ns t cyc interrupt pulse width (edge-triggered) t ilih 125 ns interrupt pulse period t ilil (4) ? cyc osc1 pulse width t oh , t ol 90 ns write/erase endurance (5)(6) 10000 cycles data retention (5)(6) 10 years figure 12-1 timer relationship external signal (tcap1, tcap2) t tltl t th t tl 165
motorola 12-6 MC68HC05X16 rev. 1 electrical specifications 12 12.5 mcan bus interface dc electrical characteristics 12.6 mcan bus interface control timing characteristics (1) maximum dc current should comply with maximum ratings. table 12-5 mcan bus interface dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit mcan bus input comparator: pins rx0 and rx1 input voltage common mode range latch-up trigger current (1) input offset voltage hysteresis v in c mr i lt v ofs v hys 0.5 1.5 ?00 ?0 1 v dd +0.5 v dd ?.5 +100 +30 22 v v ma mv mv v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 ma output current latch-up trigger current (1) dv out i out i lt ?00 ?00 ?00 +200 +100 +100 mv m a ma mcan bus output driver: pins tx0 and tx1 source current per pin (v out = v dd ?.0v) sink current per pin (v out = 1.0v) latch-up trigger current (1) i oh i ol i lt ?0 10 ?00 +100 ma ma ma (v dd = 5.0 vdc 2%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 m adv out ?80 +180 mv table 12-6 mcan bus interface control timing characteristics (4.5v v dd 5.5v, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit mcan bus output driver rise and fall time (c load = 100pf) t rf ?5ns 166
MC68HC05X16 rev. 1 motorola 13-1 mechanical data 13 13 mechanical data 13.1 64-pin quad ?t pack (qfp) pinout figure 13-1 64-pin qfp pinout nc pb0 nwoi vpp1 17 18 20 21 22 23 24 25 26 27 29 30 31 32 19 48 47 45 44 43 42 41 40 39 38 37 36 35 34 33 46 pb6 pb7 tx0 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 mds tcap2 tcap1 plmb d/a tx1 pc1 pc0 vss1 rx0 rx1 vdd1 rdi sclk tdo tcmp2 tcmp1 pd7/an7 pd6/an6 pd5/an5 nu vddh vrl vrh vdd pd3/an3 pd2/an2 pd1/an1 nu nc/ cane nc/ vpp6 osc1 osc2 reset irq plma d/a pd4/an4 pc2/eclk pc3 pc5 pc6 pc7 vss pb1 pb2 pb3 pb4 pb5 pc4 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 3 pd0/an0 28 64 63 61 60 59 58 56 55 54 53 52 51 50 49 62 57 device pin 26 pin 27 MC68HC05X16, mc68hc05x32 nc nc mc68hc705x32 cane vpp6 nc = not connected nu = non-user pin (should be tied to v ss in an electrically noisy environment) note: unless otherwise stated, a pin labelled as ?u should be tied to v ss in an electrically noisy environment. pins labelled ?c can be left ?ating, since they are not bonded to any part of the device. 167
motorola 13-2 MC68HC05X16 rev. 1 mechanical data 13 13.2 64-pin quad ?t pack (qfp) mechanical dimensions figure 13-2 64-pin qfp mechanical dimensions 64 lead qfp 0.20 m c a ?b s d s l 33 48 16 1 32 17 49 64 - b - b v 0.05 a ?b - d - a s 0.20 m h a ?b s d s l - a - detail ? b b - a, b, d - p detail ? f n j d section b? base metal g h e c -c- m detail ? m -h- datum plane seating plane u t r q k w x dim. min. max. notes dim. min. max. a 13.90 14.10 1. datum plane ??is located at bottom of lead and is coincident with the lead where the lead exits the plastic body at the bottom of the parting line. 2. datums a? and ? to be determined at datum plane ?? 3. dimensions s and v to be determined at seating plane ?? 4. dimensions a and b do not include mould protrusion. allowable mould protrusion is 0.25mm per side. dimensions a and b do include mould mismatch and are determined at datum plane ?? 5. dimension d does not include dambar protrusion. allowable dambar protrusion shall be 0.08 total in excess of the d dimension at maximum material condition. dambar cannot be located on the lower radius or the foot. 6. dimensions and tolerancing per ansi y 14.5m, 1982. 7. all dimensions in mm. m5 10 b 13.90 14.10 n 0.130 0.170 c 2.067 2.457 p 0.40 bsc d 0.30 0.45 q 2 8 e 2.00 2.40 r 0.13 0.30 f 0.30 s 16.20 16.60 g 0.80 bsc t 0.20 ref h 0.067 0.250 u 9 15 j 0.130 0.230 v 16.20 16.60 k 0.50 0.66 w 0.042 nom l 12.00 ref x 1.10 1.30 0.20 m c a ?b s d s 0.05 a ?b 0.20 m h a ?b s d s 0.20 m c a ?b s d s case no. 840c 168
MC68HC05X16 rev. 1 motorola 14-1 ordering information 14 14 ordering information this section describes the information needed to order the MC68HC05X16 and other family members. to initiate a rom pattern for the mcu, you should contact your local ?ld service of?e, local sales person or motorola representative. please note that you will need to supply details such as: mask option selections; temperature range; oscillator frequency; package type; electrical test requirements; and device marking details so that an order can be processed, and a customer speci? part number allocated. refer to table 14-1 for appropriate part numbers. the part number consists of the device title plus the appropriate suf?. for example, the MC68HC05X16 in 64-pin qfp package at ?0 to +85 c would be ordered as: MC68HC05X16cfu. note: the high speed version of the mc68hc05x32 has the same device title as the standard version. high speed operation is selected via a check box on the order form and will be con?med on the listing veri?ation form. see appendix c for electrical characteristics. table 14-1 mc order numbers device title package type suf? 0 to 70 c suf? -40 to +85 c suf? -40 to +105 c suf? -40 to +125 c MC68HC05X16 64-pin qfp fu cfu vfu mfu mc68hc05x32 64-pin qfp fu cfu vfu mfu mc68hc705x32 64-pin qfp fu cfu contact sales contact sales 169
motorola 14-2 MC68HC05X16 rev. 1 ordering information 14 14.1 eproms for the MC68HC05X16, a 16k byte eprom programmed with the customers software (positive logic for address and data) should be submitted for pattern generation. all unused bytes should be programmed to $00. the size of eprom which should be used for all other family members is listed in table 14-2 . the eprom should be clearly labelled, placed in a conductive ic carrier and securely packed. 14.2 veri?ation media all original pattern media (eproms) are ?ed for contractual purposes and are not returned. a computer listing of the rom code will be generated and returned with a listing veri?ation form. the listing should be thoroughly checked and the veri?ation form completed, signed and returned to motorola. the signed veri?ation form constitutes the contractual agreement for creation of the custom mask. if desired, motorola will program blank eproms (supplied by the customer) from the data ?e used to create the custom mask, to aid in the veri?ation process. 14.3 rom veri?ation units (rvu) ten mcus containing the customers rom pattern will be provided for program veri?ation. these units will have been made using the custom mask but are for rom veri?ation only. for expediency, they are usually unmarked and are tested only at room temperature (25 c) and at 5 volts. these rvus are included in the mask charge and are not production parts. they are neither backed nor guaranteed by motorola quality assurance. table 14-2 eproms for pattern generation device size of eprom MC68HC05X16 16k byte mc68hc05x32 32k byte 170
MC68HC05X16 rev. 1 motorola a-1 mc68hc05x32 15 a mc68hc05x32 the mc68hc05x32 is a device similar to the MC68HC05X16, but with increased ram and rom sizes. the entire MC68HC05X16 data sheet applies to the mc68hc05x32, with the exceptions outlined in this appendix. a.1 features 31232 bytes of user rom plus 16 bytes of user vectors 528 bytes of ram 654 bytes of bootstrap rom available in 64-pin qfp package high speed operation (4 mhz bus speed) available. see appendix c for tables of electrical characteristics. 40 to +125 c temperature range important note the following applies to the d53j mc68hc05x32 mask set only: mask options on the mc68hc05x32 allow the customer to select por delay cycles and oscillator div ratio. however, during reset, options of 4064 cycles por and div 10 are forced, regardless of which options the customer has selected. therefore, a power-on reset delay of 40640 oscillator cycles is forced. on the d53j mask set, div10 is forced in bootstrap mode. on later mask set revisions, including d69j, div2 is forced in bootstrap mode. 171
motorola a-2 MC68HC05X16 rev. 1 mc68hc05x32 15 note: the electrical characteristics for the MC68HC05X16 should not be used for the mc68hc05x32. section a.3.1 to section a.3.4 contain data speci? to this device. a.2 memory map, register outline and block diagram figure a-1 mc68hc05x32 block diagram port a pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 port b pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 port c pc0 pc1 pc2/eclk pc3 pc4 pc5 pc6 pc7 16-bit programmable timer port d pd0/an0 pd1/an1 pd2/an2 pd3/an3 pd4/an4 pd5/an5 pd6/an6 pd7/an7 oscillator 528 bytes ram cop watchdog reset irq vdd vss osc1 osc2 m68hc05 cpu sci a/d converter plm tcap1 tcap2 tcmp1 tcmp2 vrh vrl rdi sclk tdo vpp1 256 bytes eeprom charge pump ? 2 / ? 32 plma d/a plmb d/a 8-bit 654 bytes user rom 31248 bytes bootstrap rom (including 16 bytes user vectors) line interface mcan vddh tx0 tx1 rx0 rx1 vdd1 vss1 mds nwoi 172
MC68HC05X16 rev. 1 motorola a-3 mc68hc05x32 15 figure a-2 memory map of the mc68hc05x32 user vectors reserved i/o and registers (32 bytes) stack ram i (176 bytes) bootstrap rom i (80 bytes) user rom (31232 bytes) bootstrap rom ii (80 bytes) optr (1 byte) non protected (31 bytes) protected (224 bytes) eeprom (256 bytes) mc68hc05x32 sci timer over?w timer output compare 1& 2 timer input capture 1& 2 woi, external irq swi reset/power-on reset ram ii 352 bytes mcan registers cirq mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes ports 7 bytes eeprom/eclk control 1 byte plm system 2 bytes a/d converter 2 bytes miscellaneous 1 byte sci 5 bytes timer 14 bytes (30 bytes) bootstrap rom iii (478 bytes) bootstrap rom vectors (16 bytes) $0100 options register register $7ffe? $7ff6? $0000 $0020 $0050 $7ff0? $0120 $0101 $0250 $003e $0200 $7ff2? $00c0 $0100 $7ff4? $7ff8? $7ffa? $7ffc? $03b0 $0400 $7e00 $7fde $7fe0 $0000 $0007 $0008 $000a $000c $000d $0012 $0020 $002a $0034 $003e $0047 173
motorola a-4 MC68HC05X16 rev. 1 mc68hc05x32 15 figure a-2 memory map of the mc68hc05x32 (continued) port b data register port c data register port d input data register port a data register $0000 compare low register 2 a/d data register port a data direction register port b data direction register port c data direction register e/eeprom/eclk control register a/d status/control register pulse length modulation a pulse length modulation b miscellaneous register sci baud rate register sci control register 1 sci control register 2 sci status register sci data register timer control register timer status register capture high register 1 capture low register 1 compare high register 1 compare low register 1 counter high register counter low register alternate counter high register alternate counter low register capture high register 2 capture low register 2 compare high register 2 $0001 $0002 $0003 $0004 $0005 $0006 $0007 $0008 $0009 $000a $000b $000c $000d $000e $000f $0010 $0011 $0012 $0013 $0014 $0015 $0016 $0017 $0018 $0019 $001a $001b $001c $001d $001e $001f receive data ?ld (8 bytes) control register command register status register interrupt register acceptance code register acceptance mask register bus timing register 0 bus timing register 1 output control register test register transmit identi?r atr bit/data length code transmit data ?ld (8 bytes) receive identi?r atr bit/data length code $0020 $0021 $0022 $0023 $0024 $0025 $0026 $0027 $0028 $0029 $002a $002b $002c $0034 $0035 $0036 $003d registe mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes ports 7 bytes eeprom/eclk control 1 byte plm system 2 bytes a/d converter 2 bytes miscellaneous 1 byte sci 5 bytes timer 14 bytes $0100 options register $0047 register $0000 $0007 $0008 $000a $000c $000d $0012 $0020 $002a $0034 $003e 174
MC68HC05X16 rev. 1 motorola a-5 mc68hc05x32 15 (1) this bit is set each time there is a power-on reset. (2) the state of the wdog bit after reset is dependent upon the mask option selected; 1 = watchdog enabled, 0 = watchdog disable d. (3) this register is implemented in eeprom; therefore reset has no effect on the individual bits. table a-1 register outline register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 unde?ed port b data (portb) $0001 unde?ed port c data (portc) $0002 pc2/ eclk unde?ed port d data (portd) $0003 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed port a data direction (ddra) $0004 0000 0000 port b data direction (ddrb) $0005 0000 0000 port c data direction (ddrc) $0006 0000 0000 eeprom/eclk control $0007 woie caf 0 0 eclk e1era e1lat e1pgm 0000 0000 a/d data (addata) $0008 0000 0000 a/d status/control (adstat) $0009 coco adrc adon 0 ch3 ch2 ch1 ch0 0000 0000 pulse length modulation a (plma) $000a 0000 0000 pulse length modulation b (plmb) $000b 0000 0000 miscellaneous $000c por (1) intp intn inte sfa sfb sm wdog (2) u001 000u sci baud rate (baud) $000d spc1 spc0 sct1 sct0 sct0 scr2 scr1 scr0 00uu uuuu sci control 1 (sccr1) $000e r8 t8 m wake cpol cpha lbcl unde?ed sci control 2 (sccr2) $000f tie tcie rie ilie te re rwu sbk 0000 0000 sci status (scsr) $0010 tdre tc rdrf idle or nf fe 1100 000u sci data (scdr) $0011 0000 0000 timer control (tcr) $0012 icie ocie toie folv2 folv1 olv2 iedg1 olvl1 0000 00u0 timer status (tsr) $0013 icf1 ocf1 tof icf2 ocf2 unde?ed input capture high 1 $0014 unde?ed input capture low 1 $0015 unde?ed output compare high 1 $0016 unde?ed output compare low 1 $0017 unde?ed timer counter high $0018 1111 1111 timer counter low $0019 1111 1100 alternate counter high $001a 1111 1111 alternate counter low $001b 1111 1100 input capture high 2 $001c unde?ed input capture low 2 $001d unde?ed output compare high 2 $001e unde?ed output compare low 2 $001f unde?ed options (optr) (3) $0100 ee1p sec not affected 175
motorola a-6 MC68HC05X16 rev. 1 mc68hc05x32 15 a.3 electrical speci?ations this section contains the electrical speci?ations and associated timing information for the mc68hc05x32. a.3.1 maximum ratings note: this device contains circuitry designed to protect against damage due to high electrostatic voltages or electric ?lds. however, it is recommended that normal precautions be taken to avoid the application of any voltages higher than those given in the maximum ratings table to this high impedance circuit. for maximum reliability all unused inputs should be tied to either v ss or v dd . (1) all voltages are with respect to v ss . (2) maximum current drain per pin is for one pin at a time, limited by an external resistor. table a-2 maximum ratings rating symbol value unit supply voltage (1) v dd ?0.5 to +7.0 v input voltage v in v ss ?0.5 to v dd + 0.5 v input voltage ?bootstrap mode (irq pin only) v in v ss ?0.5 to 2v dd + 0.5 v operating temperature range t a t l to t h ?40 to +125 c storage temperature range t stg ?65 to +150 c current drain per pin (2) (excluding vdd, vss, vdd1 and vss1) ?source ?sink i d i s 25 45 ma ma external oscillator frequency f osc 22 mhz 176
MC68HC05X16 rev. 1 motorola a-7 mc68hc05x32 15 a.3.2 dc electrical characteristics table a-3 dc electrical characteristics ( v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic (1) symbol min typ (2) max unit output voltage i load = ?10 m a i load = +10 m a v oh v ol v dd ?0.1 0.1 v output high voltage (i load = 0.8ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, output high voltage (i load = 1.6ma) tdo, sclk, plma, plmb output high voltage (i load = ?00 m a) osc2 v oh v oh v oh v dd ?0.8 v dd ?0.8 v dd ?0.8 v dd ?0.2 v dd ?0.2 v dd ?0.3 v output low voltage (i load = 1.6ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, tdo, sclk, plma, plmb output low voltage (i load = 1.6ma) reset output low voltage (i load = ?00 m a) osc2 v ol v ol v ol 0.1 0.2 0.2 0.4 0.6 0.4 v input high voltage pa0?, pb0?, pc0?, pd0?, osc1, irq , reset , tcap1, tcap2, rdi, mds, nwoi v ih 0.7 v dd ? dd v input low voltage pa0?, pb0?, pc0?, pd0?, osc1, irq , reset , tcap1, tcap2, rdi, mds, nwoi v il v ss 0.2v dd v can comparator i dd (i dd1 ) (3)(4)(5) supply current in div2 mode run: can active (6) stop: can active wait: can asleep (7) stop: can asleep i dd1 i dd1 i dd1 i dd1 360 360 32 10 900 900 100 30 m a m a m a m a mcu i dd (3)(4)(8) supply current in div 2 mode run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 3.6 1.6 1.8 1.5 0.8 0.4 0.5 90 7 3.6 4 3.7 1.4 1.1 1.5 300 ma ma ma ma ma ma ma m a mcu i dd (3)(5)(8) supply current in div 10 mode run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 6.6 4.6 4.6 4.5 1.2 0.8 0.5 90 13 8 8.5 8 1.8 1.4 1.5 300 ma ma ma ma ma ma ma m a high-z leakage current pa0?, pb0?, pc0?, tdo, reset , sclk i il 0.2 1 m a 177
motorola a-8 MC68HC05X16 rev. 1 mc68hc05x32 15 (1) all i dd measurements taken with suitable decoupling capacitors across the power supply to suppress the transient switching currents inherent in cmos designs (see section 2). (2) typical values are at mid point of voltage range and at 25 c only. (3) run and wait i dd : measured using an external square-wave clock source, refer to figure 2-6 (c); all inputs 0.2 v from rail; no dc loads; maximum load on outputs 50pf (20pf on osc2). stop/wait i dd : all ports con?ured as inputs; v il = 0.2 v and v ih = v dd ?0.2 v: stop i dd measured with osc1 = v dd . wait i dd is affected linearly by the osc2 capacitance. (4) f osc = 4.4 mhz; f bus = 2.2 mhz; f can = 2.2 mhz (5) f osc = 22 mhz; f bus = 2.2 mhz; f can = 11 mhz (6) these limits are also applicable under the following conditions: mcu run mode/slow mode/can active mcu wait mode/slow mode/can active mcu wait mode/can active (7) these limits are also applicable under the following conditions: mcu wait mode/slow mode/can asleep (8) these currents are the summation of the mcu current + can current (i dd + i dd1 ) (9) current injection is guaranteed but not tested. functionality of the mcu is guaranteed during injection of dc current up to the maximum speci?d level. the maximum speci?d current for each port is the sum of the magnitudes of the currents on each side of the individual port pins. some disturbance of the a/d accuracy is possible during an injection event and is dependent on board layout, power supply decoupling and reference voltage decoupling con?urations. input current osc1=v dd (osc2=v ss ) input current osc1=v ss (osc2=v dd ) i fh i fl ?0 +10 m a input current irq , tcap1, tcap2, rdi, pd0/an0-pd7/an7 (channel not selected) i in 0.2 1 m a capacitance ports (as input or output), reset , tdo, sclk irq , tcap1, tcap2, osc1, rdi pd0/an0?d7/an7 (a/d off) pd0/an0?d7/an7 (a/d on) c out c in c in c in 12 22 12 8 pf pf pf pf dc injection current (9) port a (pa0?a7) port b (pb0?b7) |i inj | |i inj | 10 10 ma ma table a-3 dc electrical characteristics ( v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic (1) symbol min typ (2) max unit 178
MC68HC05X16 rev. 1 motorola a-9 mc68hc05x32 15 a.3.3 a/d converter characteristics (1) performance veri?d down to 2.5v d vr, but accuracy is tested and guaranteed at d vr = 5v 10%. (2) source impedances greater than 10k w will adversely affect internal charging time during input sampling. (3) the external system error caused by input leakage current is approximately equal to the product of r source and input current. input current to a/d channel will be dependent on external source impedance (see figure 9-2 ). table a-4 a/d characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic parameter min max unit resolution number of bits resolved by the a/d 8 bit non-linearity max deviation from the best straight line through the a/d transfer characteristics (v rh = v dd and v rl = 0v) 0.5 lsb quantization error uncertainty due to converter resolution 0.5 lsb absolute accuracy difference between the actual input voltage and the full-scale equivalent of the binary code output code for all errors 1 lsb conversion range analog input voltage range v rl v rh v v rh maximum analog reference voltage v rl v dd + 0.1 v v rl minimum analog reference voltage v ss ?0.1 v rh v d v r (1) minimum difference between v rh and v rl 3v conversion time total time to perform a single analog to digital conversion a. external clock (osc1, osc2) b. internal rc oscillator 32 32 t cyc m s monotonicity conversion result never decreases with an increase in input voltage and has no missing codes guaranteed zero input reading conversion result when v in = v rl 00 hex full scale reading conversion result when v in = v rh ?fhex sample acquisition time analog input acquisition sampling a. external clock (osc1, osc2) b. internal rc oscillator (2) 12 12 t cyc m s sample/hold capacitance input capacitance on pd0/an0?d7/an7 12 pf input leakage (3) input leakage on a/d pins pd0/an0?d7/an7, vrl, vrh 1 m a 179
motorola a-10 MC68HC05X16 rev. 1 mc68hc05x32 15 a.3.4 control timing (1) for bus frequencies less than 2 mhz, the internal rc oscillator should be used when programming the eeprom. (2) since a 2-bit prescaler in the timer must count four external cycles (t cyc ), this is the limiting factor in determining the timer resolution. (3) the minimum period t tltl should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 t cyc . (4) the minimum period t ilil should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 t cyc . (5) at a temperature of 85 c. (6) refer to reliability monitor report (currrent quarterly issue) for current failure rate information. table a-5 control timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic symbol min max unit frequency of operation oscillator frequency mcan module clock frequency mcu bus frequency f osc f can f mcu 0 0 0 22 11 2.2 mhz mhz mhz cycle time (see figure 10-1 )t cyc 455 ns crystal oscillator start-up time (see figure 10-1 )t oxov 100 ms stop recovery start-up time (crystal oscillator) t ilch 100 ms a/d converter stabilization time t adon 500 m s external reset input pulse width t rl 1.5 t cyc power-on reset output pulse width (mask option) 4064 cycle 16 cycle t porl t porl 4064 16 t cyc t cyc watchdog reset output pulse width t dogl 1.5 t cyc watchdog time-out t dog 6144 7168 t cyc eeprom byte erase time t era 10 10 ms eeprom byte program time (1) t prog 10 10 ms timer (see figure a-3 ) resolution (2) input capture pulse width input capture pulse period t resl t th , t tl t tltl 4 125 (3) t cyc ns t cyc interrupt pulse width (edge-triggered) t ilih 125 ns interrupt pulse period t ilil (4) ? cyc osc1 pulse width t oh , t ol 90 ns write/erase endurance (5)(6) 10000 cycles data retention (5)(6) 10 years 180
MC68HC05X16 rev. 1 motorola a-11 mc68hc05x32 15 a.3.5 mcan bus interface dc electrical characteristics (1) maximum dc current should comply with maximum ratings. figure a-3 timer relationship table 1-6 mcan bus interface dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic symbol min max unit mcan bus input comparator: pins rx0 and rx1 input voltage common mode range latch-up trigger current (1) input offset voltage hysteresis v in c mr i lt v ofs v hys 0.5 1.5 ?00 ?0 1 v dd +0.5 v dd ?.5 +100 +30 22 v v ma mv mv v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 m a output current latch-up trigger current (1) dv out i out i lt ?00 ?00 ?00 +200 +100 +100 mv ma ma mcan bus output driver: pins tx0 and tx1 source current per pin (v out = v dd ?.0v) sink current per pin (v out = 1.0v) latch-up trigger current (1) i oh i ol i lt ?0 10 ?00 +100 ma ma ma (v dd = 5.0 vdc 2%, v ss = 0 vdc, t a = ?0 c to +125 c ) characteristic symbol min max unit v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 m adv out ?80 +180 mv external signal (tcap1, tcap2) t tltl t th t tl 181
motorola a-12 MC68HC05X16 rev. 1 mc68hc05x32 15 a.3.6 mcan bus interface control timing characteristics table 1-7 mcan bus interface control timing characteristics (4.5v v dd 5.5v, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit mcan bus output driver rise and fall time (c load = 100pf) t rf ?5ns 182
MC68HC05X16 rev. 1 motorola b-1 mc68hc705x32 15 b mc68hc705x32 the mc68hc705x32 is a device similar to the MC68HC05X16, but with 32k bytes of eprom instead of 16k bytes of rom. in addition, the bootstrap routines available in the MC68HC05X16 are replaced by bootstrap routines speci? to the mc68hc705x32. the entire MC68HC05X16 data sheet applies to the mc68hc705x32, with the exceptions outlined in this appendix. important note the following applies to the d59j mc68hc705x32 mask set only. a mask option register (mor) on the mc68hc705x32 allows the customer to select por delay cycles and oscillator div ratio. however, during reset, options of 4064 cycles por and div10 are forced, regardless of which options the customer has selected. therefore, a power-on reset delay of 40640 oscillator cycles is forced. on the d59j mask set, the oscillator divide ratio depends on the cane pin: cane = 1 div10 forced in bootloader mode cane = 0 div2 forced in bootloader mode on later mask set revisions, including g47v, div2 is forced in bootloader mode, regardless of the cane pin. the following applies to the d40j and d59j mc68hc705x32 mask sets only: the minimum external reset input pulse width, t rl ( table b-10 ) is 1.5 t cyc maximum bus speed 2.2 mhz 183
motorola b-2 MC68HC05X16 rev. 1 mc68hc705x32 15 b.1 features ?0 to +125 c operating temperature range 31232 bytes user eprom plus 16 bytes of eprom user vectors 528 bytes of ram 654 bytes bootstrap rom simultaneous programming of up to 16 bytes of eprom 4 mhz bus speed available in 64-pin qfp package note: the electrical characteristics for the MC68HC05X16 should not be used for the mc68hc705x32. section b.9.2 and section b.9.5 contain data speci? to this device. b.2 vpp6 the vpp6 pin is the voltage input for the eprom in both read and programming modes (see section b.5 ). b.3 cane this pin is the mcan enable input. if cane is connected to vdd, the internal mcan module is selected and its registers are mapped at addresses $0020 to $003d. note: although this pin can be left ?ating to disconnect the mcan module, it is advisable to connect it to vss when the module is not in use. 184
MC68HC05X16 rev. 1 motorola b-3 mc68hc705x32 15 b.4 block diagram, memory map and register outline figure b-1 mc68hc705x32 block diagram port a pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 port b pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 port c pc0 pc1 pc2/eclk pc3 pc4 pc5 pc6 pc7 16-bit programmable timer port d pd0/an0 pd1/an1 pd2/an2 pd3/an3 pd4/an4 pd5/an5 pd6/an6 pd7/an7 oscillator 528 bytes ram cop watchdog reset irq vdd vss osc1 osc2 m68hc05 cpu sci a/d converter plm tcap1 tcap2 tcmp1 tcmp2 vrh vrl rdi sclk tdo vpp1 256 bytes eeprom charge pump ? 2 / ? 32 plma d/a plmb d/a 8-bit 654 bytes eprom 31248 bytes bootstrap rom (including 16 bytes user vectors) line interface mcan vddh tx0 tx1 rx0 rx1 vdd1 vss1 cane mds vpp6 nwoi 185
motorola b-4 MC68HC05X16 rev. 1 mc68hc705x32 15 (1) this bit is set each time there is a power-on reset. (2) the state of the wdog bit after reset is dependent upon the mask option selected; 1 = watchdog enabled, 0 = watchdog disable d. (3) this register is implemented in eeprom; therefore reset has no effect on the individual bits. (4) this register is implemented in eprom; therefore reset has no effect on the individual bits. however, please read the import ant note on page b-1. table b-1 register outline register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 unde?ed port b data (portb) $0001 unde?ed port c data (portc) $0002 pc2/eclk unde?ed port d data (portd) $0003 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 unde?ed port a data direction (ddra) $0004 0000 0000 port b data direction (ddrb) $0005 0000 0000 port c data direction (ddrc) $0006 0000 0000 eeprom/eclk control $0007 woie caf e6lat e6pgm eclk e1era e1lat e1pgm 0000 0000 a/d data (addata) $0008 0000 0000 a/d status/control (adstat) $0009 coco adrc adon 0 ch3 ch2 ch1 ch0 0000 0000 pulse length modulation a (plma) $000a 0000 0000 pulse length modulation b (plmb) $000b 0000 0000 miscellaneous $000c por (1) intp intn inte sfa sfb sm wdog (2) u001 000u sci baud rate (baud) $000d spc1 spc0 sct1 sct0 sct0 scr2 scr1 scr0 00uu uuuu sci control 1 (sccr1) $000e r8 t8 m wake cpol cpha lbcl unde?ed sci control 2 (sccr2) $000f tie tcie rie ilie te re rwu sbk 0000 0000 sci status (scsr) $0010 tdre tc rdrf idle or nf fe 1100 000u sci data (scdr) $0011 0000 0000 timer control (tcr) $0012 icie ocie toie folv2 folv1 olv2 iedg1 olvl1 0000 00u0 timer status (tsr) $0013 icf1 ocf1 tof icf2 ocf2 unde?ed input capture high 1 $0014 unde?ed input capture low 1 $0015 unde?ed output compare high 1 $0016 unde?ed output compare low 1 $0017 unde?ed timer counter high $0018 1111 1111 timer counter low $0019 1111 1100 alternate counter high $001a 1111 1111 alternate counter low $001b 1111 1100 input capture high 2 $001c unde?ed input capture low 2 $001d unde?ed output compare high 2 $001e unde?ed output compare low 2 $001f unde?ed options (optr) (3) $0100 ee1p sec not affected mask option register (mor) (4) $7fde woi div2 div8 rtim rwat wwat pbpd pcpd not affected 186
MC68HC05X16 rev. 1 motorola b-5 mc68hc705x32 15 figure b-2 memory map of the mc68hc705x32 eprom user reserved i/o and registers (32 bytes) stack ram i (176 bytes) bootstrap rom i (80 bytes) user eprom (31232 bytes) bootstrap rom ii (80 bytes) optr (1 byte) non protected (31 bytes) protected (224 bytes) eeprom (256 bytes) mc68hc705x32 sci timer over?w timer output compare 1& 2 timer input capture 1& 2 woi, external irq swi reset/power-on reset ram ii 352 bytes mcan registers cirq mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes ports 7 bytes eeprom/eclk control 1 byte plm system 2 bytes a/d converter 2 bytes miscellaneous 1 byte sci 5 bytes timer 14 bytes $7fde mask options register (30 bytes) mask options register bootstrap rom iii (478 bytes) bootstrap rom vectors (16 bytes) $0100 options register register groups $7ffe? $7ff6? $0000 $0020 $0050 $7ff0? $0120 $0101 $0250 $003e $0200 $7ff2? $00c0 $0100 $7ff4? $7ff8? $7ffa? $7ffc? $03b0 $0400 $7e00 $7fde $7fdf $7fe0 $0000 $0007 $0008 $000a $000c $000d $0012 $0020 $002a $0034 $003e $0047 vectors 187
motorola b-6 MC68HC05X16 rev. 1 mc68hc705x32 15 figure b-2 memory map of the mc68hc705x32 (continued) port b data register port c data register port d input data register port a data register $0000 compare low register 2 a/d data register port a data direction register port b data direction register port c data direction register e/eeprom/eclk control register a/d status/control register pulse length modulation a pulse length modulation b miscellaneous register sci baud rate register sci control register 1 sci control register 2 sci status register sci data register timer control register timer status register capture high register 1 capture low register 1 compare high register 1 compare low register 1 counter high register counter low register alternate counter high register alternate counter low register capture high register 2 capture low register 2 compare high register 2 $0001 $0002 $0003 $0004 $0005 $0006 $0007 $0008 $0009 $000a $000b $000c $000d $000e $000f $0010 $0011 $0012 $0013 $0014 $0015 $0016 $0017 $0018 $0019 $001a $001b $001c $001d $001e $001f receive data ?ld (8 bytes) control register command register status register interrupt register acceptance code register acceptance mask register bus timing register 0 bus timing register 1 output control register test register transmit identi?r atr bit/data length code transmit data ?ld (8 bytes) receive identi?r atr bit/data length code $0020 $0021 $0022 $0023 $0024 $0025 $0026 $0027 $0028 $0029 $002a $002b $002c $0034 $0035 $0036 $003d registers mcan control registers 10 bytes mcan transmit buffer 10 bytes mcan receive buffer 10 bytes ports 7 bytes eeprom/eclk control 1 byte plm system 2 bytes a/d converter 2 bytes miscellaneous 1 byte sci 5 bytes timer 14 bytes $7fde mask options register $0100 options register $0047 register groups $0000 $0007 $0008 $000a $000c $000d $0012 $0020 $002a $0034 $003e 188
MC68HC05X16 rev. 1 motorola b-7 mc68hc705x32 15 b.5 eprom the mc68hc705x32 memory map is given in figure b-2 . the device has a total of 31248 bytes of eprom. 16 bytes are used for the reset and interrupt vectors from address $7ff0 to $7fff. the main eprom block of 31232 bytes is located from $0400 to $7dff. one byte of eprom is used as an option register and is located at address $7fde. the eprom can be completely tested before assembly with sequences of both program and erase. it is ?ally erased before being typically assembled in a package with no erase window. therefore, only programming is possible and the eprom operates as a prom. the eprom array is supplied by the vpp6 pin in both read and program modes. typically the users software would be loaded into a programming board where v pp6 is controlled by one of the bootstrap loader routines. it would then be placed in an application where no programming occurs. in this case the vpp6 pin should be hardwired to v dd . warning: a minimum v pp6r voltage must be applied to the vpp6 pin at all times, including power-on. failure to do so could result in permanent damage to the device. unless otherwise stated, eprom programming is guaranteed at ambient temperature (25 c) only. b.5.1 eprom read operation the execution of a program in the eprom address range or a load from the eprom are both read operations. the e6lat bit in the eprom/eeprom control register should be cleared to ? which automatically resets the e6pgm bit. in this way the eprom is read like a normal rom. reading the eprom with the e6lat bit set will give data that does not correspond to the actual memory content. as interrupt vectors are in eprom, they will not be loaded when e6lat is set. similarly, the bootstrap rom routines cannot be executed when e6lat is set. in read mode, the vpp6 pin must be at the v pp6r level. when entering the stop mode, the eprom is automatically set to the read mode. note: an erased byte reads as $00. 189
motorola b-8 MC68HC05X16 rev. 1 mc68hc705x32 15 b.5.2 eprom program operation typically the eprom will be programmed by the bootstrap routines resident in the on-chip rom. however, the user program can be used to program some eprom locations if the proper procedure is followed. in particular, the programming sequence must be running in ram, as the eprom will not be available for code execution while the e6lat bit is set. the v pp6 switching must occur externally after the e6pgm bit is set, for example under control of a signal generated on a pin by the programming routine. note: when the part becomes a prom, only the cumulative programming of bits to logic ? is possible if multiple programming is made on the same byte. to allow simultaneous programming of up to sixteen bytes, these bytes must be in the same group of addresses which share the same most signi?ant address bits; only the four least signi?ant bits can change. b.5.3 eprom/eeprom/eclk control register woie ?wired-or interrupt enable bit 1 (set) wired-or interrupts are enabled, provided the woi bit in register mor is set. 0 (clear) wired-or interrupts are disabled. the woie bit can be used to enable the wired-or interrupts (woi) on the nwoi pin and on all port b pins that have been programmed as inputs. woi is activated if the woie bit is set and if the woi bit in the mask options register (mor) is also set (see section b.7 ). if woi is not set then woie is forced to zero. external and power-on resets clear the woie bit. caf ?mcan asleep ?g this ?g is set by the mcu when the mcan module enters sleep mode.this is the only indication that the mcan is asleep (see section 5.5 ). the bit is cleared when the mcan wakes up. 1 (set) the mcan module is in sleep mode. 0 (clear) the mcan module is not in sleep mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eprom/eeprom/eclk control $0007 woie caf e6lat e6pgm eclk e1era e1lat e1pgm 0000 0000 190
MC68HC05X16 rev. 1 motorola b-9 mc68hc705x32 15 e6lat ?eprom programming latch enable bit 1 (set) address and up to sixteen data bytes can be latched into the eprom for further programming providing the e6pgm bit is cleared. 0 (clear) data can be read from the eprom or ?mware rom; the e6pgm bit is cleared when e6lat is ?? stop, power-on and external reset clear the e6lat bit. note: after the t era1 erase time or t prog1 programming time, the e6lat bit has to be reset to zero in order to clear the e6pgm bit. e6pgm ?eprom program enable bit this bit is the eprom program enable bit. it can be set to ? to enable programming only after e6lat is set and at least one byte is written to the eprom. it is not possible to clear this bit using software but clearing e6lat will always clear e6pgm. note: the e6pgm bit can never be set while the e6lat bit is at zero. eclk ?external clock output see section 4.3 . e1era ?eeprom erase/programming bit providing the e1lat and e1pgm bits are at logic one, this bit indicates whether the access to the eeprom is for erasing or programming purposes. 1 (set) an erase operation will take place. 0 (clear) a programming operation will take place. once the program/erase eeprom address has been selected, e1era cannot be changed. table b-2 eprom control bits description e6lat e6pgm description 0 0 read/execute in eprom 1 0 ready to write address/data to eprom 1 1 programming in progress 191
motorola b-10 MC68HC05X16 rev. 1 mc68hc705x32 15 e1lat ?eeprom programming latch enable bit 1 (set) address and data can be latched into the eeprom for further program or erase operations, providing the e1pgm bit is cleared. 0 (clear) data can be read from the eeprom. the e1era bit and the e1pgm bit are reset to zero when e1lat is ?? stop, power-on and external reset clear the e1lat bit. note: after the t era1 erase time or t prog1 programming time, the e1lat bit has to be reset to zero in order to clear the e1era bit and the e1pgm bit. 1) e1pgm ?eeprom charge pump enable/disable 1 (set) internal charge pump generator switched on. 0 (clear) internal charge pump generator switched off. when the charge pump generator is on, the resulting high voltage is applied to the eeprom array. this bit cannot be set before the data is selected, and once this bit has been set it can only be cleared by clearing the e1lat bit. a summary of the effects of setting/clearing bits 0, 1 and 2 of the control register are given in table b-3 . note: the e1pgm and e1era bits are cleared when the e1lat bit is at zero. table b-3 eeprom1 control bits description e1era e1lat e1pgm description 0 0 0 read condition 0 1 0 ready to load address/data for program/erase 0 1 1 byte programming in progress 1 1 0 ready for byte erase (load address) 1 1 1 byte erase in progress 192
MC68HC05X16 rev. 1 motorola b-11 mc68hc705x32 15 b.6 eeprom options register (optr) ee1p ?eeprom protect bit in order to achieve a higher degree of protection, the eeprom is split into two parts, both working from the vpp1 charge pump. part 1 of the eeprom array (32 bytes from $0100 to $011f) cannot be protected; part 2 (224 bytes from $0120 to $01ff) is protected by the ee1p bit in the options register. 1 (set) part 2 of the eeprom array is not protected; all 256 bytes of eeprom can be accessed for any read, erase or programming operations. 0 (clear) part 2 of the eeprom array is protected; any attempt to erase or program a location will be unsuccessful. when this bit is set (erased), the protection will remain until the next power-on or external reset. ee1p can only be written to ? when the e1lat bit in the eeprom control register is set. note: the eeprom1 protect function is disabled while in bootstrap mode. sec ?secure bit this bit allows the eprom and eeprom1 to be secured from external access. when this bit is in the erased state (set), the eprom and eeprom1 content is not secured and the device may be used in non user mode. when the sec bit is programmed to ?ero? the eprom and eeprom1 content is secured by prohibiting entry to the non user mode. to deactivate the secure bit, the eprom has to be erased by exposure to a high density ultraviolet light, and the device has to be entered into the eprom erase veri?ation mode with pd1 set. when the sec bit is changed, its new value will have no effect until the next power-on or external reset. 1 (set) eeprom/eprom not protected. 0 (clear) eeprom/eprom protected. (1) this register is implemented in eeprom; therefore reset has no effect on the individual bits. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset options (optr) (1) $0100 ee1p sec not affected 193
motorola b-12 MC68HC05X16 rev. 1 mc68hc705x32 15 b.7 mask option register (mor) woi ?wired-or interrupt enable 1 (set) wired-or interrupts are enabled, provided the woie bit in the eprom/eeprom/eclk control register is set. 0 (clear) wired-or interrupts are disabled, irrespective of the woie bit in the eprom/eeprom/eclk control register. the woi bit can be used to enable the wired-or interrupt (woi) on all port b pins that have been programmed as inputs. woi is activated if the woi bit is set and if the woie bit in the optr register is also set. div2, div8 ?clock divide ratio selection the div2 and div8 bits are used to select the cpu clock divide ratio (see table b-4 ). note that a divide-by-two clock ratio is forced in bootstrap mode, regardless of the div2 and div8 values. rtim ?reset time this bit can modify the time t porl , where the reset pin is kept low after a power-on reset. 1 (set) t porl = 16 cycles. 0 (clear) t porl = 4064 cycles. rwat ?watchdog after reset this bit can modify the status of the watchdog counter after reset. 1 (set) the watchdog will be active immediately following power-on or external reset (except in bootstrap mode). 0 (clear) the watchdog system will be disabled after power-on or external reset. (1) this register is implemented in eprom; therefore reset has no effect on the individual bits. however, please read the import ant note on page b-1. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset mask option register (mor) (1) $7fde woi div2 div8 rtim rwat wwat pbpd pcpd not affected table b-4 clock divide ratio selection div2 div8 clock divide ratio 11 2 10 4 01 8 00 10 194
MC68HC05X16 rev. 1 motorola b-13 mc68hc705x32 15 wwat ?watchdog during wait mode this bit can modify the status of the watchdog counter during wait mode. 1 (set) the watchdog will be active during wait mode. 0 (clear) the watchdog system will be disabled during wait mode. pbpd ?port b pull-down this bit, when programmed, connects a resistive pull-down on each pin of port b. this pull-down, r pd , is active on a given pin only while it is an input. 1 (set) pull-down resistors are connected to all 8 pins of port b; the pull-down, r pd , is active only while the pin is an input. 0 (clear) no pull-down resistors are connected. pcpd ?port c pull-down this bit, when programmed, connects a resistive pull-down on each pin of port c. this pull-down, r pd , is active on a given pin only while it is an input. 1 (set) pull-down resistors are connected to all 8 pins of port c; the pull-down, r pd , is active only while the pin is an input. 0 (clear) no pull-down resistors are connected. 195
motorola b-14 MC68HC05X16 rev. 1 mc68hc705x32 15 b.8 bootstrap mode oscillator divide-by-two is forced in bootstrap mode; all other options stay as programmed in the mask options register (see section b.7 ). the bootstrap ?mware is located in mask rom at address locations $0200 to $024f, $03b0 to $3fff, $7e00 to $7fdd and $7fe0 to $7fef. this ?mware can be used to program the eprom and the eeprom, to check if the eprom is erased, or to load and execute routines in ram. after reset, while going to the bootstrap mode, the vector located at address $7fee and $7fef (reset ) is fetched to start execution of the bootstrap program. to place the part in bootstrap mode, the following conditions must be met during transition of the reset pin from low to high: 1) irq pin at 2xv dd or mds pin at v dd 2) tcap1 pin at v dd 3) tcap2 pin at v ss the hold time on the irq , mds, tcap1 and tcap2 pins is two clock cycles after the external reset pin is brought high. when the mc68hc705x32 is placed in the bootstrap mode, the bootstrap reset vector will be fetched and the bootstrap ?mware will start to execute. table b-5 shows the conditions required to enter each level of bootstrap mode on the rising edge of reset . the bootstrap program ?st copies part of itself into ram (except ?am parallel load?, as the program cannot be executed in rom during veri?ation/programming of the eprom. table b-5 mode of operation selection mds irq tcap1 tcap2 pd1 pd2 pd3 pd4 mode v ss and v ss to v dd v ss to v dd x xxxx single-chip mode bootstrap mode: v dd or 2v dd v dd v ss 0 0 0 x eprom erase check v dd or 2v dd v dd v ss 100x eprom erase check, erase eeprom, parallel eprom/eeprom program/verify v dd or 2v dd v dd v ss 0 1 0 x parallel eeprom only verify (sec bit not active) v dd or 2v dd v dd v ss 110x eprom erase check, erase eeprom, parallel eprom only program/verify v dd or 2v dd v dd v ss x 1 1 0 jump to ram $0051 (sec bit not active) v dd or 2v dd v dd v ss x x 1 1 serial ram load and execute (sec bit not active) x = don? care 196
MC68HC05X16 rev. 1 motorola b-15 mc68hc705x32 15 figure b-3 modes of operation ?w chart red led on sec bit active? pd3 set? red led on jump to ram ($0051) y n y n parallel e/eeprom bootstrap pd4 set? y erased eprom veri?ation serial ram load/execute n pd2 set? y n reserved for motorola use pd2 set? n pd1 set? y n sec bit active? red led on y n pd4 set? y eprom erased? n y y green led on pd1 set? n erase eeprom1 red led off n a b c bootstrap mode 197
motorola b-16 MC68HC05X16 rev. 1 mc68hc705x32 15 figure b-3 modes of operation ?w chart (continued) data veri?d? y pd2 set? n red led on a base address = $400 (eprom only) base address = $100 (eprom and eeprom) y n green led on b c pd2 set? n y base address = $100 (eprom and eeprom) base address = $400 (eprom only) 198
MC68HC05X16 rev. 1 motorola b-17 mc68hc705x32 15 b.8.1 erased eprom veri?ation and eeprom erasure if a non $00 byte is detected, the red led will be turned on and the routine will stop (see figure b-3 ). only when the whole eprom array is veri?d as erased will the green led be turned on. pd1 is then checked. if pd1=0, the bootstrap program stops here and no programming occurs until a high level is sensed on pd1. if pd1 = 1, the bootstrap program proceeds to erase the eeprom1 for a nominal 2.5 seconds (4.0 mhz crystal). it is then checked for complete erasure; if any eeprom byte is not erased, the program will stop before erasing the sec byte. when both eprom and eeprom1 are completely erased and the security bit is cleared the programming operation can be performed. a schematic diagram of the circuit required for erased eprom veri?ation is shown in figure b-6 . b.8.2 eprom/eeprom parallel bootstrap within this mode there are various subsections which can be utilised by correctly con?uring the port pins shown in table b-5 . the erased eprom veri?ation program will be executed ?st as described in section b.8.1 . when pd2=0, the programming time is set to 5 milliseconds with the bootstrap program and verify for the eprom taking approximately 15 seconds. the eprom will be loaded in increasing address order with non eprom segments being skipped by the loader. simultaneous programming is performed by reading sixteen bytes of data before actual programming is performed, thus dividing the loading time of the internal eprom by 16. if any block of 16 eprom bytes or 1 eeprom byte of data is in the erased state, no programming takes place, thus speeding up the execution time. parallel data is entered through port a, while the 15-bit address is output on port b, pc0 to pc4 and tcmp1 and tcmp2. if the data comes from an external eprom, the handshake can be disabled by connecting together pc5 and pc6. if the data is supplied by a parallel interface, handshake will be provided by pc5 and pc6 according to the timing diagram of figure b-4 (see also figure b-5 ). during programming, the green led will ?sh at about 3 hz. upon completion of the programming operation, the eprom and eeprom1 content will be checked against the external data source. if programming is veri?d the green led will stay on, while an error will cause the red led to be turned on. figure b-6 is a schematic diagram of a circuit which can be used to program the eprom or to load and execute data in the ram. note: the entire eprom and eeprom1 can be loaded from the external source; if it is desired to leave a segment undisturbed, the data for this segment should be all $00s for eprom data and all $ffs for eeprom1 data. 199
motorola b-18 MC68HC05X16 rev. 1 mc68hc705x32 15 figure b-4 timing diagram with handshake figure b-5 parallel eprom loader timing diagram data read data read address hdsk out (pc5) data hdsk in (pc6) f29 t cooe t ade t dhe address data t ade t dhe t ade t dhe t ade t dhe t cooe t cooe t cdde t ade max (address to data delay) 5 machine cycles t dha min (data hold time) 14 machine cycles t cooe (load cycle time) 117 machine cycles < t cooe < 150 machine cycles t cdde (programming cycle time) t cooe + t prog (5ms nominal for eprom; 10ms for eeprom1)) 1 machine cycle = 1/(2f 0 (xtal)) 200
MC68HC05X16 rev. 1 motorola b-19 mc68hc705x32 15 warning: a minimum v pp6r voltage must be applied to the vpp6 pin at all times, including power-on. failure to do so could result in permanent damage to the device. unless otherwise stated, eprom programming is guaranteed at ambient temperature (25 c) only. figure b-6 eprom parallel bootstrap schematic diagram vcc 28 1 vpp pgm 27 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 vdd osc1 osc2 tcap1 irq reset vss a0 a1 a2 a3 a4 a5 a6 a7 d0 d1 d2 d3 d4 d5 d6 d7 gnd oe 14 22 10 9 8 7 6 5 4 26 12 13 15 16 17 18 19 11 3 +5v 1 2 p1 gnd +5v 100mf 22pf 4.0 mhz 1n914 1k w 1.0mf 22pf 100k w 1n914 reset run 0.01mf tdo sclk rdi vrl tcap2 pd7 pd6 pd5 pd3 pd2 pd1 pd0 pd4 +5v 3 v pp vpp6 pc7 pc5 pc4 pc3 pc2 pc1 pc0 pc6 24 21 23 2 a9 a8 a10 a12 ce a11 a12 a11 a10 a9 a8 hdsk out hdsk in short circuit if handshake not used 100 k w nc tcmp1 tcmp2 plma plmb 470 w 470 w red led green led 4k7 w 4k7 w 12 k w bc239c bc309c 10k w 27c256 + + vrh red led ?programming failed green led ?programming ok 25 1nf 1n5819 1 k w + ram eprom green led ?eprom erased 47mf + erase check & boot eprom erase check vpp1 red led ?eprom not erased boot erase check a13 20 mc68hc705x32 mcu a14 verify program eprom eprom 201
motorola b-20 MC68HC05X16 rev. 1 mc68hc705x32 15 b.8.3 serial ram loader this mode is similar to the ram load/execute program for the mc68hc05x32 described in section 2.1.2.1 , with the additional features listed below. table b-5 shows the entry conditions required for this mode. if the ?st byte is less than $b0, the bootloader behaves exactly as the mc68hc05x32, i.e. count byte followed by data stored in $0050 to $00ff. if the count byte is larger than ram i (176 bytes) then the code continues to ?l ram ii then ram iii. in this case the count byte is ignored and the program execution begins at $0051 once the total ram area is ?led or if no data is received for 5 milliseconds. the user must take care when using branches or jumps as his code will be relocated in ram i, ii and iii. if the user intends to use the stack in his program, he should send nops to ?l the desired stack area. in the ram bootloader mode, all interrupt vectors are mapped to pseudo-vectors in ram (see table b-6 ). this allows programmers to use their own service-routine addresses. each pseudo-vector is allowed three bytes of space rather than the two bytes for normal vectors, because an explicit jump (jmp) opcode is needed to cause the desired jump to the users service-routine address. b.8.3.1 jump to start of ram ($0051) the jump to start of ram program will be executed then the device will be brought out of reset with pd2 and pd3 at ? and pd4 at ?? table b-6 bootstrap vector targets in ram vector targets in ram sci interrupt $0063 timer over?w $0060 timer output compare $005d timer input capture $005a irq $0057 swi $0054 202
MC68HC05X16 rev. 1 motorola b-21 mc68hc705x32 15 figure b-7 ram load and execute schematic diagram vpp6 pc7 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 vdd osc1 osc2 tcap1 irq reset vss p1 gnd +5v 1n914 1k w 1.0mf 100k w 1n914 reset run 0.01mf v pp pc5 pc4 pc3 pc2 pc1 pc0 pc6 plma plmb 470 w 470 w red led green led + + vrh 22mf 22mf 22mf 2 x 3k w 1 2 3 4 8 6 7 5 11 12 13 14 15 16 5 3 2 1 22mf rs232 connector max 232 +5v 9600 bd 8-bit no parity vrl tcap2 tcmp1 tcmp2 sclk nc 10nf 47mf pd0 pd4 pd1 pd2 pd5 pd6 pd7 + + + + 22pf 4.0 mhz 22pf 4k7 w 4k7 w 12 k w bc239c bc309c 10k w 1nf 1n5819 1 k w + 47mf + pd3 rdi tdo vpp1 mc68hc705x32 mcu v ss 203
motorola b-22 MC68HC05X16 rev. 1 mc68hc705x32 15 figure b-8 parallel ram loader timing diagram t adr t dhr address data t cr pd4 t exr max t ho t hi max pc5 out pc6 in 204
MC68HC05X16 rev. 1 motorola b-23 mc68hc705x32 15 b.9 electrical speci?ations b.9.1 maximum ratings note: this device contains circuitry designed to protect against damage due to high electrostatic voltages or electric ?lds. however, it is recommended that normal precautions be taken to avoid the application of any voltages higher than those given in the maximum ratings table to this high impedance circuit. for maximum reliability all unused inputs should be tied to either v ss or v dd . (1) all voltages are with respect to v ss . (2) maximum current drain per pin is for one pin at a time, limited by an external resistor. table b-7 maximum ratings rating symbol value unit supply voltage (1) v dd ?0.5 to +7.0 v input voltage v in v ss ?0.5 to v dd + 0.5 v input voltage ?bootstrap mode (irq pin only) v in v ss ?0.5 to 2v dd + 0.5 v operating temperature range t a t l to t h ?0 to +125 c storage temperature range t stg ?65 to +150 c current drain per pin (2) (excluding vdd, vss, vdd1 and vss1) ?source ?sink i d i s 25 45 ma ma external oscillator frequency f osc 22 mhz 205
motorola b-24 MC68HC05X16 rev. 1 mc68hc705x32 15 b.9.2 dc electrical characteristics table b-8 dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic (1) symbol min typ (2) max unit output voltage i load = ?10 m a i load = +10 m a v oh v ol v dd ?0.1 0.1 v output high voltage (i load = 0.8ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, output high voltage (i load = 1.6ma) tdo, sclk, plma, plmb output high voltage (i load = ?00 m a) osc2 v oh v oh v oh v dd ?0.8 v dd ?0.8 v dd ?0.8 v dd ?0.2 v dd ?0.2 v dd ?0.3 v output low voltage (i load = 1.6ma) pa0?, pb0?, pc0?, tcmp1, tcmp2, tdo, sclk, plma, plmb output low voltage (i load = 1.6ma) reset output low voltage (i load = ?00 m a) osc2 v ol v ol v ol 0.1 0.2 0.2 0.4 0.6 0.4 v input high voltage pa0?, pb0?, pc0?, pd0?, osc1, irq, reset , tcap1, tcap2, rdi, cane, mds, nwoi v ih 0.7v dd ? dd v input low voltage pa0?, pb0?, pc0?, pd0?, osc1, irq, reset , tcap1, tcap2, rdi, cane, mds, nwoi v il v ss 0.2v dd v can comparator i dd (i dd1 ) (3)(4)(5) supply current in div2 mode run: can active (6) stop: can active wait: can asleep (7) stop: can asleep i dd1 i dd1 i dd1 i dd1 360 360 32 10 900 900 100 30 m a m a m a m a mcu i dd (3)(4)(8) supply current in div 2 mode run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 7 2.2 2.4 1.9 1.3 0.7 0.5 90 11.4 3.9 4.4 3.2 2.7 0.9 1.5 300 ma ma ma ma ma ma ma m a mcu i dd (3)(5)(8) supply current run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 3.9 1.2 1.4 1.0 1.1 0.6 0.16 90 7 2.9 3.2 2.6 2 1.75 1.5 300 ma ma ma ma ma ma ma m a high-z leakage current pa0?, pb0?, pc0?, tdo, reset , sclk i il 0.2 1 m a 206
MC68HC05X16 rev. 1 motorola b-25 mc68hc705x32 15 (1) all i dd measurements taken with suitable decoupling capacitors across the power supply to suppress the transient switching currents inherent in cmos designs (see section 2). (2) typical values are at mid point of voltage range and at 25 c only. (3) run and wait i dd : measured using an external square-wave clock source, refer to figure 2-6 (c); all inputs 0.2 v from rail; no dc loads; maximum load on outputs 50pf (20pf on osc2). stop/wait i dd : all ports con?ured as inputs; v il = 0.2 v and v ih = v dd ?0.2 v: stop i dd measured with osc1 = v dd . wait i dd is affected linearly by the osc2 capacitance. (4) f osc = 8 mhz; f bus = 4 mhz; f can = 4 mhz (5) f osc = 4.4 mhz; f bus = 2.2 mhz; f can = 2.2 mhz (6) these limits are also applicable under the following conditions: mcu run mode/slow mode/can active mcu wait mode/slow mode/can active mcu wait mode/can active (7) these limits are also applicable under the following conditions: mcu wait mode/slow mode/can asleep (8) these currents are the summation of the mcu current + can current (i dd + i dd1 ) (9) current injection is guaranteed but not tested. functionality of the mcu is guaranteed during injection of dc current up to the maximum speci?d level. the maximum speci?d current for each port is the sum of the magnitudes of the currents on each side of the individual port pins. some disturbance of the a/d accuracy is possible during an injection event and is dependent on board layout, power supply decoupling and reference voltage decoupling con?urations. input current osc1=v dd (osc2=v ss ) input current osc1=v ss (osc2=v dd ) i fh i fl ?0 +10 m a input current irq , tcap1, tcap2, rdi, pd0/an0-pd7/an7 (channel not selected) i in 0.2 1 m a capacitance ports (as input or output), reset , tdo, sclk irq , tcap1, tcap2, osc1, rdi pd0/an0?d7/an7 (a/d off) pd0/an0?d7/an7 (a/d on) c out c in c in c in 12 22 12 8 pf pf pf pf dc injection current (9) port a (pa0?a7) port b (pb0?b7) |i inj | |i inj | 10 10 ma ma table b-8 dc electrical characteristics (continued) (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic (1) symbol min typ (2) max unit 207
motorola b-26 MC68HC05X16 rev. 1 mc68hc705x32 15 b.9.3 eprom electrical characteristics (1) typical values are at mid point of voltage range and at 25 c only. (a) f mcu > 2.2 mhz (b) f mcu 2.2 mhz note: use of programming times between 5ms and 20ms will not affect the product reliability. table b-9 eprom electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c, f mcu 4mhz) characteristic symbol min typ (1) max unit eprom absolute maximum voltage programming voltage programming current read voltage (a) read voltage (b) read current v pp6 max v pp6 i pp6 v pp6r v pp6r i pp6r v dd 14.5 v dd ?0.35 v dd ?0.5 15 50 100 18 16 64 v dd v dd 150 v v ma v v m a eprom programming time t prog 5 20 ms 208
MC68HC05X16 rev. 1 motorola b-27 mc68hc705x32 15 b.9.4 control timing (1) for bus frequencies less than 2 mhz, the internal rc oscillator should be used when programming the eeprom. (2) since a 2-bit prescaler in the timer must count four external cycles (t cyc ), this is the limiting factor in determining the timer resolution. (3) the minimum period t tltl should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 t cyc . (4) the minimum period t ilil should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 t cyc . (5) at a temperature of 85 c. (6) refer to reliability monitor report (current quarterly issue) for current failure rate information. table b-10 control timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit frequency of operation oscillator frequency mcan module clock frequency mcu bus frequency f osc f can f mcu 0 0 0 22 11 4 mhz mhz mhz cycle time (see figure 10-1 )t cyc 455 ns crystal oscillator start-up time (see figure 10-1 )t oxov 100 ms stop recovery start-up time (crystal oscillator) t ilch 100 ms a/d converter stabilization time t adon 500 m s external reset input pulse width t rl 3.0 t cyc power-on reset output pulse width 4064 cycle 16 cycle t porl t porl 4064 16 t cyc t cyc watchdog reset output pulse width t dogl 1.5 t cyc watchdog time-out t dog 6144 7168 t cyc eeprom byte erase time t era 10 10 ms eeprom byte program time (1) t prog 10 10 ms timer (see figure b-9 ) resolution (2) input capture pulse width input capture pulse period t resl t th , t tl t tltl 4 125 (3) t cyc ns t cyc interrupt pulse width (edge-triggered) t ilih 125 ns interrupt pulse period t ilil (4) ? cyc osc1 pulse width t oh , t ol 90 ns write/erase endurance (5)(6) 10000 cycles data retention (5)(6) 10 years figure b-9 timer relationship external signal (tcap1, tcap2) t tltl t th t tl 209
motorola b-28 MC68HC05X16 rev. 1 mc68hc705x32 15 b.9.5 a/d converter characteristics (1) performance veri?d down to 2.5v d vr, but accuracy is tested and guaranteed at d vr = 5v 10%. (2) source impedances greater than 10k w will adversely affect internal charging time during input sampling. (3) the external system error caused by input leakage current is approximately equal to the product of r source and input current. input current to a/d channel will be dependent on external source impedance (see figure 9-2 ). table b-11 a/d characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic parameter min max unit resolution number of bits resolved by the a/d 8 bit non-linearity max deviation from the best straight line through the a/d transfer characteristics (v rh = v dd and v rl = 0v) 0.5 lsb quantization error uncertainty due to converter resolution 0.5 lsb absolute accuracy difference between the actual input voltage and the full-scale equivalent of the binary code output code for all errors 1 lsb conversion range analog input voltage range v rl v rh v v rh maximum analog reference voltage v rl v dd + 0.1 v v rl minimum analog reference voltage v ss ?0.1 v rh v d v r (1) minimum difference between v rh and v rl 3v conversion time total time to perform a single analog to digital conversion a. external clock (osc1, osc2) b. internal rc oscillator 32 32 t cyc m s monotonicity conversion result never decreases with an increase in input voltage and has no missing codes guaranteed zero input reading conversion result when v in = v rl 00 hex full scale reading conversion result when v in = v rh ?fhex sample acquisition time analog input acquisition sampling a. external clock (osc1, osc2) b. internal rc oscillator (2) 12 12 t cyc m s sample/hold capacitance input capacitance on pd0/an0?d7/an7 12 pf input leakage (3) input leakage on a/d pins pd0/an0?d7/an7, vrl, vrh 1 m a 210
MC68HC05X16 rev. 1 motorola b-29 mc68hc705x32 15 b.9.6 mcan bus interface dc electrical characteristics b.9.7 mcan bus interface control timing characteristics (1) maximum dc current should comply with maximum ratings. table b-12 mcan bus interface dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit mcan bus input comparator: pins rx0 and rx1 input voltage common mode range latch-up trigger current (1) input offset voltage hysteresis v in c mr i lt v ofs v hys 0.5 1.5 ?00 ?0 1 v dd +0.5 v dd ?.5 +100 +30 22 v v ma mv mv v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 m a output current latch-up trigger current 1 dv out i out i lt ?00 ?00 ?00 +200 +100 +100 mv m a ma mcan bus output driver: pins tx0 and tx1 source current per pin (v out = v dd ?.0v) sink current per pin (v out = 1.0v) latch-up trigger current 1 i oh i ol i lt ?0 10 ?00 +100 ma ma ma (v dd = 5.0 vdc 2%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit v dd ? 2 generator: pin vddh output voltage difference to v dd ? 2 for ?00 m a < i out < +100 m adv out ?80 +180 mv table b-13 mcan bus interface control timing characteristics (4.5v v dd 5.5v, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit mcan bus output driver rise and fall time (c load = 100pf) t rf ?5ns 211
motorola b-30 MC68HC05X16 rev. 1 mc68hc705x32 15 this page left blank intentionally 212
MC68HC05X16 rev. 1 motorola c-1 mc68hc05x32 high speed operation 15 c mc68hc05x32 high speed operation the following table of electrical characteristics applies only to the mc68hc05x32 operating with a 4 mhz bus speed. for all other information relating to this device (except ordering information, which can be found in section 14 ), please refer to appendix a . c.1 dc electrical characteristics note: the 4mhz bus frequency is achievable only in divide by 2 and divide by 4 modes. it is not possible in divide by 10 mode. (1) all i dd measurements taken with suitable decoupling capacitors across the power supply to suppress the transient switching currents inherent in cmos designs (see section 2). (2) typical values are at mid point of voltage range and at 25 c only. (3) run and wait i dd : measured using an external square-wave clock source, refer to figure 2-6 (c); all inputs 0.2 v from rail; no dc loads; maximum load on outputs 50pf (20pf on osc2). stop/wait i dd : all ports con?ured as inputs; v il = 0.2 v and v ih = v dd ?0.2 v: stop i dd measured with osc1 = v dd . wait i dd is affected linearly by the osc2 capacitance. (4) f osc = 8 mhz; f bus = 4 mhz; f can = 4 mhz. (5) these currents are the summation of the mcu current + can current (i dd + i dd1 ). table c-1 dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic (1) symbol min typ (2) max unit mcu i dd (3)(4)(5) supply current run (sm = 0): can active run (sm = 1): can active wait (sm = 0): can active wait (sm =1): can active wait (sm = 0): can asleep wait (sm = 1): can asleep stop: can active stop: can asleep i dd i dd i dd i dd i dd i dd i dd i dd 5.8 2.1 2.6 2 1.1 0.6 0.5 90 11 5.5 5.5 5 2.2 1.2 1.5 300 ma ma ma ma ma ma ma m a 213
motorola c-2 MC68HC05X16 rev. 1 mc68hc05x32 high speed operation 15 c.2 control timing table c-2 control timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = ?0 c to +125 c) characteristic symbol min max unit frequency of operation oscillator frequency mcan module clock frequency mcu bus frequency f osc f can f mcu 0 0 0 16 4 4 mhz mhz mhz cycle time (see figure 10-1 )t cyc 250 ns 214
MC68HC05X16 rev. 1 motorola i glossary glossary this section contains abbreviations and specialist words used in this data sheet and throughout the industry. further information on many of the terms may be gleaned from motorolas m68hc11 reference manual, m68hc11rm/ad , or from a variety of standard electronics text books. $xxxx the digits following the ? are in hexadecimal format. %xxxx the digits following the ? are in binary format. a/d , adc analog-to-digital (converter). bootstrap mode in this mode the device automatically loads its internal memory from an external source on reset and then allows this program to be executed. byte eight bits. can controller area network. ccr condition codes register; an integral part of the cpu. cerquad a ceramic package type, principally used for eprom and high temperature devices. clear ? ?the logic zero state; the opposite of ?et? cmos complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. cop computer operating properly. aka ?atchdog? this circuit is used to detect device runaway and provide a means for restoring correct operation. cpu central processing unit. d/a, dac digital-to-analog (converter). eeprom electrically erasable programmable read only memory. aka ?erom? eprom erasable programmable read only memory. this type of memory requires exposure to ultra-violet wavelengths in order to erase previous data. aka ?rom? esd electrostatic discharge. 215
motorola ii MC68HC05X16 rev. 1 glossary expanded mode in this mode the internal address and data bus lines are connected to external pins. this enables the device to be used in much more complex systems, where there is a need for external memory for example. evs evaluation system. one of the range of platforms provided by motorola for evaluation and emulation of their devices. hcmos high-density complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. i/o input/output; used to describe a bidirectional pin or function. input capture (ic) this is a function provided by the timing system, whereby an external event is ?aptured by storing the value of a counter at the instant the event is detected. interrupt this refers to an asynchronous external event and the handling of it by the mcu. the external event is detected by the mcu and causes a predetermined action to occur. irq interrupt request. the overline indicates that this is an active-low signal format. k byte a kilo-byte (of memory); 1024 bytes. lcd liquid crystal display. lsb least signi?ant byte. m68hc05 motorolas family of 8-bit mcus. mcu microcontroller unit. mi bus motorola interconnect bus. a single wire, medium speed serial communications protocol. msb most signi?ant byte. nibble half a byte; four bits. nrz non-return to zero. opcode the opcode is a byte which identi?s the particular instruction and operating mode to the cpu. operand the operand is a byte containing information the cpu needs to execute a particular instruction. output compare (oc) this is a function provided by the timing system, whereby an external event is generated when an internal counter value matches a prede?ed value. plcc plastic leaded chip carrier package. pll phase-locked loop circuit. this provides a method of frequency multiplication, to enable the use of a low frequency crystal in a high frequency circuit. 216
MC68HC05X16 rev. 1 motorola iii glossary pull-down, pull-up these terms refer to resistors, sometimes internal to the device, which are permanently connected to either ground or v dd . pwm pulse width modulation. this term is used to describe a technique where the width of the high and low periods of a waveform is varied, usually to enable a representation of an analog value. qfp quad ?t pack package. ram random access memory. fast read and write, but contents are lost when the power is removed. rfi radio frequency interference. rti real-time interrupt. rom read-only memory. this type of memory is programmed during device manufacture and cannot subsequently be altered. rs-232c a standard serial communications protocol. sar successive approximation register. sci serial communications interface. set ? ?the logic one state; the opposite of ?lear? silicon glen an area in the central belt of scotland, so called because of the concentration of semiconductor manufacturers and users found there. single chip mode in this mode the device functions as a self contained unit, requiring only i/o devices to complete a system. spi serial peripheral interface. test mode this mode is intended for factory testing. ttl transistor-transistor logic. uart universal asynchronous receiver transmitter. vco voltage controlled oscillator. watchdog see ?op? wired-or a means of connecting outputs together such that the resulting composite output state is the logical or of the state of the individual outputs. word two bytes; 16 bits. xirq non-maskable interrupt request. the overline indicates that this has an active-low signal format. 217
motorola iv MC68HC05X16 rev. 1 glossary this page left blank intentionally 218
MC68HC05X16 rev. 1 motorola v index index in this index numeric entries are placed ?st; page references in italics indicate that the reference is to a ?ure. 64-pin qfp mechanical drawing 13-2 64-pin qfp pinout 13-1 a a ?accumulator 11-1 a/d converter adstat 4-5 block diagram 9-2 clock selection 9-4 ac7-ac0 bits in cacc 5-13 addata ?a/d result data register 9-3 addressing modes 11-11 11-13 adon bit in adstat 4-5 , 9-5 adrc bit in adstat 9-4 adstat ?a/d status/control register 4-5 , 9-4 adon ?a/d converter on bit 4-5 , 9-5 adrc ?a/d rc oscillator control bit 9-4 ch3-ch0 ?a/d channel selection bits 9-5 coco ?continuous conversion bit 9-4 alternate counter register 6-3 am0-am7 bits in cacm 5-14 at bit in ccom 5-9 b baud ?baud rate register 7-18 scp1, scp0 ?serial prescaler select bits 7-18 scr2, scr1, scr0 ?sci rate select bits 7-19 sct2, sct1, sct0 ?sci rate select bits 7-18 baud rate selection 7-20 biphase mode 5-18 bit set/clear addressing mode 11-13 bit test and branch addressing mode 11-13 bit time calculation 5-17 block diagrams a/d converter 9-2 cop watchdog system 10-4 MC68HC05X16 1-4 mc68hc05x32 a-2 mc68hc705x32 b-3 mcan module 5-1 plm system 8-1 programmable timer 6-2 sci 7-2 slow mode divider 2-10 brp5-brp0 bits in cbt0 5-15 bs bit in cstat 5-10 c cacc ?mcan acceptance code register 5-13 ac7-ac0 ?acceptance code bits 5-13 cacm ?mcan acceptance mask register 5-14 am0-am7 ?acceptance mask bits 5-14 caf bit in eeprom control b-8 can ?see mcan cane b-2 c-bit in ccr 11-3 cbt0 ?mcan bus timing register 0 5-14 brp5-brp0 ?baud rate prescalar bits 5-15 sjw1, sjw0 ?synchronization jump width bits 5-14 cbt1 ?mcan bus timing register 1 5-16 samp ?sampling bit 5-16 tseg22-tseg10 ?time segment bits 5-16 ccntrl ?mcan control register 5-6 eie ?error interrupt enable bit 5-6 mode ?undefined mode bit 5-6 oie ?overrun interrupt enable bit 5-6 rie ?receive interrupt enable bit 5-7 rr ?reset request bit 5-7 spd ?speed mode bit 5-6 tie ?transmit interrupt enable bit 5-6 ccom ?mcan command register 5-7 at ?abort transmission bit 5-9 compsel ?comparator selector bit 5-8 cos ?clear overrun status bit 5-9 rrb ?release receive buffer bit 5-9 rx0, rx1 ?receive pin bits 5-8 sleep ?go to sleep bit 5-8 tr ?transmission request bit 5-9 ccr ?condition code register 11-2 ceramic resonator 2-13 ch3-ch0 bits in adstat 9-5 219
motorola vi MC68HC05X16 rev. 1 index cint ?mcan interrupt register 5-12 eif ?error interrupt flag 5-12 oif ?overrun interrupt flag 5-12 rif ?receive interrupt flag 5-13 tif ?transmit interrupt flag 5-12 wif ?wake-up interrupt flag 5-12 cirq 10-11 clocks ?see oscillator clock cocntrl ?mcan output control register 5-18 ocm1, ocm0 ?output control mode bits 5-18 coco bit in adstat 9-4 compsel bit in ccom 5-8 cop 10-3 block diagram 10-4 cos bit in ccom 5-9 counter 6-1 alternate counter register 6-3 counter register 6-3 cpha bit in sccr1 7-12 cpol bit in sccr1 7-12 cpu a ?accumulator 11-1 addressing modes 11-11 11-13 ccr ?condition code register 11-2 instruction set 11-3 11-10 pc ?program counter 11-2 programming model 11-1 sp ?stack pointer 11-2 stacking order 11-2 x ?index register 11-2 crystal 2-13 cstat ?mcan status register 5-10 bs ?bus status bit 5-10 do ?data overrun bit 5-11 es ?error status bit 5-10 rbs ?receive buffer status bit 5-11 rs ?receive status bit 5-10 tba ?transmit buffer access bit 5-11 tcs ?transmission complete status bit 5-11 ts ?transmit status bit 5-10 d db7-db0 bits in tds 5-21 direct addressing mode 11-11 div2, div8 bits in mor b-12 dlc3-dlc0 bits in trtdl 5-20 do bit in cstat 5-11 e e1era bit in eeprom control 3-5 e1lat bit in eeprom control 3-5 e1pgm bit in eeprom control 3-5 e6lat bit in eeprom control b-9 e6pgm bit in eeprom control b-9 eclk bit in eeprom control 3-5 , 4-3 ee1p bit in optr 3-8 , b-11 eeprom erase operation 3-6 programming operation 3-7 read operation 3-6 eeprom control register 3-4 , b-8 caf ?mcan asleep flag b-8 e1era ?erase/programming bit 3-5 e1lat ?programming latch enable bit 3-5 e1pgm ?charge pump enable/disable bit 3-5 e6lat ?eprom program latch enable bit b-9 e6pgm ?eprom program enable bit b-9 eclk ?external clock option bit 3-5 , 4-3 woie ?wired-or interrupt enable bit b-8 eie bit in ccntrl 5-6 eif bit in cint 5-12 eprom mor b-12 program operation b-8 read operation b-7 es bit in cstat 5-10 extended addressing mode 11-12 external clock 2-13 f fe bit in scsr 7-17 flow charts interrupts 10-8 self check mode (MC68HC05X16) 2-2 stop and wait 2-9 folv2, folv1 bits in tcr 6-5 h h-bit in ccr 11-2 i i-bit in ccr 11-3 icf1, icf2 bits in tsr 6-6 icie bit in tcr 6-4 icr1, icr2 ?input capture registers 6-7 id10-id3 bits in tbi 5-20 id2-id0 bits in trtdl 5-20 idle bit in scsr 7-16 iedg1 bit in tcr 6-5 ilie bit in sccr2 7-14 immediate addressing mode 11-11 indexed addressing modes 11-12 inherent addressing mode 11-11 input capture 6-7 instruction set 11-3 11-10 tables of instructions 11-5 11-10 inte bit in miscellaneous 3-11 , 10-10 interrupts 220
MC68HC05X16 rev. 1 motorola vii index cirq 10-11 flow chart 10-8 irq 10-11 maskable 10-9 nonmaskable 10-9 priorities 10-9 programmable timer 10-12 sci 10-12 swi 10-9 woi 10-11 intp, intn bits in miscellaneous 3-11 , 10-10 irq 2-11 , 10-11 l lbcl bit in sccr1 7-13 low power modes 2-3 slow 2-8 wait 2-7 m m bit in sccr1 7-11 mask options MC68HC05X16 1-3 MC68HC05X16 block diagram 1-4 mask options 1-3 memory map 3-2 register outline 3-9 mc68hc05x32 block diagram a-2 memory map a-3 register outline a-5 mc68hc705x32 block diagram b-3 memory map b-5 register outline b-4 mcan biphase mode 5-18 block diagram 5-1 cane b-2 electrical characteristics 12-6 , a-11 , b-29 memory map 3-3 , 5-5 normal mode 1 5-19 normal mode 2 5-19 oscillator block diagram 5-15 output control bits 5-19 rbf 5-4 register outline 3-10 single wire operation 5-24 sleep 5-24 tbf 5-4 mds 2-12 mechanical drawings 64-pin qfp 13-2 memory eeprom (MC68HC05X16) 3-4 eprom (mc68hc705x32) b-7 mcan memory map 3-3 , 5-5 memory map (MC68HC05X16) 3-2 memory map (mc68hc05x32) a-3 memory map (mc68hc705x32) b-5 ram (MC68HC05X16) 3-1 rom (MC68HC05X16) 3-1 self-check rom (MC68HC05X16) 3-3 miscellaneous register 2-10 , 3-11 , 8-3 inte ?external interrupt enable bit 3-11 , 10-10 intp, intn ?external interrupt sensitivity bits 10-10 intp, intn ?interrupt sensitivity bits 3-11 por ?power-on reset bit 3-11 , 10-2 sfa, sfb ?slow or fast mode selection bits 3-11 , 8-3 sm ?slow mode selection bit 3-12 , 8-3 sm slow mode selection bit 2-10 wdog ?watchdog enable/disable bit 3-12 , 10-4 mode bit in ccntrl 5-6 modes of operation jump to any address 2-3 low power modes 2-3 self-check mode 2-2 serial ram loader 2-3 single-chip mode 2-1 mor ?mask option register b-12 div2, div8 ?clock divide ratio select bits b-12 pbpd, pcpd ?port b and c pull-down bits b-13 rtim ?reset time bit b-12 rwat ?watchdog after reset bit b-12 woi ?wired-or interrupt enable bit b-12 wwat ?watchdog during wait bit b-13 n n-bit in ccr 11-3 nf bit in scsr 7-17 normal mode 1 5-19 normal mode 2 5-19 nwoi 2-16 o ocie bit in tcr 6-4 ocm1, ocm0 bits in cocntrl 5-18 ocr1, ocr2 ?output compare registers 6-9 oie bit in ccntrl 5-6 oif bit in cint 5-12 olv2, olv1 bits in tcr 6-5 optr ?eeprom options register b-11 ee1p ?eeprom protect bit b-11 sec ?secure bit b-11 optr ?options register 3-7 ee1p ?eeprom protect bit 3-8 sec ?security bit 3-8 or bit in scsr 7-17 order numbers 14-1 221
motorola viii MC68HC05X16 rev. 1 index osc1, osc2 2-13 oscillator clock ceramic resonator 2-13 crystal 2-13 external clock 2-13 osc1, osc2 2-13 output compare 6-9 p pa0?, pb0?, pc0? 2-16 pbpd, pcpd bits in mor b-13 pc ?program counter 11-2 pd0/an0?d7/an7 2-16 pinouts 64-pin qfp 13-1 pins cane b-2 irq 2-11 mds 2-12 nwoi 2-16 osc1, osc2 2-13 pa0?, pb0?, pc0? 2-16 pd0/an0?d7/an7 2-16 plma, plmb 2-15 rdi 2-12 , 7-6 reset 2-11 , 10-3 rx0, rx1 2-17 sclk 2-13 tcap1, tcap2 2-12 tcmp1, tcmp2 2-12 tdo 2-12 tx0, tx1 2-17 vdd, vss 2-11 vdd1, vss1 2-17 vddh 2-17 vpp1 2-16 vpp6 b-2 vrh 2-16 vrl 2-16 plm 6-11 block diagram 8-1 clock selection 8-4 miscellaneous register 8-3 plma, plmb ?pulse length modulation registers 8-2 plma, plmb pins 2-15 por bit in miscellaneous 3-11 , 10-2 ports data direction registers 4-6 data registers 4-4 logic levels 4-7 port a 4-2 port b 4-2 port c 4-3 port d 4-4 power-on reset 10-2 programmable timer block diagram 6-2 counter 6-1 icr1, icr2 6-7 ocr1, ocr2 6-9 plm 6-11 software force compare 6-11 tcr 6-4 timing diagrams 6-12 tsr 6-6 pulse length modulation ?see plm r r8 bit in sccr1 7-11 rbf ?receive buffer 5-4 rbi ?receive buffer identifier register 5-21 rbs bit in cstat 5-11 rdi ?receive data in 2-12 , 7-6 rdrf bit in scsr 7-16 rds ?receive data segment registers 5-22 re bit in sccr2 7-15 receiver wake-up 7-5 register outline MC68HC05X16 3-9 mc68hc05x32 a-5 mc68hc705x32 b-4 mcan 3-10 relative addressing mode 11-13 reset 2-11 , 10-3 resets cop 10-3 power-on 10-2 reset pin 2-11 , 10-3 timing diagram 10-1 rie bit in ccntrl 5-7 rie bit in sccr2 7-14 rif bit in cint 5-13 rom verification units 14-2 rr bit in ccntrl 5-7 rrb bit in ccom 5-9 rrtdl ?transmission request/dlc register 5-22 rs bit in cstat 5-10 rtim bit in mor b-12 rtr bit in trtdl 5-20 rvu 14-2 rwat bit in mor b-12 rwu bit in sccr2 7-15 rx0, rx1 bits in ccom 5-8 rx0, rx1 pins 2-17 s samp bit in cbt1 5-16 sbk bit in sccr2 7-15 sccr1 ?serial communications control register 1 7-10 cpha ?clock phase 7-12 cpol ?clock polarity bit 7-12 lbcl ?last bit clock 7-13 m ?mode (select character format) 7-11 222
MC68HC05X16 rev. 1 motorola ix index r8 ?receive data bit 8 7-11 t8 ?transmit data bit 8 7-11 wake ?wake-up mode select bit 7-11 sccr2 ?serial communications control register 2 7-14 ilie ?idle line interrupt enable 7-14 re ?receiver enable 7-15 rie ?receiver interrupt enable 7-14 rwu ?receiver wake-up 7-15 sbk ?send break 7-15 tcie ?transmit complete interrupt enable 7-14 te ?transmitter enable 7-14 tie ?transmit interrupt enable 7-14 scdr ?serial communications data register 7-10 sci baud rate selection 7-20 block diagram 7-2 data format 7-5 receiver wake-up 7-5 start bit detection 7-6 timing diagrams 7-12 sclk 2-13 scp1, scp0 bits in baud 7-18 scr2, scr1, scr0 bits in baud 7-19 scsr ?serial communications status register 7-16 fe ?framing error flag 7-17 idle ?idle line detected flag 7-16 nf ?noise error flag 7-17 or ?overrun error flag 7-17 rdrf ?receive data register full flag 7-16 tc ?transmit complete flag 7-16 tdre ?transmit data register empty flag 7-16 sct2, sct1, sct0 bits in baud 7-18 sec bit in optr 3-8 , b-11 self-check mode 2-2 sfa, sfb bits in miscellaneous 3-11 , 8-3 single-chip mode 2-1 sjw1, sjw0 bits in cbt0 5-14 sleep 5-24 sleep bit in ccom 5-8 slow 2-8 sm bit in miscellaneous 2-10 , 3-12 , 8-3 software force compare 6-11 sp ?stack pointer 11-2 spd bit in ccntrl 5-6 t t8 bit in sccr1 7-11 tba bit in cstat 5-11 tbf ?transmit buffer 5-4 tbi ?transmit buffer identifier register 5-20 id10-id3 ?identifier bits 5-20 tc bit in scsr 7-16 tcap1, tcap2 2-12 tcie bit in sccr2 7-14 tcmp1, tcmp2 2-12 tcr ?timer control register 6-4 folv2, folv1 ?force output compare bits 6-5 icie ?input capture interrupt enable 6-4 iedg1 ?input edge bit 6-5 ocie ?output compare interrupt enable 6-4 olv2, olv1 ?output level bits 6-5 toie ?timer overflow interrupt enable 6-4 tcs bit in cstat 5-11 tdo sci transmit data out 7-8 tdo ?transmit data out 2-12 tdre bit in scsr 7-16 tds ?transmit data segment registers 5-21 db7-db0 ?data bits 5-21 te bit in sccr2 7-14 tie bit in ccntrl 5-6 tie bit in sccr2 7-14 tif bit in cint 5-12 timing diagrams eclk 4-3 programmable timer 6-12 reset 10-1 sci data clock 7-12 tof bit in tsr 6-6 toie bit in tcr 6-4 tr bit in ccom 5-9 trtdl ?transmission request/dlc register 5-20 dlc3-dlc0 ?data length code bits 5-20 id2-id0 ?identifier bits 5-20 rtr ?remote transmission request 5-20 ts bit in cstat 5-10 tseg22-tseg10 bits in cbt1 5-16 tsr ?timer status register 6-6 icf1, icf2 ?input capture flags 6-6 ocf1, ocf2 ?output compare flags 6-6 tof ?timer overflow status flag 6-6 tx0, tx1 2-17 v vdd, vss 2-11 vdd1, vss1 2-17 vddh 2-17 vpp1 2-16 vpp6 b-2 vrh 2-16 vrl 2-16 w wait 2-7 wake bit in sccr1 7-11 watchdog ?see cop wdog bit in miscellaneous 3-12 , 10-4 wif bit in cint 5-12 wired-or interrupt ?see woi woi 10-11 woi bit in mor b-12 woie bit in eeprom control b-8 wwat bit in mor b-13 223
motorola x MC68HC05X16 rev. 1 index x x ?index register 11-2 z z-bit in ccr 11-3 224
customer feedback questionnaire (MC68HC05X16/d) motorola wishes to continue to improve the quality of its documentation. we would welcome your feedback on the publication you have just received. having used the document, please complete this card (or a photocopy of it, if you prefer). 1. how would you rate the quality of the document? check one box in each category. excellent poor excellent poor organization oooo tables oooo readability oooo table of contents oooo understandability oooo index oooo accuracy oooo page size/binding oooo illustrations oooo overall impression oooo comments: 2. what is your intended use for this document? if more than one option applies, please rank them (1, 2, 3). selection of device for new application o other o please specify: system design o training purposes o 3. how well does this manual enable you to perform the task(s) outlined in question 2? completely not at all comments: oooo 4. how easy is it to ?d the information you are looking for? easy dif?ult comments: oooo 5. is the level of technical detail in the following sections suf?ient to allow you to understand how the device functions? too little detail too much detail ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo ooooo comments: 6. have you found any errors? if so, please comment: 7. from your point of view, is anything missing from the document? if so, please say what: ?cut along this line to remove " section 1 introduction section 2 modes of operation and pin descriptions section 3 memory and registers section 4 input/output ports section 5 motorola can module (mcan) section 6 programmable timer section 7 serial communications interface section 8 pulse length d/a converters section 9 analog to digital converter section 10 resets and interrupts section 11 cpu core and instruction set section 12 electrical specifications section 13 mechanical data section 14 ordering information section 15 appendices 225
13. currently there is some discussion in the semiconductor industry regarding a move towards providing data sheets in electron ic form. if you have any opinion on this subject, please comment. 14. we would be grateful if you would supply the following information (at your discretion), or attach your card. name: phone no: position: fax no: department: company: address: thank you for helping us improve our documentation, graham forbes, technical publications manager, motorola ltd., scotland . ?cut along this line to remove ?third fold back along this line 8. how could we improve this document? 9. how would you rate motorolas documentation? excellent poor ?in general oooo ?against other semiconductor suppliers oooo 10. which semiconductor manufacturer provides the best technical documentation? 11. which company (in any ?ld) provides the best technical documentation? 12. how many years have you worked with microprocessors? less than 1 year o 1? years o 3? years o more than 5 years o by air mail par avion ne pas affranchir ibrs number phq-b/207/g ccri numero phq-b/207/g reponse payee grande-bretagne motorola ltd., colvilles road, kelvin industrial estate, east kilbride, g75 8br. great britain. f.a.o. technical publications manager (re: MC68HC05X16/d) no stamp required ?first fold back along this line semiconductor products sector ?second fold back along this line ? finally, tuck this edge into opposite ?p " 226
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 227 introduction modes of operation and pin descriptions memory and registers input/output ports motorola can module (mcan) programmable timer serial communications interface pulse length d/a converters analog to digital converter resets and interrupts cpu core and instruction set electrical specifications mechanical data ordering information appendices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 introduction modes of operation and pin descriptions memory and registers input/output ports motorola can module (mcan) programmable timer serial communications interface pulse length d/a converters analog to digital converter resets and interrupts cpu core and instruction set electrical specifications mechanical data ordering information appendices 228
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 how to reach us: usa/europe/locations not listed: motorola literature distribution; p.o. box 5405; denver, colorado 80217.1-800-441-2447 or 1-303-675-2140 mfax: rmfax0@email.sps.mot.com, http://sps.motorola.com/mfax/ ?touchtone 1-602-244-6609 motorola fax back system internet: http://motorola.com/sps/ japan: nippon motorola ltd.; tatsumi-spd-jldc, 6f seibu-butsuryu-center, 3-14-2 tatsumi koto-ku, tokyo 135, japan. 81-3-3521-8315 asia/pacific: motorola semiconductors h.k. ltd.; 8b tai ping industrial park, 51 ting kok road, tai po, n.t., hong kong. 852-26629298 customer focus center: 1-800-521-6274 mfax is a trademark of motorola, inc.


▲Up To Search▲   

 
Price & Availability of MC68HC05X16

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

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


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