|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
mc 68 hc 705 jj 7 / d rev 4 m 6 8 h c 0 5 m 6 0 5 m 6 8 h c 0 5 m 8 h c 0 5 m 6 8 h c mc68h c 705jj7 mc68h c 705jp7 mc68h c 705sj7 mc68h c 705sp7 mc68h r c705jj7 mc68h r c705jp7 advance info r m at i o n h c m o s m i c r ocontroller unit
blank MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola 3 MC68HC705JJ7 mc68hrc705sj7 mc68hc705sj7 mc68hc705jp7 mc68hrc705jj7 mc68hc705sp7 advance information 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, including without limitation consequential or incidental damages. "typical" parameters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all operating parameters, including "typicals" must be validated for each customer application by customer's 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, inc. is an equal opportunity/affirmative action employer. motorola and are registered trademarks of motorola, inc. digitaldna is a trademark of motorola, inc. ? motorola, inc., 2001 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 4 motorola advance information to provide the most up-to-date information, the revision of our documents on the world wide web will be the most current. your printed copy may be an earlier revision. to verify you have the latest information available, refer to: http://www.motorola.com/mcu/ the following revision history table summarizes changes contained in this document. for your convenience, the page number designators have been linked to the appropriate location. revision history date revision level description page number(s) august, 2001 4 general reformat to bring document up to current publication standards all references to mc68hrc705sj7 and mc68hrc705sp7 removed throughout all figure 7-9. pb4/an4/tcmp/cmp1 pin i/o circuit ? change label of register $1ff0 from mask option register to cop register 94 table 7-2. port b pin functions ? pb0?pb4 ? change heading under comparator 1 from opt in mor to opt in copr 96 12.4 peprom programming ? contact information updated 179 figure 13-3. eprom security in cop and security register (copr) ? figure title change 188 13.4 eprom programming ? contact information updated and corrected reference to cop register from cop to copr 189 15.15 siop timing (vdd = 5.0 vdc) ? value change for clock (sck) low time 225 15.16 siop timing (vdd = 3.0 vdc) ? value change for clock (sck) low time 226 section 15. electrical specifications ? added figure 15-1 through figure 15-10 and figure 15-12 213 , 214 , 219 , 223 , and 227 MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola list of sections 5 advance information ? MC68HC705JJ7/mc68hc705jp7 list of sections section 1. general description . . . . . . . . . . . . . . . . . . . . 23 section 2. memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 section 3. central processor unit (cpu) . . . . . . . . . . . . 45 section 4. interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 section 5. resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 section 6. operating modes . . . . . . . . . . . . . . . . . . . . . . . 75 section 7. parallel input/output . . . . . . . . . . . . . . . . . . . . 83 section 8. analog subsystem . . . . . . . . . . . . . . . . . . . . 107 section 9. simple synchronous serial interface . . . . . 141 section 10. core timer . . . . . . . . . . . . . . . . . . . . . . . . . . 151 section 11. programmable timer . . . . . . . . . . . . . . . . . 159 section 12. personality eprom (peprom) . . . . . . . . . 175 section 13. eprom/otprom . . . . . . . . . . . . . . . . . . . . 183 section 14. instruction set . . . . . . . . . . . . . . . . . . . . . . . 191 section 15. electrical specifications. . . . . . . . . . . . . . . 209 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 6 list of sections motorola list of sections section 16. mechanical specifications . . . . . . . . . . . . . 231 section 17. ordering information . . . . . . . . . . . . . . . . . 237 MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola table of contents 7 advance information ? MC68HC705JJ7/mc68hc705jp7 table of contents section 1. general description 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 1.4 device options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.5 functional pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.6 v dd and v ss pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.7 osc1 and osc2 pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.7.1 crystal oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.7.2 ceramic resonator oscillator . . . . . . . . . . . . . . . . . . . . . . . 30 1.7.3 rc oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.7.4 external clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.7.5 internal low-power oscillator . . . . . . . . . . . . . . . . . . . . . . . 31 1.8 reset pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.9 irq /v pp pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.10 pa0 ? pa5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.11 pb0 ? pb7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.12 pc0 ? pc7 (mc68hc705jp7) . . . . . . . . . . . . . . . . . . . . . . . . . . 33 section 2. memory 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.3 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 8 table of contents motorola table of contents 2.4 input/output registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.5 user and interrupt vector mapping. . . . . . . . . . . . . . . . . . . . . . 42 2.6 random-access memory (ram) . . . . . . . . . . . . . . . . . . . . . . . 42 2.7 erasable programmable read-only memory (eprom) . . . . . 43 2.8 cop register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 section 3. central processor unit (cpu) 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.3 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.4 index register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.5 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.6 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.7 condition code register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 3.8 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . .50 section 4. interrupts 4.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.3 interrupt vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 4.4 interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.5 software interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.6 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 4.6.1 irq /v pp pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.6.2 pa0 ? pa3 pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.6.3 irq status and control register (iscr) . . . . . . . . . . . . . . . 58 table of contents MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola table of contents 9 4.7 core timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 4.7.1 core timer overflow interrupt . . . . . . . . . . . . . . . . . . . . . . .60 4.7.2 real-time interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.8 programmable timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . 61 4.8.1 input capture interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.8.2 output compare interrupt . . . . . . . . . . . . . . . . . . . . . . . . . .61 4.8.3 timer overflow interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.9 serial interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.10 analog interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.10.1 comparator input match interrupt . . . . . . . . . . . . . . . . . . . .63 4.10.2 input capture interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 section 5. resets 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.3 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.4 external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.5 internal resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.5.1 power-on reset (por) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.5.2 computer operating properly (cop) reset. . . . . . . . . . . . . 68 5.5.3 low-voltage reset (lvr). . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.5.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6 reset states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6.1 cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6.2 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6.3 core timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6.4 cop watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 5.6.5 16-bit programmable timer . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.6 serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.7 analog subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.8 external oscillator and internal low-power oscillator . . . . . 73 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 10 table of contents motorola table of contents section 6. operating modes 6.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.3 oscillator source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.4 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 6.4.1 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 6.4.2 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.4.3 halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 6.4.4 data-retention mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 section 7. parallel input/output 7.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 7.3.2 data direction register a. . . . . . . . . . . . . . . . . . . . . . . . . . . 86 7.3.3 pulldown register a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.3.4 port a external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . .88 7.3.5 port a logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.4.2 data direction register b. . . . . . . . . . . . . . . . . . . . . . . . . . . 91 7.4.3 pulldown register b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.4.4 port b logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.4.5 pb0, pbi, pb2, and pb3 logic. . . . . . . . . . . . . . . . . . . . . . .93 7.4.6 pb4/an4/tcmp/cmp1 logic. . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.7 pb5/sdo logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 7.4.8 pb6/sdi logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.4.9 pb7/sck logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table of contents MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola table of contents 11 7.5 port c (28-pin versions only) . . . . . . . . . . . . . . . . . . . . . . . . 101 7.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 7.5.2 data direction register c. . . . . . . . . . . . . . . . . . . . . . . . . . 102 7.5.3 port c pulldown devices . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.5.4 port c logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.6 port transitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 section 8. analog subsystem 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 8.3 analog multiplex register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 8.4 analog control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 8.5 analog status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 8.6 a/d conversion methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 8.7 voltage measurement methods . . . . . . . . . . . . . . . . . . . . . . .132 8.7.1 absolute voltage readings . . . . . . . . . . . . . . . . . . . . . . . . 133 8.7.1.1 internal absolute reference . . . . . . . . . . . . . . . . . . . . . 133 8.7.1.2 external absolute reference . . . . . . . . . . . . . . . . . . . . . 134 8.7.2 ratiometric voltage readings . . . . . . . . . . . . . . . . . . . . . . 134 8.7.2.1 internal ratiometric reference . . . . . . . . . . . . . . . . . . .135 8.7.2.2 external ratiometric reference . . . . . . . . . . . . . . . . . . . 136 8.8 voltage comparator features . . . . . . . . . . . . . . . . . . . . . . . . 136 8.8.1 voltage comparator 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.8.2 voltage comparator 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 8.9 current source features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 8.10 internal temperature sensing diode features. . . . . . . . . . . . 138 8.11 sample and hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 8.12 port b interaction with analog inputs . . . . . . . . . . . . . . . . . . .139 8.13 port b pins as inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 8.14 port b pulldowns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 8.15 noise sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 12 table of contents motorola table of contents section 9. simple serial interface 9.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 9.3 siop signal format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 9.3.1 serial clock (sck) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 9.3.2 serial data input (sdi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.3.3 serial data output (sdo). . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.4 siop registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 9.4.1 siop control register (scr). . . . . . . . . . . . . . . . . . . . . . . 145 9.4.2 siop status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.4.3 siop data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 section 10. core timer 10.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 10.3 core timer status and control register. . . . . . . . . . . . . . . . . 153 10.4 core timer counter register . . . . . . . . . . . . . . . . . . . . . . . . . 155 10.5 cop watchdog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 section 11. programmable timer 11.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 11.3 timer registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 11.4 alternate counter registers . . . . . . . . . . . . . . . . . . . . . . . . . . 163 11.5 input capture registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 11.6 output compare registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.7 timer control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 11.8 timer status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 11.9 timer operation during wait mode. . . . . . . . . . . . . . . . . . . . . 173 table of contents MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola table of contents 13 11.10 timer operation during stop mode . . . . . . . . . . . . . . . . . . . . 173 11.11 timer operation during halt mode . . . . . . . . . . . . . . . . . . . . . 173 section 12. personality eprom (peprom) 12.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 12.3 peprom registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 12.3.1 peprom bit select register . . . . . . . . . . . . . . . . . . . . . . . 177 12.3.2 peprom status and control register. . . . . . . . . . . . . . . . 178 12.4 peprom programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 12.5 peprom reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 12.6 peprom erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 section 13. eprom/otprom 13.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3 eprom registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 13.3.1 eprom programming register . . . . . . . . . . . . . . . . . . . . . 184 13.3.2 mask option register. . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 13.3.3 eprom security bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 13.4 eprom programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.4.1 mor programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.4.2 epmsec programming . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 13.5 eprom erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 section 14. instruction set 14.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 14 table of contents motorola table of contents 14.3 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.3.1 inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.3.2 immediate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 14.3.3 direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.4 extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 14.3.5 indexed, no offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.6 indexed, 8-bit offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.7 indexed, 16-bit offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . .194 14.3.8 relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 14.4 instruction types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 14.4.1 register/memory instructions. . . . . . . . . . . . . . . . . . . . . . . 195 14.4.2 read-modify-write instructions . . . . . . . . . . . . . . . . . . . . . 196 14.4.3 jump/branch instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 197 14.4.4 bit manipulation instructions . . . . . . . . . . . . . . . . . . . . . . . 199 14.4.5 control instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 14.5 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 14.6 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 section 15. electrical specifications 15.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 15.3 maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 15.4 operating temperature range. . . . . . . . . . . . . . . . . . . . . . . .211 15.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 15.6 supply current characteristics (v dd = 4.5 to 5.5 vdc) . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 15.7 supply current characteristics (v dd = 2.7 to 3.3 vdc) . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 15.8 dc electrical characteristics (5.0 vdc). . . . . . . . . . . . . . . . . . 215 15.9 dc electrical characteristics (3.0 vdc). . . . . . . . . . . . . . . . . . 216 15.10 analog subsystem characteristics (5.0 vdc) . . . . . . . . . . . . . 217 table of contents MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola table of contents 15 15.11 analog subsystem characteristics (3.0 vdc) . . . . . . . . . . . . . 218 15.12 control timing (5.0 vdc). . . . . . . . . . . . . . . . . . . . . . . . . . . . .220 15.13 control timing (3.0 vdc). . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 15.14 peprom and eprom programming characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 15.15 siop timing (v dd = 5.0 vdc) . . . . . . . . . . . . . . . . . . . . . . . . .225 15.16 siop timing (v dd = 3.0 vdc) . . . . . . . . . . . . . . . . . . . . . . . . .226 15.17 reset characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 section 16. mechanical specifications 16.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 16.3 20-pin plastic dual in-line package (case 738) . . . . . . . . . . 232 16.4 20-pin small outline integrated circuit (case 751d) . . . . . . . 233 16.5 28-pin plastic dual in-line package (case 710) . . . . . . . . . . 233 16.6 28-pin small outline integrated circuit (case 751f) . . . . . . . 234 16.7 20-pin windowed ceramic integrated circuit (case 732) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 16.8 28-pin windowed ceramic integrated circuit (case 733a). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 section 17. ordering information 17.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 17.3 MC68HC705JJ7 order numbers . . . . . . . . . . . . . . . . . . . . . . 238 17.4 mc68hc705jp7 order numbers . . . . . . . . . . . . . . . . . . . . . .239 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 16 table of contents motorola table of contents MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola list of figures 17 advance information ? MC68HC705JJ7/mc68hc705jp7 list of figures figure title page 1-1 user mode block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1-2 user mode pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1-3 epo oscillator connections . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2-1 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2-2 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2-3 register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 2-4 vector mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 2-5 cop and security register (copr). . . . . . . . . . . . . . . . . . . . . 43 3-1 68hc05 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3-2 accumulator (a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3-3 index register (x). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3-4 stack pointer (sp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 3-5 program counter (pc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3-6 condition code register (ccr) . . . . . . . . . . . . . . . . . . . . . . . . 48 4-1 interrupt stacking order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 4-2 interrupt flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 4-3 external interrupt logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4-4 irq status and control register (iscr) . . . . . . . . . . . . . . . . . 58 5-1 reset sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5-2 cop and security register (copr). . . . . . . . . . . . . . . . . . . . . 69 6-1 irq status and control register (iscr) . . . . . . . . . . . . . . . . . 76 6-2 stop/wait/halt flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 18 list of figures motorola list of figures figure title page 7-1 port a data register (porta) . . . . . . . . . . . . . . . . . . . . . . . . . 85 7-2 data direction register a (ddra) . . . . . . . . . . . . . . . . . . . . . . 86 7-3 pulldown register a (pdra) . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7-4 port a i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7-5 port b data register (portb) . . . . . . . . . . . . . . . . . . . . . . . . . 90 7-6 data direction register b (ddrb) . . . . . . . . . . . . . . . . . . . . . . 91 7-7 pulldown register b (pdrb) . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7-8 pb0 ? pb3 pin i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 7-9 pb4/an4/tcmp/cmp1 pin i/o circuit . . . . . . . . . . . . . . . . . . . 94 7-10 pb5/sdo pin i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 7-11 pb6/sdi pin i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7-12 pb7/sck pin i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 7-13 port c data register (portc). . . . . . . . . . . . . . . . . . . . . . . . 102 7-14 data direction register c (ddrc) . . . . . . . . . . . . . . . . . . . . . 103 7-15 port c i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 8-1 analog subsystem block diagram . . . . . . . . . . . . . . . . . . . . . 109 8-2 analog multiplex register (amux) . . . . . . . . . . . . . . . . . . . . . 110 8-3 comparator 2 input circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 8-4 inv bit action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 8-5 analog control register (acr). . . . . . . . . . . . . . . . . . . . . . . . 115 8-6 analog status register (asr) . . . . . . . . . . . . . . . . . . . . . . . . 119 8-7 single-slope a/d conversion method . . . . . . . . . . . . . . . . . . 122 8-8 a/d conversion ? full manual control (mode 0) . . . . . . . . . 128 8-9 a/d conversion ? manual/auto discharge control (mode 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 8-10 a/d conversion ? tof/icf control (mode 2) . . . . . . . . . . . . 130 8-11 a/d conversion ? ocf/icf control (mode 3). . . . . . . . . . . . 131 8-12 cop and security register (copr). . . . . . . . . . . . . . . . . . . . 137 9-1 siop block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 9-2 siop timing diagram (cpha = 0) . . . . . . . . . . . . . . . . . . . . . 143 9-3 siop timing diagram (cpha = 1) . . . . . . . . . . . . . . . . . . . . . 144 9-4 siop control register (scr) . . . . . . . . . . . . . . . . . . . . . . . . . 145 9-5 siop status register (ssr). . . . . . . . . . . . . . . . . . . . . . . . . . 148 9-6 siop data register (sdr) . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 list of figures MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola list of figures 19 figure title page 10-1 core timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 10-2 core timer status and control register (ctscr). . . . . . . . . 153 10-3 core timer counter register (ctcr) . . . . . . . . . . . . . . . . . . 155 10-4 cop and security register (copr). . . . . . . . . . . . . . . . . . . . 156 11-1 programmable timer overall block diagram . . . . . . . . . . . . . 161 11-2 programmable timer block diagram . . . . . . . . . . . . . . . . . . .162 11-3 programmable timer registers (tmrh and tmrl) . . . . . . . 163 11-4 alternate counter block diagram . . . . . . . . . . . . . . . . . . . . . .164 11-5 alternate counter registers (acrh and acrl) . . . . . . . . . . 165 11-6 timer input capture block diagram . . . . . . . . . . . . . . . . . . . . 166 11-7 input capture registers (icrh and icrl) . . . . . . . . . . . . . . .166 11-8 timer output compare block diagram. . . . . . . . . . . . . . . . . . 168 11-9 output compare registers (ocrh and ocrl) . . . . . . . . . . . 168 11-10 timer control register (tcr). . . . . . . . . . . . . . . . . . . . . . . . . 170 11-11 timer status register (tsr) . . . . . . . . . . . . . . . . . . . . . . . . . 172 12-1 personality eprom block diagram . . . . . . . . . . . . . . . . . . . . 176 12-2 peprom bit select register (pebsr) . . . . . . . . . . . . . . . . . 177 12-3 peprom status and control register (pescr) . . . . . . . . . . 178 13-1 eprom programming register (eprog) . . . . . . . . . . . . . . .184 13-2 mask option register (mor) . . . . . . . . . . . . . . . . . . . . . . . . . 186 13-3 eprom security in cop and security register (copr). . . . 188 15-1 typical run i dd versus internal clock frequency at 25 c . . . . . . . . . . . . . . . . . . . . . . . . . 213 15-2 typical wait i dd versus internal clock frequency at 25 c . . . . . . . . . . . . . . . . . . . . . . . . . 213 15-3 typical run i dd with external oscillator . . . . . . . . . . . . . . . . . 214 15-4 typical wait i dd with external oscillator . . . . . . . . . . . . . . . . 214 15-5 typical stop i dd with analog and lvr disabled . . . . . . . . . . 214 15-6 typical temperature diode performance. . . . . . . . . . . . . . . . 219 15-7 typical 500 khz external low-power oscillator frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 20 list of figures motorola list of figures figure title page 15-8 typical 100 khz external low-power oscillator frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 15-9 typical rc oscillator internal operating frequency range versus resistance for high v dd operating range at t = 25 c . . . . . . . . . . . . . . . . . . . . . .223 15-10 typical rc oscillator internal operating frequency range versus resistance for low v dd operating range at t = 25 c . . . . . . . . . . . . . . . . . . . . . .223 15-11 siop timing diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 15-12 typical falling low voltage reset . . . . . . . . . . . . . . . . . . . . . 227 15-13 stop recovery timing diagram . . . . . . . . . . . . . . . . . . . . . . . 228 15-14 internal reset timing diagram . . . . . . . . . . . . . . . . . . . . . . . . 228 15-15 low-voltage reset timing diagram . . . . . . . . . . . . . . . . . . . . 229 MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola list of tables 21 advance information ? MC68HC705JJ7/mc68hc705jp7 list of tables table title page 1-1 device options by part number . . . . . . . . . . . . . . . . . . . . . . . . 26 4-1 reset/interrupt vector addresses. . . . . . . . . . . . . . . . . . . . . . .52 4-2 oscillator selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6-1 oscillator selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 7-1 port a pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7-2 port b pin functions ? pb0 ? pb4 . . . . . . . . . . . . . . . . . . . . . .96 7-3 port b pin functions ? pb5 ? pb7 . . . . . . . . . . . . . . . . . . . . .101 7-4 port c pin functions (28-pin versions only) . . . . . . . . . . . . . 104 8-1 comparator 2 input sources. . . . . . . . . . . . . . . . . . . . . . . . . . 111 8-2 channel select bus combinations . . . . . . . . . . . . . . . . . . . . . 114 8-3 a/d conversion options . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116 8-4 a/d conversion parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 126 8-5 sample conversion timing (v dd = 5.0 vdc) . . . . . . . . . . . . .127 8-6 absolute voltage reading errors . . . . . . . . . . . . . . . . . . . . . .134 8-7 ratiometric voltage reading errors . . . . . . . . . . . . . . . . . . . . 135 8-8 voltage comparator setup conditions . . . . . . . . . . . . . . . . . . 136 9-1 siop clock rate selection. . . . . . . . . . . . . . . . . . . . . . . . . . . 147 10-1 core timer interrupt rates and cop timeout selection . . . . 155 10-2 cop watchdog recommendations . . . . . . . . . . . . . . . . . . . . 157 11-1 output compare initialization example . . . . . . . . . . . . . . . . . 169 12-1 peprom bit selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 22 list of tables motorola list of tables table title page 14-1 register/memory instructions . . . . . . . . . . . . . . . . . . . . . . . . . 195 14-2 read-modify-write instructions . . . . . . . . . . . . . . . . . . . . . . . 196 14-3 jump and branch instructions . . . . . . . . . . . . . . . . . . . . . . . . 198 14-4 bit manipulation instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 199 14-5 control instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 14-6 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 14-7 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 23 advance information ? MC68HC705JJ7/mc68hc705jp7 section 1. general description 1.1 contents 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 1.4 device options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.5 functional pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.6 v dd and v ss pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.7 osc1 and osc2 pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.7.1 crystal oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.7.2 ceramic resonator oscillator . . . . . . . . . . . . . . . . . . . . . . . 30 1.7.3 rc oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.7.4 external clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.7.5 internal low-power oscillator . . . . . . . . . . . . . . . . . . . . . . . 31 1.8 reset pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.9 irq /v pp pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.10 pa0 ? pa5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.11 pb0 ? pb7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.12 pc0 ? pc7 (mc68hc705jp7) . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.2 introduction the motorola MC68HC705JJ7 and mc68hc705jp7 are erasable programmable read-only memory (eprom) versions of the mc68hc05jj/jp family of microcontrollers (mcu). advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 24 general description motorola general description 1.3 features features of the two parts include: low-cost, m68hc05 core mcu in 20-pin package (MC68HC705JJ7) or 28-pin package (mc68hc705jp7) 6160 bytes of user eprom, including 16 bytes of user vectors 224 bytes of low-power user random-access memory (ram) 64 bits of personality eprom (serial access) 16-bit programmable timer with input capture and output compare 15-stage core timer, including 8-bit free-running counter and 4-stage selectable real-time interrupt generator simple serial input/output port (siop) with interrupt capability two voltage comparators, one of which can be combined with the 16-bit programmable timer to create a 4-channel, single-slope analog-to-digital (a/d) converter output of voltage comparator can drive port pin pb4 directly under software control 14 input/output (i/o) lines (MC68HC705JJ7) or 22 i/o lines (mc68hc705jp7), including high-source/sink current capability on 6 i/o pins (MC68HC705JJ7) or 14 i/o pins (mc68hc705jp7) programmable 8-bit mask option register (mor) to select mask options found in read-only memory (rom) based versions mor selectable software programmable pulldowns on all i/o pins and keyboard scan interrupt on four i/o pins software mask and request bit for irq interrupt with mor selectable sensitivity on irq interrupt (edge- and level-sensitive or edge-only) on-chip oscillator with device option of crystal/ceramic resonator or resistor-capacitor (rc) operation and mor selectable shunt resistor, 2 m ? by design general description device options MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 25 internal oscillator for lower-power operation, approximately 100 khz (500 khz selected as device option) eprom security bit (1) to aid in locking out access to programmable eprom array mor selectable computer operating properly (cop) watchdog system power-saving stop and wait mode instructions (mor selectable stop conversion to halt and option for fast 16-cycle restart and power-on reset) on-chip temperature measurement diode mor selectable reset module to reset central processor unit (cpu) in low-voltage conditions illegal address reset internal steering diode and pullup device on reset pin to v dd 1.4 device options these MC68HC705JJ7/mc68hc705jp7 device options are available: on-chip oscillator type: crystal/ceramic resonator connections or resistor-capacitor (rc) connections nominal frequency of internal low-power oscillator: 100 or 500 khz note: a line over a signal name indicates an active low signal. for example, reset is active high and reset is active low. any reference to voltage, current, or frequency specified in the following sections will refer to the nominal values. the exact values and their tolerance or limits are specified in section 15. electrical specifications . 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the eprom/otprom difficult for unauthorized users. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 26 general description motorola general description combinations of the various device options are specified by part number. refer to table 1-1 and to section 17. ordering information for specific ordering information. table 1-1. device options by part number part number pin count oscillator type internal lpo nominal frequency (khz) MC68HC705JJ7 mc68hc705jp7 20 28 crystal/resonator crystal/resonator 100 100 mc68hc705sj7 mc68hc705sp7 20 28 crystal/resonator crystal/resonator 500 500 mc68hrc705jj7 mc68hrc705jp7 20 28 resistor-capacitor resistor-capacitor 100 100 general description device options MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 27 figure 1-1. user mode block diagram 2 simple serial interface (siop) transfer control stk ptr watchdog & illegal addr detect 16-bit timer (1) input capture (1) output compare external oscillator cond code reg 1 1 1 i n z c h index reg cpu control 0 0 0 1 1 0 0 0 0 0 reset osc1 osc2 static ram (4t) ? 224 bytes alu 68hc05 cpu accum program counter cpu registers pa 0*? pa 1*? pa 2*? pa 3*? pa 4* port a data dir. reg. port a pb4/an4/tcmp/cmp1* pb3/an3/tcap user eprom ? 6160 bytes * high sink current capability * high source current capability ? irq interrupt capability pb2/an2 pb1/an1 pb0/an0 15-stage core timer system internal oscillator int int v ss v dd + ? comparator control & multiplexer tcmp v dd current source + ? comp2 comp1 tcap int pb7/sck pb6/sdi pb5/sdo pa 5* lvr port b port b data dir. reg. ocf tof icf temperature diode v ss pc3* pc4* pc5* pc6* pc7* pc0* pc1* pc2* port c port c data dir. reg. port c only on 28-pin versions v ss personality eprom ? 64 bits irq /v pp boot rom ? 240 bytes advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 28 general description motorola general description 1.5 functional pin description refer to figure 1-2 for the pinouts of the MC68HC705JJ7 and mc68hc705jp7 in the user mode . the following paragraphs give a description of the general function of each pin. figure 1-2. user mode pinouts * denotes 10 ma sink /5 ma source capability ? denotes irq interrupt capability pb0/an0 28 v dd 27 26 25 osc2 24 pc3* 23 pc2* 22 pc1* 21 pb1/an1 1 pb2/an2 2 pb3/an3/tcap 3 *pb4/an4/tcmp/cmp1 4 pb5/sdo 5 * pc4 6 *pc5 7 * pc6 8 pc0* 20 reset 19 *pc7 9 pb6/sdi 10 v ss osc1 irq /v pp 18 pa0* ? 17 pb7/sck 11 *pa5 12 pa1* ? 16 pa2* ? 15 * pa4 13 ? * pa3 14 pb0/an0 v dd osc2 pb1/an1 pb2/an2 pb3/an3/tcap *pb4/an4/tcmp/cmp1 pb5/sdo reset pb6/sdi v ss osc1 irq /v pp pa0* ? pb7/sck *pa5 pa1* ? pa2* ? * pa4 ? * pa3 MC68HC705JJ7 mc68hc705jp7 20 19 18 17 16 1 2 3 4 5 15 6 14 13 7 8 12 11 9 10 general description vdd and vss pins MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 29 1.6 v dd and v ss pins power is supplied to the mcu through v dd and v ss . v dd is the positive supply, and v ss is ground. the mcu operates from a single power supply. very fast signal transitions occur on the mcu pins. the short rise and fall times place very high short-duration current demands on the power supply. to prevent noise problems, special care should be taken to provide good power supply bypassing at the mcu by using bypass capacitors with good high-frequency characteristics that are positioned as close to the mcu as possible. 1.7 osc1 and osc2 pins the osc1 and osc2 pins are the connections for the external pin oscillator (epo). the osc1 and osc2 pins can accept these sets of components: a crystal as shown in figure 1-3 (a) a ceramic resonator as shown in figure 1-3 (a) an external resistor as shown in figure 1-3 ( b) an external clock signal as shown in figure 1-3 (c) the selection of the crystal/ceramic resonator or rc oscillator configuration is done by product part number selection as described in section 17. ordering information . the frequency, f osc , of the epo or external clock source is divided by two to produce the internal operating frequency, f op . advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 30 general description motorola general description figure 1-3. epo oscillator connections 1.7.1 crystal oscillator the circuit in figure 1-3 (a) shows a typical oscillator circuit for an at-cut, parallel resonant crystal. the crystal manufacturer ? s recommendations should be followed, as the crystal parameters determine the external component values required to provide maximum stability and reliable startup. the load capacitance values used in the oscillator circuit design should include all stray capacitances. the crystal and components should be mounted as close as possible to the pins for startup stabilization and to minimize output distortion. an internal startup resistor of approximately 2 m ? can be provided between osc1 and osc2 for the crystal type oscillator by use of the oscres bit in the mor. 1.7.2 ceramic resonator oscillator in cost-sensitive applications, a ceramic resonator can be used in place of the crystal. the circuit in figure 1-3 (a) can be used for a ceramic resonator. the resonator manufacturer ? s recommendations should be followed, as the resonator parameters determine the external component values required for maximum stability and reliable starting. the load capacitance values used in the oscillator circuit design should include all stray capacitances. the ceramic resonator and components should be mounted as close as possible to the pins for startup stabilization and to minimize output distortion. an internal startup resistor mcu (a) crystal or ceramic resonator connections osc1 osc2 2 m ? r unconnected external clock (b) rc oscillator connections (c) external clock source connection osc1 osc2 mcu osc1 osc2 mcu general description osc1 and osc2 pins MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 31 of approximately 2 m ? can be provided between osc1 and osc2 for the ceramic resonator type oscillator by use of the oscres bit in the mor. 1.7.3 rc oscillator the lowest cost oscillator is the rc oscillator configuration where a resistor is connected between the two oscillator pins as shown in figure 1-3 (b) . the selection of the rc oscillator configuration is done by product part number selection as described in section 17. ordering information . note: do not use the internal startup resistor between osc1 and osc2 for the rc-type oscillator. 1.7.4 external clock an external clock from another cmos-compatible device can be connected to the osc1 input, with the osc2 input not connected, as shown in figure 1-3 (c) . this oscillator can be selected via software. this configuration is possible regardless of whether the crystal/ceramic resonator or rc oscillator configuration is used. note: do not use the internal startup resistor between osc1 and osc2 for the external clock. 1.7.5 internal low-power oscillator an internal low-power oscillator (lpo) is provided which is the default oscillator out of reset. when operating from this internal lpo, the other oscillator can be powered down by software to further conserve power. the selection of the lpo configuration is done by product part number selection as described in section 17. ordering information . advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 32 general description motorola general description 1.8 reset pin the reset pin can be used as an input to reset the mcu to a known startup state by pulling it to the low state. it also functions as an output to indicate that an internal cop watchdog, illegal address, or low-voltage reset has occurred. the reset pin contains a pullup device to allow the pin to be left disconnected without an external pullup resistor. the reset pin also contains a steering diode that, when the power is removed, will discharge to v dd any charge left on an external capacitor connected between the reset pin and v ss . the reset pin also contains an internal schmitt trigger to improve its noise immunity as an input. 1.9 irq /v pp pin the irq /v pp input pin drives the asynchronous irq interrupt function of the cpu. the irq interrupt function uses the level bit in the mor to provide either negative edge-sensitive triggering or both negative edge-sensitive and low level-sensitive triggering. if the level bit is set to enable level-sensitive triggering, the irq /v pp pin requires an external resistor to v dd for ? wired-or ? operation. if the irq /v pp pin is not used, it must be tied to the v dd supply. the irq /v pp pin contains an internal schmitt trigger as part of its input to improve noise immunity. the voltage on this pin may affect operation if the voltage on the irq /v pp pin is above v dd when the device is released from a reset condition. the irq /v pp pin should only be taken above v dd to program an eprom memory location or personality eprom bit. for more information, refer to 15.14 peprom and eprom programming characteristics . note: each of the pa0?pa3 i/o pins may be connected as an or function with the irq interrupt function by the pirq bit in the mor. this capability allows keyboard scan applications where the transitions or levels on the i/o pins will behave the same as the irq /v pp pin, except that active transitions and levels are inverted. the edge or level sensitivity selected by the level bit in the mor for the irq /v pp pin also applies to the i/o general description pa0?pa5 MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola general description 33 pins that are ored to create the irq signal. for more information, refer to 4.6 external interrupts . 1.10 pa0 ? pa5 these six i/o lines comprise port a, a general-purpose bidirectional i/o port. this port also has four pins which have keyboard interrupt capability. all six of these pins have high current source and sink capability. all of these pins have software programmable pulldowns which can be disabled by the swpdi bit in the mor. 1.11 pb0 ? pb7 these eight i/o lines comprise port b, a general-purpose bidirectional i/o port. this port is also shared with the 16-bit programmable timer input capture and output compare functions, with the two voltage comparators in the analog subsystem, and with the simple serial interface (siop). the outputs of voltage comparator 1 can directly drive the pb4 pin; and the pb4 pin has high current source and sink capability. all of these pins have software programmable pulldowns which can be disabled by the swpdi bit in the mor. 1.12 pc0 ? pc7 (mc68hc705jp7) these eight i/o lines comprise port c, a general-purpose bidirectional i/o port. this port is only available on the 28-pin mc68hc705jp7. all eight of these pins have high current source and sink capability. all of these pins have software programmable pulldowns which can be disabled by the swpdi bit in the mor. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 34 general description motorola general description MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola memory 35 advance information ? MC68HC705JJ7/mc68hc705jp7 section 2. memory 2.1 contents 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.3 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.4 input/output registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.5 user and interrupt vector mapping. . . . . . . . . . . . . . . . . . . . . . 42 2.6 random-access memory (ram) . . . . . . . . . . . . . . . . . . . . . . . 42 2.7 erasable programmable read-only memory (eprom) . . . . . 43 2.8 cop register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.2 introduction this section describes the organization of the memory on the MC68HC705JJ7/mc68hc705jp7. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 36 memory motorola memory 2.3 memory map the central processor unit (cpu) can address 8 kilobytes of memory space as shown in figure 2-1 . the memory map includes: the erasable programmable read-only memory (eprom) portion of memory holds the program instructions, fixed data, user-defined vectors, and interrupt service routines. the random-access memory (ram) portion of memory holds variable data. input/output (i/o) registers are memory mapped so that the cpu can access their locations in the same way that it accesses all other memory locations. 2.4 input/output registers figure 2-2 and figure 2-3 summarize: the first 32 addresses of the memory space, $0000 ? $001f, containing the i/o registers section one i/o register located outside the 32-byte i/o section, which is the computer operating properly register (copr) mapped at $1ff0 $1eff figure 2-1. memory map memory input/output registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola memory 37 address register name $0000 port a data register $0001 port b data register $0002 port c data register * $0003 analog mux register $0004 port a data direction register $0005 port b data direction register $0006 port c data direction register * $0007 unused $0008 core timer status & control register $0009 core timer counter $000a serial control register $000b serial status register $000c serial data register $000d irq status & control register $000e personality eprom bit select register $000f personality eprom status & control register $0010 port a and port c pulldown register * $0011 port b pulldown register $0012 timer control register $0013 timer status register $0014 input capture register (msb) $0015 input capture register (lsb) $0016 output compare register (msb) $0017 output compare register (lsb) $0018 timer counter register (msb) $0019 timer counter register (lsb) $001a alternate counter register (msb) $001b alternate counter register (lsb) $001c eprom programming register $001d analog control register $001e analog status register $001f reserved * features related to port c are only available on the 28-pin mc68hc705jp7 devices. figure 2-2. i/o registers advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 38 memory motorola memory addr. register bit 7654321bit 0 $0000 port a data register (porta) see page 85. read: 0 0 pa5 pa4 pa3 pa2 pa1 pa0 write: reset: unaffected by reset $0001 port b data register (portb) see page 90. read: pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 write: reset: unaffected by reset $0002 port c (1) data register (portc) see page 102. read: pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 write: reset: unaffected by reset $0003 analog multiplex register (amux) see page 110. read: hold dhold inv vref mux4 mux3 mux2 mux1 write: reset:10000000 $0004 data direction register a (ddra) see page 86. read: 0 0 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 $0005 data direction register b (ddrb) see page 91. read: ddrb7 ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 $0006 data direction register c (ddrc) see page 103. read: ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 write: reset:00000000 $0007 unimplemented $0008 core timer status and control register (ctscr) see page 153. read: ctof rtif ctofe rtie 00 rt1 rt0 write: ctofr rtifr reset:00000011 $0009 core timer counter register (ctcr) see page 155. read: bit 7 654321bit 0 write: reset:00000000 = unimplemented r = reserved u = unaffected 1. features related to port c are only available on the 28-pin mc68hc705jp7 devices. figure 2-3. register summary (sheet 1 of 4) memory input/output registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola memory 39 $000a siop control register (scr) see page 145. read: spie spe lsbf mstr 0 cpha spr1 spr0 write: spir reset:00000000 $000b siop status register (ssr) see page 148. read: spif dcol 000000 write: reset:00000000 $000c siop data register (sdr) see page 149. read: bit 7654321bit 0 write: reset: $000d irq status and control register (iscr) see page 58. read: irqe om2 om1 0irqf000 write: r irqr reset:110000u0 $000e peprom bit select register (pebsr) see page 177. read: peb7 peb6 peb5 peb4 peb3 peb2 peb1 peb0 write: reset:00000000 $000f peprom status and control register (pescr) see page 178. read: pedata 0 pepgm 0000peprzf write: rrr reset:u0000001 $0010 pulldown register port a and port c (1) (pdra) see page 87. read: write: pdich pdicl pdia5 pdia4 pdia3 pdia2 pdia1 pdia0 reset:00000000 $0011 pulldown register b (pdrb) see page 92. read: write: pdib7 pdib6 pdib5 pdib4 pdib3 pdib2 pdib1 pdib0 reset:00000000 $0012 timer control register (tcr) see page 170. read: icie ocie toie 000 iedg olvl write: reset:000000u0 addr. register bit 7654321bit 0 = unimplemented r = reserved u = unaffected 1. features related to port c are only available on the 28-pin mc68hc705jp7 devices. figure 2-3. register summary (sheet 2 of 4) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 40 memory motorola memory $0013 timer status register (tsr) see page 172. read: icf ocf tof 00000 write: reset:uuu00000 $0014 input capture register high (icrh) see page 166. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: unaffected by reset $0015 input capture register low (icrl) see page 166. read: bit 7 654321bit 0 write: reset: unaffected by reset $0016 output compare register high (ocrh) see page 168. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: unaffected by reset $0017 output compare register low (ocrl) see page 168. read: bit 7654321bit 0 write: reset: unaffected by reset $0018 programmable timer register high (tmrh) see page 163. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 $0019 programmable timer register low (tmrl) see page 163. read: bit 7 654321bit 0 write: reset:11111100 $001a alternate counter register high (acrh) see page 165. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 $001b alternate counter register low (acrl) see page 165. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111100 addr. register bit 7654321bit 0 = unimplemented r = reserved u = unaffected 1. features related to port c are only available on the 28-pin mc68hc705jp7 devices. figure 2-3. register summary (sheet 3 of 4) memory input/output registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola memory 41 $001c eprom programming register (eprog) see page 184. read: 0 0000 elat mpgm epgm write: rrrr reset:00000000 $001d analog counter register (acr) see page 115. read: chg atd2 atd1 icen cpie cp2en cp1en isen write: reset:00000000 $001e analog status register (asr) see page 115. read: cpf2 cpf1 0 0 coe1 voff cmp2 cmp1 write: cpfr2 cpfr1 r reset:00000000 $001f reserved r rrrrrrr $1fef reserved rrrrrrrr $1ff0 cop and security register (copr) see pages 43 , 137 , 156 , and 188 . read: opt write: epmsec copc reset: unaffected by reset addr. register bit 7654321bit 0 = unimplemented r = reserved u = unaffected 1. features related to port c are only available on the 28-pin mc68hc705jp7 devices. figure 2-3. register summary (sheet 4 of 4) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 42 memory motorola memory 2.5 user and interrupt vector mapping the interrupt vectors are contained in the upper memory addresses above $1ff0 as shown in figure 2-4 . 2.6 random-access memory (ram) the 224 addresses from $0020 to $00ff serve as both the user ram and the stack ram. the central processor unit (cpu) uses five ram bytes to save all cpu register contents before processing an interrupt. during a subroutine call, the cpu uses two bytes to store the return address. the stack pointer decrements during pushes and increments during pulls. note: be careful when using nested subroutines or multiple interrupt levels. the cpu may overwrite data in the ram during a subroutine or during the interrupt stacking operation. address register name $1ff0 cop register and eprom security $1ff1 mask option register $1ff2 analog interrupt vector (msb) $1ff3 analog interrupt vector (lsb) $1ff4 serial interrupt vector (msb) $1ff5 serial interrupt vector ((lsb) $1ff6 timer interrupt vector (msb) $1ff7 timer interrupt vector (lsb) $1ff8 core timer interrupt vector (msb) $1ff9 core timer interrupt vector (lsb) $1ffa external irq vector (msb) $1ffb external irq vector (lsb) $1ffc swi vector (msb) $1ffd swi vector (lsb) $1ffe reset vector (msb) $1fff reset vector (lsb) figure 2-4. vector mapping memory erasable programmable read-only memory (eprom) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola memory 43 2.7 erasable programmable read-only memory (eprom) the eprom is located in three areas of the memory map: addresses $0700 ? $1eff contain 6144 bytes of user eprom. addresses $1ff0 ? $1ff1 contain 2 bytes of eprom reserved for user vectors and cop and security register (copr), and the mask option register. only bit 7 of $1ff0 is a programmable bit. addresses $1ff2 ? $1fff contain 14 bytes of interrupt vectors. 2.8 cop register as shown in figure 2-5 , a register location is provided at $1ff0 to set the eprom security (1) , select the optional features, and reset the cop watchdog timer. the opt bit controls the function of the pb4 port pin and the availability to add an offset to any measured analog voltages. see 8.5 analog status register for more information 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the eprom/otprom difficult for unauthorized users. address: $1ff0 $1ff0 bit 7 6 5 4 3 2 1 bit 0 read: opt write: epmsec copc reset: unaffected by reset = unimplemented figure 2-5. cop and security register (copr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 44 memory motorola memory MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola central processor unit (cpu) 45 advance information ? MC68HC705JJ7/mc68hc705jp7 section 3. central processor unit (cpu) 3.1 contents 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.3 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.4 index register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.5 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.6 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.7 condition code register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 3.8 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . .50 3.2 introduction this section describes the central processor unit (cpu) registers. figure 3-1 shows the five cpu registers. cpu registers are not part of the memory map. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 46 central processor unit (cpu) motorola central processor unit (cpu) figure 3-1. m68hc05 programming model 3.3 accumulator the accumulator is a general-purpose 8-bit register as shown in figure 3-2 . the cpu uses the accumulator to hold operands and results of arithmetic and non-arithmetic operations. accumulator (a) a index register (x) x sp 11 00 00 0 00 0 pcl pch 11 1 zc in 1h 11 0 4 75 condition code register (ccr) program counter (pc) stack pointer (sp) 0 7 8 15 15 5 7 7 0 0 0 half-carry flag interrupt mask negative flag zero flag carry/borrow flag 10 6 bit 7654321bit 0 read: write: reset: unaffected by reset figure 3-2. accumulator (a) central processor unit (cpu) index register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola central processor unit (cpu) 47 3.4 index register the index register is a general-purpose 8-bit register as shown in figure 3-3 . in the indexed addressing modes, the cpu uses the byte in the index register to determine the conditional address of the operand. the 8-bit index register can also serve as a temporary data storage location. 3.5 stack pointer the stack pointer is a 16-bit register that contains the address of the next location on the stack as shown in figure 3-4 . during a reset or after the reset stack pointer (rsp) instruction, the stack pointer initializes to $00ff. the address in the stack pointer decrements as data is pushed onto the stack and increments as data is pulled from the stack. the 10 most significant bits of the stack pointer are permanently fixed at 0000000011, so the stack pointer produces addresses from $00c0 to $00ff. if subroutines and interrupts use more than 64 stack locations, the stack pointer wraps around to address $00ff and begins writing over the previously stored data. a subroutine uses two stack locations; an interrupt uses five locations. bit 7654321bit 0 read: write: reset: unaffected by reset figure 3-3. index register (x) bit 151413121110987654321 bit 0 read: 0000000011 write: reset:0000000011111111 figure 3-4. stack pointer (sp) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 48 central processor unit (cpu) motorola central processor unit (cpu) 3.6 program counter the program counter is a 16-bit register that contains the address of the next instruction or operand to be fetched as shown in figure 3-5 . the three most significant bits of the program counter are ignored internally and appear as 111 during stacking and subroutine calls. normally, the address in the program counter automatically increments to the next sequential memory location every time an instruction or operand is fetched. jump, branch, and interrupt operations load the program counter with an address other than that of the next sequential location. 3.7 condition code register the condition code register is an 8-bit register whose three most significant bits are permanently fixed at 111 as shown in figure 3-6 . the condition code register contains the interrupt mask and four flags that indicate the results of the instruction just executed. the following paragraphs describe the functions of the condition code register. bit 151413121110987654321 bit 0 read: 111 write: reset: 0 0 0 loaded with vector from $1ffe and $1fff figure 3-5. program counter (pc) bit 7654321bit 0 read: 111hincz write: reset:111u1uuu u = unaffected figure 3-6. condition code register (ccr) central processor unit (cpu) condition code register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola central processor unit (cpu) 49 half-carry flag (h) the cpu sets the half-carry flag when a carry occurs between bits 3 and 4 of the accumulator during an add or adc operation. the half-carry flag is required for binary coded decimal (bcd) arithmetic operations. reset has no effect on the half-carry flag. interrupt mask (i) setting the interrupt mask disables interrupts. if an interrupt request occurs while the interrupt mask is a logic 0, the cpu saves the cpu registers on the stack, sets the interrupt mask, and then fetches the interrupt vector. if an interrupt request occurs while the interrupt mask is set, the interrupt request is latched. the cpu processes the latched interrupt as soon as the interrupt mask is cleared again. a return-from-interrupt (rti) instruction pulls the cpu registers from the stack, restoring the interrupt mask to its cleared state. after a reset, the interrupt mask is set and can be cleared only by a cli instruction. negative flag (n) the cpu sets the negative flag when an arithmetic operation, logical operation, or data manipulation produces a negative result. reset has no affect on the negative flag. zero flag (z) the cpu sets the zero flag when an arithmetic operation, logical operation, or data manipulation produces a result of $00. reset has no affect on the zero flag. carry/borrow flag (c) the cpu sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. some logical operations and data manipulation instructions also clear or set the carry/borrow flag. reset has no effect on the carry/borrow flag. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 50 central processor unit (cpu) motorola central processor unit (cpu) 3.8 arithmetic/logic unit (alu) the alu performs the arithmetic and logical operations defined by the instruction set. the binary arithmetic circuits decode instructions and set up the alu for the selected operation. most binary arithmetic is based on the addition algorithm, carrying out subtraction as negative addition. multiplication is not performed as a discrete operation but as a chain of addition and shift operations within the alu. the multiply instruction (mul) requires 11 internal clock cycles to complete this chain of operations. MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 51 advance information ? MC68HC705JJ7/mc68hc705jp7 section 4. interrupts 4.1 contents 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.3 interrupt vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 4.4 interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.5 software interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.6 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 4.6.1 irq /v pp pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.6.2 pa0 ? pa3 pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.6.3 irq status and control register (iscr) . . . . . . . . . . . . . . . 58 4.7 core timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 4.7.1 core timer overflow interrupt . . . . . . . . . . . . . . . . . . . . . . .60 4.7.2 real-time interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.8 programmable timer interrupts . . . . . . . . . . . . . . . . . . . . . . . . 61 4.8.1 input capture interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.8.2 output compare interrupt . . . . . . . . . . . . . . . . . . . . . . . . . .61 4.8.3 timer overflow interrupt. . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.9 serial interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.10 analog interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.10.1 comparator input match interrupt . . . . . . . . . . . . . . . . . . . .63 4.10.2 input capture interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.2 introduction an interrupt temporarily stops normal program execution to process a particular event. an interrupt does not stop the execution of the instruction in progress, but takes effect when the current instruction completes its execution. interrupt processing automatically saves the advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 52 interrupts motorola interrupts central processor unit (cpu) registers on the stack and loads the program counter with a user-defined vector address. 4.3 interrupt vectors table 4-1 summarizes the reset and interrupt sources and vector assignments. note: if more than one interrupt request is pending, the cpu fetches the vector of the higher priority interrupt first. a higher priority interrupt does not actually interrupt a lower priority interrupt service routine unless the lower priority interrupt service routine clears the i bit. table 4-1. reset/interrupt vector addresses function source mor control bit global hardware mask local software mask priority (1 = highest) vector address reset power-on logic reset pin low-voltage reset illegal address reset ? ?? 1$1ffe ? $1fff cop watchdog copen (1) software interrupt (swi) user code ??? same priority as instruction $1ffc ? $1ffd external interrupt (irq) irq /v pp pin ? i bit irqe bit 2 $1ffa ? $1ffb pa 3 p i n pa 2 p i n pa 1 p i n pa 0 p i n pirq (2) core timer interrupts tof bit rtif bit ? i bit tofe bit rtie bit 3$1ff8 ? $1ff9 programmable timer interrupts icf bit ocf bit tof bit ? i bit icie bit ocie bit toie bit 4$1ff6 ? $1ff7 serial interrupt spif bit ? i bit spie bit 5 $1ff4 ? $1ff5 analog interrupt cpf1 bit cpf2 bit ? i bit cpie bit 6 $1ff2 ? $1ff3 1. copen enables the cop watchdog timer. 2. pirq enables port a external interrupts on pa0 ? pa3. interrupts interrupt processing MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 53 4.4 interrupt processing to begin servicing an interrupt, the cpu does these actions: stores the cpu registers on the stack in the order shown in figure 4-1 sets the i bit in the condition code register to prevent further interrupts loads the program counter with the contents of the appropriate interrupt vector locations as shown in table 4-1 the return-from-interrupt (rti) instruction causes the cpu to recover its register contents from the stack as shown in figure 4-1 . the sequence of events caused by an interrupt is shown in the flowchart in figure 4-2 . $0020 bottom of ram $0021 $00be $00bf $00c0 bottom of stack $00c1 $00c2 unstacking order ? n condition code register 5 1 n+1 accumulator 4 2 n+2 index register 3 3 n+3 program counter (high byte) 2 4 n+4 program counter (low byte) 1 5 ? stacking order $00fd $00fe $00ff top of stack (ram) figure 4-1. interrupt stacking order advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 54 interrupts motorola interrupts figure 4-2. interrupt flowchart no external interrupt? i bit set? from reset yes yes clear irq latch no execute instruction unstack ccr, a, x, pch, pcl fetch next instruction stack pcl, pch, x, a, ccr set i bit load pc with interrupt vector core timer interrupt? yes no timer interrupt? yes no serial interrupt? yes no analog interrupt? yes no swi instruction? yes no rti instruction? yes no interrupts software interrupt MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 55 4.5 software interrupt the software interrupt (swi) instruction causes a non-maskable interrupt. 4.6 external interrupts these sources can generate external interrupts: irq /v pp pin pa3 ? pa0 pins setting the i bit in the condition code register or clearing the irqe bit in the interrupt status and control register disables these external interrupts. 4.6.1 irq /v pp pin an interrupt signal on the irq /v pp pin latches an external interrupt request. to help clean up slow edges, the input from the irq /v pp pin is processed by a schmitt trigger gate. when the cpu completes its current instruction, it tests the irq latch. if the irq latch is set, the cpu then tests the i bit in the condition code register and the irqe bit in the irq status and control register (iscr). if the i bit is clear and the irqe bit is set, then the cpu begins the interrupt sequence. the cpu clears the irq latch while it fetches the interrupt vector, so that another external interrupt request can be latched during the interrupt service routine. as soon as the i bit is cleared during the return from interrupt, the cpu can recognize the new interrupt request. figure 4-3 shows the logic for external interrupts. note: if the irq /v pp pin is not in use, it should be connected to the v dd pin. the irq /v pp pin can be negative edge-triggered only or negative edge- and low level-triggered. external interrupt sensitivity is programmed with the level bit in the mask option register (mor). advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 56 interrupts motorola interrupts figure 4-3. external interrupt logic with the edge- and level-sensitive trigger mor option, a falling edge or a low level on the irq /v pp pin latches an external interrupt request. the edge- and level-sensitive trigger mor option allows connection to the irq /v pp pin of multiple wired-or interrupt sources. as long as any source is holding the irq low, an external interrupt request is present, and the cpu continues to execute the interrupt service routine. with the edge-sensitive-only trigger option, a falling edge on the irq /v pp pin latches an external interrupt request. a subsequent interrupt request can be latched only after the voltage level on the irq /v pp pin returns to a logic 1 and then falls again to logic 0. pa3 pa2 pa1 pa0 irq latch v dd rst irq vector fetch irq status/control register ($000d) external interrupt request irqe irqf irqr internal data bus to bih & bil instruction processing r pirq level v pp to user eprom and peprom mask option register ($1ff1) irq /v pp interrupts external interrupts MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 57 note: the response of the irq /v pp pin can be affected if the external interrupt capability of the pa0 through pa3 pins is enabled. if the port a pins are enabled as external interrupts, then any high level on a pa0 ? pa3 pin will cause the irq changes and state to be ignored until all of the pa0 ? pa3 pins have returned to a low level. 4.6.2 pa0 ? pa3 pins programming the pirq bit in the mor to a logic 1 enables the pa0 ? pa3 pins (pa0:3) to serve as additional external interrupt sources. a rising edge on a pa0:3 pin latches an external interrupt request. after completing the current instruction, the cpu tests the irq latch. if the irq latch is set, the cpu then tests the i bit in the condition code register and the irqe bit in the iscr. if the i bit is clear and the irqe bit is set, the cpu then begins the interrupt sequence. the cpu clears the irq latch while it fetches the interrupt vector, so that another external interrupt request can be latched during the interrupt service routine. as soon as the i bit is cleared during the return from interrupt, the cpu can recognize the new interrupt request. the pa0:3 pins can be edge-triggered or edge- and level-triggered. external interrupt triggering sensitivity is selected by the level bit in the mor. with the edge- and level-sensitive trigger mor option, a rising edge or a high level on a pa0:3 pin latches an external interrupt request. the edge- and level-sensitive trigger mor option allows connection to a pa0:3 pin of multiple wired-or interrupt sources. as long as any source is holding the pin high, an external interrupt request is present, and the cpu continues to execute the interrupt service routine. with the edge-sensitive only trigger mor option, a rising edge on a pa0:3 pin latches an external interrupt request. a subsequent external interrupt request can be latched only after the voltage level of the previous interrupt signal returns to a logic 0 and then rises again to a logic 1. note: if the port a pins are enabled as external interrupts, then a high level on any pa0:3 pin will drive the state of the irq function such that the advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 58 interrupts motorola interrupts irq /v pp pin and other pa0:3 pins are to be ignored until all of the pa0:3 pins have returned to a low level. similarly, if the irq /v pp pin is at a low level, the pa0:3 pins will be ignored until the irq /v pp pin returns to a high state. 4.6.3 irq status and control register (iscr) the irq status and control register (iscr), shown in figure 4-4 , contains an external interrupt mask (irqe), an external interrupt flag (irqf), and a flag reset bit (irqr). unused bits will read as logic 0s. the iscr also contains two control bits for the oscillators, external pin oscillator, and internal low-power oscillator. reset sets the irqe and om2 bits and clears all the other bits. irqe ? external interrupt request enable bit this read/write bit enables external interrupts. reset sets the irqe bit. 1 = external interrupt processing enabled 0 = external interrupt processing disabled om1 and om2 ? oscillator select bits these bits control the selection and enabling of the oscillator source for the mcu. one choice is the internal low-power oscillator (lpo). the other choice is the external pin oscillator (epo) which is common to most m68hc05 mcu devices. the epo uses external components address: $000d bit 7654321bit 0 read: irqe om2 om1 0irqf000 write: r irqr reset:110000u0 = unimplemented r = reserved u = unaffected figure 4-4. irq status and control register (iscr) interrupts external interrupts MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 59 like filter capacitors and a crystal or ceramic resonator and consumes more power. the selection and enable conditions for these two oscillators are shown in table 4-2 . therefore, the lowest power is consumed when om1 is cleared. the state with both om1 and om2 set is provided so that the epo can be started and allowed to stabilize while the lpo still clocks the mcu. the reset state is for om1 to be cleared and om2 to be set, which selects the lpo and disables the epo. irqf ? external interrupt request flag the irq flag is a clearable, read-only bit that is set when an external interrupt request is pending. writing to the irqf bit has no effect. reset clears the irqf bit. 1 = interrupt request pending 0 = no interrupt request pending the following conditions set the irq flag: an external interrupt signal on the irq /v pp pin an external interrupt signal on pin pa0, pa1, pa2, or pa3 when the pa0 ? pa3 pins are enabled by the pirq bit in the mor to serve as external interrupt sources. the following conditions clear the irq flag: when the cpu fetches the interrupt vector when a logic 1 is written to the irqr bit table 4-2. oscillator selection om2 om1 oscillator selected by cpu internal low-power oscillator (lpo) external pin oscillator (epo) power consumption 0 0 internal enabled disabled lowest 0 1 external disabled enabled normal 1 0 internal enabled disabled lowest 1 1 internal enabled enabled normal advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 60 interrupts motorola interrupts irqr ? interrupt request reset bit this write-only bit clears the irqf flag bit and prevents redundant execution of interrupt routines. writing a logic 1 to irqr clears the irqf. writing a logic 0 to irqr has no effect. irqr always reads as a logic 0. reset has no effect on irqr. 1 = clear irqf flag bit 0 = no effect 4.7 core timer interrupts the core timer can generate the following interrupts: timer overflow interrupt real-time interrupt setting the i bit in the condition code register disables core timer interrupts. the controls and flags for these interrupts are in the core timer status and control register (ctscr) located at $0008. 4.7.1 core timer overflow interrupt an overflow interrupt request occurs if the core timer overflow flag (tof) becomes set while the core timer overflow interrupt enable bit (tofe) is also set. the tof flag bit can be reset by writing a logic 1 to the ctofr bit in the ctscr or by a reset of the device. 4.7.2 real-time interrupt a real-time interrupt request occurs if the real-time interrupt flag (rtif) in the ctscr becomes set while the real-time interrupt enable bit (rtie) is also set. the rtif flag bit can be reset by writing a logical 1 to the rtifr bit in the ctscr or by a reset of the device. interrupts programmable timer interrupts MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 61 4.8 programmable timer interrupts the 16-bit programmable timer can generate an interrupt whenever the following events occur: input capture output compare timer counter overflow setting the i bit in the condition code register disables timer interrupts. the controls for these interrupts are in the timer control register (tcr) located at $0012 and in the status bits in the timer status register (tsr) located at $0013. 4.8.1 input capture interrupt an input capture interrupt occurs if the input capture flag (icf) becomes set while the input capture interrupt enable bit (icie) is also set. the icf flag bit is in the tsr, and the icie enable bit is located in the tcr. the icf flag bit is cleared by a read of the tsr with the icf flag bit set, and then followed by a read of the lsb of the input capture register (icrl) or by reset. the icie enable bit is unaffected by reset. 4.8.2 output compare interrupt an output compare interrupt occurs if the output compare flag (ocf) becomes set while the output compare interrupt enable bit (ocie) is also set. the ocf flag bit is in the tsr and the ocie enable bit is in the tcr. the ocf flag bit is cleared by a read of the tsr with the ocf flag bit set, and then followed by an access to the lsb of the output compare register (ocrl) or by reset. the ocie enable bit is unaffected by reset. 4.8.3 timer overflow interrupt a timer overflow interrupt occurs if the timer overflow flag (tof) becomes set while the timer overflow interrupt enable bit (toie) is also set. the tof flag bit is in the tsr and the toie enable bit is in the tcr. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 62 interrupts motorola interrupts the tof flag bit is cleared by a read of the tsr with the tof flag bit set, and then followed by an access to the lsb of the timer registers (tmrl) or by reset. the toie enable bit is unaffected by reset. 4.9 serial interrupts the simple serial interface can generate the following interrupts: receive sequence complete transmit sequence complete setting the i bit in the condition code register disables serial interrupts. the controls for these interrupts are in the serial control register (scr) located at $000a and in the status bits in the serial status register (ssr) located at $000b. a transfer complete interrupt occurs if the serial interrupt flag (spif) becomes set while the serial interrupt enable bit (spie) is also set. the spif flag bit is in the serial status register (ssr) located at $000b, and the spie enable bit is located in the serial control register (scr) located at $000a. the spif flag bit is cleared by a read of the ssr with the spif flag bit set, and then followed by a read or write to the serial data register (sdr) located at $000c. the spif flag bit can also be reset by writing a one to the spir bit in the scr. 4.10 analog interrupts the analog subsystem can generate the following interrupts: voltage on positive input of comparator 1 is greater than the voltage on the negative input of comparator 1. voltage on positive input of comparator 2 is greater than the voltage on the negative input of comparator 2. trigger of the input capture interrupt from the programmable timer as described in 4.8.1 input capture interrupt interrupts analog interrupts MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola interrupts 63 setting the i bit in the condition code register disables analog subsystem interrupts. the controls for these interrupts are in the analog subsystem control register (acr) located at $001d, and the status bits are in the analog subsystem status register (asr) located at $001e. 4.10.1 comparator input match interrupt a comparator input match interrupt occurs if either compare flag bit (cpf1 or cpf2) in the asr becomes set while the comparator interrupt enable bit (cpie) in the acr is also set. the cpf1 and cpf2 flag bits can be reset by writing a one to the corresponding cpfr1 or cpfr2 bits in the asr. reset clears these bits. 4.10.2 input capture interrupt the analog subsystem can also generate an input capture interrupt through the 16-bit programmable timer. the input capture can be triggered when there is a match in the input conditions for the voltage comparator 2. if comparator 2 sets the cp2f flag bit in the asr and the input capture enable (icen) in the acr is set, then an input capture will be performed by the programmable timer. if the icie enable bit in the tcr is also set, then an input compare interrupt will occur. reset clears these bits. note: for the analog subsystem to generate an interrupt using the input capture function of the programmable timer, the icen enable bit in the acr, and the icie and iedg bits in the tcr must all be set. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 64 interrupts motorola interrupts MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola resets 65 advance information ? MC68HC705JJ7/mc68hc705jp7 section 5. resets 5.1 contents 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.3 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.4 external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.5 internal resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.5.1 power-on reset (por) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.5.2 computer operating properly (cop) reset. . . . . . . . . . . . . 68 5.5.3 low-voltage reset (lvr). . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.5.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6 reset states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6.1 cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 5.6.2 i/o registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6.3 core timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6.4 cop watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 5.6.5 16-bit programmable timer . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.6 serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.7 analog subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.6.8 external oscillator and internal low-power oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . .73 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 66 resets motorola resets 5.2 introduction this section describes the five reset sources and how they initialize the microcontroller unit (mcu). a reset immediately stops the operation of the instruction being executed, initializes certain control bits, and loads the program counter with a user-defined reset vector address. these conditions produce a reset: initial power-up of device (power-on reset) a logic 0 applied to the reset pin (external reset) timeout of the computer operating properly (cop) watchdog (cop reset) low voltage applied to the device (lvr reset) fetch of an opcode from an address not in the memory map (illegal address reset) figure 5-1 shows a block diagram of the reset sources and their interaction. figure 5-1. reset sources reset reset latch r copen cop watchdog power-on reset illegal address reset internal d internal clock s rst to cpu and lv re n low-voltage reset v dd 3-cycle clocked 1-shot subsystems address bus mask option register ($1ff1) internal data bus resets power-on reset MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola resets 67 5.3 power-on reset a positive transition on the v dd pin generates a power-on reset. the power-on reset is strictly for conditions during powering up and cannot be used to detect drops in power supply voltage. a delay of 16 or 4064 internal bus cycles (t cyc ) after the oscillator becomes active allows the clock generator to stabilize. if the reset pin is at logic 0 at the end of this multiple t cyc time, the mcu remains in the reset condition until the signal on the reset pin goes to a logic 1. 5.4 external reset a logic 0 applied to the reset pin for a minimum of one and one half t cyc generates an external reset. this pin is connected to a schmitt trigger input gate to provide an upper and lower threshold voltage separated by a minimum amount of hysteresis. the external reset occurs whenever the reset pin is pulled below the lower threshold and remains in reset until the reset pin rises above the upper threshold. this active low input will generate the internal rst signal that resets the cpu and peripherals. the reset pin can also be pulled to a low state by an internal pulldown device that is activated by three internal reset sources. this reset pulldown device will only be asserted for three to four cycles of the internal bus or as long as the internal reset source is asserted. note: do not connect the reset pin directly to v dd , as this may overload some power supply designs if the internal pulldown on the reset pin should activate. if an external reset function is not required, the reset pin should be left unconnected. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 68 resets motorola resets 5.5 internal resets the four internally generated resets are: initial power-on reset (por) function cop watchdog timer reset low-voltage reset (lvr) illegal address detector only the cop watchdog timer reset, low-voltage reset, and illegal address detector will also assert the pulldown device on the reset pin for the duration of the reset function or for three to four internal bus cycles, whichever is longer. 5.5.1 power-on reset (por) the internal por is generated on power-up to allow the clock oscillator to stabilize. the por is strictly for power turn-on conditions and is not able to detect a drop in the power supply voltage (brown-out); that function can be performed by the lvr. depending on the delay bit in the mask option register (mor), there is an oscillator stabilization delay of 16 or 4064 internal bus cycles after the lpo becomes active. the por will generate the rst signal which will reset the cpu. if any other reset function is active at the end of the 16- or 4064-cycle delay, the rst signal will remain in the reset condition until the other reset condition(s) end. por will not activate the pulldown device on the reset pin. v dd must drop below v por for the internal por circuit to detect the next rise of v dd . 5.5.2 computer operating properly (cop) reset a timeout of the cop watchdog generates a cop reset. the cop watchdog is part of a software error detection system and must be cleared periodically to start a new timeout period. to clear the cop watchdog and prevent a cop reset, write a logic 0 to the copc bit of the copr register at location $1ff0. the copc bit, shown in figure 5-2 , is a write-only bit. resets internal resets MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola resets 69 epmsec ? eprom security (1) bit the epmsec bit is an eprom, write-only security bit to protect the contents of the user eprom code stored in locations $0700 ? $1fff. opt ? optional features bit the opt bit enables two additional features: direct drive by comparator 1 output to pb4 and voltage offset capability to sample capacitor in analog subsystem. 1 = optional features enabled 0 = optional features disabled note: see 8.8.1 voltage comparator 1 and 8.11 sample and hold for further descriptions of the opt bit. copc ? cop clear bit copc is a write-only bit. periodically writing a logic 0 to copc prevents the cop watchdog from resetting the mcu. reset clears the copc bit. 1 = no effect on cop watchdog timer 0 = reset cop watchdog timer the cop watchdog reset will assert the pulldown device to pull the reset pin low for three to four cycles of the internal bus. the cop watchdog reset function can be enabled or disabled by programming the copen bit in the mor. address: $1ff0 bit 7654321bit 0 read: epmsec opt write: copc reset:u uuuuuuu = unimplemented u = unaffected figure 5-2. cop and security register (copr) 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the eprom/otprom difficult for unauthorized users. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 70 resets motorola resets 5.5.3 low-voltage reset (lvr) the lvr activates the rst reset signal to reset the device when the voltage on the v dd pin falls below the lvr trip voltage. the lvr will assert the pulldown device to pull the reset pin low for three to four cycles of the internal bus. the lvr reset function can be enabled or disabled by programming the lvren bit in the mor. note: the lvr is intended for applications where the v dd supply voltage normally operates above 4.5 volts. 5.5.4 illegal address reset an opcode fetch (execution of an instruction) at an address that is not in the eprom (locations $0700 ? $1fff) or the ram (locations $0020 ? $00ff) generates an illegal address reset. the illegal address reset will assert the pulldown device to pull the reset pin low for three to four cycles of the internal bus. 5.6 reset states this subsection describe how the various resets initialize the mcu. 5.6.1 cpu a reset has these effects on the cpu: loads the stack pointer with $ff sets the i bit in the condition code register, inhibiting interrupts loads the program counter with the user-defined reset vector from locations $1ffe and $1fff clears the stop latch, enabling the cpu clock clears the wait latch, bringing the cpu out of the wait mode resets reset states MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola resets 71 5.6.2 i/o registers a reset has these effects on input/output (i/o) registers: clears bits in data direction registers configuring pins as inputs: ? ddra5 ? ddra0 in ddra for port a ? ddrb7 ? ddrb0 in ddrb for port b ? ddrc7 ? ddrc0 in ddrc for port c (1) clears bits in pulldown inhibit registers to enable pulldown devices: ? pdia5 ? pdia0 in pdra for port a ? pdib7 ? pdib0 in pdrb for port b ? pdich and pdicl in pdra for port c (1) has no effect on port a, b, or c (1) data registers sets the irqe bit in the interrupt status and control register (iscr) 5.6.3 core timer a reset has these effects on the core timer: clears the core timer counter register (ctcr) clears the core timer interrupt flag and enable bits in the core timer status and control register (ctscr) sets the real-time interrupt (rti) rate selection bits (rt0 and rt1) such that the device will start with the longest real-time interrupt and longest cop timeout delays 5.6.4 cop watchdog a reset clears the cop watchdog timeout counter. 1. features related to port c are only available on the 28-pin mc68hc705jp7 devices advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 72 resets motorola resets 5.6.5 16-bit programmable timer a reset has these effects on the 16-bit programmable timer: initializes the timer counter registers (tmrh and tmrl) to a value of $fffc initializes the alternate timer counter registers (acrh and acrl) to a value of $fffc clears all the interrupt enables and the output level bit (olvl) in the timer control register (tcr) does not affect the input capture edge bit (iedg) in the tcr does not affect the interrupt flags in the timer status register (tsr) does not affect the input capture registers (icrh and icrl) does not affect the output compare registers (ocrh and ocrl) 5.6.6 serial interface a reset has these effects on the serial interface: clears all bits in the siop control register (scr) clears all bits in the siop status register (ssr) does not affect the contents of the siop data register (sdr) a reset, therefore, disables the siop and leaves the shared port b pins as general i/o. any pending interrupt flag is cleared and the siop interrupt is disabled. also the baud rate defaults to the slowest rate. 5.6.7 analog subsystem a reset has these effects on the analog subsystem: clears all the bits in the multiplex register (amux) bits except the hold switch bit (hold) which is set clears all the bits in the analog control register (acr) clears all the bits in the analog status register (asr) resets reset states MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola resets 73 a reset, therefore, connects the negative input of comparator 2 to the channel selection bus, which is switched to v ss . both comparators are set up as non-inverting (a higher positive voltage on the positive input results in a positive output) and both are powered down. the current source and discharge device on the pb0/an0 pin is disabled and powered down. any analog subsystem interrupt flags are cleared and the analog interrupt is disabled. direct drive by comparator 1 to the pb4 pin and the voltage offset to the sample capacitor are disabled (if both are enabled by the opt bit being set in the copr). 5.6.8 external oscillator and internal low-power oscillator a reset presets the oscillator select bits (om1 and om2) in the interrupt status and control register (iscr) such that the device runs from the internal oscillator (om1 = 0, om2 = 1) which has these effects on the oscillators: the internal low-power oscillator is enabled and selected. the external oscillator is disabled. the cpu bus clock is driven from the internal low-power oscillator. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 74 resets motorola resets MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola operating modes 75 advance information ? MC68HC705JJ7/mc68hc705jp7 section 6. operating modes 6.1 contents 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.3 oscillator source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.4 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 6.4.1 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 6.4.2 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.4.3 halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 6.4.4 data-retention mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 6.2 introduction this section describes the operation of the device with respect to the oscillator source and the low-power modes: stop mode wait mode halt mode data-retention mode advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 76 operating modes motorola operating modes 6.3 oscillator source the microcontroller unit (mcu) can be clocked by either an internal low-power oscillator (lpo) without external components or by an external pin oscillator (epo) which uses external components. the enable and selection of the clock source is determined by the state of the oscillator select bits (om1 and om2) in the interrupt status and control register (iscr) as shown in figure 6-1 . irqe ? external interrupt request enable bit this read/write bit enables external interrupts. refer to section 4. interrupts for more details. om1 and om2 ? oscillator select bits these bits control the selection and enabling of the oscillator source for the mcu. one choice is the internal lpo and the other oscillator is the epo which is common to most m68hc05 mcu devices. the epo uses external components like filter capacitors and a crystal or ceramic resonator and consumes more power than the lpo. the selection and enable conditions for these two oscillators are shown in table 6-1 . reset clears om1 and sets om2, which selects the lpo and disables the epo. therefore, the lowest power is consumed when om1 is cleared. the state with both om1 and om2 set is provided so that the epo can be started up and allowed to stabilize while the lpo still clocks the mcu. address: $000d bit 7654321bit 0 read: irqe om2 om1 0irqf000 write: r irqr reset:11000000 = unimplemented r = reserved figure 6-1. irq status and control register (iscr) operating modes low-power modes MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola operating modes 77 . note: when switching from lpo to epo, the user must be careful to ensure that the epo has been enabled and powered up long enough to stabilize before shifting clock sources. irqf ? external interrupt request flag the irqf flag is a clearable, read-only bit that is set when an external interrupt request is pending. refer to section 4. interrupts for more details. irqr ? interrupt request reset bit this write-only bit clears the irqf flag bit and prevents redundant execution of interrupt routines. refer to section 4. interrupts for more details. 6.4 low-power modes four modes of operation reduce power consumption: stop mode wait mode halt mode data-retention mode figure 6-2 shows the sequence of events in stop, wait, and halt modes. table 6-1. oscillator selection om2 om1 oscillator selected internal low-power oscillator (lpo) external pin oscillator (epo) power consumption 0 0 internal enabled disabled lowest 0 1 external disabled enabled normal 1 0 internal enabled disabled lowest 1 1 internal enabled enabled normal advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 78 operating modes motorola operating modes figure 6-2. stop/wait/halt flowchart stop swait bit in mor set? clear i bit in ccr. set irqe bit in iscr. clear ctof, rtif, ctofe, and rtie bits in tscr. disable external pin oscillator. external reset? external interrupt? no no no turn on selected oscillator. reset stabilization delay timer. yes yes halt yes end of stabilization delay? yes no no external reset? clear i bit in ccr. set irqe bit in iscr. turn off cpu clock. keep other module yes wait turn on cpu clock. 1. load pc with reset vector or 2. service interrupt. a. save cpu registers on stack. b. set i bit in ccr. c. load pc with interrupt vector. turn off internal low-power oscillator. clear icf, ocf, and tof bits in tsr. clear icie, ocie, and toie bits in tcr. clocks active. no core interrupt? yes timer no external interrupt? yes no prog. interrupt? yes timer no siop interrupt? yes no interrupt? yes analog no cop reset? yes clear i bit in ccr. set irqe bit in iscr. turn off cpu clock. keep other module clocks active. no external reset? yes no core interrupt? yes timer no external interrupt? yes no prog. interrupt? yes timer no siop interrupt? yes no yes no cop reset? yes interrupt? analog operating modes low-power modes MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola operating modes 79 6.4.1 stop mode the stop instruction puts the mcu in a mode with the lowest power consumption and affects the mcu as follows: turns off the central processor unit (cpu) clock and all internal clocks by stopping both the external pin oscillator and the internal low-power oscillator. the selection of the oscillator by the om1 and om2 bits in the iscr is not affected. the stopped clocks turn off the cop watchdog, the core timer, the programmable timer, the analog subsystem, and the siop. removes any pending core timer interrupts by clearing the core timer interrupt flags (ctof and rtif) in the core timer status and control register (ctscr) disables any further core timer interrupts by clearing the core timer interrupt enable bits (ctofe and rtie) in the ctscr removes any pending programmable timer interrupts by clearing the timer interrupt flags (icf, ocf, and tof) in the timer status register (tsr) disables any further programmable timer interrupts by clearing the timer interrupt enable bits (icie, ocie, and toie) in the timer control register (tcr) enables external interrupts via the irq /v pp pin by setting the irqe bit in the irq status and control register (iscr). external interrupts are also enabled via the pa0 through pa3 pins, if the port a interrupts are enabled by the pirq bit in the mask option register (mor). enables interrupts in general by clearing the i bit in the condition code register the stop instruction does not affect any other bits, registers, or i/o lines. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 80 operating modes motorola operating modes the following conditions bring the mcu out of stop mode: an external interrupt signal on the irq /v pp pin ? a high-to-low transition on the irq /v pp pin loads the program counter with the contents of locations $1ffa and $1ffb. an external interrupt signal on a port a external interrupt pin ? if selected by the pirq bit in the mor, a low-to-high transition on a pa3 ? pa0 pin loads the program counter with the contents of locations $1ffa and $1ffb. external reset ? a logic 0 on the reset pin resets the mcu and loads the program counter with the contents of locations $1ffe and $1fff. when the mcu exits stop mode, processing resumes after a stabilization delay of 16 or 4064 internal bus cycles, depending on the state of the delay bit in the mor. note: execution of the stop instruction without setting the swait bit in the mor will cause the oscillators to stop, and, therefore, disable the cop watchdog timer. if the cop watchdog timer is to be used, stop mode should be changed to halt mode as described in 6.4.3 halt mode . 6.4.2 wait mode the wait instruction puts the mcu in a low-power wait mode which consumes more power than the stop mode and affects the mcu as follows: enables interrupts by clearing the i bit in the condition code register enables external interrupts by setting the irqe bit in the irq status and control register stops the cpu clock which drives the address and data buses, but allows the selected oscillator to continue to clock the core timer, programmable timer, analog subsystem, and siop the wait instruction does not affect any other bits, registers, or i/o lines. operating modes low-power modes MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola operating modes 81 these conditions restart the cpu bus clock and bring the mcu out of wait mode: an external interrupt signal on the irq /v pp pin ? a high-to-low transition on the irq /v pp pin loads the program counter with the contents of locations $1ffa and $1ffb. an external interrupt signal on a port a external interrupt pin ? if selected by pirq bit in the mor, a low-to-high transition on a pa3 ? pa0 pin loads the program counter with the contents of locations $1ffa and $1ffb. a core timer interrupt ? a core timer overflow or a real-time interrupt loads the program counter with the contents of locations $1ff8 and $1ff9. a programmable timer interrupt ? a programmable timer interrupt driven by an input capture, output compare, or timer overflow loads the program counter with the contents of locations $1ff6 and $1ff7. an siop interrupt ? an siop interrupt driven by the completion of transmitted or received 8-bit data loads the program counter with the contents of locations $1ff4 and $1ff5. an analog subsystem interrupt ? an analog subsystem interrupt driven by a voltage comparison loads the program counter with the contents of locations $1ff2 and $1ff3. a cop watchdog reset ? a timeout of the cop watchdog resets the mcu and loads the program counter with the contents of locations $1ffe and $1fff. software can enable real-time interrupts so that the mcu can periodically exit the wait mode to reset the cop watchdog. an external reset ? a logic 0 on the reset pin resets the mcu and loads the program counter with the contents of locations $1ffe and $1fff. when the mcu exits the wait mode, there is no delay before code executes like occurs when exiting the stop or halt modes. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 82 operating modes motorola operating modes 6.4.3 halt mode the stop instruction puts the mcu in halt mode if selected by the swait bit in the mor. halt mode is identical to wait mode, except that a variable recovery delay occurs when the mcu exits halt mode. a recovery time of from 1 to 16 or from 1 to 4064 internal bus cycles can be selected by the delay bit in the mor. if the swait bit is set in the mor to put the mcu in halt mode, the cop watchdog cannot be turned off inadvertently by a stop instruction. 6.4.4 data-retention mode in the data-retention mode, the mcu retains random-access memory (ram) contents and cpu register contents at v dd voltages as low as 2.0 vdc. the data retention feature allows the mcu to remain in a low-power consumption state during which it retains data, but the cpu cannot execute instructions. current consumption in this mode is not tested. to put the mcu in the data retention mode: 1. drive the reset pin to a logic 0. 2. lower the v dd voltage. the reset pin must remain low continuously during data retention mode. to take the mcu out of the data retention mode: 1. return v dd to normal operating voltage. 2. return the reset pin to a logic 1. MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 83 advance information ? MC68HC705JJ7/mc68hc705jp7 section 7. parallel input/output 7.1 contents 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 7.3.2 data direction register a. . . . . . . . . . . . . . . . . . . . . . . . . . . 86 7.3.3 pulldown register a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.3.4 port a external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . .88 7.3.5 port a logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.4.2 data direction register b. . . . . . . . . . . . . . . . . . . . . . . . . . . 91 7.4.3 pulldown register b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.4.4 port b logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.4.5 pb0, pbi, pb2, and pb3 logic. . . . . . . . . . . . . . . . . . . . . . .93 7.4.6 pb4/an4/tcmp/cmp1 logic. . . . . . . . . . . . . . . . . . . . . . . . 94 7.4.7 pb5/sdo logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 7.4.8 pb6/sdi logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 7.4.9 pb7/sck logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 7.5 port c (28-pin versions only) . . . . . . . . . . . . . . . . . . . . . . . . 101 7.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 7.5.2 data direction register c. . . . . . . . . . . . . . . . . . . . . . . . . . 102 7.5.3 port c pulldown devices . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.5.4 port c logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.6 port transitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 84 parallel input/output motorola parallel input/output 7.2 introduction the MC68HC705JJ7 has 14 bidirectional input/output (i/o) pins which form two parallel i/o ports, a and b. the mc68hc705jp7 has 22 bidirectional i/o pins which form three parallel i/o ports, a, b and c. each i/o pin is programmable as an input or an output. the contents of the data direction registers determine the data direction of each of the i/o pins. all i/o pins have software programmable pulldown devices which can be enabled or disabled globally by the swpdi bit in the mask option register (mor). 7.3 port a port a is a 6-bit, general-purpose, bidirectional i/o port with these features: individual programmable pulldown devices high current sinking capability on all port a pins, with a maximum total for port a high current sourcing capability on all port a pins, with a maximum total for port a external interrupt capability (pins pa3 ? pa0) parallel input/output port a MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 85 7.3.1 port a data register the port a data register (porta) contains a bit for each of the port a pins. when a port a pin is programmed to be an output, the state of its data register bit determines the state of the output pin. when a port a pin is programmed to be an input, reading the port a data register returns the logic state of the pin. the upper two bits of the port a data register will always read as logic 0s. pa5 ? pa0 ? port a data bits these read/write bits are software programmable. data direction of each bit is under the control of the corresponding bit in the port a data direction register (ddra). reset has no effect on port a data. address: $0000 bit 7654321bit 0 read: 0 0 pa5 pa4 pa3 pa2 pa1 pa0 write: reset: unaffected by reset alternate: kybd3 kybd2 kybd1 kybd0 = unimplemented figure 7-1. port a data register (porta) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 86 parallel input/output motorola parallel input/output 7.3.2 data direction register a the contents of the port a data direction register (ddra) determine whether each port a pin is an input or an output. writing a logic 1 to a ddra bit enables the output buffer for the associated port a pin. a ddra bit set to a logic 1 also disables the pulldown device for that pin. writing a logic 0 to a ddra bit disables the output buffer for the associated port a pin. the upper two bits always read as logic 0s. a reset initializes all ddra bits to logic 0s, configuring all port a pins as inputs and disabling the voltage comparators from driving pa4 or pa5. ddra5 ? ddra0 ? port a data direction bits these read/write bits control port a data direction. reset clears the ddra5 ? ddra0 bits. 1 = corresponding port a pin configured as output and pulldown device disabled 0 = corresponding port a pin configured as input address: $0004 bit 7654321bit 0 read: 0 0 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 = unimplemented figure 7-2. data direction register a (ddra) parallel input/output port a MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 87 7.3.3 pulldown register a all port a pins can have software programmable pulldown devices enabled or disabled globally by swpdi bit in the mor. these pulldown devices are controlled by the write-only pulldown register a (pdra) shown in figure 7-3 . clearing the pdia5 ? pdia0 bits in the pdra turns on the pulldown devices if the port a pin is an input. reading the pdra returns undefined results since it is a write-only register; therefore, do not change the value in pdra with read/modify/write instructions. on the mc68hc705jp7 the pdra contains two pulldown control bits (pdich and pdicl) for port c. reset clears the pdia5 ? pdia0, pdich, and pdicl bits, which turns on all the port a and port c pulldown devices. pdich ? upper port c pulldown inhibit bits (mc68hc705jp7) writing to this write-only bit controls the port c pulldown devices on the upper four bits (pc4 ? pc7). reading these pulldown register a bits returns undefined data. reset clears bit pdich. 1 = upper four port c pins pulldown devices turned off 0 = upper four port c pins pulldown devices turned on if pin has been programmed by the ddrc to be an input pdicl ? lower port c pulldown inhibit bits (mc68hc705jp7) writing to this write-only bit controls the port c pulldown devices on the lower four bits (pc0 ? pc3). reading these pulldown register a bits returns undefined data. reset clears bit pdicl. 1 = lower four port c pins pulldown devices turned off address: $0010 bit 7654321bit 0 read: write: pdich pdicl pdia5 pdia4 pdia3 pdia2 pdia1 pdia0 reset:00000000 = unimplemented figure 7-3. pulldown register a (pdra) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 88 parallel input/output motorola parallel input/output 0 = lower four port c pins pulldown devices turned on if pin has been programmed by the ddrc to be an input pdia5 ? pdia0 ? port a pulldown inhibit bits writing to these write-only bits controls the port a pulldown devices. reading these pulldown register a bits returns undefined data. reset clears bits pdia5 ? pdia0. 1 = corresponding port a pin pulldown device turned off 0 = corresponding port a pin pulldown device turned on if pin has been programmed by the ddra to be an input 7.3.4 port a external interrupts the pirq bit in the mor enables the pa3 ? pa0 pins to serve as external interrupt pins in addition to the irq /v pp pin. the active interrupt state for the pa3 ? pa0 pins is a logic 1 or a rising edge. a state of the pirq bit in the mor determines whether external interrupt inputs are edge-sensitive only or both edge- and level-sensitive. port a interrupts are also interactive with each other and the irq /v pp pin as described in 4.6 external interrupts . note: when testing for external interrupts, the bih and bil instructions test the voltage on the irq /v pp pin, not the state of the internal irq signal. therefore, bih and bil cannot test the port a external interrupt pins. parallel input/output port a MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 89 7.3.5 port a logic when a pa0:pa5 pin is programmed as an output, reading the port bit actually reads the value of the data latch and not the voltage on the pin itself. when a pa0:pa5 pin is programmed as an input, reading the port bit reads the voltage level on the pin. the data latch can always be written, regardless of the state of its ddr bit. figure 7-4 shows the i/o logic of pa0 ? pa5 pins of port a. the data latch can always be written, regardless of the state of its ddr bits. table 7-1 summarizes the operations of the port a pins. figure 7-4. port a i/o circuit pax external interrupt request port a data register bit pax read $0004 write $0000 read $0000 write $0010 pulldown device reset internal data bus high sink/source current swpdi write $0004 data direction register a bit ddrax pulldown register a bit pdiax r r mask option reg. ($1ff1) capability (pa0:3) table 7-1. port a pin functions port a pin(s) swpdi (in mor) port a porta access (pin or data register) result on port a pins pdiax ddrax (1) read write pulldown pin pa 0 pa 1 pa 2 pa 3 pa 4 pa 5 000pindataonpax in 010pindataoffpax in 1 x 0 pin data off pax in x (2) x (2) 1 data data off pax out 1. ddra can always be read or written. 2. don ? t care advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 90 parallel input/output motorola parallel input/output 7.4 port b port b is an 8-bit, general-purpose, bidirectional i/o port with these features: programmable pulldown devices pb0 ? pb4 are shared with the analog subsystem. pb3 and pb4 are shared with the 16-bit programmable timer. pb4 can be driven directly by the output of comparator 1. pb5 ? pb7 are shared with the simple serial interface (siop). high current sinking capability on the pb4 pin high current sourcing capability on the pb4 pin 7.4.1 port b data register the port b data register (portb) contains a bit for each of the port b pins. when a port b pin is programmed to be an output, the state of its data register bit determines the state of the output pin. when a port b pin is programmed to be an input, reading the port b data register returns the logic state of the pin. reset has no effect on port b data. pb0-pb7 ? port b data bits these read/write bits are software programmable. data direction of each bit is under the control of the corresponding bit in data direction register b. reset has no effect on port b data. address: $0001 bit 7654321bit 0 read: pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 write: reset: unaffected by reset alternate: sck sdi sdo an4 an3 an2 an1 an0 alternate: sck sdi sdo tcmp tcap an2 an1 an0 alternate: sck sdi sdo cmp1 tcap an2 an1 an0 figure 7-5. port b data register (portb) parallel input/output port b MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 91 7.4.2 data direction register b the contents of the port b data direction register (ddrb) determine whether each port b pin is an input or an output. writing a logic 1 to a ddrb bit enables the output buffer for the associated port b pin. a ddrb bit set to a logic 1 also disables the pulldown device for that pin. writing a logic 0 to a ddrb bit disables the output buffer for the associated port b pin. a reset initializes all ddrb bits to logic 0s, configuring all port b pins as inputs. ddrb7 ? ddrb0 ? port b data direction bits these read/write bits control port b data direction. reset clears the bits ddrb7 ? ddrb0. 1 = corresponding port b pin configured as output and pulldown device disabled 0 = corresponding port b pin configured as input address: $0005 bit 7654321bit 0 read: ddrb7 ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 figure 7-6. data direction register b (ddrb) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 92 parallel input/output motorola parallel input/output 7.4.3 pulldown register b all port b pins can have software programmable pulldown devices enabled or disabled globally by the swpdi bit in the mor. these pulldown devices are individually controlled by the write-only pulldown register b (pdrb) shown in figure 7-7 . clearing the pdib7 ? pdib0 bits in the pdrb turns on the pulldown devices if the port b pin is an input. reading the pdrb returns undefined results since it is a write-only register. reset clears the pdib7 ? pdib0 bits, which turns on all the port b pulldown devices. pdib7 ? pdib0 ? port b pulldown inhibit bits writing to these write-only bits controls the port b pulldown devices. reading these pulldown register b bits returns undefined data. reset clears bits pdib7 ? pdib0. 1 = corresponding port b pin pulldown device turned off 0 = corresponding port b pin pulldown device turned on if pin has been programmed by the ddrb to be an input 7.4.4 port b logic all port b pins have the general i/o port logic similar to port a; but they also share this function with inputs or outputs from other modules, which are also attached to the pin itself or override the general i/o function. pb0, pb1, pb2, and pb3 simply share their inputs with another module. pb4, pb5, pb6, and pb7 will have their operation altered by outputs or controls from other modules. address: $0011 bit 7654321bit 0 read: write: pdib7 pdib6 pdib5 pdib4 pdib3 pdib2 pdib1 dib0 reset:00000000 = unimplemented figure 7-7. pulldown register b (pdrb) parallel input/output port b MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 93 7.4.5 pb0, pbi, pb2, and pb3 logic the typical i/o logic shown in figure 7-8 is used for pb0, pb1, pb2, and pb3 pins of port b. when these port b pins are programmed as an output, reading the port bit actually reads the value of the data latch and not the voltage on the pin itself. when these port b pins are programmed as an input, reading the port bit reads the voltage level on the pin. the data latch can always be written, regardless of the state of its ddrb bit. the operations of the pb0 ? pb3 pins are summarized in table 7-2 . figure 7-8. pb0 ? pb3 pin i/o circuit the pb0 ? pb3 pins share their inputs with another module. when using the other attached module, these conditions must be observed: 1. if the ddrb configures the pin as an output, then the port data register can provide an output which may conflict with any external input source to the other module. the pulldown device will be disabled in this case. 2. if the ddrb configures the pin as an input, then reading the port data register will return the state of the input in terms of the digital threshold for that pin (analog inputs will default to logic states). 3. if ddrb configures the pin as an input and the pulldown device is activated for a pin, it will also load the input to the other module. port bdata register bit pbx data direction register b bit ddrbx pulldown register b bit pdibx r r pbx analog subsystem, and programmable timer input capture read $0005 write $0001 read $0001 write $0011 pulldown device reset internal data bus (pins pb0, pb1, pb2, pb3) write $0005 swpdi mask option reg. ($1ff1) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 94 parallel input/output motorola parallel input/output 4. if interaction between the port logic and the other module is not desired, the pin should be configured as an input by clearing the appropriate ddrb bit. the input pulldown device is disabled by clearing the appropriate pdrb bit (or by disabling programmable pulldowns with the swpdi bit in the mor). 7.4.6 pb4/an4/tcmp/cmp1 logic the pb4/an4/tcmp/cmp1 pin can be used as a simple i/o port pin, be controlled by the olvl bit from the output compare function of the 16-bit programmable timer, or be controlled directly by the output of comparator 1 as shown in figure 7-9 . the pb4 data, the programmable timer olvl bit, and the output of comparator 1 are all logically ored together to drive the pin. also, the analog subsystem input channel 4 multiplexer is connected directly to this pin. the operations of pb4 pin are summarized in table 7-2 . figure 7-9. pb4/an4/tcmp/cmp1 pin i/o circuit port bdata register bit pb4 data direction register b bit ddrb4 pulldown register b bit pdib4 r r pb4 analog subsystem input an4 and timer output compare read $0005 write $0001 read $0001 write $0011 pulldown device reset internal data bus write $0005 an4 tcmp olvl swpdi mask option reg. ($1ff1) cmp1 (comparator 1 out) (timer output compare) opt cop register ($1ff0) high sink/ source current capability parallel input/output port b MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 95 when using the pb4/an4/tcmp/cmp1 pin, these interactions must be noted: 1. if the olvl timer output compare function is the required output function, then the ddrb4 bit must be set, the pb4 data bit must be cleared, and the opt bit in the copr must be cleared. the pb4/an4/tcmp/cmp1 pin becomes an output which follows the state of the olvl bit. the pulldown device will be disabled in this case. the analog subsystem would not normally use this pin as an analog input in this case. 2. if the pb4 data bit is the required output function, then the ddrb4 bit must be set, the olvl bit in the tcr must be cleared, and the opt bit in the copr must be cleared. the pulldown device will be disabled in this case. the analog subsystem would not normally use this pin as an analog input in this case. 3. if the comparator 1 output is the desired output function, then the pb4 data bit must be cleared, the ddrb4 bit must be set, the olvl bit in the tcr must be cleared, and the opt bit in the copr must be set. the pb4/an4/tcmp/cmp1 pin becomes an output which follows the state of the olvl bit. the pulldown device will be disabled in this case. the analog subsystem would not normally use this pin as an analog input in this case. 4. if the pb4 pin is to be an input to the analog subsystem or a digital input, then the ddrb4 bit must be cleared. in this case, the pb4 pin can still be read, but the voltage present will be returned as a binary value. depending on the external application, the pb4 pulldown may also be disabled by setting the pdib4 pulldown inhibit bit. in this case, both the digital and analog functions connected to this pin can be utilized. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 96 parallel input/output motorola parallel input/output . 7.4.7 pb5/sdo logic the pb5/sdo pin can be used as a simple i/o port pin or be controlled by the siop serial interface as shown in figure 7-10 . the operations of the pb5 pin are summarized in table 7-3 . when using the pb5/sdo pin, these interactions must be noted: 1. if the siop function is required, then the spe bit in the scr must be set. this causes the pb5/sdo pin buffer to be enabled and to be driven by the serial data output (sdo) from the siop. the pulldown device will be disabled in this case. 2. if the siop function is in control of the pb5/sdo pin, the ddrb5 and pb5 data register bits are still accessible to the cpu and can be altered or read without affecting the siop functionality. however, if the ddrb5 bit is cleared, reading the pb5 data register will return the current state of the pb5/sdo pin. table 7-2. port b pin functions ? pb0 ? pb4 port b pin control bits portb access (pin or data register) result on port b pins comparator 1 timer swpdi in mor port b cmp1 coe1 opt in copr olvl pdibx ddrbx (1) read write pulldown pin pb0 pb1 pb2 pb3 x (2) x (2) x (2) x (2) 000pindataonpbx in 0 1 0 pin data off pbx in 1 x (2) 0 pin data off pbx in x (2) x (2) 1 data data off pbx out pb4 x (2) x (2) x (2) x (2) 000pindataonpb4 in 0 1 0 pin data off pb4 in 1 x (2) 0 pin data off pb4 in x (2) x (2) 00 x (2) x (2) 1 data data off pb4 out x (2) 010 x (2) x (2) 1 data data off pb4 out 01 1 0 x (2) x (2) 1 data data off pb4 out x (2) x (2) x (2) 1 x (2) x (2) 11dataoff1 11 1 x (2) x (2) x (2) 11dataoff1 1. ddrb can always be read or written. 2. don ? t care parallel input/output port b MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 97 figure 7-10 . pb5/sdo pin i/o circuit 3. if the siop function is terminated by clearing the spe bit in the scr, then the last conditions stored in the ddrb5, pdib5, and pb5 register bits will then control the pb5/sdo pin. 4. if the pb5/sdo pin is to be a digital input, then both the spe bit in the scr and the ddrb5 bit must be cleared. depending on the external application, the pulldown device may also be disabled by setting the pdib5 pulldown inhibit bit. 5. if the pb5/sdo pin is to be a digital output, then the spe bit in the scr must be cleared and the pdib5 bit must be set. the pulldown device will be disabled in this case. data direction register b bit ddrb5 port b data register bit pb5 pulldown register b bit pdib5 r r pb5 read $0005 write $0001 read $0001 write $0011 pulldown device reset internal data bus write $0005 sdo serial enable (spe) serial data out (sdo) v dd swpdi mask option reg. ($1ff1) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 98 parallel input/output motorola parallel input/output 7.4.8 pb6/sdi logic the pb6/sdi pin can be used as a simple i/o port pin or be controlled by the siop serial interface as shown in figure 7-11 . the operations of pb6/sdi pin are summarized in table 7-3 . figure 7-11. pb6/sdi pin i/o circuit when using the pb6/sdi pin, these interactions must be noted: 1. if the siop function is required, then the spe bit in the scr must be set. this causes the pb6/sdi pin buffer to be disabled to allow the pb6/sdi pin to act as an input that feeds the serial data input (sdi) of the siop. the pulldown device is disabled in this case. 2. if the siop function is in control of the pb6/sdi pin, the ddrb6 and pb6 data register bits are still accessible to the cpu and can be altered or read without affecting the siop functionality. however, if the ddrb6 bit is cleared, reading the pb6 data register will return the current state of the pb6/sdi pin. data direction register b bit ddrb6 port b data register bit pb6 pulldown register b bit pdib6 r r pb6 read $0005 write $0001 read $0001 write $0011 pulldown device reset internal data bus write $0005 sdi serial enable (spe) serial data in (sdi) swpdi mask option reg. ($1ff1) parallel input/output port b MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 99 3. if the siop function is terminated by clearing the spe bit in the scr, then the last conditions stored in the ddrb6, pdib6, and pb6 register bits will then control the pb6/sdi pin. 4. if the pb6/sdi pin is to be a digital input, then both the spe bit in the scr and the ddrb6 bit must be cleared. depending on the external application, the pulldown device may also be disabled by setting the pdib6 pulldown inhibit bit. 5. if the pb6/sdi pin is to be a digital output, then the spe bit in the scr must be cleared and the ddrb6 bit must be set. the pulldown device will be disabled in this case. 7.4.9 pb7/sck logic the pb7/sck pin can be used as a simple i/o port pin or be controlled by the siop serial interface as shown in figure 7-12 . the operations of the pb7/sck pin are summarized in table 7-3 . figure 7-12. pb7/sck pin i/o circuit data direction register b bit ddrb7 port b data register bit pb7 pulldown register b bit pdib7 r r pb7 read $0005 write $0001 read $0001 write $0011 pulldown device reset internal data bus write $0005 sck serial enable (spe) clock source (mstr) serial data clock (sck) swpdi mask option reg. ($1ff1) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 100 parallel input/output motorola parallel input/output when using the pb7/sck pin, these interactions must be noted: 1. if the siop function is required, then the spe bit in the scr must be set. this causes the pb7/sck pin buffer to be controlled by the mstr control bit in the scr. the pulldown device is disabled in these cases. a. if the mstr bit is set, then the pb7/sck pin buffer will be enabled and driven by the serial data clock (sck) from the siop. b. if the mstr bit is clear, then the pb7/sck pin buffer will be disabled, allowing the pb7/sck pin to drive the serial data clock (sck) into the siop. 2. if the siop function is in control of the pb7/sck pin, the ddrb7 and pb7 data register bits are still accessible to the cpu and can be altered or read without affecting the siop functionality. however, if the ddrb7 bit is cleared, reading the pb7 data register will return the current state of the pb7/sck pin. 3. if the siop function is terminated by clearing the spe bit in the scr, then the last conditions stored in the ddrb7, pdib7, and pb7 register bits will then control the pb7/sck pin. 4. if the pb7/sck pin is to be a digital input, then both the spe bit in the scr and the ddrb7 bit must be cleared. depending on the external application, the pulldown device may also be disabled by setting the pdib7 pulldown inhibit bit. 5. if the pb7/sck pin is to be a digital output, then the spe bit in the scr must be cleared and the ddrb7 bit must be set. the pulldown device will be disabled when the pin is set as an output. parallel input/output port c (28-pin versions only) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 101 7.5 port c (28-pin versions only) port c is an 8-bit, general-purpose, bidirectional i/o port with these features: individual programmable pulldown devices high current sinking capability on all port c pins, with a maximum total for port c high current sourcing capability on all port c pins, with a maximum total for port c table 7-3. port b pin functions ? pb5 ? pb7 port b pin control bits portb access (pin or data register) result on port b pins siop swpdi in mor port b spe mstr pdibx ddrbx (1) read write pulldown pin pb5 0 x (2) 0 0 0 pin data on pb5 in 0 1 0 pin data off pb5 in 1 x 0 pin data off pb5 in x (2) x (2) 1 data data off pb5 out 1 x (2) x (2) x (2) 0 sdo data off sdo out 1 data data off sdo out pb6 0 x (2) 0 0 0 pin data on pb6 in 0 1 0 pin data off pb6 in 1 x (2) 0 pin data off pb6 in x (2) x (2) 1 data data off pb6 out 1 x (2) x (2)) x (2) 0 sdi data off sdi in 1 data data off sdi in pb7 0 x (2) 0 0 0 pin data on pb7 in 0 1 0 pin data off pb7 in 1 x (2) 0 pin data off pb7 in x (2) x (2) 1 data data off pb7 out 1 0 x (2) x (2) 0 sck data off sck in 1datadataoffsck in 1 x (2) x (2) 0 sck data off sck out 1 data data off sck out 1. ddrb can always be read or written. 2. don ? t care advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 102 parallel input/output motorola parallel input/output 7.5.1 port c data register the port c data register (portc) contains a bit for each of the port c pins. when a port c pin is programmed to be an output, the state of its data register bit determines the state of the output pin. when a port c pin is programmed to be an input, reading the port c data register returns the logic state of the pin. pc7 ? pc0 ? port c data bits these read/write bits are software programmable. data direction of each bit is under the control of the corresponding bit in the port c data direction register (ddrc). reset has no effect on port c data. 7.5.2 data direction register c the contents of the port c data direction register (ddrc) determine whether each port c pin is an input or an output. writing a logic 1 to a ddrc bit enables the output buffer for the associated port c pin. a ddrc bit set to a logic 1 also disables the pulldown device for that pin. writing a logic 0 to a ddrc bit disables the output buffer for the associated port c pin. a reset initializes all ddrc bits to logic 0s, configuring all port c pins as inputs. address: $0002 bit 7654321bit 0 read: pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 write: reset: unaffected by reset figure 7-13. port c data register (portc) parallel input/output port c (28-pin versions only) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 103 ddrc7 ? ddrc0 ? port c data direction bits these read/write bits control port c data direction. reset clears the ddrc7 ? ddrc0 bits. 1 = corresponding port c pin configured as output and pulldown device disabled 0 = corresponding port c pin configured as input 7.5.3 port c pulldown devices all port c pins can have software programmable pulldown devices enabled or disabled globally by the swpdi bit in the mor. these pulldown devices are individually controlled by the write-only pulldown register a (pdra) shown in figure 7-3 . pdich controls the upper four pins (pc7 ? pc4) and pdicl controls the lower four pins (pc3 ? pc0). clearing the pdich or pdicl bits in the pdra turns on the pulldown devices if the port c pin is an input. reading the pdra returns undefined results since it is a write-only register. reset clears the pdich and pdicl bits, which turns on all the port c pulldown devices. 7.5.4 port c logic figure 7-15 shows the i/o logic of port c. when a port c pin is programmed as an output, reading the port bit actually reads the value of the data latch and not the voltage on the pin itself. when a port c pin is programmed as an input, reading the port bit reads the voltage level on the pin. the data latch can always be written, regardless of the state of its ddr bit. table 7-4 summarizes the operations of the port c pins. address: $0006 bit 7654321bit 0 read: ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 write: reset:00000000 figure 7-14. data direction register c (ddrc) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 104 parallel input/output motorola parallel input/output figure 7-15. port c i/o circuit pcx port c data register bit pcx read $0006 write $0002 read $0002 write $0010 pulldown device reset internal data bus write $0006 data direction register c bit ddrcx pulldown register a bit pdicx r r swpdi mask option register ($1ff1) high sink/source current capability table 7-4. port c pin functions (28-pin versions only) port c pin(s) control bits portc access (pin or data register) result on port c pins swpdi in mor port c pdich pdicl ddrcx (1) read write pulldown pin pc0 pc1 pc2 pc3 0 x (2) 00 pindataonpcx in 0 x (2) 1 0 pin data off pcx in 1x x (2) 0 pin data off pcx in x (2) x (2) x (2) 1 data data off pcx out pc4 pc5 pc6 pc7 00 x (2) 0 pin data on pcx in 01 x (2) 0 pin data off pcx in 1x x (2) 0 pin data off pcx in x (2) x (2) x (2) 1 data data off pcx out 1. ddrc can always be read or written. 2. don ? t care parallel input/output port transitions MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola parallel input/output 105 7.6 port transitions glitches and temporary floating inputs can occur if the control bits regarding each port i/o pin are not performed in the correct sequence. do not use read-modify-write instructions on pulldown register a or b. avoid glitches on port pins by writing to the port data register before changing data direction register bits from a logic 0 to a logic 1. avoid a floating port input by clearing its pulldown register bit before changing its data direction register bit from a logic 1 to a logic 0. the swpdi bit in the mor turns off all port pulldown devices and disables software control of the pulldown devices. reset has no effect on the pulldown devices when the swpdi bit is set. two or more output pins of the same port can be connected electrically to provide output currents up to the sum of the maximum specified drive currents as defined in 15.8 dc electrical characteristics (5.0 vdc) and 15.9 dc electrical characteristics (3.0 vdc) . care must be taken to ensure that all ganged pins always maintain the same output logic value. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 106 parallel input/output motorola parallel input/output MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 107 advance information ? MC68HC705JJ7/mc68hc705jp7 section 8. analog subsystem 8.1 contents 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 8.3 analog multiplex register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 8.4 analog control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 8.5 analog status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 8.6 a/d conversion methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 8.7 voltage measurement methods . . . . . . . . . . . . . . . . . . . . . . .132 8.7.1 absolute voltage readings . . . . . . . . . . . . . . . . . . . . . . . . 133 8.7.1.1 internal absolute reference . . . . . . . . . . . . . . . . . . . . . 133 8.7.1.2 external absolute reference . . . . . . . . . . . . . . . . . . . . . 134 8.7.2 ratiometric voltage readings . . . . . . . . . . . . . . . . . . . . . . 134 8.7.2.1 internal ratiometric reference . . . . . . . . . . . . . . . . . . .135 8.7.2.2 external ratiometric reference . . . . . . . . . . . . . . . . . . . 136 8.8 voltage comparator features . . . . . . . . . . . . . . . . . . . . . . . . 136 8.8.1 voltage comparator 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.8.2 voltage comparator 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 8.9 current source features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 8.10 internal temperature sensing diode features. . . . . . . . . . . . 138 8.11 sample and hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 8.12 port b interaction with analog inputs . . . . . . . . . . . . . . . . . . .139 8.13 port b pins as inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 8.14 port b pulldowns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 8.15 noise sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 108 analog subsystem motorola analog subsystem 8.2 introduction the analog subsystem of the MC68HC705JJ7/mc68hc705jp7 is based on two on-chip voltage comparators and a selectable current charge/discharge function as shown in figure 8-1 . this configuration provides several features: two independent voltage comparators with external access to both inverting and non-inverting inputs one voltage comparator can be connected as a single-slope analog-to-digital (a/d) and the other connected as a single-voltage comparator. the possible single-slope a/d connection provides these features: ? a/d conversions can use v dd or an external voltage as a reference with software used to calculate ratiometric or absolute results ? channel access of up to four inputs via multiplexer control with independent multiplexer control allowing mixed input connections ? access to v dd and v ss for calibration ? divide by 2 to extend input voltage range ? each comparator can be inverted to calculate input offsets. ? internal sample and hold capacitor ? direct digital output of comparator 1 to the pb4 pin voltages are resolved by measuring the time it takes an external capacitor to charge up to the level of the unknown input voltage being measured. the beginning of the a/d conversion time can be started by several means: output compare from the 16-bit programmable timer timer overflow from the 16-bit programmable timer direct software control via a register bit analog subsystem introduction MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 109 figure 8-1. analog subsystem block diagram analog interrupt pb0 v dd tof ocf an0 charge current chg ? + pb1 an1 v dd pb2 an2 pb3 an3 pb4 an4 inv comp2 portb logic mux4 mux3 mux1 mux2 sample portb logic portb logic portb logic portb logic i chg hold inv dhold v ref mux4 mux3 mux2 mux1 i dischg 2 to 1 mux 16-bit prog. analog tcap internal hc05 bus cmp2 cmp1 cap tcap tcmp mux4 mux3 mux2 channel select bus cp1en mux1 v ref isen cp2en analog control register (acr) icen cpie cp1en cp2en mux register (amux) cpf1 analog status register (asr) cpf2 pb3/an3/tcap timer ? + inv comp1 atd2 atd1 icf control logic v dd temperature diode internal v ref v ss denotes internal analog v ss v ss + ? v aoff $001d $001e $0003 voff opt (copr) 100 mv offset + ? comparator input select and sample control port b control coe1 opt (copr) logic olvl 80 k ? 80 k ? av ss = v ss = v aoff advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 110 analog subsystem motorola analog subsystem the end of the a/d conversion time can be captured by these means: input capture in the 16-bit programmable timer interrupt generated by the comparator output software polling of the comparator output using software loop time 8.3 analog multiplex register the analog multiplex register (amux) controls the general interconnection and operation. the control bits in the amux are shown in figure 8-2 . hold, dhold these read/write bits control the source connection to the negative input of voltage comparator 2 shown in figure 8-3 . this allows the voltage on the internal temperature sensing diode, the channel selection bus, or the divide-by-two channel selection bus to charge the internal sample capacitor and to also be presented to comparator 2. the decoding of these sources is given in table 8-1 . during the hold case when both the hold and dhold bits are clear, the voff bit in the analog status register (asr) can offset the v ss reference on the sample capacitor by approximately 100 mv. this offset source is bypassed whenever the sample capacitor is being charged with either the hold or dhold bit set. the voff bit must be enabled by the opt bit in the copr at location $1ff0. address: $0003 bit 7654321bit 0 read: hold dhold inv vref mux4 mux3 mux2 mux1 write: reset:10000000 figure 8-2. analog multiplex register (amux) analog subsystem analog multiplex register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 111 figure 8-3. comparator 2 input circuit ? + comp2 sample hold dhold cap temperature diode internal voff v ss offset + ? opt (mor) channel pb0 selection bus v dd 80 k ? 80 k ? table 8-1. comparator 2 input sources case hold (amux) dhold (amux) opt (mor) voff (asr) voltage offset source to negative input of comparator 2 hold sample voltage 00 0 x (1) no sample capacitor connected to comparator 2 negative input; very low leakage current. 10 11yes sample capacitor connected to comparator 2 negative input; bottom of capacitor offset from v ss by approximately 100 mv, very low leakage current. divide input 0 1 x (1) x (1) no signal on channel selection bus is divided by 2 and connected to sample capacitor and comparator 2 negative input direct input 1 0 x (1) x (1) no signal on channel selection bus is connected directly to sample capacitor and comparator 2 negative input. internal temperature diode 11 x (1) x (1) no internal temperature sensing diode connected directly to sample capacitor and comparator 2 negative input. 1. don ? t care advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 112 analog subsystem motorola analog subsystem during a reset, the hold bit is set and the dhold bit is cleared, which connects the internal sample capacitor to the channel selection bus. and since a reset also clears the mux[1:4] bits, then the channel selection bus will be connected to v ss and the internal sample capacitor will be discharged to v ss following the reset. note: when sampling a voltage for later conversion, the hold and dhold bits should be cleared before making any changes in the mux channel selection. if the mux channel and the hold/dhold are changed on the same write cycle to the amux register, the sampled voltage may be altered during the channel switching. inv this is a read/write bit that controls the relative polarity of the inherent input offset voltage of the voltage comparators. this bit allows voltage comparisons to be made with both polarities and then averaged together by taking the sum of the two readings and then dividing by 2 (logical shift right). the polarity of the input offset is reversed by interchanging the internal voltage comparator inputs while also inverting the comparator output. this interchange does not alter the action of the voltage comparator output with respect to its port pins. that is, the output will only go high if the voltage on the positive input (pb2 pin for comparator 1 and pb0 pin for comparator 2) is above the voltage on the respective negative input (pb3 pin for comparator 1 and pb1 pin for comparator 2). this is shown schematically in figure 8-4 . this bit is cleared by a reset of the device. 1 = the voltage comparators are internally inverted. 0 = the voltage comparators are not internally inverted. note: the effect of changing the state of the inv bit is to only change the polarity of the input offset voltage. it does not change the output phase of the cpf1 or cpf2 flags with respect to the external port pins. analog subsystem analog multiplex register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 113 figure 8-4. inv bit action note: either comparator may generate an output flag when the inputs are exchanged due to a change in the state of the inv bit. it is therefore recommended that the inv bit not be changed while waiting for a comparator flag. further, any changes to the state of the inv bit should be followed by writing a logic 1 to both the cpfr1 and cpfr2 bits to clear any extraneous cpf1 or cpf2 flags that may have occurred. vref this read/write bit connects the channel select bus to v dd for making a reference voltage measurement. it cannot be selected if any of the other input sources to the channel select bus are selected as shown in table 8-2 . this bit is cleared by a reset of the device. 1 = channel select bus connected to v dd if all mux1:4 are cleared. 0 = channel select bus cannot be connected to v dd . mux1:4 these are read/write bits that connect the analog subsystem pins to the channel select bus and voltage comparator 2 for purposes of making a voltage measurement. they can be selected individually or combined with any of the other input sources to the channel select bus as shown in table 8-2 . note: the v aoff voltage source shown in figure 8-1 depicts a small offset voltage generated by the total chip current passing through the package bond wires and lead frame that are attached to the single v ss pin. this offset raises the internal v ss reference (av ss ) in the analog subsystem v ? v+ inv = 0 + comp v io ? rise when v+ > v ? inv = 1 v+ v ? + comp v io ? rise when v+ > v ? advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 114 analog subsystem motorola analog subsystem with respect to the external v ss pin. turning on the v ss mux to the channel select bus connects it to this internal av ss reference line. when making a/d conversions, this av ss offset gets placed on the external ramping capacitor since the discharge device on the pb0/an0 pin discharges the external capacitor to the internal av ss line. under these circumstances, the positive input (+) to comparator 2 will always be higher than the negative input ( ? ) until the negative input reaches the av ss offset voltage plus any offset in comparator 2. therefore, input voltages cannot be resolved if they are less than the sum of the av ss offset and the comparator offset, because they will always yield a low output from the comparator. table 8-2. channel select bus combinations analog multiplex register channel select bus connected to: vref mux4 mux3 mux2 mux1 v dd pb4/an4/ tcmp pb3/an3/ tcap pb2/an2 pb1/an1 v ss 0 0 0 0 0 hi-z hi-z hi-z hi-z hi-z on x (1) 0 0 0 1 hi-z hi-z hi-z hi-z on hi-z x (1) 0 0 1 0 hi-z hi-z hi-z on hi-z hi-z x (1) 0 0 1 1 hi-z hi-z hi-z on on hi-z x (1) 0 1 0 0 hi-z hi-z on hi-z hi-z hi-z x (1) 0 1 0 1 hi-z hi-z on hi-z on hi-z x (1) 0 1 1 0 hi-z hi-z on on hi-z hi-z x (1) 0 1 1 1 hi-z hi-z on on on hi-z x (1) 1 0 0 0 hi-z on hi-z hi-z hi-z hi-z x (1) 1 0 0 1 hi-z on hi-z hi-z on hi-z x (1) 1 0 1 0 hi-z on hi-z on hi-z hi-z x (1) 1 0 1 1 hi-z on hi-z on on hi-z x (1) 1 1 0 0 hi-z on on hi-z hi-z hi-z x (1) 1 1 0 1 hi-z on on hi-z on hi-z x (1) 1 1 1 0 hi-z on on on hi-z hi-z x (1) 1111hi zon on on onhi z 1. don/t care analog subsystem analog control register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 115 8.4 analog control register the analog control register (acr) controls the power-up, interrupt, and flag operation. the analog subsystem draws current while it is operating. the resulting power consumption can be reduced by powering down the analog subsystem when not in use (refer to 15.6 supply current characteristics (v dd = 4.5 to 5.5 vdc) ). this can be done by clearing three enable bits (isen, cp1en, and cp2en) in the acr at $001d. since these bits are cleared following a reset, the voltage comparators and the charge current source will be powered down following a reset of the device. the control bits in the acr are shown in figure 8-5 . all the bits in this register are cleared by a reset of the device. chg the chg enable bit allows direct control of the charge current source and the discharge device and also reflects the state of the discharge device. this bit is cleared by a reset of the device. 1 = if the isen bit is also set, the charge current source is sourcing current out of the pb0/an0 pin. writing a logic 1 enables the charging current out of the pb0/an0 pin. 0 = the discharge device is sinking current into the pb0/an0 pin. writing a logic 0 disables the charging current and enables the discharging current into the pb0/an0 pin, if the isen bit is also set. address: $001d bit 7654321bit 0 read: chg atd2 atd1 icen cpie cp2en cp1en isen write: reset:00000000 figure 8-5. analog control register (acr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 116 analog subsystem motorola analog subsystem atd1 ? atd2 the atd1 ? atd2 enable bits select one of the four operating modes used for making a/d conversions via the single-slope method.these four modes are given in table 8-3 . these bits have no effect if the isen enable bit is cleared. these bits are cleared by a reset of the device and thereby return the analog subsystem to the manual a/d conversion method. icen this is a read/write bit that enables a voltage comparison to trigger the input capture register of the programmable timer when the cpf2 flag bit is set. therefore, an a/d conversion could be started by receiving an ocf or tof from the programmable timer and then terminated when the voltage on the external ramping capacitor reaches the level of the unknown voltage. the time of termination will be stored in the table 8-3. a/d conversion options a/d option mode charge control a/d options current flow to/from pb0/an0 isen atd2 atd1 chg disabled current source and discharge disabled 0xxx current control disabled, no source or sink current 1001 begin sourcing current when the chg bit is set and continue to source current until the chg bit is cleared. 1101 the chg bit remains set until the next time icf occurs. 3 automatic charge and discharge (ocf ? icf) synchronized to timer 1110 the chg bit remains cleared until the next time ocf occurs. 1111 the chg bit remains set until the next time icf occurs. analog subsystem analog control register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 117 16-bit buffer located at $0014 and $0015. this bit is automatically set whenever mode 2 or 3 is selected by setting the atd2 control bit. this bit is cleared by a reset of the device. 1 = connects the cpf2 flag bit to the timer input capture register 0 = connects the pb3/an3 pin to the timer input capture register note: for the input capture to occur when the output of comparator 2 goes high, the iedg bit in the tcr must also be set. when the icen bit is set, the input capture function of the programmable timer is not connected to the pb3/an3/tcap pin but is driven by the cpf2 output flag from comparator 2. to return to capturing times from external events, the icen bit must first be cleared before the timed event occurs. cpie this is a read/write bit that enables an analog interrupt when either of the cpf1 or cpf2 flag bits is set to a logic 1. this bit is cleared by a reset of the device. 1 = enables analog interrupts when comparator flag bits are set 0 = disables analog interrupts when comparator flag bits are set note: if both the icen and cpie bits are set, they will both generate an interrupt by different paths. one will be the programmable timer interrupt due to the input capture and the other will be the analog interrupt due to the output of comparator 2 going high. in this case, the input capture interrupt will be entered first due to its higher priority. the analog interrupt will then need to be serviced even if the comparator 2 output has been reset or the input capture flag (icf) has been cleared. cp2en the cp2en enable bit controls power to voltage comparator 2 in the analog subsystem. powering down a comparator will drop the supply current. this bit is cleared by a reset of the device. 1 = writing a logic 1 powers up voltage comparator 2. 0 = writing a logic 0 powers down voltage comparator 2. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 118 analog subsystem motorola analog subsystem note: voltage comparators power up slower than digital logic and their outputs may go through indeterminate states which might set their respective flags (cpf1, cpf2). it is therefore recommended to power up the charge current source first (isen), then to power up any comparators, and finally clear the flag bits by writing a logic 1 to the respective cpfr1 or cpfr2 bits in the acr. cp1en the cp1en enable bit will power down the voltage comparator 1 in the analog subsystem. powering down a comparator will drop the supply current. this bit is cleared by a reset of the device. 1 = writing a logic 1 powers up voltage comparator 1 0 = writing a logic 0 powers down voltage comparator 1 isen the isen enable bit will power down the charge current source and disable the discharge device in the analog subsystem. powering down the current source will drop the supply current by about 200 a. this bit is cleared by a reset of the device. 1 = writing a logic 1 powers up the ramping current source and enables the discharge device on the pb0/an0 pin. 0 = writing a logic 0 powers down the ramping current source and disables the discharge device on the pb0/an0 pin. note: the analog subsystem has support circuitry which draws current. this current will be powered down if both comparators and the charge current source are powered down (isen, cp1en, and cp2en all cleared). powering up either comparator or the charge current source will activate the support circuitry. analog subsystem analog status register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 119 8.5 analog status register the analog status register (asr) contains status and control of the comparator flag bits. these bits in the asr are shown in figure 8-6 . all the bits in this register are cleared by a reset of the device. cpf2 this read-only flag bit is edge sensitive to the rising output of comparator 2. it is set when the voltage on the pb0/an0 pin rises above the voltage on a sample capacitor which creates a positive edge on the output of comparator 2, regardless of the state of the inv bit in the amux register. this bit is reset by writing a logic 1 to the cpfr2 reset bit in the asr. this bit is cleared by a reset of the device. 1 = a positive transition on the output of comparator 2 has occurred since the last time the cpf2 flag has been cleared. 0 = a positive transition on the output of comparator 2 has not occurred since the last time the cpf2 flag has been cleared. cpf1 this read-only flag bit is edge sensitive to the rising output of comparator 1. it is set when the voltage on the pb2/an2 pin rises above the voltage on the pn3/an3/tcap pin which creates a positive edge on the output of comparator 1, regardless of the state of the inv bit in the amux register. this bit is reset by writing a logic 1 to the cpfr1 reset bit in the asr. this bit is cleared by a reset of the device. 1 = a positive transition on the output of comparator 1 has occurred since the last time the cpf1 flag has been cleared. 0 = a positive transition on the output of comparator 1 has not occurred since the last time the cpf1 flag has been cleared. address: $001e bit 7654321bit 0 read: cpf2 cpf1 0 0 coe1 voff cmp2 cmp1 write: cpfr2 cpfr1 r reset:00000000 = unimplemented r = reserved figure 8-6. analog status register (asr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 120 analog subsystem motorola analog subsystem cpfr2 writing a logic 1 to this write-only flag clears the cpf2 flag in the asr. writing a logic 0 to this bit has no effect. reading the cpfr2 bit will return a logic 0. by default, this bit looks cleared following a reset of the device. 1 = clears the cpf2 flag bit 0 = no effect cpfr1 writing a logic 1 to this write-only flag clears the cpf1 flag in the asr. writing a logic 0 to this bit has no effect. reading the cpfr1 bit will return a logic 0. by default, this bit looks cleared after a reset of the device. 1 = clears the cpf1 flag bit 0 = no effect note: the cpfr1 and cpfr2 bits should be written with logic 1s following a power-up of either comparator. this will clear out any latched cpf1 or cpf2 flag bits which might have been set during the slower power-up sequence of the analog circuitry. if both inputs to a comparator are above the maximum common-mode input voltage (v dd ? 1.5 v), the output of the comparator is indeterminate and may set the comparator flag. applying a reset to the device may only temporarily clear this flag as long as both inputs of a comparator remain above the maximum common-mode input voltages. voff this read-write bit controls the addition of an offset voltage to the bottom of the sample capacitor. it is not active unless the opt bit in the copr at location $1ff0 is set. any reads of the voff bit location return a logic 0 if the opt bit is clear. during the time that the sample capacitor is connected to an input (either hold or dhold set), the bottom of the sample capacitor is connected to v ss . the voff bit is cleared by a reset of the device. for more information, see 8.11 sample and hold . 1 = enables approximately 100 mv offset to be added to the sample voltage when both the hold and dhold control bits are cleared 0 = connects the bottom of the sample capacitor to v ss analog subsystem analog status register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 121 coe1 this read-write bit controls the output of comparator 1 to the pb4 pin. it is not active unless the opt bit in the copr at location $1ff0 is set. any reads of the coe1 bit location return a logic 0 if the opt bit is clear. the coe1 bit is cleared by a reset of the device. 1 = enables the output of comparator 1 to be ored with the pb4 data bit and olvl bit, if the ddrb4 bit is also set 0 = disables the output of comparator 1 from affecting the pb4 pin cmp2 this read-only bit shows the state of comparator 2 during the time that the bit is read. this bit is therefore the current state of the comparator without any latched history. the cmp2 bit will be high if the voltage on the pb0/an0 pin is greater than the voltage on the pb1/an1 pin, regardless of the state of the inv bit in the amux register. since a reset disables comparator 2, this bit returns a logic 0 following a reset of the device. 1 = the voltage on the positive input on comparator 2 is higher than the voltage on the negative input of comparator 2. 0 = the voltage on the positive input on comparator 2 is lower than the voltage on the negative input of comparator 2. cmp1 this read-only bit shows the state of comparator 1 during the time that the bit is read. this bit is therefore the current state of the comparator without any latched history. the cmp1 bit will be high if the voltage on the pb2/an2 pin is greater than the voltage on the pb3/an3/tcap pin, regardless of the state of the inv bit in the amux register. since a reset disables comparator 1, this bit returns a logic 0 following a reset of the device. 1 = the voltage on the positive input on comparator 1 is higher than the voltage on the negative input of comparator 1. 0 = the voltage on the positive input on comparator 1 is lower than the voltage on the negative input of comparator 1. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 122 analog subsystem motorola analog subsystem 8.6 a/d conversion methods the control bits in the acr provide various options to charge or discharge current through the pb0/an0 pin to perform single-slope a/d conversions using an external capacitor from the pb0/an0 pin to v ss as shown in figure 8-7 . the various a/d conversion triggering options are given in table 8-3 . figure 8-7. single-slope a/d conversion method the top three bits of the acr control the charging and discharging current into or out of the pb0/an0 pin. these three bits will have no effect on the pb0/an0 pin if the isen enable bit is cleared. any clearing of the isen bit will immediately disable both the charge current source and the discharge device. since all these bits and the isen bit are unknown voltage on ( ? ) input charge time to match unknown discharge time to reset capacitor voltage on capacitor connected to (+) input maximum charge time to v dd ? 1.5 vdc v dd ? 1.5 vdc c x v x i v dd + 5 v ramp cap v ss pb0/an0 pb1/an1 pb2/an2 pb3/an3 pb4/an4 unknown or reference MC68HC705JJ7 charge time = mc68hc705jp7 signals analog subsystem a/d conversion methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 123 cleared when the device is reset, the MC68HC705JJ7/mc68hc705jp7 starts with the charge and discharge function disabled. the length of time required to reach the maximum voltage to be measured and the speed of the time counting mechanism will determine the resolution of the reading. the time to ramp the external capacitor voltage to match the maximum voltage is dependent on: charging current to external capacitor value of the external capacitor clock rate for timing function any prescaling of the clock to the timing function desired resolution the charging behavior is described by the general equation: t chg = c ext x v x / i chg where: t chg = charge time (seconds) c ext = capacitance ( f) v x = unknown voltage (volts) i chg = charge current ( a) since the mcu can measure time in a variety of ways, the resolution of the conversion will depend on the length of the time keeping function and its prescaling to the oscillator frequency (f osc ). therefore, the charge time also equals: t chg = p x n / f osc where: p = prescaler value ( 2, 4, 8, etc.) n = number of counts during charge time f osc = oscillator clock frequency (hz) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 124 analog subsystem motorola analog subsystem note: noise on the system ground or the external ramping capacitor can cause the comparator to trip prematurely. therefore, in any given application it is best to use the fastest possible ramp rate (shortest charge time). the previous two equations for the charge time, t chg , can be combined to form the following expression for the full scale count (n fs ) of the measured time versus the full scale unknown voltage (v fs ): n fs = c ext x v fs x f osc / (p x i chg ) since a given timing method has a fixed charge current and prescaler, then the variation in the resultant count for a given unknown voltage is mainly dependent on the operating frequency and the capacitance value used. the desired external capacitance for a given voltage range, f osc , conversion method, and resolution is defined as: c ext = n fs x p x i chg / (v fs x f osc ) note: the value of any capacitor connected directly to the pb0/an0 pin should be limited to less than 2 microfarads. larger capacitances will create high discharge currents which may damage the device or create signal noise. the full scale voltage range for a given capacitance, f osc , conversion method, and resolution is defined as: v fs = n fs x p x i chg / (c ext x f osc ) once charged to a given voltage, a finite amount of time will be required to discharge the capacitor back to its start voltage at v ss . this discharge time will be solely based on the value of capacitance used and the sinking current of the internal discharge device. to allow a reasonable time for the capacitor to return to v ss levels, the discharge time should last about 10 milliseconds per microfarad of capacitance attached to the pb0 pin. if the total charge/discharge cycle time is critical, then the discharge time should be at least 1/10 of the most recent charge time. shorter discharge times may be used if lesser accuracy in the voltage measurement is acceptable. analog subsystem a/d conversion methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 125 note: sufficient time should be allowed to discharge the external capacitor or subsequent charge times will be shortened with resultant errors in timing conversion. table 8-4 gives the range of values of each parameter in the a/d timing conversion and table 8-5 gives some a/d conversion examples for several bit resolutions. the mode selection bits in the acr allow four methods of single-slope a/d conversion. each of these methods is shown in figure 8-8 through figure 8-11 using the signal names and parameters given in table 8-4 . manual start and stop (mode 0) figure 8-8 manual start and automatic discharge (mode 1) figure 8-9 automatic start and stop from tof to icf (mode 2) figure 8-10 automatic start and stop from ocf to icf (mode 3) figure 8-11 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 126 analog subsystem motorola analog subsystem table 8-4. a/d conversion parameters name function min typ max units v x unknown voltage on channel selection bus v ss ? v dd ? 1.5 v v max maximum charging voltage on external capacitor ?? v dd ? 1.5 v i chg charging current on external ramping capacitor v dd = 3 vdc v dd = 5 vdc refer to 15.10 analog subsystem characteristics (5.0 vdc) and 15.11 analog subsystem characteristics (3.0 vdc) i dis discharge current on external ramping capacitor refer to 15.10 analog subsystem characteristics (5.0 vdc) and 15.11 analog subsystem characteristics (3.0 vdc) t chg time to charge external capacitor (100 khz < f osc < 4.0 mhz) 4-bit result 6-bit result 8-bit result 10-bit result 12-bit result 0.032 0.128 0.512 2.048 8.192 0.128 0.512 2.048 8.196 32.768 2.56 10.24 40.96 120 (1) 120 (1) ms t dis time to discharge external capacitor, c ext ? 510ms / f c ext capacitance of external ramping capacitor 0.0001 0.1 2.0 f n number of counts for i chg to charge c ext to v x 1 1024 65536 counts p prescaler into timing function ( p) using core timer using 16-bit programmable timer using software loops 8 8 24 8 8 user defined 8 8 user defined p f osc clock source frequency (excluding any prescaling) refer to 15.12 control timing (5.0 vdc) and 15.13 control timing (3.0 vdc) 1. limited by requirement for c ext to be less than 2.0 f analog subsystem a/d conversion methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 127 table 8-5. sample conversion timing (v dd = 5.0 vdc) bits counts v x (vdc) a/d method clock source f osc (mhz) t chg (ms) c ext ( f) 416 3.5 software loop (12 bus cycles) (24 f osc cycles) mode 0 or 1 (manual) low-power oscillator 0.1 3.840 0.110 external pin oscillator 1.0 0.384 0.011 2.0 0.192 0.006 4.0 0.096 0.003 416 3.5 programmable timer (prescaler = 8) mode 2 or 3 (tof icf or ocf icf) low-power oscillator 0.1 1.280 0.037 external pin oscillator 1.0 0.128 0.004 2.0 0.064 0.002 4.0 0.032 0.001 664 3.5 software loop (12 bus cycles) (24 f osc cycles) mode 0 or 1 (manual) low-power oscillator 0.1 15.36 0.439 external pin oscillator 1.0 1.536 0.044 2.0 0.768 0.022 4.0 0.384 0.011 664 3.5 programmable timer (prescaler = 8) mode 2 or 3 (tof cf or ocf icf) low-power oscillator 0.1 5.120 0.585 external pin oscillator 1.0 0.512 0.059 2.0 0.256 0.029 4.0 0.128 0.015 8 256 3.5 software loop (12 bus cycles) (24 f osc cycles) mode 0 or 1 (manual) low-power oscillator 0.1 61.44 1.755 external pin oscillator 1.0 6.144 0.176 2.0 3.072 0.088 4.0 1.536 0.044 8 256 3.5 programmable timer (prescaler = 8) mode 2 or 3 (tof cf or ocf icf) low-power oscillator 0.1 20.48 0.585 external pin oscillator 1.0 2.048 0.059 2.0 1.024 0.029 4.0 0.512 0.015 10 1024 3.5 programmable timer (prescaler = 8) mode 2 or 3 (tof icf or ocf icf) low-power oscillator 0.1 note 1 note 1 external pin oscillator 1.0 8.192 0.234 2.0 4.096 0.117 4.0 2.048 0.059 12 4096 3.5 programmable timer (prescaler = 8) mode 2 or 3 (tof icf or ocf icf) low-power oscillator 0.1 note 1 note 1 external pin oscillator 1.0 32.768 0.936 2.0 16.384 0.468 4.0 8.192 0.234 1. not usable as the value of c ext would be greater than 2.0 f advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 128 analog subsystem motorola analog subsystem figure 8-8. a/d conversion ? full manual control (mode 0) t dis (min) t chg x i chg c ext t chg t dis v x = t max v max chg comp2 0 tof ocf icf (min) v cap t dis v x 2 3 4 1 5 1 point action software/hardware action dependent variable(s) 0 begin initial discharge and select mode 0 by clearing the chg, atd2, and atd1 control bits in the acr. software write software 1 v cap falls to v ss . wait out minimum t dis time. v max , i dis , c ext 2 stop discharge and begin charge by setting chg control bit in acr. software write software 3 v cap rises to v x and comparator 2 output trips, setting cpf2 and cmp2. wait out t chg time. v x , i chg , c ext 4 v cap reaches v max . none v max , i chg , c ext 5 begin next discharge by clearing the chg control bit in the acr. reset cpf2 by writing a 1 to cpfr2. software write software analog subsystem a/d conversion methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 129 figure 8-9. a/d conversion ? manual/auto discharge control (mode 1) t dis (min) t chg x i chg c ext t chg t dis v x = v max chg comp2 0 tof ocf icf (min) v cap t dis v x 1 2 3 1 2 point action software/hardware action dependent variable(s) 0 begin initial discharge and select mode 1 by clearing chg and atd2 and setting atd1 in the acr. software write software 1 v cap falls to v ss . wait out minimum t dis time. v max , i dis , c ext 2 stop discharge and begin charge by setting chg control bit in acr. software write software 3 v cap rises to v x and comparator 2 output trips, setting cpf2 and cmp2, which clears chg control bit in the acr. reset cpf2 by writing a 1 to cpfr2. wait out t chg time. cpf2 clears chg control bit. v x , i chg , c ext advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 130 analog subsystem motorola analog subsystem figure 8-10. a/d conversion ? tof/icf control (mode 2) t dis (min) t chg x i chg c ext t chg t dis v x = v max chg comp2 0 tof ocf icf (min) v cap t dis v x 1 2 3 1 2 (tcap) point action software/hardware action dependent variable(s) 0 begin initial discharge and select mode 2 by clearing chg and atd1 and setting atd2 in the acr. also set icen bit in acr and iedg bit in tcr. software write software 1 v cap falls to v ss . wait out minimum t dis time. v max , i dis , c ext 2 stop discharge and begin charge when the next tof sets the chg control bit in acr. timer tof sets the chg control bit in the acr. free-running timer counter overflow, f osc 3 v cap rises to v x and comparator 2 output trips, setting cpf2 and cmp2, which causes an icf from the timer and clears the chg control bit in acr. must clear cpf2 to trap next cpf2 flag. wait out t chg time. timer icf clears the chg control bit in the acr. v x , i chg , c ext analog subsystem a/d conversion methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 131 figure 8-11. a/d conversion ? ocf/icf control (mode 3) t dis (min) t chg x i chg c ext t chg t dis v x = v max chg comp2 0 tof ocf icf (min) v cap t dis v x 1 2 3 1 2 (tcap) point action software/hardware action dependent variable(s) 0 begin initial discharge and select mode 3 by clearing chg and setting atd2 and atd1 in the acr. also set icen bit in acr and iedg bit in tcr. software write software 1 v cap falls to v ss . set timer output compare registers (ocrh and ocrl) to desired charge start time. wait out minimum t dis time. software write to ocrh, ocrl v max , i dis , c ext , software 2 stop discharge and begin charge when the next ocf sets the chg control bit in acr. timer ocf sets the chg control bit in the acr. free-running timer output compare, f osc 3 v cap rises to v x and comparator 2 output trips, setting cpf2 and cmp2, which causes an icf from the timer and clears the chg control bit in acr. must clear cpf2 to trap next cpf2 flag. load next ocf. wait out t chg time. timer icf clears the chg control bit in the acr. v x , i chg , c ext advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 132 analog subsystem motorola analog subsystem 8.7 voltage measurement methods the methods for obtaining a voltage measurement can use software techniques to express these voltages as absolute or ratiometric readings. in most applications the external capacitor, the clock source, the reference voltage, and the charging current may vary between devices and with changes in supply voltage or ambient temperature. all of these variations must be considered when determining the desired resolution of the measurement. the maximum and minimum extremes for the full scale count will be: n fsmin = c extmin x v fsmin x f oscmin / (p x i chgmax ) n fsmax = c extmax x v fsmax x f oscmax / (p x i chgmin ) the minimum count should be the desired resolution, and the counting mechanism must be capable of counting to the maximum. the final scaling of the count will be by a math routine which calculates: v x = v ref x (n x ? n off ) / (n ref ? n off ) where: v ref = known reference voltage v x = unknown voltage between v ss and v ref n x = conversion count for unknown voltage n ref = conversion count for known reference voltage (v ref ) n off = conversion count for minimum reference voltage (v ss ) when v ref is a stable voltage source such as a zener or other reference source, then the unknown voltage will be determined as an absolute reading. if v ref is the supply source to the device (v dd ), then the unknown voltage will be determined as a ratio of v dd , or a ratiometric reading. if the unknown voltage applied to the comparator is greater than its common-mode range (v dd ? 1.5 volts), then the external capacitor will try to charge to the same level. this will cause both comparator inputs to be above the common-mode range and the output of the comparator will analog subsystem voltage measurement methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 133 be indeterminate. in this case the comparator output flags may also be set even if the actual voltage on the positive input (+) is less than the voltage on the negative input ( ? ). all a/d conversion methods should have a maximum time check to determine if this case is occurring. once the maximum timeout detection has been made, the state of the comparator outputs can be tested to determine the situation. however, such tests should be carefully designed when using modes 1, 2, or 3 as these modes cause the immediate automatic discharge of the external ramping capacitor before any software check can be made of the output state of comparator 2. note: all a/d conversion methods should include a test for a maximum elapsed time to detect error cases where the inputs may be outside of the design specification. 8.7.1 absolute voltage readings the absolute value of a voltage measurement can be calculated in software by first taking a reference reading from a fixed source and then comparing subsequent unknown voltages to that reading as a percentage of the reference voltage multiplied times the known reference value. the accuracy of absolute readings will depend on the error sources taken into account using the features of the analog subsystem and appropriate software as described in table 8-6 . as can be seen from this table, most of the errors can be reduced by frequent comparisons to a known voltage, use of the inverted comparator inputs, and averaging of multiple samples. 8.7.1.1 internal absolute reference if a stable source of v dd is provided, the reference measurement point can be internally selected. in this case, the reference reading can be taken by setting the v ref bit and clearing the mux1:4 bits in the amux register. this connects the channel selection bus to the v dd pin. to stay within the v max range, the dhold bit should be used to select the 1/2 divided input. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 134 analog subsystem motorola analog subsystem 8.7.1.2 external absolute reference if a stable external source is provided, the reference measurement point can be any one of the channel selected pins from pb1 ? pb4. in this case the reference reading can be taken by setting the mux bit in the amux which connects channel selection bus to the pin connected to the external reference source. if the external reference is greater than v dd ? 1.5 volts, then the dhold bit should be used to select the 1/2 divided input. 8.7.2 ratiometric voltage readings the ratiometric value of a voltage measurement can be calculated in software by first taking a reference reading from a reference source and then comparing subsequent unknown voltages to that reading as a percentage of the reference value. the accuracy of ratiometric readings table 8-6. absolute voltage reading errors error source accuracy improvements possible in hardware in software change in reference voltage provide closer tolerance reference calibration and storage of reference source over temperature and supply voltage change in magnitude of ramp current source not adjustable compare unknown with recent measurement from reference non-linearity of ramp current source vs. voltage not adjustable calibration and storage of voltages at 1/4, 1/2, 3/4, and fs frequency shift in internal low-power oscillator use external oscillator with crystal compare unknown with recent measurement from reference sampling capacitor leakage use faster conversion times compare unknown with recent measurement from reference internal voltage divider ratio not adjustable compare unknown with recent measurement from reference or avoid use of divided input input offset voltage of comparator 2 not adjustable sum two readings on reference or unknown using inv and inv control bit and divide by 2 (average of both) noise internal to mcu close decoupling at v dd and v ss pins and reduce supply source impedance average multiple readings on both the reference and the unknown voltage analog subsystem voltage measurement methods MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 135 will depend on the variety of sources, but will generally be better than for absolute readings. many of these error sources can be taken into account using the features of the analog subsystem and appropriate software as described in table 8-7 . as with absolute measurements, most of the errors can be reduced by frequent comparisons to the reference voltage, use of the inverted comparator inputs, and averaging of multiple samples. 8.7.2.1 internal ratiometric reference if readings are to be ratiometric to v dd , the reference measurement point can be internally selected. in this case the reference reading can be taken by setting the v ref bit and clearing the mux1:4 bits in the amux register which connects the channel selection bus to the v dd pin. in order to stay within the v max range, the dhold bit should be used to select the 1/2 divided input. table 8-7. ratiometric voltage reading errors error source accuracy improvements possible in hardware in software change in reference voltage not required for ratiometric compare unknown with recent measurement from reference change in magnitude of ramp current source not adjustable compare unknown with recent measurement from reference non-linearity of ramp current source vs. voltage not adjustable calibration and storage of voltages at 1/4, 1/2, 3/4, and fs frequency shift in internal low-power oscillator not required for ratiometric compare unknown with recent measurement from reference sampling capacitor leakage use faster conversion times compare unknown with recent measurement from reference internal voltage divider ratio not adjustable compare unknown with recent measurement from reference input offset voltage of comparator 2 not adjustable sum two readings on reference or unknown using inv and inv control bit and divide by 2 (average of both) noise internal to mcu close decoupling at v dd and v ss pins and reduce supply source impedance average multiple readings on both the reference and the unknown voltage advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 136 analog subsystem motorola analog subsystem 8.7.2.2 external ratiometric reference if readings are to be ratiometric to some external source, the reference measurement point can be connected to any one of the channel selected pins from pb1 ? pb4. in this case, the reference reading can be taken by setting the mux bit in the amux which connects channel selection bus to the pin connected to the external reference source. if the external reference is greater than v dd ? 1.5 volts, then the dhold bit should be used to select the 1/2 divided input. 8.8 voltage comparator features the two internal comparators can be used as simple voltage comparators if set up as described in table 8-8 . both comparators can be active in the wait mode and can directly restart the part by means of the analog interrupt. both comparators can also be active in the stop mode, but cannot directly restart the part. however, the comparators can directly drive pb4 which can then be connected externally to activate either a port interrupt on the pa0:3 pins or the irq /v pp pin. 8.8.1 voltage comparator 1 voltage comparator 1 is always connected to two of the port b i/o pins. these pins should be configured as inputs and have their software programmable pulldowns disabled. also, the negative input of voltage comparator 1 is connected to the pb3/an3/tcap and shared with the input capture function of the 16-bit programmable timer. therefore, the timer input capture interrupt should be disabled so that changes in the table 8-8. voltage comparator setup conditions comparator current source enable discharge device disable port b pin as inputs port b pin pulldowns disabled prog. timer input capture source 1 not affected not affected ddrb2 = 0 ddrb3 = 0 pdib2 = 1 pdib3 = 1 not affected 2 isen = 0 isen = 0 ddrb0 = 0 ddrb1 = 0 pdib0 = 1 pdib1 = 1 icen = 0 iedg = 1 analog subsystem voltage comparator features MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 137 voltage on the pb3/an3/tcap pin do not cause unwanted input capture interrupts. the output of comparator 1 can be connected to the port logic driving the pb4/an4/tcmp/cmp1 pin such that the output of the comparator is ored with the pb4 data bit and the olvl bit from the 16-bit timer. this capability requires that the opt bit is set in the copr at location $1ff0 as in figure 8-12 , and the coe1 bit is set in the asr at location $001e. opt ? optional features bit the opt bit enables two additional features: direct drive by comparator 1 output to pb4 and voltage offset capability to sample capacitor in analog subsystem. 1 = optional features enabled 0 = optional features disabled 8.8.2 voltage comparator 2 voltage comparator 2 can be used as a simple comparator if its charge current source and discharge device are disabled by clearing the isen bit in the acr. if the isen bit is set, the internal ramp discharge device connected to pb0/an0 may become active and try to pull down any voltage source that may be connected to that pin. also, since voltage comparator 2 is always connected to two of the port b i/o pins, these pins should be configured as inputs and have their software programmable pulldowns disabled. address: $1ff0 bit 7654321bit 0 read: epmsec opt write: copc reset:u uuuuuuu = unimplemented u = unaffected figure 8-12. cop and security register (copr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 138 analog subsystem motorola analog subsystem 8.9 current source features the internal current source connected to the pb0/an0 pin supplies about 100 a of current when the discharge device is disabled and the current source is active. therefore, this current source can be used in an application if the isen enable bit is set to power up the current source and by setting the a/d conversion method to manual mode 0 (atd1 and atd2 cleared) and the charge current enabled (chg set). 8.10 internal temperature sensing diode features an internal diode is forward biased to v ss and will have its voltage change, v d , for each degree centigrade rise in the temperature of the device. this temperature sensing diode is powered up from a current source only during the time that the diode is selected. when on, this current source typically adds about 30 a to the i dd current. the temperature sensing diode can be selected by setting both the hold and dhold bits in the amux register (see 8.3 analog multiplex register ). 8.11 sample and hold when using the internal sample capacitor to capture a voltage for later conversion, the hold or dhold bit must be cleared first before changing any channel selection. if both the hold (or dhold) bit and the channel selection are changed on the same write cycle, the sample may be corrupted during the switching transitions. note: the sample capacitor can be affected by excessive noise created with respect to the device ? s v ss pin such that it may appear to leak down or charge up depending on the voltage level stored on the sample capacitor. it is recommended to avoid switching large currents through the port pins while a voltage is to remain stored on the sample capacitor. the additional option of adding an offset voltage to the bottom of the sample capacitor allows unknown voltages near v ss to be sampled and then shifted up past the comparator offset and the device offset caused analog subsystem port b interaction with analog inputs MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola analog subsystem 139 by a single v ss return pin. this offset also provides a means to measure the internal v ss level regardless of the comparator offset to determine n off as described in 8.7 voltage measurement methods . in either case the opt bit must be set in the copr located at $1ff0 as in figure 8-12 and the voff bit must be set in the asr. it is not necessary to switch the voff bit during conversions, since the offset is controlled by the hold and dhold bits when the voff is active. refer to 8.3 analog multiplex register for more details on the design and decoding of the sample and hold circuit. 8.12 port b interaction with analog inputs the analog subsystem is connected directly to the port b i/o pins without any intervening gates. it is, therefore, possible to measure the voltages on port b pins set as inputs or to have the analog voltage measurements corrupted by port b pins set as outputs. 8.13 port b pins as inputs all the port b pins will power up as inputs or return to inputs after a reset of the device since the bits in the port b data direction register will be reset. if any port b pins are to be used for analog voltage measurements, they should be left as inputs. in this case, not only can the voltage on the pin be measured, but the logic state of the port b pins can be read from location $0002. 8.14 port b pulldowns all the port b pins have internal software programmable pulldown devices available dependent on the state of the swpdi bit in the mask option register (mor). if the pulldowns are enabled, they will create an approximate 100 a load to any analog source connected to the pin. in some cases, the analog source may be able to supply this current without causing any advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 140 analog subsystem motorola analog subsystem error due to the analog source output impedance. since this may not always be true, it is therefore best to disable port b pulldowns on those pins used for analog input sources. 8.15 noise sensitivity in addition to the normal effects of electrical noise on the analog input signal there can also be other noise-related effects caused by the digital-to-analog interface. since there is only one v ss return for both the digital and the analog subsystems on the device, currents in the digital section may affect the analog ground reference within the device. this can add voltage offsets to measured inputs or cause channel-to-channel crosstalk. to reduce the impact of these effects, there should be no switching of heavy i/o currents to or from the device while there is a critical analog conversion or voltage comparison in process. limiting switched i/o currents to 2 ? 4 ma during these times is recommended. a noise reduction benefit can be gained with 0.1- f bypass capacitors from each analog input (pb4:1) to the v ss pin. also, try to keep all the digital power supply or load currents from passing through any conductors which are the return paths for an analog signal. MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola simple synchronous serial interface 141 advance information ? MC68HC705JJ7/mc68hc705jp7 section 9. simple synchronous serial interface 9.1 contents 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 9.3 siop signal format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 9.3.1 serial clock (sck) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 9.3.2 serial data input (sdi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.3.3 serial data output (sdo). . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.4 siop registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 9.4.1 siop control register (scr). . . . . . . . . . . . . . . . . . . . . . . 145 9.4.2 siop status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.4.3 siop data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 9.2 introduction the simple synchronous serial i/o port (siop) subsystem is designed to provide efficient serial communications with peripheral devices or other mcus. siop is implemented as a 3-wire master/slave system with serial clock (sck), serial data input (sdi), and serial data output (sdo). a block diagram of the siop is shown in figure 9-1 . the siop subsystem shares its input/output pins with port b. when the siop is enabled (spe bit set in the scr), the port b data direction and data registers are bypassed by the siop. the port b data direction and data registers will remain accessible and can be altered by the application software, but these actions will not affect the siop transmitted or received data. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 142 simple synchronous serial interface motorola simple synchronous serial interface figure 9-1. siop block diagram portb logic siop interrupt pb7 sck pb6 sdi pb5 sdo sdr0 sdr1 sdr2 sdr3 sdr4 sdr5 sdr6 sdr7 siop internal m68hc05 bus spe siop control register (scr) spie data register (sdr) dcol siop status register (ssr) spif format control spir 8-bit shift lsbf latch s r register din dout clk clock control mstr cpha spr1 spr0 clock divider oscillator clock q (lsb or msb first) portb logic portb logic and select d0 d1 d2 d3 d4 d5 d6 d7 internal m68hc05 bus comp error 2 $000a $000b $000c simple synchronous serial interface siop signal format MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola simple synchronous serial interface 143 9.3 siop signal format the siop subsystem can be software configured for master or slave operation. no external mode selection inputs are available (for instance, no slave select pin). 9.3.1 serial clock (sck) the state of the sck output remains a fixed logic level during idle periods between data transfers. the edges of sck indicate the beginning of each output data transfer and latch any incoming data received. the first bit of transmitted data is output from the sdo pin on the first falling edge of sck. the first bit of received data is accepted at the sdi pin on the first rising edge of sck after the first falling edge. the transfer is terminated upon the eighth rising edge of sck. the idle state of the sck is determined by the state of the cpha bit in the scr. when the cpha is clear, sck will remain idle at a logic 1 as shown in figure 9-2 . when the cpha is set, sck will remain idle at a logic 0 as shown in figure 9-3 . in both cases, the sdo changes data on the falling edge of the sck, and the sdi latches data in on the rising edge of sck. figure 9-2. siop timing diagram (cpha = 0) sck sdo sdi 100 ns 100 ns bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 (cpha = 0) (idle = 1) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 144 simple synchronous serial interface motorola simple synchronous serial interface figure 9-3. siop timing diagram (cpha = 1) the only difference in the master and slave modes of operation is the sourcing of the sck. in master mode, sck is driven from an internal source within the mcu. in slave mode, sck is driven from a source external to the mcu. the sck frequency is based on one of four divisions of the oscillator clock that is selected by the spr0 and spr1 bits in the scr. 9.3.2 serial data input (sdi) the sdi pin becomes an input as soon as the siop subsystem is enabled. new data is presented to the sdi pin on the falling edge of sck. valid data must be present at least 100 nanoseconds before the rising edge of sck and remain valid for 100 nanoseconds after the rising edge of sck. see figure 9-3 . 9.3.3 serial data output (sdo) the sdo pin becomes an output as soon as the siop subsystem is enabled. the state of the pb5/sdo pin reflects the value of the first bit received on the previous transmission. prior to enabling the siop, the pb5/sdo can be initialized to determine the beginning state. while siop is enabled, the port b logic cannot be used as a standard output since that pin is connected to the last stage of the siop serial shift register. a control bit (lsbf) is included in the scr to allow the data to be transmitted in either the msb first format or the lsb first format. sck sdo sdi 100 ns 100 ns bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 (cpha = 1) (idle = 0) simple synchronous serial interface siop registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola simple synchronous serial interface 145 the first data bit will be shifted out to the sdo pin on the first falling edge of the sck. the remaining data bits will be shifted out to the sdi pin on subsequent falling edges of sck. the sdo pin will present valid data at least 100 nanoseconds before the rising edge of the sck and remain valid for 100 nanoseconds after the rising edge of sck. see figure 9-3 . 9.4 siop registers the siop is programmed and controlled by the siop control register (scr) located at address $000a, the siop status register (ssr) located at address $000b, and the siop data register (sdr) located at address $000c. 9.4.1 siop control register (scr) the siop control register (scr) is located at address $000a and contains seven control bits and a write-only reset of the interrupt flag. figure 9-4 shows the position of each bit in the register and indicates the value of each bit after reset. spie ? serial peripheral interrupt enable bit the spie bit enables the siop to generate an interrupt whenever the spif flag bit in the ssr is set. clearing the spie bit will not affect the state of the spif flag bit and will not terminate a serial interrupt once the interrupt sequence has started. reset clears the spie bit. 1 = serial interrupt enabled 0 = serial interrupt disabled address: $000a bit 7654321bit 0 read: spie spe lsbf mstr 0 cpha spr1 spr0 write: spir reset:00000000 figure 9-4. siop control register (scr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 146 simple synchronous serial interface motorola simple synchronous serial interface note: if the spie bit is cleared just after the serial interrupt sequence has started (for instance, the cpu status is being stacked), then the cpu will be unable to determine the source of the interrupt and will vector to the reset vector as a default. spe ? serial peripheral enable bit the spe bit switches the port b interface such that sdo/pb5 is the serial data output, sdi/pb6 is the serial data input, and sck/pb7 is a serial clock input in the slave mode or a serial clock output in the master mode. the port b ddr and data registers can be manipulated as usual, but these actions will not affect the transmitted or received data. the spe bit is readable and writable at any time, but clearing the spe bit while a transmission is in progress will 1) abort the transmission, 2) reset the serial bit counter, and 3) convert port b to a general-purpose i/o port. reset clears the spe bit. 1 = serial peripheral enabled (port b i/o disabled) 0 = serial peripheral disabled (port b i/o enabled) lsbf ? least significant bit first bit the lsbf bit controls the format of the transmitted and received data to be transferred lsb or msb first. reset clears this bit. 1 = lsb transferred first 0 = msb transferred first mstr ? master mode select bit the mstr bit configures the serial i/o port for master mode. a transfer is initiated by writing to the sdr. also, the sck pin becomes an output providing a synchronous data clock dependent upon the divider of the oscillator frequency selected by the spr0:1 bits. when the device is in master mode, the sdo and sdi pins do not change function. these pins behave exactly the same in both the master and slave modes. the mstr bit is readable and writable at any time regardless of the state of the spe bit. clearing the mstr bit will abort any transfers that may have been in progress. reset clears the mstr bit, placing the siop subsystem in slave mode. 1 = siop set up as master, sck is an output 0 = siop set up as slave, sck is an input simple synchronous serial interface siop registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola simple synchronous serial interface 147 spir ? serial peripheral interrupt reset bit the spir bit is a write-only control to reset the spif flag bit in the ssr. reading the spir bit will return a logic 0. 1 = reset the spif flag bit 0 = no effect cpha ? clock phase bit the cpha bit controls the clock timing and phase in the siop. data is changed on the falling edge of sck and data is captured (read) on the rising edge of sck. this bit is cleared by reset. 1 = sck is idle low 0 = sck is idle high spr0:1 ? serial peripheral clock rate select bits the spr0 and spr1 bits select one of four clock rates given in table 9-1 to be supplied on the pb7/sck pin when the device is configured with the siop as a master (mstr = 1). the fastest rate is when both spr0 and spr1 are set. both the spr0 and spr1 bits are cleared by reset, which places the siop clock selection at the slowest rate. table 9-1. siop clock rate selection spr1 spr0 siop clock rate oscillator frequency divided by: 00 64 01 32 10 16 11 8 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 148 simple synchronous serial interface motorola simple synchronous serial interface 9.4.2 siop status register the siop status register (ssr) is located at address $000b and contains two read-only bits. figure 9-5 shows the position of each bit in the register and indicates the value of each bit after reset. spif ? serial port interrupt flag the spif is a read-only status bit that is set on the last rising edge of sck and indicates that a data transfer has been completed. it has no effect on any future data transfers and can be ignored. the spif bit can be cleared by reading the ssr followed by a read or write of the sdr or by writing a logic 1 to the spir bit in the scr. if the spif is cleared before the last rising edge of sck it will be set again on the last rising edge of sck. reset clears the spif bit. 1 = serial transfer complete, serial interrupt if the spie bit in scr is set 0 = serial transfer in progress or serial interface idle dcol ? data collision bit the dcol is a read-only status bit which indicates that an illegal access of the sdr has occurred. the dcol bit will be set when reading or writing the sdr after the first falling edge of sck and before spif is set. reading or writing the sdr during this time will result in invalid data being transmitted or received. the dcol bit is cleared by reading the ssr (when the spif bit is set) followed by a read or write of the sdr. if the last part of the clearing sequence is address: $000b bit 7654321bit 0 read: spif dcol 000000 write: reset:00000000 = unimplemented figure 9-5. siop status register (ssr) simple synchronous serial interface siop registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola simple synchronous serial interface 149 done after another transfer has started, the dcol bit will be set again. reset clears the dcol bit. 1 = illegal access of the sdr occurred 0 = no illegal access of the sdr detected 9.4.3 siop data register the siop data register (sdr) is located at address $000c and serves as both the transmit and receive data register. writing to this register will initiate a message transmission if the node is in master mode. the siop subsystem is not double buffered and any write to this register will destroy the previous contents. the sdr can be read at any time. however, if a transfer is in progress the results may be ambiguous. writing to the sdr while a transfer is in progress can cause invalid data to be transmitted and/or received. figure 9-6 shows the position of each bit in the register. this register is not affected by reset. address: $000c bit 7654321bit 0 read: bit 7654321bit 0 write: reset: unaffected by reset figure 9-6. siop data register (sdr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 150 simple synchronous serial interface motorola simple synchronous serial interface MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola core timer 151 advance information ? MC68HC705JJ7/mc68hc705jp7 section 10. core timer 10.1 contents 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 10.3 core timer status and control register. . . . . . . . . . . . . . . . . 153 10.4 core timer counter register . . . . . . . . . . . . . . . . . . . . . . . . . 155 10.5 cop watchdog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 10.2 introduction this section describes the operation of the core timer and the computer operating properly (cop) watchdog as shown by the block diagram in figure 10-1 . advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 152 core timer motorola core timer figure 10-1. core timer block diagram bits 0 ? 7 of 15-stage internal data bus ripple counter copr register rti rate select 2 2 2 2 2 2 2 2 reset cop watchdog reset power-on reset internal clock 1024 ctof rtif ctofe rtie ctofr rtifr rt1 rt0 core timer request interrupt core timer status/control register copc 2 2 2 reset core timer counter register overflow reset 4 osc1 2 internal clock $0009 $0008 $1ff0 core timer core timer status and control register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola core timer 153 10.3 core timer status and control register the read/write core timer status and control register (ctscr) contains the interrupt flag bits, interrupt enable bits, interrupt flag bit resets, and the rate selects for the real-time interrupt as shown in figure 10-2 . ctof ? core timer overflow flag this read-only flag becomes set when the first eight stages of the core timer counter roll over from $ff to $00. the ctof flag bit generates a timer overflow interrupt request if ctofe is also set. the ctof flag bit is cleared by writing a logic 1 to the ctofr bit. writing to ctof has no effect. reset clears ctof. 1 = overflow in core timer has occurred. 0 = no overflow of core timer since ctof last cleared rtif ? real-time interrupt flag this read-only flag becomes set when the selected real-time interrupt (rti) output becomes active. rtif generates a real-time interrupt request if rtie is also set. the rtif enable bit is cleared by writing a logic 1 to the rtifr bit. writing to rtif has no effect. reset clears rtif. 1 = overflow in real-time counter has occurred. 0 = no overflow of real-time counter since rtif last cleared address: $0008 bit 7654321bit 0 read: ctof rtif ctofe rtie 00 rt1 rt0 write: ctofr rtifr reset:00000011 = unimplemented figure 10-2. core timer status and control register (ctscr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 154 core timer motorola core timer ctofe ? core timer overflow interrupt enable bit this read/write bit enables core timer overflow interrupts. reset clears ctofe. 1 = core timer overflow interrupts enabled 0 = core timer overflow interrupts disabled rtie ? real-time interrupt enable bit this read/write bit enables real-time interrupts. reset clears rtie. 1 = real-time interrupts enabled 0 = real-time interrupts disabled ctofr ? core timer overflow flag reset bit writing a logic 1 to this write-only bit clears the ctof bit. ctofr always reads as a logic 0. reset does not affect ctofr. 1 = clear ctof flag bit 0 = no effect on ctof flag bit rtifr ? real-time interrupt flag reset bit writing a logic 1 to this write-only bit clears the rtif bit. rtifr always reads as a logic 0. reset does not affect rtifr. 1 = clear rtif flag bit 0 = no effect on rtif flag bit rt1 and rt0 ? real-time interrupt select bits 1 and 0 these read/write bits select one of four real-time interrupt rates, as shown in table 10-1 . because the selected rti output drives the cop watchdog, changing the real -time interrupt rate also changes the counting rate of the cop watchdog. reset sets rt1 and rt0, selecting the longest cop timeout period and longest real-time interrupt period. note: changing rt1 and rt0 when a cop timeout is imminent or uncertain may cause a real-time interrupt request to be missed or an additional real-time interrupt request to be generated. clear the cop timer just before changing rt1 and rt0. core timer core timer counter register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola core timer 155 10.4 core timer counter register a 15-stage ripple counter driven by a divide-by-eight prescaler is the basis of the core timer. the value of the first eight stages is readable at any time from the read-only timer counter register as shown in figure 10-3 . power-on clears the entire counter chain and begins clocking the counter. after the startup delay (16 or 4064 internal bus cycles depending on the delay bit in the mask option register (mor)), the power-on reset circuit is released, clearing the counter again and allowing the mcu to come out of reset. table 10-1. core timer interrupt rates and cop timeout selection timer overflow interrupt period tof = 1/(f osc 2 11 ) (microseconds) rt1 rt0 rti rate = f osc divided by: real-time interrupt period (rti) (milliseconds) cop timeout period cop = 7-to-8 rti periods (milliseconds) @ f osc (mhz) @ f osc (mhz) @ f osc (mhz) 4.2 mhz 2.0 mhz 1.0 mhz 4.2 mhz 2.0 mhz 1.0 mhz 4.2 mhz 2.0 mhz 1.0 mhz minmaxminmaxminmax 488 1024 2048 00 2 15 7.80 16.4 32.8 54.6 62.4 115 131 229 262 01 2 16 15.6 32.8 65.5 109 125 229 262 459 524 10 2 17 31.2 65.5 131 218 250 459 524 918 1049 11 2 18 62.4 131 262 437 499 918 1049 1835 2097 address: $0009 bit 7654321bit 0 read: bit 7 654321bit 0 write: reset:00000000 = unimplemented figure 10-3. core timer counter register (ctcr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 156 core timer motorola core timer each count of the timer counter register takes eight oscillator cycles or four cycles of the internal bus. a timer overflow function at the eighth counter stage allows a timer interrupt every 2048 oscillator clock cycles or every 1024 internal bus cycles. 10.5 cop watchdog four counter stages at the end of the core timer make up the computer operating properly (cop) watchdog which can be enabled by the copen bit in the mor. the cop watchdog is a software error detection system that automatically times out and resets the mcu if the cop watchdog is not cleared periodically by a program sequence. writing a logic 0 to copc bit in the copr register clears the cop watchdog and prevents a cop reset. epmsec ? eprom security (1) bit the epmsec bit is a write-only security bit to protect the contents of the user eprom code stored in locations $0700 ? $1fff. opt ? optional features bit the opt bit enables two additional features: direct drive by comparator outputs to port a and voltage offset capability to sample capacitor in analog subsystem. 1 = optional features enabled 0 = optional features disabled address: $1ff0 bit 7654321bit 0 read: opt write: epmsec copc reset: unaffected by reset = unimplemented figure 10-4. cop and security register (copr) 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the eprom/otprom difficult for unauthorized users. core timer cop watchdog MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola core timer 157 copc ? cop clear bit this write-only bit resets the cop watchdog. the cop watchdog is active in the run, wait, and halt modes of operation if the cop is enabled by setting the copen bit in the mor. the stop instruction disables the cop watchdog by clearing the counter and turning off its clock source. in applications that depend on the cop watchdog, the stop instruction can be disabled by setting the swait bit in the mor. in applications that have wait cycles longer than the cop timeout period, the cop watchdog can be disabled by clearing the copen bit. table 10-2 summarizes recommended conditions for enabling and disabling the cop watchdog. note: if the voltage on the irq /v pp pin exceeds 1.5 v dd , the cop watchdog turns off and remains off until the irq /v pp pin voltage falls below 1.5 v dd . table 10-2. cop watchdog recommendations voltage on irq /v pp pin swait (in mor) (1) 1. the swait bit in the mor converts stop instructions to halt instructions. wait/halt time recommended cop watchdog condition less than 1.5 v dd 1 less than cop timeout period enabled (2) 2. reset the cop watchdog immediately before executing the wait/halt instruction. less than 1.5 v dd 1 greater than cop timeout period disabled less than 1.5 v dd 0 x (3) 3. don ? t care disabled more than 1.5 v dd x x (3) disabled advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 158 core timer motorola core timer MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 159 advance information ? MC68HC705JJ7/mc68hc705jp7 section 11. programmable timer 11.1 contents 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 11.3 timer registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 11.4 alternate counter registers . . . . . . . . . . . . . . . . . . . . . . . . . . 163 11.5 input capture registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 11.6 output compare registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.7 timer control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 11.8 timer status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 11.9 timer operation during wait mode. . . . . . . . . . . . . . . . . . . . . 173 11.10 timer operation during stop mode . . . . . . . . . . . . . . . . . . . . 173 11.11 timer operation during halt mode . . . . . . . . . . . . . . . . . . . . . 173 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 160 programmable timer motorola programmable timer 11.2 introduction the MC68HC705JJ7/mc68hc705jp7 mcu contains a 16-bit programmable timer with an input capture function and an output compare function as shown by the block diagram in figure 11-1 . the basis of the capture/compare timer is a 16-bit free-running counter which increases in count with every four internal bus clock cycles. the counter is the timing reference for the input capture and output compare functions. the input capture and output compare functions provide a means to latch the times at which external events occur, to measure input waveforms, and to generate output waveforms and timing delays. software can read the value in the 16-bit free-running counter at any time without affecting the counter sequence. the input/output (i/o) registers for the input capture and output compare functions are pairs of 8-bit registers, because of the 16-bit timer architecture used. each register pair contains the high and low bytes of that function. generally, accessing the low byte of a specific timer function allows full control of that function; however, an access of the high byte inhibits that specific timer function until the low byte is also accessed. because the counter is 16 bits long and preceded by a fixed divide-by-four prescaler, the counter rolls over every 262,144 internal clock cycles (every 524,288 oscillator clock cycles). timer resolution with a 4-mhz crystal oscillator is 2 microseconds/count. the interrupt capability, the input capture edge, and the output compare state are controlled by the timer control register (tcr) located at $0012, and the status of the interrupt flags can be read from the timer status register (tsr) located at $0013. programmable timer introduction MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 161 figure 11-1. programmable timer overall block diagram iedg olvl icie ocie toie tmrh ($0018) tmrl ($0019) 16-bit counter 4 internal (osc 2) timer control register timer request overflow (tof) reset clock interrupt acrh ($001a) acrl ($001b) 16-bit comparator ocrh ($0016) ocrl ($0017) pin i/o logic pb4 an4 tcmp pb3 an3 tcap edge select & detect icf ocf tof timer status register iedg icf ocf olvl $0012 $0013 internal data bus logic input select mux cpf2 flag icen control bit bit from analog subsystem icrh ($0014) icrl ($0015) d c q analog comp 1 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 162 programmable timer motorola programmable timer 11.3 timer registers the functional block diagram of the 16-bit free-running timer counter and timer registers is shown in figure 11-2 . the timer registers include a transparent buffer latch on the lsb of the 16-bit timer counter. figure 11-2. programmable timer block diagram the timer registers (tmrh and tmrl) shown in figure 11-3 are read-only locations which contain the current high and low bytes of the 16-bit free-running counter. writing to the timer registers has no effect. reset of the device presets the timer counter to $fffc. the tmrl latch is a transparent read of the lsb until a read of the tmrh takes place. a read of the tmrh latches the lsb into the tmrl location until the tmrl is again read. the latched value remains fixed even if multiple reads of the tmrh take place before the next read of the tmrl. therefore, when reading the msb of the timer at tmrh, the lsb of the timer at tmrl must also be read to complete the read sequence. during power-on reset (por), the counter is initialized to $fffc and begins counting after the oscillator startup delay. because the counter is 16 bits and preceded by a fixed prescaler, the value in the counter repeats every 262,144 internal bus clock cycles (524,288 oscillator cycles). toie tmrh ($0018) tmr lsb 16-bit counter 4 internal (osc 2) timer control reg. timer request overflow (tof) reset clock interrupt tmrl ($0019) tof timer status reg. $0012 $0013 internal $fffc data read tmrh read tmrl read latch bus programmable timer alternate counter registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 163 when the free-running counter rolls over from $ffff to $0000, the timer overflow flag bit (tof) is set in the tsr. when the tof is set, it can generate an interrupt if the timer overflow interrupt enable bit (toie) is also set in the tcr. the tof flag bit can only be reset by reading the tmrl after reading the tsr. other than clearing any possible tof flags, reading the tmrh and tmrl in any order or any number of times does not have any effect on the 16-bit free-running counter. note: to prevent interrupts from occurring between readings of the tmrh and tmrl, set the i bit in the condition code register (ccr) before reading tmrh and clear the i bit after reading tmrl. 11.4 alternate counter registers the functional block diagram of the 16-bit free-running timer counter and alternate counter registers is shown in figure 11-4 . the alternate counter registers behave the same as the timer registers, except that any reads of the alternate counter will not have any effect on the tof address: $0018 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 address: $0018 bit 7654321bit 0 read: bit 7 654321bit 0 write: reset:11111100 = unimplemented figure 11-3. programmable timer registers (tmrh and tmrl) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 164 programmable timer motorola programmable timer flag bit and timer interrupts. the alternate counter registers include a transparent buffer latch on the lsb of the 16-bit timer counter. figure 11-4. alternate counter block diagram the alternate counter registers (acrh and acrl) shown in figure 11-5 are read-only locations which contain the current high and low bytes of the 16-bit free-running counter. writing to the alternate counter registers has no effect. reset of the device presets the timer counter to $fffc. the acrl latch is a transparent read of the lsb until a read of the acrh takes place. a read of the acrh latches the lsb into the acrl location until the acrl is again read. the latched value remains fixed even if multiple reads of the acrh take place before the next read of the acrl. therefore, when reading the msb of the timer at acrh, the lsb of the timer at acrl must also be read to complete the read sequence. during power-on reset (por), the counter is initialized to $fffc and begins counting after the oscillator startup delay. because the counter is 16 bits and preceded by a fixed prescaler, the value in the counter repeats every 262,144 internal bus clock cycles (524,288 oscillator cycles). reading the acrh and acrl in any order or any number of times does not have any effect on the 16-bit free-running counter or the tof flag bit. note: to prevent interrupts from occurring between readings of the acrh and acrl, set the i bit in the condition code register (ccr) before reading acrh and clear the i bit after reading acrl. acrh ($001a) tmr lsb 16-bit counter 4 internal (osc 2) reset clock acrl ($001b) internal $fffc data read acrh read acrl read latch bus programmable timer input capture registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 165 11.5 input capture registers the input capture function is a means to record the time at which an event occurs. the source of the event can be the change on an external pin (pb3/an3/tcap) or the cpf2 flag bit of voltage comparator 2 in the analog subsystem. the icen bit in the analog subsystem control register (acr) at $001d selects which source is the input signal. when the input capture circuitry detects an active edge on the selected source, it latches the contents of the free-running timer counter registers into the input capture registers as shown in figure 11-6 . note: both the icen bit in the acr and the iedg bit in the tcr must be set when using voltage comparator 2 to trigger the input capture function. latching values into the input capture registers at successive edges of the same polarity measures the period of the selected input signal. latching the counter values at successive edges of opposite polarity measures the pulse width of the signal. address: $001a bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 address: $001b bit 7654321bit 0 read: bit 7 654321bit 0 write: reset:11111100 = unimplemented figure 11-5. alternate counter registers (acrh and acrl) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 166 programmable timer motorola programmable timer figure 11-6. timer input capture block diagram the input capture registers are made up of two 8-bit read-only registers (icrh and icrl) as shown in figure 11-7 . the input capture edge detector contains a schmitt trigger to improve noise immunity. the edge that triggers the counter transfer is defined by the input edge bit (iedg) in the tcr. reset does not affect the contents of the input capture registers. icie icrh ($0014) 16-bit counter 4 internal (osc 2) timer control reg. timer request input capture (icf) reset clock interrupt icrl ($0015) icf timer status reg. $0012 $0013 internal $fffc data read icrh read icrl latch bus iedg edge select & detect logic iedg pb3 an3 tcap input select mux cpf2 flag icen control bit bit from analog subsystem internal data bus address: $0014 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: unaffected by reset address: $0015 bit 7654321bit 0 read: bit 7 654321bit 0 write: reset: unaffected by reset = unimplemented figure 11-7. input capture registers (icrh and icrl) programmable timer output compare registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 167 the result obtained by an input capture will be one count higher than the value of the free-running timer counter preceding the external transition. this delay is required for internal synchronization. resolution is affected by the prescaler, allowing the free-running timer counter to increment once every four internal clock cycles (eight oscillator clock cycles). reading the icrh inhibits future captures until the icrl is also read. reading the icrl after reading the timer status register (tsr) clears the icf flag bit. there is no conflict between reading the icrl and transfers from the free-running timer counters. the input capture registers always contain the free-running timer counter value which corresponds to the most recent input capture. note: to prevent interrupts from occurring between readings of the icrh and icrl, set the i bit in the condition code register (ccr) before reading icrh and clear the i bit after reading icrl. 11.6 output compare registers the output compare function is a means of generating an output signal when the 16-bit timer counter reaches a selected value as shown in figure 11-8 . software writes the selected value into the output compare registers. on every fourth internal clock cycle (every eight oscillator clock cycles) the output compare circuitry compares the value of the free-running timer counter to the value written in the output compare registers. when a match occurs, the timer transfers the output level (olvl) from the timer control register (tcr) to the pb4/an4/tcmp pin. software can use the output compare register to measure time periods, to generate timing delays, or to generate a pulse of specific duration or a pulse train of specific frequency and duty cycle on the pb4/an4/tcmp pin. the planned action on the pb4/an4/tcmp pin depends on the value stored in the olvl bit in the tcr, and it occurs when the value of the 16-bit free-running timer counter matches the value in the output compare registers shown in figure 11-9 . these registers are read/write bits and are unaffected by reset. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 168 programmable timer motorola programmable timer figure 11-8. timer output compare block diagram ocie ocrh ($0016) 16-bit counter 4 internal (osc 2) timer control reg. timer request output compare reset clock interrupt ocrl ($0017) ocf timer status reg. $0012 $0013 internal $fffc data r/w ocrh r/w ocrl bus olvl pb4 an4 tcmp edge select detect logic olvl 16-bit comparator (ocf) address: $0016 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: unaffected by reset address: $0017 bit 7654321bit 0 read: bit 7654321bit 0 write: reset: unaffected by reset figure 11-9. output compare registers (ocrh and ocrl) programmable timer output compare registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 169 writing to the ocrh before writing to the ocrl inhibits timer compares until the ocrl is written. reading or writing to the ocrl after reading the tcr will clear the output compare flag bit (ocf). the output compare olvl state will be clocked to its output latch regardless of the state of the ocf. to prevent ocf from being set between the time it is read and the time the output compare registers are updated, use this procedure: 1. disable interrupts by setting the i bit in the condition code register. 2. write to the ocrh. compares are now inhibited until ocrl is written. 3. read the tsr to arm the ocf for clearing. 4. enable the output compare registers by writing to the ocrl. this also clears the ocf flag bit in the tsr. 5. enable interrupts by clearing the i bit in the condition code register. a software example of this procedure is shown in table 11-1 . table 11-1. output compare initialization example 9b ... ... b7 b6 bf ... ... 9a 16 13 17 sei ... ... sta lda stx ... ... cli ocrh tsr ocrl disable interrupts ..... ..... inhibit output compare arm ocf flag for clearing ready for next compare, ocf cleared ..... ..... enable interrupts advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 170 programmable timer motorola programmable timer 11.7 timer control register the timer control register (tcr) shown in figure 11-10 , performs the following functions: enables input capture interrupts enables output compare interrupts enables timer overflow interrupts controls the active edge polarity of the tcap signal controls the active level of the tcmp output reset clears all the bits in the tcr with the exception of the iedg bit which is unaffected. icie ? input capture interrupt enable bit this read/write bit enables interrupts caused by an active signal on the tcap pin or from cpf2 flag bit of the analog subsystem voltage comparator 2. reset clears the icie bit. 1 = input capture interrupts enabled 0 = input capture interrupts disabled ocie ? output compare interrupt enable bit this read/write bit enables interrupts caused by an active match of the output compare function. reset clears the ocie bit. 1 = output compare interrupts enabled 0 = output compare interrupts disabled address: $0012 bit 7654321bit 0 read: icie ocie toie 000 iedg olvl write: reset:000000u0 = unimplemented u = unaffected figure 11-10. timer control register (tcr) programmable timer timer status register MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 171 toie ? timer overflow interrupt enable this read/write bit enables interrupts caused by a timer overflow. reset clears the toie bit. 1 = timer overflow interrupts enabled 0 = timer overflow interrupts disabled iedg ? input capture edge select the state of this read/write bit determines whether a positive or negative transition triggers a transfer of the contents of the timer register to the input capture register. this transfer can occur due to transitions on the tcap pin or the cpf2 flag bit of voltage comparator 2. resets have no effect on the iedg bit. 1 = positive edge (low-to-high transition) triggers input capture 0 = negative edge (high-to-low transition) triggers input capture note: the iedg bit must be set when either mode 2 or 3 of the analog subsystem is being used for a/d conversions. otherwise, the input capture will not occur on the rising edge of the comparator 2 flag. olvl ? output compare output level select the state of this read/write bit determines whether a logic 1 or a logic 0 is transferred to the tcmp pin when a successful output compare occurs. reset clears the olvl bit. 1 = signal to tcmp pin goes high on output compare. 0 = signal to tcmp pin goes low on output compare. 11.8 timer status register the timer status register (tsr) shown in figure 11-11 contains flags for these events: an active signal on the tcap pin or the cpf2 flag bit of voltage comparator 2 in the analog subsystem, transferring the contents of the timer registers to the input capture registers a match between the 16-bit counter and the output compare registers, transferring the olvl bit to the pb4/an4/tcmp pin if that pin is set as an output an overflow of the timer registers from $ffff to $0000 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 172 programmable timer motorola programmable timer writing to any of the bits in the tsr has no effect. reset does not change the state of any of the flag bits in the tsr. icf ? input capture flag the icf bit is automatically set when an edge of the selected polarity occurs on the tcap pin. clear the icf bit by reading the timer status register with the icf set, and then reading the low byte (icrl, $0015) of the input capture registers. resets have no effect on icf. ocf ? output compare flag the ocf bit is automatically set when the value of the timer registers matches the contents of the output compare registers. clear the ocf bit by reading the timer status register with the ocf set and then accessing the low byte (ocrl, $0017) of the output compare registers. resets have no effect on ocf. tof ? timer overflow flag the tof bit is automatically set when the 16-bit timer counter rolls over from $ffff to $0000. clear the tof bit by reading the timer status register with the tof set and then accessing the low byte (tmrl, $0019) of the timer registers. resets have no effect on tof. address: $0013 bit 7654321bit 0 read: icf ocf tof 00000 write: reset:uuu00000 = unimplemented u = unaffected figure 11-11. timer status register (tsr) programmable timer timer operation during wait mode MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola programmable timer 173 11.9 timer operation during wait mode during wait mode, the 16-bit timer continues to operate normally and may generate an interrupt to trigger the mcu out of wait mode. 11.10 timer operation during stop mode when the mcu enters stop mode, the free-running counter stops counting (the internal processor clock is stopped). it remains at that particular count value until stop mode is exited by applying a low signal to the irq /v pp pin, at which time the counter resumes from its stopped value as if nothing had happened. if stop mode is exited via an external reset (logic low applied to the reset pin), the counter is forced to $fffc. if a valid input capture edge occurs during stop mode, the input capture detect circuitry will be armed. this action does not set any flags or wake up the mcu, but when the mcu does wake up there will be an active input capture flag (and data) from the first valid edge. if the stop mode is exited by an external reset, no input capture flag or data will be present even if a valid input capture edge was detected during stop mode. 11.11 timer operation during halt mode when the mcu enters halt mode, the functions and states of the 16-bit programmable timer are the same as for wait mode described in 11.9 timer operation during wait mode . advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 174 programmable timer motorola programmable timer MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola personality eprom (peprom) 175 advance information ? MC68HC705JJ7/mc68hc705jp7 section 12. personality eprom (peprom) 12.1 contents 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 12.3 peprom registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 12.3.1 peprom bit select register . . . . . . . . . . . . . . . . . . . . . . . 177 12.3.2 peprom status and control register. . . . . . . . . . . . . . . . 178 12.4 peprom programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 12.5 peprom reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 12.6 peprom erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 12.2 introduction this section describes how to program the 64-bit personality erasable programmable read-only memory (peprom). figure 12-1 shows the structure of the peprom subsystem. note: in packages with no quartz window, the peprom functions as one-time programmable rom (otprom). advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 176 personality eprom (peprom) motorola personality eprom (peprom) figure 12-1. personality eprom block diagram peprom status/control register single sense amplifier pedata 0 0 0 0 0 pepgm peprzf 8-to-1 column decoder and multiplexer 8-to-1 row decoder and multiplexer col 0 col 1 col 2 col 3 col 4 col 5 col 6 col 7 row 0 row 1 row 2 row 3 row 4 row 5 row 6 row 7 v pp switch v pp switch peprom bit select register 0 0 peb5 peb4 peb3 peb2 peb1 peb0 row zero decoder internal data bus internal data bus v pp reset reset $000f $000e personality eprom (peprom) peprom registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola personality eprom (peprom) 177 12.3 peprom registers two i/o registers control programming and reading of the peprom: the peprom bit select register (pebsr) the peprom status and control register (pescr) 12.3.1 peprom bit select register the peprom bit select register (pebsr) selects one of 64 bits in the peprom array. reset clears all the bits in the peprom bit select register. peb7 and peb6 ? not connected to the peprom array these read/write bits are available as storage locations. reset clears peb7 and peb6. peb5 ? peb0 ? peprom bit selects these read/write bits select one of 64 bits in the peprom as shown in table 12-1 . bits peb2 ? 0 select the peprom row, and bits peb5 ? peb3 select the peprom column. reset clears peb5 ? peb0, selecting the peprom bit in row zero, column zero. address: $000e bit 7654321bit 0 read: peb7 peb6 peb5 peb4 peb3 peb2 peb1 peb0 write: reset:00000000 figure 12-2. peprom bit select register (pebsr) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 178 personality eprom (peprom) motorola personality eprom (peprom) 12.3.2 peprom status and control register the peprom status and control register (pescr) controls the peprom programming voltage. this register also transfers the peprom bits to the internal data bus and contains a flag bit when row zero is selected. pedata ? peprom data bit this read-only bit is the output state of the peprom sense amplifier and shows the state of the currently selected bit. the state of the pedata bit does not affect the programming of the bit selected by the pebsr. reset does not affect the pedata bit. 1 = peprom data is a logic 1. 0 = peprom data is a logic 0. pepgm ? peprom program control bit this read/write bit controls the switches that apply the programming voltage from the irq /v pp pin to the selected peprom bit cell. when the pepgm bit is set, the selected bit cell will be programmed to a logic 1, regardless of the state of the pedata bit. reset clears the pepgm bit. 1 = programming voltage applied to array bit 0 = programming voltage not applied to array bit peprzf ? peprom row zero flag this read-only bit is set when the peprom bit select register selects the first row (row zero) of the peprom array. selecting any other row clears peprzf. monitoring peprzf can reduce the code needed to address: $000f bit 7654321bit 0 read: pedata 0 pepgm 0000peprzf write: rrr reset:u0000001 = unimplemented r = reserved u = unaffected figure 12-3. peprom status and control register (pescr) personality eprom (peprom) peprom programming MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola personality eprom (peprom) 179 access one byte of eight peprom locations. reset clears the peprom bit select register, thereby setting the peprzf bit by default. 1 = row zero selected 0 = row zero not selected 12.4 peprom programming factory-provided software for programming the peprom is available on the world wide web at: http://www.motorola.com/mcu/ note: while the pepgm bit is set and the v pp voltage level is applied to the irq /v pp pin, do not access bits that are to be left unprogrammed (erased). to program the peprom bits properly, the v dd voltage must be greater than 4.5 vdc. table 12-1. peprom bit selection pebsr peprom bit selected $00 $01 | v $07 $08 $09 | v $37 $38 $39 | v $3e $3f row 0 row 1 | v row 7 row 0 row 1 | v row 7 row 0 row 1 | v row 6 row 7 column 0 column 0 | v column 0 column 1 column 1 | v column 6 column 7 column 7 | v column 7 column 7 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 180 personality eprom (peprom) motorola personality eprom (peprom) the peprom can also be programmed by user software with the v pp voltage level applied to the irq /v pp pin. this sequence shows how to program each peprom bit: 1. select a peprom bit by writing to the pebsr. 2. set the pepgm bit in the pescr. 3. wait for the programming time, t epgm . 4. clear the pepgm bit. 5. move to next peprom bit to be programmed in step 1. 12.5 peprom reading this sequence shows how to read the peprom: 1. select a bit by writing to the pebsr. 2. read the pedata bit in the pescr. 3. store the pedata bit in ram or in a register. 4. select another bit by changing the pebsr. 5. continue reading and storing the pedata bits until the required personality eprom data is retrieved and stored. reading the peprom is easiest when each peprom column contains one byte. selecting a row 0 bit selects the first bit, and incrementing the peprom bit select register (pebsr) selects the next bit in row 1 from the same column. incrementing pebsr seven more times selects the remaining bits of the column and ends up selecting the bit in row 0 of the next column, thereby setting the row 0 flag, peprzf. note: a peprom byte that has been read can be transferred to the personality eprom bit select register (pebsr) as a temporary storage location such that subsequent reads of the pebsr quickly yield that peprom byte. personality eprom (peprom) peprom erasing MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola personality eprom (peprom) 181 12.6 peprom erasing mcus with windowed packages permit peprom erasing with ultraviolet light. erase the peprom by exposing it to 15 ws/cm 2 of ultraviolet light with a wavelength of 2537 angstroms. position the ultraviolet light source 1 inch from the window. do not use a shortwave filter. the erased state of a peprom bit is a logic 0. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 182 personality eprom (peprom) motorola personality eprom (peprom) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola eprom/otprom 183 advance information ? MC68HC705JJ7/mc68hc705jp7 section 13. eprom/otprom 13.1 contents 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3 eprom registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 13.3.1 eprom programming register . . . . . . . . . . . . . . . . . . . . . 184 13.3.2 mask option register. . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 13.3.3 eprom security bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 13.4 eprom programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.4.1 mor programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.4.2 epmsec programming . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 13.5 eprom erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 13.2 introduction this section describes how to program the 6160-byte erasable programmable read-only memory/one-time programmable read-only memory (eprom/otprom), the mask option register (mor), and the eprom security bit (epmsec). note: in packages with no quartz window, the eprom functions as one-time programmable rom (otprom). advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 184 eprom/otprom motorola eprom/otprom 13.3 eprom registers the eprom programming register (eprog) controls the actual programming of the eprom bytes and the mask option register (mor). the mor controls eight mask options found on the read-only memory (rom) version of this microcontroller unit (mcu). there is an additional eprom bit (epmsec) located at the computer operating properly (cop) address to provide eprom array security. 13.3.1 eprom programming register the eprom programming register (eprog) shown in figure 13-1 contains the control bits for programming the eprom. in normal operation, the eprom programming register contains all logic 0s. epgm ? eprom programming bit this read/write bit applies the voltage from the irq /v pp pin to the eprom. to write the epgm bit, the elat bit must already be set. clearing the elat bit also clears the epgm bit. reset clears epgm. 1 = eprom programming power switched on 0 = eprom programming power switched off mpgm ? mask option register (mor) programming bit this read/write bit applies programming power from the irq /v pp pin to the mor. reset clears mpgm. 1 = mor programming power switched on 0 = mor programming power switched off address: $001c bit 7654321bit 0 read: 00000 elat mpgm epgm write: rrrr reset:00000000 = unimplemented r = reserved for test figure 13-1. eprom programming register (eprog) eprom/otprom eprom registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola eprom/otprom 185 elat ? eprom bus latch bit this read/write bit configures address and data buses for programming the eprom array. eprom data cannot be read when elat is set. clearing the elat bit also clears the epgm bit. reset clears elat. 1 = address and data buses configured for eprom programming of the array. the address and data buses are latched in the eprom array when a subsequent write to the array is made. data in the eprom array cannot be read. 0 = address and data buses configured for normal operation whenever the elat bit is cleared, the epgm bit is also cleared. both the epgm and the elat bit cannot be set using the same write instruction. any attempt to set both the elat and epgm bit on the same write instruction cycle will result in the elat bit being set and the epgm bit being cleared. to program a byte of eprom, manipulate the eprog register as follows: 1. set the elat bit in the eprog register. 2. write the desired data to the desired eprom address. 3. set the epgm bit in the eprog register for the specified programming time, t epgm . 4. clear the elat and epgm bits in the eprog register. 13.3.2 mask option register the mask option register (mor) shown in figure 13-2 is an eprom byte that controls eight mask options. the mor is unaffected by reset. the erased state of the mor is $00. the options that can be programmed by the mor are: 1. port software programmable pulldown devices (enable or disable) 2. startup delay after stop (16 or 4064 cycles) 3. oscillator shunt resistor (2 m ? or open) 4. stop instruction (enable or disable) 5. low-voltage reset (enable or disable) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 186 eprom/otprom motorola eprom/otprom 6. port a external interrupt function (enable or disable) 7. irq trigger sensitivity (edge-triggered only or both edge- and level-triggered) 8. cop watchdog (enable or disable) swpdi ? software pulldown inhibit bit this eprom bit inhibits software control of the port a and port b pulldown devices. 1 = software pulldown inhibited 0 = software pulldown enabled delay ? stop startup delay bit this eprom bit selects the number of bus cycles that must elapse before bus activity begins following a restart from the stop mode. 1 = startup delay is 4064 bus cycles. 0 = startup delay is 16 bus cycles. caution: the 16-cycle delay option will work properly in devices with the internal low-power oscillator or with a steady external clock source. check crystal/ceramic resonator specifications carefully before using the 16-cycle delay option with a crystal or ceramic resonator. oscres ? oscillator resistor bit this eprom bit configures the internal shunt resistor. 1 = oscillator configured with 2 m ? shunt resistor 0 = oscillator configured without a shunt resistor address: $1ff1 bit 76 5 4321bit 0 read: swpdi delay oscres swait lvren pirq level copen write: reset: unaffected by reset erased:00 0 00000 figure 13-2. mask option register (mor) eprom/otprom eprom registers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola eprom/otprom 187 note: the optional oscillator resistor is not recommended for devices that use an external rc oscillator. for such devices, this bit should be left erased as a 0. swait ? stop conversion to wait bit this eprom bit disables the stop instruction and prevents inadvertently turning off the cop watchdog with a stop instruction. when the swait bit is set, a stop instruction puts the mcu in halt mode. halt mode is a wait-like low-power state. the internal oscillator and timer clock continue to run, but the cpu clock stops. when the swait bit is clear, a stop instruction stops the internal oscillator, the internal clock, the cpu clock, the timer clock, and the cop watchdog timer. 1 = stop instruction converted to wait instruction 0 = stop instruction not converted to wait instruction lvren ? low-voltage reset enable bit this eprom bit enables the low-voltage reset (lvr) function. 1 = lvr function enabled 0 = lvr function disabled pirq ? port a irq enable bit this eprom bit enables the pa3 ? pa0 pins to function as external interrupt sources. 1 = pa3 ? pa0 enabled as external interrupt sources 0 = pa3 ? pa0 not enabled as external interrupt sources level ? external interrupt sensitivity bit this eprom bit makes the external interrupt inputs level-triggered as well as edge-triggered 1 = irq /v pp pin negative-edge triggered and low-level triggered; pa3 ? pa0 pins positive-edge triggered and high-level triggered 0 = irq /v pp pin negative-edge triggered only; pa3 ? pa0 pins positive-edge triggered only advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 188 eprom/otprom motorola eprom/otprom copen ? cop watchdog enable bit this eprom bit enables the cop watchdog. 1 = cop watchdog enabled 0 = cop watchdog disabled 13.3.3 eprom security bit an eprom programmable bit is provided at the location of the cop watchdog register at $1ff0 as shown in figure 13-3 . this bit allows control of access to the eprom array. any accesses of the eprom locations will return undefined results when the epmsec bit is set. refer to 13.4.2 epmsec programming for programming instructions. epmsec ? eprom security 1 this eprom write-only bit enables the access to the eprom array. 1 = access to the eprom array in non-user modes is denied. 0 = access to the eprom array in non-user modes is enabled. address: $1ff0 bit 7654321bit 0 read: opt write: epmsec copc reset: unaffected by reset erased: 0 ??????? = unimplemented figure 13-3. eprom security in cop and security register (copr) 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the eprom/otprom difficult for unauthorized users. eprom/otprom eprom programming MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola eprom/otprom 189 13.4 eprom programming a programming board is available from motorola to download to the on-chip eprom/otprom using the factory-provided programming software. factory-provided software for programming the peprom is available on the world wide web at: http://www.motorola.com/mcu/ the programming software copies to the 6144-byte space located at eprom addresses $0700 ? $1eff and to the 16-byte space at addresses $1ff0 ? $1fff which includes the mask option register at address $1ff1, and the security bit at address $1ff0. note: to program the eprom/otprom, mor, or epmsec bits properly, the v dd voltage must be greater than 4.5 volts. 13.4.1 mor programming the contents of the mor should be programmed using the programmer board. to program any bits in the mor, the desired bit states must be written to the mor address and then the mpgm bit in the eprog register must be used. the following sequence will program the mor: 1. write the desired data to the mor location ($1ff1). 2. apply the programming voltage to the irq /v pp pin. 3. set the mpgm bit in the eprog. 4. wait for the programming time, t mpgm . 5. clear the mpgm bit in the eprog. 6. remove the programming voltage from the irq /v pp pin. once the mor bits have been programmed, some of the options may experience glitches in operation after removal of the programming voltage. it is recommended that the part be reset before trying to verify the contents of the user eprom or the mor itself. note: the contents of the eprom or the mor cannot be accessed if the epmsec bit in the copr register has been set. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 190 eprom/otprom motorola eprom/otprom 13.4.2 epmsec programming the epmsec bit is programmable. to program the epmsec bit, the desired state must be written to the cop address and then the mpgm bit in the eprog register must be used. the following sequence will program the epmsec bit: 1. write the desired data to bit 7 of the copr location ($1ff0). 2. apply the programming voltage to the irq /v pp pin. 3. set the mpgm bit in the eprog. 4. wait for the programming time, t mpgm . 5. clear the mpgm bit in the eprog. 6. remove the programming voltage from the irq /v pp pin. once the epmsec bit has been programmed to a logic 1, access to the contents of the eprom and mor in the expanded non-user modes will be denied. it is therefore recommended that the user eprom and mor in the part first be programmed and fully verified before setting the epmsec bit. 13.5 eprom erasing mcus with windowed packages permit eprom erasing with ultraviolet light. erase the eprom by exposing it to 15 ws/cm 2 of ultraviolet light with a wavelength of 2537 angstroms. position the ultraviolet light source 1 inch from the window. do not use a shortwave filter. the erased state of an eprom bit is a logic 0. note: unlike many commercial eproms, an erased eprom byte in the mcu will read as $00. all unused locations should be programmed as 0s. MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 191 advance information ? MC68HC705JJ7/mc68hc705jp7 section 14. instruction set 14.1 contents 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 14.3 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.3.1 inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.3.2 immediate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 14.3.3 direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.4 extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 14.3.5 indexed, no offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.6 indexed, 8-bit offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14.3.7 indexed, 16-bit offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . .194 14.3.8 relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 14.4 instruction types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 14.4.1 register/memory instructions. . . . . . . . . . . . . . . . . . . . . . . 195 14.4.2 read-modify-write instructions . . . . . . . . . . . . . . . . . . . . . 196 14.4.3 jump/branch instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 197 14.4.4 bit manipulation instructions . . . . . . . . . . . . . . . . . . . . . . . 199 14.4.5 control instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 14.5 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 14.6 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 14.2 introduction the microcontroller unit (mcu) instruction set has 62 instructions and uses eight addressing modes. the instructions include all those of the m146805 cmos family plus one more: the unsigned multiply (mul) instruction. the mul instruction allows unsigned multiplication of the contents of the accumulator (a) and the index register (x). the advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 192 instruction set motorola instruction set high-order product is stored in the index register, and the low-order product is stored in the accumulator. 14.3 addressing modes the cpu uses eight addressing modes for flexibility in accessing data. the addressing modes provide eight different ways for the cpu to find the data required to execute an instruction. the eight addressing modes are: inherent immediate direct extended indexed, no offset indexed, 8-bit offset indexed, 16-bit offset relative 14.3.1 inherent inherent instructions are those that have no operand, such as return from interrupt (rti) and stop (stop). some of the inherent instructions act on data in the cpu registers, such as set carry flag (sec) and increment accumulator (inca). inherent instructions require no operand address and are one byte long. 14.3.2 immediate immediate instructions are those that contain a value to be used in an operation with the value in the accumulator or index register. immediate instructions require no operand address and are two bytes long. the opcode is the first byte, and the immediate data value is the second byte. instruction set addressing modes MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 193 14.3.3 direct direct instructions can access any of the first 256 memory locations with two bytes. the first byte is the opcode, and the second is the low byte of the operand address. in direct addressing, the cpu automatically uses $00 as the high byte of the operand address. 14.3.4 extended extended instructions use three bytes and can access any address in memory. the first byte is the opcode; the second and third bytes are the high and low bytes of the operand address. when using the motorola assembler, the programmer does not need to specify whether an instruction is direct or extended. the assembler automatically selects the shortest form of the instruction. 14.3.5 indexed, no offset indexed instructions with no offset are 1-byte instructions that can access data with variable addresses within the first 256 memory locations. the index register contains the low byte of the effective address of the operand. the cpu automatically uses $00 as the high byte, so these instructions can address locations $0000 ? $00ff. indexed, no offset instructions are often used to move a pointer through a table or to hold the address of a frequently used random-access memory (ram) or input/output (i/o) location. 14.3.6 indexed, 8-bit offset indexed, 8-bit offset instructions are 2-byte instructions that can access data with variable addresses within the first 511 memory locations. the cpu adds the unsigned byte in the index register to the unsigned byte following the opcode. the sum is the effective address of the operand. these instructions can access locations $0000 ? $01fe. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 194 instruction set motorola instruction set indexed 8-bit offset instructions are useful for selecting the kth element in an n-element table. the table can begin anywhere within the first 256 memory locations and could extend as far as location 510 ($01fe). the k value is typically in the index register, and the address of the beginning of the table is in the byte following the opcode. 14.3.7 indexed, 16-bit offset indexed, 16-bit offset instructions are 3-byte instructions that can access data with variable addresses at any location in memory. the cpu adds the unsigned byte in the index register to the two unsigned bytes following the opcode. the sum is the effective address of the operand. the first byte after the opcode is the high byte of the 16-bit offset; the second byte is the low byte of the offset. indexed, 16-bit offset instructions are useful for selecting the kth element in an n-element table anywhere in memory. as with direct and extended addressing, the motorola assembler determines the shortest form of indexed addressing. 14.3.8 relative relative addressing is only for branch instructions. if the branch condition is true, the cpu finds the effective branch destination by adding the signed byte following the opcode to the contents of the program counter. if the branch condition is not true, the cpu goes to the next instruction. the offset is a signed, two ? s complement byte that gives a branching range of ? 128 to +127 bytes from the address of the next location after the branch instruction. when using the motorola assembler, the programmer does not need to calculate the offset, because the assembler determines the proper offset and verifies that it is within the span of the branch. instruction set instruction types MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 195 14.4 instruction types the mcu instructions fall into the following five categories: register/memory instructions read-modify-write instructions jump/branch instructions bit manipulation instructions control instructions 14.4.1 register/memory instructions these instructions operate on cpu registers and memory locations. most of them use two operands. one operand is in either the accumulator or the index register. the cpu finds the other operand in memory. table 14-1. register/memory instructions instruction mnemonic add memory byte and carry bit to accumulator adc add memory byte to accumulator add and memory byte with accumulator and bit test accumulator bit compare accumulator cmp compare index register with memory byte cpx exclusive or accumulator with memory byte eor load accumulator with memory byte lda load index register with memory byte ldx multiply mul or accumulator with memory byte ora subtract memory byte and carry bit from accumulator sbc store accumulator in memory sta store index register in memory stx subtract memory byte from accumulator sub advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 196 instruction set motorola instruction set 14.4.2 read-modify-write instructions these instructions read a memory location or a register, modify its contents, and write the modified value back to the memory location or to the register. note: do not use read-modify-write operations on write-only registers. table 14-2. read-modify-write instructions instruction mnemonic arithmetic shift left (same as lsl) asl arithmetic shift right asr bit clear bclr (1) 1. unlike other read-modify-write instructions, bclr and bset use only direct addressing. bit set bset (1) clear register clr complement (one ? s complement) com decrement dec increment inc logical shift left (same as asl) lsl logical shift right lsr negate (two ? s complement) neg rotate left through carry bit rol rotate right through carry bit ror test for negative or zero tst (2) 2. tst is an exception to the read-modify-write sequence be- cause it does not write a replacement value. instruction set instruction types MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 197 14.4.3 jump/branch instructions jump instructions allow the cpu to interrupt the normal sequence of the program counter. the unconditional jump instruction (jmp) and the jump-to-subroutine instruction (jsr) have no register operand. branch instructions allow the cpu to interrupt the normal sequence of the program counter when a test condition is met. if the test condition is not met, the branch is not performed. the brclr and brset instructions cause a branch based on the state of any readable bit in the first 256 memory locations. these 3-byte instructions use a combination of direct addressing and relative addressing. the direct address of the byte to be tested is in the byte following the opcode. the third byte is the signed offset byte. the cpu finds the effective branch destination by adding the third byte to the program counter if the specified bit tests true. the bit to be tested and its condition (set or clear) is part of the opcode. the span of branching is from ? 128 to +127 from the address of the next location after the branch instruction. the cpu also transfers the tested bit to the carry/borrow bit of the condition code register. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 198 instruction set motorola instruction set table 14-3. jump and branch instructions instruction mnemonic branch if carry bit clear bcc branch if carry bit set bcs branch if equal beq branch if half-carry bit clear bhcc branch if half-carry bit set bhcs branch if higher bhi branch if higher or same bhs branch if irq /v pp pin high bih branch if irq /v pp pin low bil branch if lower blo branch if lower or same bls branch if interrupt mask clear bmc branch if minus bmi branch if interrupt mask set bms branch if not equal bne branch if plus bpl branch always bra branch if bit clear brclr branch never brn branch if bit set brset branch to subroutine bsr unconditional jump jmp jump to subroutine jsr instruction set instruction types MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 199 14.4.4 bit manipulation instructions the cpu can set or clear any writable bit in the first 256 bytes of memory, which includes i/o registers and on-chip ram locations. the cpu can also test and branch based on the state of any bit in any of the first 256 memory locations. table 14-4. bit manipulation instructions instruction mnemonic bit clear bclr branch if bit clear brclr branch if bit set brset bit set bset advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 200 instruction set motorola instruction set 14.4.5 control instructions these instructions act on central processor unit (cpu) registers and control cpu operation during program execution. table 14-5. control instructions instruction mnemonic clear carry bit clc clear interrupt mask cli no operation nop reset stack pointer rsp return from interrupt rti return from subroutine rts set carry bit sec set interrupt mask sei stop oscillator and enable irq /v pp pin stop software interrupt swi transfer accumulator to index register tax transfer index register to accumulator txa stop cpu clock and enable interrupts wait instruction set instruction set summary MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 201 14.5 instruction set summary . table 14-6. instruction set summary (sheet 1 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc adc # opr adc opr adc opr adc opr ,x adc opr ,x adc ,x add with carry a (a) + (m) + (c) ? imm dir ext ix2 ix1 ix a9 b9 c9 d9 e9 f9 ii dd hh ll ee ff ff 2 3 4 5 4 3 add # opr add opr add opr add opr ,x add opr ,x add ,x add without carry a (a) + (m) ? imm dir ext ix2 ix1 ix ab bb cb db eb fb ii dd hh ll ee ff ff 2 3 4 5 4 3 and # opr and opr an d opr and opr ,x and opr ,x and ,x logical and a (a) (m) ?? ? imm dir ext ix2 ix1 ix a4 b4 c4 d4 e4 f4 ii dd hh ll ee ff ff 2 3 4 5 4 3 asl opr asla aslx asl opr ,x asl ,x arithmetic shift left (same as lsl) ?? dir inh inh ix1 ix 38 48 58 68 78 dd ff 5 3 3 6 5 asr opr asra asrx asr opr ,x asr ,x arithmetic shift right ?? dir inh inh ix1 ix 37 47 57 67 77 dd ff 5 3 3 6 5 bcc rel branch if carry bit clear pc (pc) + 2 + rel ? c = 0 ????? rel 24 rr 3 bclr n opr clear bit n mn 0 ????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 11 13 15 17 19 1b 1d 1f dd dd dd dd dd dd dd dd 5 5 5 5 5 5 5 5 bcs rel branch if carry bit set (same as blo) pc (pc) + 2 + rel ? c = 1 ????? rel 25 rr 3 beq rel branch if equal pc (pc) + 2 + rel ? z = 1 ????? rel 27 rr 3 c b0 b7 0 b0 b7 c advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 202 instruction set motorola instruction set bhcc rel branch if half-carry bit clear pc (pc) + 2 + rel ? h = 0 ????? rel 28 rr 3 bhcs rel branch if half-carry bit set pc (pc) + 2 + rel ? h = 1 ????? rel 29 rr 3 bhi rel branch if higher pc (pc) + 2 + rel ? c z = 0 ????? rel 22 rr 3 bhs rel branch if higher or same pc (pc) + 2 + rel ? c = 0 ????? rel 24 rr 3 bih rel branch if irq pin high pc (pc) + 2 + rel ? irq = 1 ????? rel 2f rr 3 bil rel branch if irq pin low pc (pc) + 2 + rel ? irq = 0 ????? rel 2e rr 3 bit # opr bit opr bit opr bit opr ,x bit opr ,x bit ,x bit test accumulator with memory byte (a) (m) ?? ? imm dir ext ix2 ix1 ix a5 b5 c5 d5 e5 f5 ii dd hh ll ee ff ff p 2 3 4 5 4 3 blo rel branch if lower (same as bcs) pc (pc) + 2 + rel ? c = 1 ????? rel 25 rr 3 bls rel branch if lower or same pc (pc) + 2 + rel ? c z = 1 ????? rel 23 rr 3 bmc rel branch if interrupt mask clear pc (pc) + 2 + rel ? i = 0 ????? rel 2c rr 3 bmi rel branch if minus pc (pc) + 2 + rel ? n = 1 ????? rel 2b rr 3 bms rel branch if interrupt mask set pc (pc) + 2 + rel ? i = 1 ????? rel 2d rr 3 bne rel branch if not equal pc (pc) + 2 + rel ? z = 0 ????? rel 26 rr 3 bpl rel branch if plus pc (pc) + 2 + rel ? n = 0 ????? rel 2a rr 3 bra rel branch always pc (pc) + 2 + rel ? 1 = 1 ????? rel 20 rr 3 brclr n opr rel branch if bit n clear pc (pc) + 2 + rel ? mn = 0 ???? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 01 03 05 07 09 0b 0d 0f dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 table 14-6. instruction set summary (sheet 2 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc instruction set instruction set summary MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 203 brset n opr rel branch if bit n set pc (pc) + 2 + rel ? mn = 1 ???? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 00 02 04 06 08 0a 0c 0e dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 brn rel branch never pc (pc) + 2 + rel ? 1 = 0 ????? rel 21 rr 3 bset n opr set bit n mn 1 ????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 10 12 14 16 18 1a 1c 1e dd dd dd dd dd dd dd dd 5 5 5 5 5 5 5 5 bsr rel branch to subroutine pc (pc) + 2; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1 pc (pc) + rel ????? rel ad rr 6 clc clear carry bit c 0 ???? 0inh98 2 cli clear interrupt mask i 0 ? 0 ??? inh 9a 2 clr opr clra clrx clr opr ,x clr ,x clear byte m $00 a $00 x $00 m $00 m $00 ?? 01 ? dir inh inh ix1 ix 3f 4f 5f 6f 7f dd ff 5 3 3 6 5 cmp # opr cmp opr cmp opr cmp opr ,x cmp opr ,x cmp ,x compare accumulator with memory byte (a) ? (m) ?? imm dir ext ix2 ix1 ix a1 b1 c1 d1 e1 f1 ii dd hh ll ee ff ff 2 3 4 5 4 3 com opr coma comx com opr ,x com ,x complement byte (one ? s complement) m () = $ff ? (m) a () = $ff ? (m) x () = $ff ? (m) m () = $ff ? (m) m () = $ff ? (m) ?? 1 dir inh inh ix1 ix 33 43 53 63 73 dd ff 5 3 3 6 5 table 14-6. instruction set summary (sheet 3 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc m a x m m advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 204 instruction set motorola instruction set cpx # opr cpx opr cpx opr cpx opr ,x cpx opr ,x cpx ,x compare index register with memory byte (x) ? (m) ?? 1 imm dir ext ix2 ix1 ix a3 b3 c3 d3 e3 f3 ii dd hh ll ee ff ff 2 3 4 5 4 3 dec opr deca decx dec opr ,x dec ,x decrement byte m (m) ? 1 a (a) ? 1 x (x) ? 1 m (m) ? 1 m (m) ? 1 ?? ? dir inh inh ix1 ix 3a 4a 5a 6a 7a dd ff 5 3 3 6 5 eor # opr eor opr eor opr eor opr ,x eor opr ,x eor ,x exclusive or accumulator with memory byte a (a) (m) ?? ? imm dir ext ix2 ix1 ix a8 b8 c8 d8 e8 f8 ii dd hh ll ee ff ff 2 3 4 5 4 3 inc opr inca incx inc opr ,x inc ,x increment byte m (m) + 1 a (a) + 1 x (x) + 1 m (m) + 1 m (m) + 1 ?? ? dir inh inh ix1 ix 3c 4c 5c 6c 7c dd ff 5 3 3 6 5 jmp opr jmp opr jmp opr ,x jmp opr ,x jmp ,x unconditional jump pc jump address ????? dir ext ix2 ix1 ix bc cc dc ec fc dd hh ll ee ff ff 2 3 4 3 2 jsr opr jsr opr jsr opr ,x jsr opr ,x jsr ,x jump to subroutine pc (pc) + n (n = 1, 2, or 3) push (pcl); sp (sp) ? 1 push (pch); sp (sp) ? 1 pc conditional address ????? dir ext ix2 ix1 ix bd cd dd ed fd dd hh ll ee ff ff 5 6 7 6 5 lda # opr lda opr lda opr lda opr ,x lda opr ,x lda ,x load accumulator with memory byte a (m) ?? ? imm dir ext ix2 ix1 ix a6 b6 c6 d6 e6 f6 ii dd hh ll ee ff ff 2 3 4 5 4 3 table 14-6. instruction set summary (sheet 4 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc instruction set instruction set summary MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 205 ldx # opr ldx opr ldx opr ldx opr ,x ldx opr ,x ldx ,x load index register with memory byte x (m) ?? ? imm dir ext ix2 ix1 ix ae be ce de ee fe ii dd hh ll ee ff ff 2 3 4 5 4 3 lsl opr lsla lslx lsl opr ,x lsl ,x logical shift left (same as asl) ?? ? dir inh inh ix1 ix 38 48 58 68 78 dd ff 5 3 3 6 5 lsr opr lsra lsrx lsr opr ,x lsr ,x logical shift right ?? 0 dir inh inh ix1 ix 34 44 54 64 74 dd ff 5 3 3 6 5 mul unsigned multiply x : a (x) (a) 0 ??? 0 inh 42 11 neg opr nega negx neg opr ,x neg ,x negate byte (two ? s complement) m ? (m) = $00 ? (m) a ? (a) = $00 ? (a) x ? (x) = $00 ? (x) m ? (m) = $00 ? (m) m ? (m) = $00 ? (m) ?? dir inh inh ix1 ix 30 40 50 60 70 ii ff 5 3 3 6 5 nop no operation ????? inh 9d 2 ora # opr ora opr ora opr ora opr ,x ora opr ,x ora ,x logical or accumulator with memory a (a) (m) ?? ? imm dir ext ix2 ix1 ix aa ba ca da ea fa ii dd hh ll ee ff ff 2 3 4 5 4 3 rol opr rola rolx rol opr ,x rol ,x rotate byte left through carry bit ?? dir inh inh ix1 ix 39 49 59 69 79 dd ff 5 3 3 6 5 ror opr rora rorx ror opr ,x ror ,x rotate byte right through carry bit ?? dir inh inh ix1 ix 36 46 56 66 76 dd ff 5 3 3 6 5 rsp reset stack pointer sp $00ff ????? inh 9c 2 table 14-6. instruction set summary (sheet 5 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc c b0 b7 0 b0 b7 c 0 c b0 b7 b0 b7 c advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 206 instruction set motorola instruction set rti return from interrupt sp (sp) + 1; pull (ccr) sp (sp) + 1; pull (a) sp (sp) + 1; pull (x) sp (sp) + 1; pull (pch) sp (sp) + 1; pull (pcl) ? inh 80 6 rts return from subroutine sp (sp) + 1; pull (pch) sp (sp) + 1; pull (pcl) inh sbc # opr sbc opr sbc opr sbc opr ,x sbc opr ,x sbc ,x subtract memory byte and carry bit from accumulator a (a) ? (m) ? (c) ?? imm dir ext ix2 ix1 ix a2 b2 c2 d2 e2 f2 ii dd hh ll ee ff ff 2 3 4 5 4 3 sec set carry bit c 1 ???? 1inh99 2 sei set interrupt mask i 1 ? 1 ??? inh 9b 2 sta opr sta opr sta opr ,x sta opr ,x sta ,x store accumulator in memory m (a) ?? ? dir ext ix2 ix1 ix b7 c7 d7 e7 f7 dd hh ll ee ff ff 4 5 6 5 4 stop stop oscillator and enable irq pin ? 0 ??? inh 8e 2 stx opr stx opr stx opr ,x stx opr ,x stx ,x store index register in memory m (x) ?? ? dir ext ix2 ix1 ix bf cf df ef ff dd hh ll ee ff ff 4 5 6 5 4 sub # opr sub opr sub opr sub opr ,x sub opr ,x sub ,x subtract memory byte from accumulator a (a) ? (m) ?? imm dir ext ix2 ix1 ix a0 b0 c0 d0 e0 f0 ii dd hh ll ee ff ff 2 3 4 5 4 3 swi software interrupt pc (pc) + 1; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1; push (x) sp (sp) ? 1; push (a) sp (sp) ? 1; push (ccr) sp (sp) ? 1; i 1 pch interrupt vector high byte pcl interrupt vector low byte ? 1 ??? inh 83 10 table 14-6. instruction set summary (sheet 6 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc instruction set opcode map MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola instruction set 207 14.6 opcode map see table 14-7 . tax transfer accumulator to index register x (a) ????? inh 97 2 tst opr tsta tstx tst opr ,x tst ,x test memory byte for negative or zero (m) ? $00 ????? dir inh inh ix1 ix 3d 4d 5d 6d 7d dd ff 4 3 3 5 4 txa transfer index register to accumulator a (x) ????? inh 9f 2 wait stop cpu clock and enable interrupts ? ??? inh 8f 2 a accumulator opr operand (one or two bytes) c carry/borrow flag pc program counter ccr condition code register pch program counter high byte dd direct address of operand pcl program counter low byte dd rr direct address of operand and relative offset of branch instruction rel relative addressing mode dir direct addressing mode rel relative program counter offset byte ee ff high and low bytes of offset in indexed, 16-bit offset addressing rr relative program counter offset byte ext extended addressing mode sp stack pointer ff offset byte in indexed, 8-bit offset addressing x index register h half-carry flag z zero flag hh ll high and low bytes of operand address in extended addressing # immediate value i interrupt mask logical and ii immediate operand byte logical or imm immediate addressing mode logical exclusive or inh inherent addressing mode ( ) contents of ix indexed, no offset addressing mode ? ( ) negation (two ? s complement) ix1 indexed, 8-bit offset addressing mode loaded with ix2 indexed, 16-bit offset addressing mode ? if m memory location : concatenated with n negative flag set or cleared n any bit ? not affected table 14-6. instruction set summary (sheet 7 of 7) source form operation description effect on ccr address mode opcode operand cycles hinzc advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 208 instruction set motorola instruction set table 14-7. opcode map bit manipulation branch read-modify-write control register/memory dir dir rel dir inh inh ix1 ix inh inh imm dir ext ix2 ix1 ix 0123456789abcdef 0 5 brset0 3dir 5 bset0 2dir 3 bra 2rel 5 neg 2dir 3 nega 1inh 3 negx 1inh 6 neg 2ix1 5 neg 1ix 9 rti 1inh 2 sub 2imm 3 sub 2dir 4 sub 3ext 5 sub 3ix2 4 sub 2ix1 3 sub 1ix 0 1 5 brclr0 3dir 5 bclr0 2dir 3 brn 2rel 6 rts 1inh 2 cmp 2imm 3 cmp 2dir 4 cmp 3ext 5 cmp 3ix2 4 cmp 2ix1 3 cmp 1ix 1 2 5 brset1 3dir 5 bset1 2dir 3 bhi 2rel 11 mul 1inh 2 sbc 2imm 3 sbc 2dir 4 sbc 3ext 5 sbc 3ix2 4 sbc 2ix1 3 sbc 1ix 2 3 5 brclr1 3dir 5 bclr1 2dir 3 bls 2rel 5 com 2dir 3 coma 1inh 3 comx 1inh 6 com 2ix1 5 com 1ix 10 swi 1inh 2 cpx 2imm 3 cpx 2dir 4 cpx 3ext 5 cpx 3ix2 4 cpx 2ix1 3 cpx 1ix 3 4 5 brset2 3dir 5 bset2 2dir 3 bcc 2rel 5 lsr 2dir 3 lsra 1inh 3 lsrx 1inh 6 lsr 2ix1 5 lsr 1ix 2 and 2imm 3 and 2dir 4 and 3ext 5 and 3ix2 4 and 2ix1 3 and 1ix 4 5 5 brclr2 3dir 5 bclr2 2dir 3 bcs/blo 2rel 2 bit 2imm 3 bit 2dir 4 bit 3ext 5 bit 3ix2 4 bit 2ix1 3 bit 1ix 5 6 5 brset3 3dir 5 bset3 2dir 3 bne 2rel 5 ror 2dir 3 rora 1inh 3 rorx 1inh 6 ror 2ix1 5 ror 1ix 2 lda 2imm 3 lda 2dir 4 lda 3ext 5 lda 3ix2 4 lda 2ix1 3 lda 1ix 6 7 5 brclr3 3dir 5 bclr3 2dir 3 beq 2rel 5 asr 2dir 3 asra 1inh 3 asrx 1inh 6 asr 2ix1 5 asr 1ix 2 tax 1inh 4 sta 2dir 5 sta 3ext 6 sta 3ix2 5 sta 2ix1 4 sta 1ix 7 8 5 brset4 3dir 5 bset4 2dir 3 bhcc 2rel 5 asl/lsl 2dir 3 asla/lsla 1inh 3 aslx/lslx 1inh 6 asl/lsl 2ix1 5 asl/lsl 1ix 2 clc 1inh 2 eor 2imm 3 eor 2dir 4 eor 3ext 5 eor 3ix2 4 eor 2ix1 3 eor 1ix 8 9 5 brclr4 3dir 5 bclr4 2dir 3 bhcs 2rel 5 rol 2dir 3 rola 1inh 3 rolx 1inh 6 rol 2ix1 5 rol 1ix 2 sec 1inh 2 adc 2imm 3 adc 2dir 4 adc 3ext 5 adc 3ix2 4 adc 2ix1 3 adc 1ix 9 a 5 brset5 3dir 5 bset5 2dir 3 bpl 2rel 5 dec 2dir 3 deca 1inh 3 decx 1inh 6 dec 2ix1 5 dec 1ix 2 cli 1inh 2 ora 2imm 3 ora 2dir 4 ora 3ext 5 ora 3ix2 4 ora 2ix1 3 ora 1ix a b 5 brclr5 3dir 5 bclr5 2dir 3 bmi 2rel 2 sei 1inh 2 add 2imm 3 add 2dir 4 add 3ext 5 add 3ix2 4 add 2ix1 3 add 1ix b c 5 brset6 3dir 5 bset6 2dir 3 bmc 2rel 5 inc 2dir 3 inca 1inh 3 incx 1inh 6 inc 2ix1 5 inc 1ix 2 rsp 1inh 2 jmp 2dir 3 jmp 3ext 4 jmp 3ix2 3 jmp 2ix1 2 jmp 1ix c d 5 brclr6 3dir 5 bclr6 2dir 3 bms 2rel 4 tst 2dir 3 tsta 1inh 3 tstx 1inh 5 tst 2ix1 4 tst 1ix 2 nop 1inh 6 bsr 2rel 5 jsr 2dir 6 jsr 3ext 7 jsr 3ix2 6 jsr 2ix1 5 jsr 1ix d e 5 brset7 3dir 5 bset7 2dir 3 bil 2rel 2 stop 1inh 2 ldx 2imm 3 ldx 2dir 4 ldx 3ext 5 ldx 3ix2 4 ldx 2ix1 3 ldx 1ix e f 5 brclr7 3dir 5 bclr7 2dir 3 bih 2rel 5 clr 2dir 3 clra 1inh 3 clrx 1inh 6 clr 2ix1 5 clr 1ix 2 wait 1inh 2 txa 1inh 4 stx 2dir 5 stx 3ext 6 stx 3ix2 5 stx 2ix1 4 stx 1ix f inh = inherent rel = relative imm = immediate ix = indexed, no offset dir = direct ix1 = indexed, 8-bit offset ext = extended ix2 = indexed, 16-bit offset 0 msb of opcode in hexadecimal lsb of opcode in hexadecimal 0 5 brset0 3dir number of cycles opcode mnemonic number of bytes/addressing mode lsb msb lsb msb lsb msb MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 209 advance information ? MC68HC705JJ7/mc68hc705jp7 section 15. electrical specifications 15.1 contents 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 15.3 maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 15.4 operating temperature range. . . . . . . . . . . . . . . . . . . . . . . .211 15.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 15.6 supply current characteristics (v dd = 4.5 to 5.5 vdc) . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 15.7 supply current characteristics (v dd = 2.7 to 3.3 vdc) . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 15.8 dc electrical characteristics (5.0 vdc). . . . . . . . . . . . . . . . . . 215 15.9 dc electrical characteristics (3.0 vdc). . . . . . . . . . . . . . . . . . 216 15.10 analog subsystem characteristics (5.0 vdc) . . . . . . . . . . . . . 217 15.11 analog subsystem characteristics (3.0 vdc) . . . . . . . . . . . . . 218 15.12 control timing (5.0 vdc). . . . . . . . . . . . . . . . . . . . . . . . . . . . .220 15.13 control timing (3.0 vdc). . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 15.14 peprom and eprom programming characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 15.15 siop timing (v dd = 5.0 vdc) . . . . . . . . . . . . . . . . . . . . . . . . .225 15.16 siop timing (v dd = 3.0 vdc) . . . . . . . . . . . . . . . . . . . . . . . . .226 15.17 reset characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 210 electrical specifications motorola electrical specifications 15.2 introduction this section contains the electrical and timing specifications. 15.3 maximum ratings maximum ratings are the extreme limits to which the mcu can be exposed without permanently damaging it. the mcu contains circuitry to protect the inputs against damage from high static voltages; however, do not apply voltages higher than those shown in the table below. keep v in and v out within the range v ss (v in or v out ) v dd . connect unused inputs to the appropriate voltage level, either v ss or v dd . note: this device is not guaranteed to operate properly at the maximum ratings. refer to 15.8 dc electrical characteristics (5.0 vdc) and 15.9 dc electrical characteristics (3.0 vdc) for guaranteed operating conditions. rating symbol value unit supply voltage v dd ? 0.3 to +7.0 v bootloader/self-check mode (irq /v pp pin only) v in v ss ? 0.3 to 17 v current drain per pin excluding v dd and v ss i25ma operating junction temperature t j +150 c storage temperature range t stg ? 65 to +150 c electrical specifications operating temperature range MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 211 15.4 operating temperature range 15.5 thermal characteristics 15.6 supply current characteristics (v dd = 4.5 to 5.5 vdc) characteristic symbol value unit operating temperature range extended t a t l to t h ? 40 to +85 c characteristic symbol value unit thermal resistance plastic dip soic ja 60 c/w characteristic (1) 1. v dd = 4.5 to 5.5 vdc, v ss = 0 v, t l t a t h , unless otherwise noted. all values shown reflect average measurements. symbol min typ (2) 2. typical values at midpoint of voltage range, 25 c only max unit run (3) (analog and lvr disabled) internal low-power oscillator at 100 khz internal low-power oscillator at 500 khz external oscillator running at 4.2 mhz 3. run (operating) i dd , wait i dd : measured using external square wave clock source to osc1 pin or internal oscillator, all inputs 0.2 vdc from either supply rail (v dd or v ss ); no dc loads, less than 50 pf on all outputs, c l = 20 pf on osc2. i dd ? ? ? 150 375 3.00 568 1100 5.20 a a ma wait (4) (analog and lvr disabled) internal low-power oscillator at 100 khz internal low-power oscillator at 500 khz external oscillator running at 4.2 mhz 4. wait i dd is affected linearly by the osc2 capacitance. i dd ? ? ? 45 75 1.00 85 375 2.20 a a ma stop (5) (analog and lvr disabled) ty p i c a l ? 40 c to 85 c 5. stop i dd : all ports configured as inputs, v il = 0.2 vdc, v ih = v dd ? 0.2 vdc, osc1 = v dd . i dd ? ? 2 4 10 20 a incremental i dd for enabled modules lv r analog subsystem i dd ? ? 5 380 15 475 a advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 212 electrical specifications motorola electrical specifications 15.7 supply current characteristics (v dd = 2.7 to 3.3 vdc) characteristic (1) 1. v dd = 2.7 to 3.3 vdc, v ss = 0 v, t l t a t h , unless otherwise noted. all values shown reflect average measurements. symbol min typ (2) 2. typical values at midpoint of voltage range, 25 c only. max unit run (3) (analog and lvr disabled) internal low-power oscillator at 100 khz internal low-power oscillator at 500 khz external oscillator running at 2.1 mhz 3. run (operating) i dd , wait i dd : measured using external square wave clock source to osc1 pin or internal oscillator, all inputs 0.2 vdc from either supply rail (v dd or v ss ); no dc loads, less than 50 pf on all outputs, c l = 20 pf on osc2. i dd ? ? ? 70 320 1.25 320 800 2.60 a a ma wait (4) (analog and lvr disabled) internal low-power oscillator at 100 khz internal low-power oscillator at 500 khz external oscillator running at 2.1 mhz 4. wait i dd is affected linearly by the osc2 capacitance. i dd ? ? ? 20 40 0.50 65 250 1.10 a a ma stop (5) (analog and lvr disabled) 25 c ? 40 c to 85 c 5. stop i dd : all ports configured as inputs, v il = 0.2 vdc, v ih = v dd ? 0.2 vdc, osc1 = v dd . i dd ? ? 1 2 5 10 a incremental i dd for enabled modules lv r analog subsystem i dd ? ? 5 380 15 475 a electrical specifications supply current characteristics (v dd = 2.7 to 3.3 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 213 figure 15-1. typical run i dd versus internal clock frequency at 25 c figure 15-2. typical wait i dd versus internal clock frequency at 25 c 0.00e+00 5.00e ? 04 1.00e ? 03 1.50e ? 03 2.00e ? 03 2.50e ? 03 3.00e ? 03 3.50e ? 03 0 0.5 1 1.5 2 2.5 frequency in mhz 5.5 v 4.5 v 3.3 v 2.7 v supply current in amps 0.00e+00 2.00e ? 04 4.00e ? 04 6.00e ? 04 8.00e ? 04 1.00e ? 03 1.20e ? 03 1.40e ? 03 1.60e ? 03 0 0.5 1 1.5 2 2.5 frequency in mhz 5.5 v 4.5 v 3.3 v 2.7 v supply current in amps advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 214 electrical specifications motorola electrical specifications figure 15-3. typical run i dd with external oscillator figure 15-4. typical wait i dd with external oscillator figure 15-5. typical stop i dd with analog and lvr disabled 5.00e ? 04 1.00e ? 03 1.50e ? 03 2.00e ? 03 2.50e ? 03 3.00e ? 03 3.50e ? 03 2.5 3 3.5 4 4.5 5 5.5 6 supply voltage in volts ? 40 c 25 c 85 c supply current in amps 2.00e ? 04 4.00e ? 04 6.00e ? 04 8.00e ? 04 1.00e ? 03 1.20e ? 03 1.40e ? 03 1.60e ? 03 1.80e ? 03 2.533.544.555.56 supply voltage in volts supply current in amps ? 40 c 25 c 85 c 0.00e+00 5.00e ? 07 1.00e ? 06 1.50e ? 06 2.00e ? 06 2.50e ? 06 3.00e ? 06 3.50e ? 06 4.00e ? 06 4.50e ? 06 2.533.544.555.56 supply voltage in volts ? 40 c 25 c 85 c supply current in amps electrical specifications dc electrical characteristics (5.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 215 15.8 dc electrical characteristics (5.0 vdc) characteristic (1), (2) 1. +4.5 v dd +5.5 v, v ss = 0 v, t l t a t h , unless otherwise noted 2. all values shown reflect average measurements. symbol min typ (3) 3. typical values at midpoint of voltage range, 25 c only. max unit output voltage i load = 10.0 a i load = ? 10.0 a v ol v oh ? v dd ? 0.1 ? ? 0.1 ? v output high voltage (i load = ? 0.8 ma) pb0 ? pb7 (i load = ? 4.0 ma) pa0 ? pa5, pb4, pc0 ? pc7 (4) 4. pc0 ? pc7 parameters only apply to mc68hc705jp7. v oh v dd ? 0.8 v dd ? 0.8 ? ? ? ? v output low voltage (i load = 1.6 ma) pb0 ? pb7, reset (i load = 10 ma) pa0 ? pa5, pb4, pc0 ? pc7 (4) (i load = 15 ma) pa0 ? pa5, pb4, pc0 ? pc7 (4) v ol ? ? ? ? ? ? 0.4 0.4 1.5 v high source current total for all (6) pa0 ? pa5 pins and pb4 total for all (8) pc0 ? pc7 (4) pins i oh ? ? ? ? 20 30 ma high sink current total for all (6) pa0 ? pa5 pins and pb4 total for all (8) pc0 ? pc7 (4) pins i ol ? ? ? ? 40 60 ma input high voltage pa 0 ? pa5, pb0 ? pb7, pc0 ? pc7 (4) , reset , osc1, irq /v pp v ih 0.7 x v dd ? v dd v input low voltage pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) , reset , osc1, irq /v pp v il v ss ? 0.3 x v dd v input current osc1, irq /v pp i in ? 1 ? 1 a input current reset (pullup, source) reset (pulldown, sink) i in 10 ? 6 ? ? ? ? a ma i/o ports hi-z leakage current (pulldowns off) pa 0 ? pa 6 , p b 0 ? pb7, pc0 ? pc7 (4) i oz ? 2 ? 2 a input pulldown current pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) (v in ; v ih = 0.7 x v dd ) pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) (v in ; v il = 0.3 x v dd ) i il 40 25 100 65 280 190 a advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 216 electrical specifications motorola electrical specifications 15.9 dc electrical characteristics (3.0 vdc) characteristic (1), (2) 1. +2.7 v dd +3.3 v, v ss = 0 v, t l t a t h , unless otherwise noted 2. all values shown reflect average measurements. symbol min typ (3) 3. typical values at midpoint of voltage range, 25 c only. max unit output voltage i load = 10.0 a i load = ? 10.0 a v ol v oh ? v dd ? 0.1 ? ? 0.1 ? v output high voltage (i load = ? 0.2 ma) pb0 ? pb7 (i load = ? 2.0 ma) pa0 ? pa5, pb4, pc0 ? pc7 (4) 4. pc0 ? pc7 parameters only apply to mc68hc705jp7. v oh v dd ? 0.8 v dd ? 0.8 ? ? ? ? v output low voltage (i load = 1.6 ma) pb0 ? pb7, reset (i load = 5 ma) pa0 ? pa5, pb4, pc0 ? pc7 (4) v ol ? ? ? ? 0.3 0.3 v high source current total for all (6) pa0 ? pa5 pins and pb4 total for all (8) pc0 ? pc7 (4) pins i oh ? ? ? ? 20 30 ma high sink current total for all (6) pa0 ? pa5 pins and pb4 total for all (8) pc0 ? pc7 (4) pins i ol ? ? ? ? 40 60 ma input high voltage pa 0 ? pa5, pb0 ? pb7, pc0 ? pc7 (4) , reset , osc1, irq /v pp v ih 0.7 x v dd ? v dd v input low voltage pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) , reset , osc1, irq /v pp v il v ss ? 0.2 x v dd v input current osc1, irq /v pp i in ? 1 ? 1 a input current reset (pullup, source) reset (pulldown, sink) i in 5 ? 3 ? ? ? ? a ma i/o ports hi-z leakage current (pulldowns off) pa 0 ? pa 6 , p b 0 ? pb7, pc0 ? pc7 (4) i oz ? 2 ? 2 a input pulldown current pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) (v in ; v ih = 0.7 x v dd ) pa 0 ? pa 5 , p b 0 ? pb7, pc0 ? pc7 (4) (v in ; v il = 0.3 x v dd ) i il 10 4 25 20 75 40 a electrical specifications analog subsystem characteristics (5.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 217 15.10 analog subsystem characteristics (5.0 vdc) note: see figure 15-6 . characteristic (1) symbol min max unit voltage comparators input offset voltage common-mode range comparator 1 input impedance comparator 2 input impedance direct input to comparator 2 (hold = 1, dhold = 0) divider input to comparator 2 (hold = 0, dhold = 1) v io v cmr z in z in z in ? ? 800 800 80 15 v dd ? 1.5 ? ? ? mv v k ? k ? k ? input divider ratio (comparator 2, hold = 0, dhold =1) v in = 0 to v dd ? 1.5 v r div 0.49 0.51 analog subsystem internal v ss offset sum of comparator offset and ir drop through v ss v aoff 20 40 mv channel selection multiplexer switch resistance r mux ? 3k ? external current source (pb0/an0) source current (v out = v dd /2) source current linearity (v out = 0 to v dd ? 1.5 vdc) discharge sink current (v out = 0.4 v) i chg i chg i dis 85 ? 1.1 113 1 ? a %fs ma external capacitor (connected to pb0/an0) voltage range discharge time value of external ramping capacitor v cap t dis c ext v ss 5 ? v dd ? 1.5 10 2 v ms/ f f internal sample and hold capacitor capacitance charge/discharge time (0 to 3.5 vdc) direct connection (hold = 1, dhold = 0) divided connection (hold = 0, dhold = 1) temperature diode connection (hold = 1, dhold = 1) leakage discharge rate c sh t shchg t shdchg t shtchg c shdis 8 1 2 1 ? 13 ? ? ? 0.2 pf s s s v/sec internal temperature sensing diode voltage at t j = 25 c temperature change in voltage v d tc d 0.65 1.8 0.71 2.0 v mv/ c 1. +4.5 v dd +5.5 v, v ss = 0 v, t l t a t h , unless otherwise noted advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 218 electrical specifications motorola electrical specifications 15.11 analog subsystem characteristics (3.0 vdc) note: see figure 15-6 . characteristic (1) symbol min max unit voltage comparators input offset voltage common-mode range comparator 1 input impedance comparator 2 input impedance direct input to comparator 2 (hold = 1, dhold = 0) divider input to comparator 2 (hold = 0, dhold = 1) v io v cmr z in z in z in ? ? 800 800 80 15 v dd ? 1.5 ? ? ? mv v k ? k ? k ? input divider ratio (comparator 2, hold = 0, dhold =1) v in = 0 to v dd ? 1.5 v r div 0.49 0.51 analog subsystem internal v ss offset v aoff 10 30 mv multiplexer switch resistance r mux ? 5k ? external current source (pb0/an0) source current (v out = v dd /2) source current linearity (v out = 0 to v dd ? 1.5 vdc) discharge sink current (v out = 0.4 v) i chg i chg i dis 75 ? 1 104 1 ? a %fs ma external capacitor (connected to pb0/an0) voltage range discharge time value of external ramping capacitor v cap t dis c ext v ss 5 ? v dd ? 1.5 10 2 v ms/ f f internal sample and hold capacitor capacitance charge/discharge time (0 to 3.5 vdc) direct connection (hold = 1, dhold = 0) divided connection (hold = 0, dhold = 1) temperature diode connection (hold = 1, dhold = 1) leakage discharge rate c sh t shchg t shdchg t shtchg c shdis 8 1 2 1 ? 13 ? ? ? 0.1 pf s s s v/sec internal temperature sensing diode voltage at t j = 25 c temperature change in voltage v d tc d 0.65 1.8 0.71 2.0 v mv/ c 1. +2.7 v dd +3.3 v, v ss = 0 v, t l t a t h , unless otherwise noted electrical specifications analog subsystem characteristics (3.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 219 figure 15-6. typical temperature diode performance 680 700 560 580 600 620 640 660 720 740 760 780 800 820 ? 45 ? 35 ? 25 ? 15 ? 5 5 15 25 35 45 55 65 75 85 95 temperature in c t diode in mv advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 220 electrical specifications motorola electrical specifications 15.12 control timing (5.0 vdc) characteristic (1) 1. v dd = 4.5 to 5.5 vdc, v ss = 0 v, t l t a t h , unless otherwise noted symbol min max unit frequency of oscillation (osc) rc oscillator option crystal oscillator option external clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal, see note 3) f osc ? 0.1 dc 60 300 4.2 4.2 4.2 140 700 mhz mhz mhz khz khz internal operating frequency, crystal, or external clock (f osc /2) rc oscillator option crystal oscillator option external clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal (2) ) f op ? 0.05 dc 30 150 2.1 2.1 2.1 75 350 mhz mhz mhz khz khz cycle time (1/f op ) external oscillator or clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal (2) ) 2. the 500-khz nominal mask option is available through special order only. contact your local motorola sales representative for detailed ordering information. not offered with the rc oscillator. t cyc 476 14.29 2.86 ? 33.33 6.67 ns s s 16-bit timer resolution input capture (tcap) pulse width t resl t th , t tl 4.0 284 ? ? t cyc ns interrupt pulse width low (edge-triggered) t ilih 284 ? ns interrupt pulse period t ilil (3) 3. 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 . ? t cyc osc1 pulse width (external clock input) t oh , t ol 110 ? ns analog subsystem response voltage comparators switching time (10 mv overdrive, either input) comparator power-up delay (bias circuit already powered up) external current source (pb0/an0) switching time (i dis to i ramp ) power-up delay (bias circuit already powered up) bias circuit power-up delay t cprop t cdelay t istart t idelay t bdelay ? ? ? ? ? 2 2 1 2 2 s s s s s electrical specifications control timing (3.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 221 15.13 control timing (3.0 vdc) characteristic (1) 1. +2.7 v dd +3.3 v, v ss = 0 v, t l t a t h , unless otherwise noted symbol min max unit frequency of oscillation (osc) rc oscillator option crystal oscillator option external clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal, see note 3)) f osc ? 0.1 dc 60 300 2.1 2.1 2.1 140 700 mhz mhz mhz khz khz internal operating frequency, crystal, or external clock (f osc /2) rc oscillator option crystal oscillator option external clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal (2) ) 2. the 500 khz nominal mask option is available through special order only. contact your local motorola sales representative for detailed ordering information. not offered with the rc oscillator option. f op ? 0.05 dc 30 150 1.05 1.05 1.05 70 350 mhz mhz mhz khz khz cycle time (1/f op ) external oscillator or clock source internal low-power oscillator standard product (100 khz nominal) mask option (500 khz nominal (2) ) t cyc 952 14.29 2.86 ? 33.33 6.67 ns s s 16-bit timer resolution input capture (tcap) pulse width t resl t th , t tl 4.0 284 ? ? t cyc ns interrupt pulse width low (edge-triggered) t ilih 284 ? ns interrupt pulse period t ilil (3) 3. 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 . ? t cyc osc1 pulse width (external clock input) t oh , t ol 110 ? ns analog subsystem response voltage comparators switching time (10 mv overdrive, either input) comparator power-up delay (bias circuit already powered up) external current source (pb0/an0) switching time (i dis to i ramp ) power-up delay (bias circuit already powered up) bias circuit power-up delay t cprop t cdelay t istart t idelay t bdelay ? ? ? ? ? 2 2 1 2 2 s s s s s advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 222 electrical specifications motorola electrical specifications figure 15-7. typical 500 khz external low-power oscillator frequency figure 15-8. typical 100 khz external low-power oscillator frequency 420000 430000 440000 450000 460000 470000 480000 490000 500000 510000 ? 45 ? 35 ? 25 ? 15 ? 5 5 15 25 35 45 55 65 75 85 95 temperature in c frequency in hz 109500 110000 110500 111000 111500 112000 112500 113000 113500 114000 ? 45 ? 35 ? 25 ? 15 ? 5 5 15 25 35 45 55 65 75 85 95 temperature in c frequency in hz electrical specifications control timing (3.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 223 figure 15-9. typical rc oscillator internal operating frequency range versus resistance for high v dd operating range at t = 25 c figure 15-10. typical rc oscillator internal operating frequency range versus resistance for low v dd operating range at t = 25 c 0 0.5 1 1.5 2 2.5 12.1 24.9 49.9 external resistor value (k ? ) v dd = 5.5 v v dd = 4.5 v internal bus frequency (mhz) 0 0.5 1 1.5 2 12.1 24.9 49.9 external resistor value (k ? ) v dd = 3.3 v v dd = 2.7 v internal bus frequency (mhz) advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 224 electrical specifications motorola electrical specifications 15.14 peprom and eprom programming characteristics note: to program the eprom/otprom, mor, or epmsec bits, the voltage on v dd must be greater than 4.5 volts. characteristic (1) 1. +4.5 v dd +5.5 v, v ss = 0 v, t l t a t h , unless otherwise noted symbol min typ max unit peprom programming voltage (irq /v pp )v pp 16.0 16.5 17.0 v peprom programming voltage (irq /v pp )i pp ? 3.0 5.0 ma peprom programming time per bit t epgm 4.0 ?? ms eprom/mor programming voltage (irq /v pp )v pp 16.0 16.5 17.0 v eprom/mor programming current (irq /v pp )i pp ? 3.0 5.0 ma eprom programming time per byte t epgm 4.0 ?? ms mor programming time t mpgm 10.0 ?? ms electrical specifications siop timing (vdd = 5.0 vdc) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 225 15.15 siop timing (v dd = 5.0 vdc) figure 15-11. siop timing diagram characteristic (1) 1. +4.5 v dd +5.5 v, v ss = 0 v, t l t a t h , unless otherwise noted symbol min typ max unit frequency of operation master slave f siop(m) f siop(s) 0.25 x f op dc 0.25 x f op ? 0.25 x f op 1050 khz cycle time master slave t sck(m) t sck(m) 4.0 x t cyc ? 4.0 x t cyc ? 4.0 x t cyc 3.8 s clock (sck) low time (f op = 4.2 mhz) t sckl 952 ?? ns sdo data valid time t v ?? 200 ns sdo hold time t ho 0 ?? ns sdi setup time t s 100 ?? ns sdi hold time t h 100 ?? ns t sck sck t sckl t v t ho sdo msb bit 1 lsb t h t s sdi msb lsb valid data advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 226 electrical specifications motorola electrical specifications 15.16 siop timing (v dd = 3.0 vdc) characteristic (1) 1. +2.7 v dd +3.3 v, v ss = 0 v, t l t a t h , unless otherwise noted symbol min typ max unit frequency of operation master slave f siop(m) f siop(s) 0.25 x f op dc 0.25 x f op ? 0.25 x f op 525 khz cycle time master slave t sck(m) t sck(m) 4.0 x t cyc ? 4.0 x t cyc ? 4.0 x t cyc 1.9 s clock (sck) low time (f op = 2.1 mhz) t sckl 1905 ?? ns sdo data valid time t v ?? 400 ns sdo hold time t ho 0 ?? ns sdi setup time t s 200 ?? ns sdi hold time t h 200 ?? ns electrical specifications reset characteristics MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 227 15.17 reset characteristics figure 15-12. typical falling low voltage reset characteristic (1) 1. +2.7 v dd +3.3 v, v ss = 0 v, t l t a t h , unless otherwise noted symbol min typ max unit low-voltage reset rising recovery voltage falling reset voltage lvr hysteresis v lv r r v lv r f v lv r h 2.4 2.3 30 3.4 3.3 70 4.4 4.3 ? v v mv por recovery voltage (2) 2. by design, not tested v por 0 ? 100 mv por v dd slew rate (2) rising (2) falling (2) s vddr s vddf ? ? ? ? 0.1 0.05 v/ s reset pulse width (when bus clock active) t rl 1.5 ?? t cyc reset pulldown pulse width from internal reset t rpd 3 ? 4 t cyc 2.5 3 3.5 4 4.5 ? 45 ? 35 ? 25 ? 15 ? 5 5 15 25 35 45 55 65 75 85 95 temperature in c reset voltage in volts advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 228 electrical specifications motorola electrical specifications figure 15-13. stop recovery timing diagram figure 15-14. internal reset timing diagram pch new 1ffe t rl osc1 1 reset internal clock (3) internal address bus (3) 4064 or 16 t cyc (2) notes: 1. represents the internal gating of the osc1 pin 2. normal delay of 4064 t cyc or short delay option of 16 t cyc 3. internal timing signal and data information not available externally internal data bus (3) 1fff new pch new pcl pcl new code op pch new 1ffe t rpd reset internal clock (3) internal address bus (3) 4064 or 16 t cyc (2) notes: 1.represents the internal reset from low-voltage reset, illegal opcode fetch or cop watchdog timeout 2.only if reset occurs during normal delay of 4064 t cyc or short delay option of 16 t cyc for initial power-up or stop recovery. 3.internal timing signal and data information not available externally internal data bus (3) 1fff new pch new pcl pcl new internal reset 1 pin electrical specifications reset characteristics MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola electrical specifications 229 figure 15-15. low-voltage reset timing diagram pch new 1ffe t rpd reset internal clock 3 internal address bus (3) 4064 or 16 t cyc (2) notes: 1. reset pin pulled down by internal device 2 only if lvr occurs during normal delay of 4064 t cyc or short delay option of 16 t cyc for initial power-up or stop recovery. 3 internal timing signal and data information not available externally internal data bus (3) 1fff new pch new pcl pcl new v dd pin 1 low voltage reset v lvrr v lvrf advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 230 electrical specifications motorola electrical specifications MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola mechanical specifications 231 advance information ? MC68HC705JJ7/mc68hc705jp7 section 16. mechanical specifications 16.1 contents 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 16.3 20-pin plastic dual in-line package (case 738) . . . . . . . . . . 232 16.4 20-pin small outline integrated circuit (case 751d) . . . . . . . 233 16.5 28-pin plastic dual in-line package (case 710) . . . . . . . . . . 233 16.6 28-pin small outline integrated circuit (case 751f) . . . . . . . 234 16.7 20-pin windowed ceramic integrated circuit (case 732) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 16.8 28-pin windowed ceramic integrated circuit (case 733a). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 16.2 introduction the MC68HC705JJ7 is available in: 20-pin plastic dual in-line package (pdip) 20-pin small outline integrated circuit (soic) package 20-pin windowed ceramic package the mc68hc705jp7 is available in: 28-pin plastic dual in-line package (pdip) 28-pin small outline integrated circuit (soic) package 28-pin windowed ceramic package advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 232 mechanical specifications motorola mechanical specifications the following figures show the latest packages at the time of this publication. to make sure that you have the latest case outline specifications, contact one of the following: local motorola sales office world wide web at: http:// www.motorola.com/mcu/ follow world wide web on-line instructions to retrieve the current mechanical specifications. 16.3 20-pin plastic dual in-line package (case 738) ! -a- c k n e gf d 20 pl j 20 pl l m -t- 110 11 20 "# "# b mechanical specifications 20-pin small outline integrated circuit (case 751d) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola mechanical specifications 233 16.4 20-pin small outline integrated circuit (case 751d) 16.5 28-pin plastic dual in-line package (case 710) ! ! $! ! "# ! ! ! "# $ $! -a- -b- p 10 pl 110 11 20 -t- d 20 pl k c r x 45 m "# "# g 18 pl f j "# %% "# $! ! 114 15 28 b a c n k m j d f hg l advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 234 mechanical specifications motorola mechanical specifications 16.6 28-pin small outline integrated circuit (case 751f) 16.7 20-pin windowed ceramic integrated circuit (case 732) ! ! $! ! "# ! ! ! "# $ $! -a- -b- 114 15 28 -t- c "# m j -t- k 26x g 28x d 14x p r x 45 f "# notes: 1. leads within 0.010 diameter, true position at seating plane, at maximum material condition. 2. dimension l to center of leads when formed parallel. 3. dimensions a and b include meniscus. dim min max inches a 0.940 0.990 b 0.260 0.295 c 0.150 0.200 d 0.015 0.022 f 0.055 0.065 g 0.100 bsc h 0.020 0.050 j 0.008 0.012 k 0.125 0.160 l 0.300 bsc m 0 15 n 0.010 0.040 a 20 110 11 b f c seating plane d h g k n j m l mechanical specifications 28-pin windowed ceramic integrated circuit (case 733a) MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola mechanical specifications 235 16.8 28-pin windowed ceramic integrated circuit (case 733a) & & & & && && && && ! ! ? a ? ? t ? &"# b c k d f g n 28 pl l j m advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 236 mechanical specifications motorola mechanical specifications MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola ordering information 237 advance information ? MC68HC705JJ7/mc68hc705jp7 section 17. ordering information 17.1 contents 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 17.3 MC68HC705JJ7 order numbers . . . . . . . . . . . . . . . . . . . . . . 238 17.4 mc68hc705jp7 order numbers . . . . . . . . . . . . . . . . . . . . . .239 17.2 introduction this section contains instructions for ordering the various erasable programmable read-only memory (eprom) versions of the mc68hc05jj/jp family of microcontrollers. advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 238 ordering information motorola ordering information 17.3 MC68HC705JJ7 order numbers mc order numbers for the available 20-pin package types are shown here. package type epo oscill. type (1) 1. crystal/ceramic resonator or rc oscillator lpo freq. (khz) operating temperature range order number plastic dip (2) 2. plastic dual in-line package (p, case outline 738) xtal 100 ? 40 to 85 c MC68HC705JJ7cp soic (3) 3. small outline integrated circuit package (dw, case outline 751d) xtal 100 ? 40 to 85 c MC68HC705JJ7cdw cerdip (4), (5) 4. windowed ceramic dual in-line package (s, case outline 732) 5. cerdip parts are only guaranteed at room temperature and are for evoluation purposes only. xtal 100 ? 40 to 85 c MC68HC705JJ7s plastic dip rc 100 ? 40 to 85 c mc68hrc705jj7cp soic rc 100 ? 40 to 85 c mc68hrc705jj7cdw cerdip (5) rc 100 ? 40 to 85 c mc68hrc705jj7s plastic dip xtal 500 ? 40 to 85 c mc68hc705sj7cp soic xtal 500 ? 40 to 85 c mc68hc705sj7cdw cerdip (5) xtal 500 ? 40 to 85 c mc68hc705sj7s ordering information mc68hc705jp7 order numbers MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 advance information motorola ordering information 239 17.4 mc68hc705jp7 order numbers mc order numbers for the available 28-pin package types are shown here. package type epo oscill. type (1) 1. crystal/ceramic resonator or rc oscillator lpo freq. (khz) operating temperature range order number plastic dip (2) 2. plastic dual in-line package (p, case outline 710) xtal 100 ? 40 to 85 c mc68hc705jp7cp soic (3) 3. small outline integrated circuit package (dw, case outline 751f) xtal 100 ? 40 to 85 c mc68hc705jp7cdw cerdip (4), (5) 4. windowed ceramic dual in-line package (s, case outline 733a) 5. cerdip parts are only guaranteed at room temperature and are for evoluation purposes only. xtal 100 ? 40 to 85 c mc68hc705jp7s plastic dip rc 100 ? 40 to 85 c mc68hrc705jp7cp soic rc 100 ? 40 to 85 c mc68hrc705jp7cdw cerdip (5) rc 100 ? 40 to 85 c mc68hrc705jp7s plastic dip xtal 500 ? 40 to 85 c mc68hc705sp7cp soic xtal 500 ? 40 to 85 c mc68hc705sp7cdw cerdip (5) xtal 500 ? 40 to 85 c mc68hc705sp7s advance information MC68HC705JJ7 ? mc68hc705jp7 ? rev 4 240 ordering information motorola ordering information blank MC68HC705JJ7/d rev 4 mc 68hc05p6 technical data how to reach us: usa/europe/locations not listed: motorola literature distribution p.o. box 5405 denver, colorado 80217 1-303-675-2140 1-800-441-2447 technical information center: 1-800-521-6274 japan: motorola japan ltd. sps, technical information center 3-20-1, minami-azabu, minato-ku tokyo 106-8573 japan 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd. silicon harbour centre 2 dai king street tai po industrial estate tai po, n.t., hong kong 852-26668334 home page: http://www.motorola.com/semiconductors/ q4/00 rev 1 |
Price & Availability of MC68HC705JJ7 |
|
|
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] |