Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. TECHNICAL DATA Freescale Semiconductor, Inc... MC68HC05F8 Freescale Semiconductor, Inc... MC68HC05F8D/H HC05 MC68HC05F8 MC68HC705F8 TECHNICAL DATA !MOTOROLA !MOTOROLA For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. GENERAL DESCRIPTION 1 PIN DESCRIPTIONS 2 MEMORY AND REGISTERS 3 RESETS 4 INTERRUPTS 5 TIMERS 6 SERIAL PERIPHERAL INTERFACE 7 MANCHESTER ENCODER/DECODER 8 DTMF/MELODY GENERATOR 9 CPU CORE AND INSTRUCTION SET 10 LOW POWER MODES 11 OPERATING MODES 12 ELECTRICAL SPECIFICATIONS 13 MECHANICAL SPECIFICATIONS 14 TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 1 Freescale Semiconductor, Inc. 1 GENERAL DESCRIPTION 2 PIN DESCRIPTIONS 3 MEMORY AND REGISTERS 4 RESETS 5 INTERRUPTS 6 TIMERS 7 SERIAL PERIPHERAL INTERFACE 8 MANCHESTER ENCODER/DECODER 9 DTMF/MELODY GENERATOR Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. 10 CPU CORE AND INSTRUCTION SET 11 LOW POWER MODES 12 OPERATING MODES 13 ELECTRICAL SPECIFICATIONS 14 MECHANICAL SPECIFICATIONS TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 2 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... MC68HC05F8 MC68HC705F8 High-density complementary metal oxide semiconductor (HCMOS) microcontroller unit All Trade Marks recognized. This document contains information on new products. Specifications and information herein are subject to change without notice. All products are sold on Motorola’s Terms & Conditions of Supply. In ordering a product covered by this document the Customer agrees to be bound by those Terms & Conditions and nothing contained in this document constitutes or forms part of a contract (with the exception of the contents of this Notice). A copy of Motorola’s Terms & Conditions of Supply is available on request. Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters can and do vary in different applications. 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 and !are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. The Customer should ensure that it has the most up to date version of the document by contacting its local Motorola office. This document supersedes any earlier documentation relating to the products referred to herein. The information contained in this document is current at the date of publication. It may subsequently be updated, revised or withdrawn. MOTOROLA LTD., 1996 TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 3 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. Conventions Register and bit mnemonics are defined in the paragraphs describing them. An overbar is used to designate an active-low signal, eg: RESET. Unless otherwise stated, blank cells in a register diagram indicate that the bit is either unused or reserved; shaded cells indicate that the bit is not described in the following paragraphs; ‘u’ is used to indicate an undefined state (on reset). TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 4 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. CUSTOMER FEEDBACK QUESTIONNAIRE (MC68HC05F8D/H) Motorola wishes to continue to improve the quality of its documentation. We would welcome your feedback on the publication you have just received. Having used the document, please complete this card (or a photocopy of it, if you prefer). 1. How would you rate the quality of the document? Check one box in each category. Excellent Organization Readability Accuracy Illustrations ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ Excellent ❏ ❏ ❏ ❏ ❏ Tables Table of contents Index Page size/binding Overall impression Poor ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ Comments: 2. What is your intended use for this document? If more than one option applies, please rank them (1, 2, 3). ❏ ❏ ❏ Selection of device for new application System design Training purposes 3. – Cut along this line to remove – Other ❏ Please specify: How well does this manual enable you to perform the task(s) outlined in question 2? Completely Not at all Comments: ❏ ❏ ❏ ❏ 4. How easy is it to find the information you are looking for? Easy Difficult Comments: ❏ ❏ ❏ ❏ 5. Is the level of technical detail in the following sections sufficient to allow you to understand how the device functions? Too little detail SECTION 1 GENERAL DESCRIPTION SECTION 2 PIN DESCRIPTIONS SECTION 3 MEMORY AND REGISTERS SECTION 4 RESETS SECTION 5 INTERRUPTS SECTION 6 TIMERS SECTION 7 SERIAL PERIPHERAL INTERFACE SECTION 8 MANCHESTER ENCODER/DECODER SECTION 9 DTMF/MELODY GENERATOR SECTION 10 CPU CORE AND INSTRUCTION SET SECTION 11 LOW POWER MODES SECTION 12 OPERATING MODES SECTION 13 ELECTRICAL SPECIFICATIONS SECTION 14 MECHANICAL SPECIFICATIONS ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ Too much detail ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ Comments: ✂ Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Understandability ❏ ❏ ❏ ❏ ❏ Poor 6. Have you found any errors? If so, please comment: 7. From your point of view, is anything missing from the document? If so, please say what: TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 5 Freescale Semiconductor, Inc. 8. How could we improve this document? 9. How would you rate Motorola’s documentation? Excellent – In general – Against other semiconductor suppliers ✂ Freescale Semiconductor, Inc. Poor ❏ ❏ ❏ ❏ ❏❏ ❏❏ 12. How many years have you worked with microprocessors? Less than 1 year ❏ 1–3 years ❏ 3–5 years ❏ More than 5 years ❏ – Second fold back along this line – By air mail Par avion FIX STAMP HERE Motorola Semiconductors H.K. Ltd., 13/F, Prosperity Centre, 77-81 Container Port Road, Kwai Chung, N.T., HONG KONG. – Cut along this line to remove – Freescale Semiconductor, Inc... 11. Which company (in any field) provides the best technical documentation? – First fold back along this line – Freescale Semiconductor, Inc... 10. Which semiconductor manufacturer provides the best technical documentation? F.A.O. HKG CSIC Technical Publications (re: MC68HC05F8D/H) !MOTOROLA Semiconductor Products Sector Asia Pacific Group FAX: (852) 2485-0548 – Third fold back along this line – 13. Currently there is some discussion in the semiconductor industry regarding a move towards providing data sheets in electronic form. If you have any opinion on this subject, please comment. 14. We would be grateful if you would supply the following information (at your discretion), or attach your card. Name: Position: Phone No: FAX No: Department: Company: Address: Thank you for helping us improve our documentation, HKG CSIC Technical Publications , Motorola Semiconductors H.K. Ltd., Hong Kong TPG For More Information On This Product, Go to: tuck www.freescale.com – Finally, this edge into opposite flap – For More Information On This Product, Go to: www.freescale.com 6 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... TABLE OF CONTENTS Paragraph Number TITLE Page Number 1 GENERAL DESCRIPTION 1.1 Features.................................................................................................................1-1 1.1.1 Hardware Features ..........................................................................................1-1 1.1.2 Software Features............................................................................................1-2 2 PIN DESCRIPTIONS 2.1 Functional Pin Descriptions ...................................................................................2-1 2.2 Pin Assignments ....................................................................................................2-3 2.3 Input/Output Programming ....................................................................................2-4 2.3.1 Parallel Ports....................................................................................................2-4 2.3.2 Serial Port (SPI) ...............................................................................................2-4 3 MEMORY AND REGISTERS 3.1 3.2 3.3 Memory Map..........................................................................................................3-1 Input/Output Section ..............................................................................................3-1 RAM.......................................................................................................................3-1 4 RESETS 4.1 4.2 4.3 4.4 Power-On Reset (POR) .........................................................................................4-1 RESET Pin ............................................................................................................4-1 Illegal Address (ILADR) Reset...............................................................................4-2 Computer Operating Properly (COP) Reset ..........................................................4-2 TPG MC68HC05F8 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA i 7 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Paragraph Number TITLE Page Number Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5 INTERRUPTS 5.1 5.2 5.3 5.3.1 5.3.2 5.3.3 5.4 5.4.1 5.5 5.6 5.7 5.8 Hardware Controlled Sequences...........................................................................5-4 Software Interrupt (SWI)........................................................................................5-4 External Interrupts (IRQ1 & IRQ2) ........................................................................5-4 External Interrupt Triggering Options (INTN1 & INTN2) ..................................5-6 External Interrupt Enable (INTE1 & INTE2).....................................................5-6 External Interrupt Flags (INTF1 & INTF2) .......................................................5-7 Keyboard Interrupt.................................................................................................5-7 Keyboard Control Register...............................................................................5-8 Programmable Timer (Timer A) Interrupt...............................................................5-8 Reloadable Timer (Timer B) Interrupt ....................................................................5-10 SPI Interrupt ..........................................................................................................5-10 Manchester Coder (MANCD) Interrupt..................................................................5-11 6 TIMERS 6.1 TIMER A - PROGRAMMABLE TIMER ..................................................................6-1 6.1.1 Counter ............................................................................................................6-1 6.1.2 Output Compare Registers ..............................................................................6-4 6.1.3 Input Capture Registers...................................................................................6-4 6.1.4 Timer Control Register (TCR)..........................................................................6-5 6.1.5 Timer A Status Register (TSR) ........................................................................6-6 6.1.6 Programmable Timer Timing Diagrams ...........................................................6-7 6.2 TIMER B - RELOADABLE TIMER .........................................................................6-10 6.2.1 Functional Description .....................................................................................6-10 6.2.2 Resolution and Maximum Period .....................................................................6-10 6.2.3 Timer B Counter ..............................................................................................6-11 6.2.4 Timer B Preset Register ..................................................................................6-12 6.2.5 Timer B Control Status Register ......................................................................6-12 6.3 COP WATCHDOG .................................................................................................6-13 6.3.1 Watchdog Timer Time-Out Flag .......................................................................6-13 6.3.2 COP System Enable and Operation ................................................................6-14 6.3.3 Disable COP Function in Stop or Wait Mode ...................................................6-14 6.3.4 Watchdog Timer Control Status Register (WDCSR)........................................6-14 7 SERIAL PERIPHERAL INTERFACE 7.1 Features ................................................................................................................7-1 7.2 Signal Description .................................................................................................7-1 7.2.1 Serial Clock (SCK)...........................................................................................7-2 TPG MOTOROLA ii For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 8 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Paragraph Number TITLE Page Number 7.2.2 Serial Data Output (SDO) ................................................................................7-3 7.2.3 Serial Data Input (SDI).....................................................................................7-3 7.3 General Operation .................................................................................................7-3 7.4 SPI Registers.........................................................................................................7-3 7.4.1 SPI Control Register (SPCR)...........................................................................7-4 7.4.2 SPI Status Register (SPSR) ............................................................................7-5 7.4.3 Serial Peripheral Data Register (SPDR) ..........................................................7-6 8 MANCHESTER ENCODER/DECODER 8.1 Features.................................................................................................................8-1 8.2 General Operation .................................................................................................8-2 8.2.1 Encoder............................................................................................................8-2 8.2.1.1 Idle State of Encoder..................................................................................8-3 8.2.1.2 Initialization of Encoder ..............................................................................8-3 8.2.1.3 Encode Data Register Empty Flag (NCM) and Encode Interrupt...............8-3 8.2.1.4 End Pattern Generation and Next Data Byte Encoding..............................8-3 8.2.1.5 Disable Encoder .........................................................................................8-3 8.2.2 Decoder ...........................................................................................................8-5 8.2.2.1 Decoder Overrun........................................................................................8-5 8.2.2.2 Data Bit Format Error Detection .................................................................8-6 8.2.2.3 Bit Rate Error Detection .............................................................................8-6 8.3 Manchester Encoder/Decoder Registers...............................................................8-6 8.3.1 MANCD Control Register.................................................................................8-6 8.3.2 MANCD Status Register ..................................................................................8-8 8.3.3 Encode Data Register ($2D)............................................................................8-9 8.3.4 Decode Data Register ($2E)............................................................................8-9 9 DTMF/MELODY GENERATOR 9.1 Features.................................................................................................................9-1 9.2 General Operation .................................................................................................9-1 9.3 DMG Registers ......................................................................................................9-3 9.3.1 Row Frequency Control Register (FCR) Column Frequency Control Register (FCC) .....................................................9-3 9.3.2 Tone Control Register (TNCR) .........................................................................9-4 9.4 Programming the DMG..........................................................................................9-6 9.4.1 DTMF Dialling ..................................................................................................9-6 9.4.2 Melody Generation...........................................................................................9-6 9.4.3 ToneX Generation ............................................................................................9-6 9.4.4 Melody+ToneX Generation..............................................................................9-6 TPG MC68HC05F8 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA iii 9 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Paragraph Number TITLE Page Number Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 10 CPU CORE AND INSTRUCTION SET 10.1 Registers .............................................................................................................10-1 10.1.1 Accumulator (A) .............................................................................................10-1 10.1.2 Index register (X) ...........................................................................................10-2 10.1.3 Program counter (PC)....................................................................................10-2 10.1.4 Stack pointer (SP)..........................................................................................10-2 10.1.5 Condition code register (CCR).......................................................................10-2 10.2 Instruction set ......................................................................................................10-3 10.2.1 Register/memory Instructions ........................................................................10-4 10.2.2 Branch instructions ........................................................................................10-4 10.2.3 Bit manipulation instructions ..........................................................................10-4 10.2.4 Read/modify/write instructions.......................................................................10-4 10.2.5 Control instructions ........................................................................................10-4 10.2.6 Tables.............................................................................................................10-4 10.3 Addressing modes...............................................................................................10-11 10.3.1 Inherent..........................................................................................................10-11 10.3.2 Immediate ......................................................................................................10-11 10.3.3 Direct .............................................................................................................10-11 10.3.4 Extended........................................................................................................10-12 10.3.5 Indexed, no offset ..........................................................................................10-12 10.3.6 Indexed, 8-bit offset .......................................................................................10-12 10.3.7 Indexed, 16-bit offset .....................................................................................10-12 10.3.8 Relative ..........................................................................................................10-13 10.3.9 Bit set/clear ....................................................................................................10-13 10.3.10 Bit test and branch.........................................................................................10-13 11 LOW POWER MODES 11.1 Stop Mode ...........................................................................................................11-1 11.1.1 Timer A during Stop Mode.............................................................................11-1 11.1.2 Timer B during Stop Mode.............................................................................11-2 11.1.3 SPI during Stop Mode....................................................................................11-2 11.1.4 DMG during Stop Mode .................................................................................11-2 11.1.5 COP during Stop Mode..................................................................................11-2 11.2 Wait Mode ...........................................................................................................11-3 12 OPERATING MODES 12.1 12.2 User Mode (Normal Operation) ...........................................................................12-2 Self-Check Mode .................................................................................................12-2 TPG MOTOROLA iv For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 10 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Paragraph Number TITLE Page Number Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 12.3 Bootstrap Mode ...................................................................................................12-4 12.3.1 EPROM Program Control Register ................................................................12-4 12.3.2 EPROM Programming Sequence ..................................................................12-5 12.3.3 Program and Verify EPROM ..........................................................................12-6 12.3.4 Verify EPROM Contents.................................................................................12-7 13 ELECTRICAL SPECIFICATIONS 13.1 13.2 13.3 13.4 13.5 13.6 Maximum Ratings ................................................................................................13-1 Thermal Characteristics.......................................................................................13-1 DC Electrical Characteristics ...............................................................................13-2 DTMF/Melody Generator Electrical Characteristics ............................................13-4 Control Timing .....................................................................................................13-5 Programming Operation Electrical Characteristics ..............................................13-7 14 MECHANICAL SPECIFICATIONS 14.1 14.2 56-pin SDIP Package...........................................................................................14-1 64-pin QFP Package............................................................................................14-2 TPG MC68HC05F8 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA v 11 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA vi For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 12 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... LIST OF FIGURES Figure Number 1-1 2-1 2-2 2-3 3-1 4-1 5-1 5-2 5-3 5-4 6-1 6-2 6-3 6-4 6-5 6-6 6-7 7-1 7-2 7-3 8-1 8-2 8-3 8-4 9-1 10-1 10-2 12-1 12-2 12-3 12-4 12-5 14-1 14-2 TITLE Page Number MC68HC05F8/MC68HC705F8 Block Diagram ......................................................1-3 Pin Assignments for 56-pin SDIP package.............................................................2-3 Pin Assignments for 64-pin QFP package..............................................................2-3 Parallel Port I/O Circuitry ........................................................................................2-5 MC68HC05F8/MC68HC705F8 Memory Map ........................................................3-2 Power-On Reset and RESET Timing......................................................................4-4 Interrupt Stacking Order .........................................................................................5-2 Hardware Interrupt Flowchart .................................................................................5-3 External Interrupt Circuit and Timing ......................................................................5-5 Keyboard Interrupt Circuit.......................................................................................5-9 Programmable Timer Block Diagram......................................................................6-2 Timer State Timing Diagram for Reset ...................................................................6-8 Timer State Timing Diagram for Input Capture .......................................................6-8 Timer State Timing Diagram for Output Compare ..................................................6-9 Timer State Diagram for Timer Overflow ................................................................6-9 Reloadable Timer Block Diagram ...........................................................................6-11 Watchdog Timer Block Diagram .............................................................................6-13 SPI Master-Slave Interconnection ..........................................................................7-2 SPI Port Timing.......................................................................................................7-2 SPI Block Diagram..................................................................................................7-4 Manchester Encoder/Decoder Block Diagram........................................................8-2 Logic Flow of Encoder Hardware Operation...........................................................8-4 Encoder Timing Diagram ........................................................................................8-5 Logic Flow of Decoder Hardware Operation...........................................................8-7 DTMF/Melody Generator Block Diagram ...............................................................9-2 Programming model .............................................................................................10-1 Stacking order ......................................................................................................10-2 Flowchart of Mode Entering .................................................................................12-1 Self-Check Mode Timing ......................................................................................12-2 Self-Test Circuit ....................................................................................................12-3 EPROM Programming Sequence.........................................................................12-6 EPROM Programming Circuit for Bootstrap Mode ...............................................12-7 56-pin SDIP Mechanical Dimensions ...................................................................14-1 64-pin QFP Mechanical Dimensions ....................................................................14-2 TPG MC68HC05F8 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA vii 13 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA viii For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 14 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... LIST OF TABLES Table Number 2-1 3-1 4-1 5-1 6-1 6-2 9-1 9-2 9-3 9-4 10-1 10-2 10-3 10-4 10-5 10-6 10-7 10-8 12-1 12-2 12-3 13-1 13-2 13-3 13-4 13-5 13-6 13-7 TITLE Page Number I/O Pin Functions ....................................................................................................2-4 MC68HC05F8/MC68HC705F8 Registers ..............................................................3-3 Reset Action on Internal Circuit ..............................................................................4-3 Reset/Interrupt Vector Addresses ..........................................................................5-2 Timer A Clock Frequency Selection .......................................................................6-3 Reloadable Timer Resolution and Maximum Period...............................................6-10 Bit Description for DTMF Generation .....................................................................9-3 Bit Description for Melody Generation....................................................................9-4 DMG Operating Modes...........................................................................................9-5 Effect of Tone Generation Enable on DMG.............................................................9-5 MUL instruction.....................................................................................................10-5 Register/memory instructions...............................................................................10-5 Branch instructions ...............................................................................................10-6 Bit manipulation instructions.................................................................................10-6 Read/modify/write instructions .............................................................................10-7 Control instructions...............................................................................................10-7 Instruction set .......................................................................................................10-8 M68HC05 opcode map.........................................................................................10-10 Mode Selection.....................................................................................................12-2 Self-Check Report ................................................................................................12-4 Bootstrap Mode Options.......................................................................................12-4 DC Electrical Characteristics for 5V Operation ....................................................13-2 DC Electrical Characteristics for 2.7V Operation .................................................13-3 Electrical Specification of sine wave tones at TONEOUT output..........................13-4 Electrical Specification of square wave tones at TONEOUT output .....................13-4 Electrical Specification of ToneX at TONEX output ..............................................13-4 Control Timing for 5V Operation ...........................................................................13-5 Control Timing for 2.7V Operation ........................................................................13-6 TPG MC68HC05F8 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA ix 15 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA x For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 16 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 1 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 GENERAL DESCRIPTION The MC68HC05F8 HCMOS microcontroller is a member of the M68HC05 family of low-cost single-chip microcontrollers. This 8-bit microcontroller unit (MCU) contains an on-chip oscillator, CPU, RAM, ROM, I/O, timer, serial peripheral interface, Manchester encoder/decoder, DTMF/melody generator, and COP watchdog monitor. This MCU is particularly suitable for cordless telephones with an answering machine. The MC68HC705F8 is an EPROM version of the MC68HC05F8. All references to the MC68HC05F8 apply equally to the MC68HC705F8, unless otherwise stated. References specific to the MC68HC705F8 are italicized in the text. 1.1 Features The following are some of the hardware and software features of the MC68HC05F8 single-chip microcontroller. 1.1.1 Hardware Features • HCMOS technology • 8-bit architecture • Power saving Wait and Stop modes • Full static operation • 2.5V to 6V operating voltage • 320 bytes of on-chip RAM (64 bytes for stack) • 8K-bytes of on-chip ROM; 8K-bytes of on-chip EPROM for MC68HC705F8 • 496-bytes self-check ROM; 496-bytes bootstrap ROM for MC68HC705F8 • 8 keyboard interrupt lines TPG MC68HC05F8 GENERAL DESCRIPTION For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 1-1 17 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 • Manchester encoder/decoder • DTMF/melody generator • Oscillator for 3.579MHz crystal • 16-bit free-running programmable timer with 4 selectable prescaler frequencies • 16-bit auto-reload timer with 4 selectable prescaler frequencies • Computer Operating Properly (COP) watchdog monitor • Serial peripheral interface • 10mA high current output pins for LED direct driving • Available in 56-pin SDIP and 64-pin QFP packages 1.1.2 Software Features • Similar to MC6800 • 8 x 8 unsigned multiply instruction • Efficient use of program space • Versatile interrupt handling • True bit manipulation • Addressing modes with index addressing for tables • Efficient instruction set • Memory mapped I/O • Two power saving standby modes • Upward software compatible with the M146805 CMOS family TPG MOTOROLA 1-2 GENERAL DESCRIPTION For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 18 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. DDR A PORT A 8 DDR B PORT B USER ROM/ EPROM - 8K-BYTES 8 DDR C KEYBOARD INTERRUPT CIRCUIT PORT C 1 8 SELF-CHECK/ BOOTSTRAP ROM - 496 BYTES 0 7 M68HC05 CPU PB0 - PB7 PC0 - PC7 ACCUMULATOR 7 0 5 PD0 - PD4 STACK POINTER 15 DDR D SPI PORT D 15 0 0 0 0 0 0 0 0 1 1 RESET INDEX REGISTER 0 5 PD5/SDI PD6/SDO 0 4 PD7/SCK IRQ1 DDR E PORT E 0 N Z C 8 DDR F 7 1 1 1 H I PORT F IRQ2 8 DDR G PROGRAM COUNTER PORT G Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... RAM - 320 BYTES PA0 - PA7 PE0 - PE7 CONDITION CODE REGISTER COP SYSTEM OSC1 OSC2 OSC ÷ 2 TIMER/BUS CLOCK PRESCALER PG0 PG1 TO PERIPHERALS MANCHESTER ENCODER/DECODER DECOIN ENCOOUT 16-BIT FREE-RUNNING TIMER TCAP TCMP VDD VSS PF0 - PF7 POWER 16-BIT RELOADABLE TIMER DTMF/MELODY GENERATOR TONEOUT TONEX Figure 1-1 MC68HC05F8/MC68HC705F8 Block Diagram TPG MC68HC05F8 GENERAL DESCRIPTION For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 1-3 19 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA 1-4 GENERAL DESCRIPTION For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 20 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 2 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 2 PIN DESCRIPTIONS This section provides a description of the functional pins and I/O programming of the MC68HC05F8/MC68HC705F8 microcontroller. 2.1 Functional Pin Descriptions 56-pin SDIP PIN No. 64-pin QFP PIN No. 53, 52 52, 51 IRQ1 IRQ2 10 9 2 1 RESET 34 30 TCAP 49 48 TCMP 48 47 33, 32 29, 28 PA0-PA7 (PA4-PA7 only) 14-11 10-3 PB0-PB7 22-15 18-11 PC0-PC7 5-1, 56-54 60-53 PIN NAME VDD, VSS OSC1, OSC2 DESCRIPTION Power is supplied to the MCU using these two pins. VDD is power and VSS is ground. IRQ1 and IRQ2 are software programmable to provide two choices of interrupt triggering sensitivity. These options are: 1) negative edge-sensitive triggering only, or 2) both negative edge-sensitive and level sensitive triggering. The active low RESET input is not required for start-up, but can be used to reset the MCU internal state and provide an orderly software start-up procedure. The TCAP input controls the input capture feature for the on-chip programmable free-running timer. The TCMP pin provides an output for the output compare feature of the on-chip programmable free-running timer. These pins provide connections to the on-chip oscillator. The crystal frequency is 3.579545MHz. OSC1 may be driven by an external oscillator if an external crystal circuit is not used. These eight I/O lines comprise port A. The state of any pin is software programmable. All port A lines are configured as input during power on or external reset. Port A can also be programmed as keyboard interrupts. PA0 to PA3 are not bonded out on the 56-pin package. These eight I/O lines comprise port B. The state of any pin is software programmable. All port B lines are configured as input during power on or external reset. These eight I/O lines comprise port C. The state of any pin is software programmable. All port C lines are configured as input during power on or external reset. Each port C pins also has the ability to sink a maximum current of 10mA with a maximum saturation of 1V. TPG MC68HC05F8 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 2-1 21 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 2 PIN NAME PD0-PD7 Freescale Semiconductor, Inc... 64-pin QFP PIN No. (PD0-PD4 only) 47-43 - 46-39 PE0-PE7 30-23 26-19 PF0-PF7 42-35 38-31 PG0, PG1 (PG0 only) 8 64, 63 ENCOOUT DECOIN 6 7 61 62 TONEOUT 50 49 TONEX 51 50 NC/VPP 31 27 SDI SDO SCK Freescale Semiconductor, Inc... 56-pin SDIP PIN No. 41 40 39 DESCRIPTION These eight I/O lines comprise port D. The state of any pin is software programmable. All port D lines are configured as input during power on or external reset. When the SPE bit of the SPI Control register (bit 6 of address $10) is set, PD5, PD6, & PD7 are used for SDI, SDO, & SCK respectively, for the Serial Peripheral Interface. PD5 to PD7 are not bonded out on the 56-pin package. Hence, the 56-pin package does not have SPI features. These eight I/O lines comprise port E. The state of any pin is software programmable. All port E lines are configured as input during power on or external reset. These eight I/O lines comprise port F. The state of any pin is software programmable. All port F lines are configured as input during power on or external reset. These two I/O lines comprise port G. The state of any pin is software programmable. All port G lines are configured as input during power on or external reset. PG1 is not bonded out on the 56-pin package. This pin is for encoded data output from the Manchester encoder. This pin is for raw (Manchester) data input to the Manchester decoder. This output pin provides dual tone DTMF or melody under the control of the DTMF/Melody Generator. This output pin provides pacifier tones under the control of the DTMF/Melody Generator. This pin is used as the programming voltage pin for the EPROM version, MC68HC705F8. It is connected to VDD for normal operation. This pin is not used in the standard ROM part, MC68HC05F8. TPG MOTOROLA 2-2 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 22 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 2.2 Pin Assignments Freescale Semiconductor, Inc... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 PC5 PC6 PC7 VDD VSS TONEX TONEOUT TCAP TCMP PD0 PD1 PD2 PD3 PD4 PF0 PF1 PF2 PF3 PF4 PF5 PF6 PF7 RESET OSC1 OSC2 NC/VPP PE0 PE1 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 PG0 PG1 DECOIN ENCOOUT PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 VDD VSS TONEX TONEOUT Figure 2-1 Pin Assignments for 56-pin SDIP package TCAP TCMP PD0 PD1 PD2 PD3 PD4 PD5/SDI PD6/SDO PD7/SCK PF0 PF1 PF2 PF3 PF4 PF5 22 23 24 25 26 27 28 29 30 31 32 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 IRQ2 IRQ1 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 PE7 PE6 PE5 PE4 PE3 PE2 PE1 PE0 NC/VPP OSC2 OSC1 RESET PF7 PF6 Freescale Semiconductor, Inc... 2 PC4 PC3 PC2 PC1 PC0 ENCOOUT DECOIN PG0 IRQ2 IRQ1 PA7 PA6 PA5 PA4 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 PE7 PE6 PE5 PE4 PE3 PE2 Figure 2-2 Pin Assignments for 64-pin QFP package TPG MC68HC05F8 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 2-3 23 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 2.3 Input/Output Programming 2.3.1 Parallel Ports Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 2 Port A, B, C, D, E, F and G may be programmed as an input or an output under software control. The direction of the pins is determined by the state of corresponding bit in the port data direction register (DDR). Each 8-bit port (except port G, where it has only 2 bits) has an associated 8-bit data direction register. Any port A, B, C, D, E, F or G pin is configured as an output if its corresponding DDR bit is set to a logic one. A pin is configured as an input if its corresponding DDR bit is cleared to a logic zero. At power-on or reset, all DDRs are cleared, which configure all port A, B, C, D, E, F and G pins as inputs. The data direction registers are capable of being written to or read by the processor. Refer to Figure 2-3 and Table 2-1. During the programmed output state, a read of the data register actually reads the value of the output data latch and not the I/O pin. Table 2-1 I/O Pin Functions R/W 0 0 1 1 2.3.2 DDR 0 1 0 1 I/O Pin Function The I/O pin is in input mode. Data is written into the output data latch. Data is written into the output data latch and output to the I/O pin. The state of the I/O pin is read. The I/O pin is in an output mode. The output data latch is read. Serial Port (SPI) The serial peripheral interface (SPI) uses the port D pins for its function. The SPI function requires three of the pins (PD5-PD7) for its serial data input (SDI), serial data output (SDO), and system clock (SCK) respectively. See Section 7 for detailed description of SPI. TPG MOTOROLA 2-4 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 24 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 2 DATA DIRECTION REGISTER BIT Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... INTERNAL MC68HC05 CONNECTIONS LATCHED OUTPUT DATA BIT OUTPUT I/O PIN INPUT REGISTER BIT INPUT I/O (a) TYPICAL PORT DATA DIRECTION REGISTER 7 6 5 4 3 2 1 0 DDR 7 DDR 6 DDR 5 DDR 4 DDR 3 DDR 2 DDR 1 DDR 0 Px2 Px1 TYPICAL PORT REGISTER I/O PORT LINES Px7 Px6 Px5 Px3 Px4 Px0 (b) VDD NOTE: (1) IP = INPUT PROTECTION (2) LATCH-UP PROTECTION NOT SHOWN PORT DATA & P PORT DDR PAD + N IP INTERNAL LOGIC (c) Figure 2-3 Parallel Port I/O Circuitry TPG MC68HC05F8 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 2-5 25 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 2 THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA 2-6 PIN DESCRIPTIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 26 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 3 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 3 MEMORY AND REGISTERS This section describes the organization of the on-chip memory. 3.1 Memory Map The CPU can address 64K-bytes of memory space. The ROM portion of memory holds the program instructions, fixed data, user-defined vectors, and interrupt service routines. The RAM portion of memory holds variable data. 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. Figure 3-1 shows the Memory Map for the MC68HC05F8/MC68HC705F8. 3.2 Input/Output Section The first 64 addresses of memory space, $0000-$003F, are the I/O section. These are the addresses of the I/O control registers, status registers, and data registers. 3.3 RAM The 320 addresses from $0040-$017F are RAM locations. The CPU uses the 64 RAM addresses, $00C0-$00FF, as the stack. Before processing an interrupt, the CPU uses five bytes of the stack to save the contents of the CPU registers. During a subroutine call, the CPU uses two bytes of the stack 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. Once the stack pointer passes $00C0, it wraps round back to $00FF. TPG MC68HC05F8 MEMORY AND REGISTERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 3-1 27 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. $0000 $003F $0040 0 I/O 64 Bytes 0 Ports 14 Bytes 63 64 RAM 128 Bytes Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 3 $00FF $0100 RESERVED 2 Bytes Stack 64 Bytes SPI 3 Bytes 255 256 RAM 128 Bytes $017F $0180 DMG 3 Bytes 383 384 Event Enable 1 Byte Miscellaneous 1 Byte Unused $02FF $0300 Timer A 10 Bytes 767 768 Timer B 7 Bytes Unused RESERVED 2 Bytes Manchester Coder 4 Bytes $DDEF $DE00 56831 56832 User ROM/EPROM 8192 Bytes $FDFF $FE00 $FFDF $FFE0 $FFEF $FFF0 $FFFF Self-Check/Bootstrap Program 496 Bytes Self-Check/Bootstrap Vectors 16 Bytes User Vectors 16 Bytes 65023 65024 65503 65504 65519 65520 RESERVED 5 Bytes Keyboard 1 Byte System Option 1 Byte Watchdog Timer 1 Byte RESERVED 8 Bytes EPROM PCR 1 Byte 65535 KEYBOARD $FFF0 $FFF2 MANCHESTER CODER SPI $FFF4 TIMER A $FFF6 TIMER B $FFF8 IRQ $FFFA SWI $FFFC RESET $FFFE 63 Port A Data Register Port B Data Register Port C Data Register Port D Data Register Port E Data Register Port F Data Register Port G Data Register Port A Direction Register Port B Direction Register Port C Direction Register Port D Direction Register Port E Direction Register Port F Direction Register Port G Direction Register RESERVED RESERVED Serial Peripheral Control Register Serial Peripheral Status Register Serial Peripheral Data I/O Register Row Frequency Control Register Column Frequency Control Register Tone Control Register Event Enable Register Miscellaneous Timer A Control Register Timer A Status Register Timer A Input Capture High Register Timer A Input Capture Low Register Timer A Output Compare High Register Timer A Output Compare Low Register Timer A Counter High Register Timer A Counter Low Register Timer A Alternative Counter High Register Timer A Alternative Counter Low Register Timer B Control Register Timer B Preset Counter High Register Timer B Preset Counter Low Register Timer B Counter High Register Timer B Counter Low Register Timer B Alternative Counter High Register Timer B Alternative Counter Low Register RESERVED RESERVED Manchester Coder Control Register Manchester Coder Status Register Manchester Encoder Register Manchester Decoder Register RESERVED RESERVED RESERVED RESERVED RESERVED Keyboard Control Register System Option Register Watchdog Timer Control Register RESERVED RESERVED RESERVED RESERVED RESERVED RESERVED RESERVED RESERVED ERPOM Programming Control Register $00 $01 $02 $03 $04 $05 $06 $07 $08 $09 $0A $0B $0C $0D $0E $0F $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $1A $1B $1C $1D $1E $1F $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $2A $2B $2C $2D $2E $2F $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $3A $3B $3C $3D $3E $3F Figure 3-1 MC68HC05F8/MC68HC705F8 Memory Map TPG MOTOROLA 3-2 MEMORY AND REGISTERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 28 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 3-1 MC68HC05F8/MC68HC705F8 Registers Address $00 $01 $02 $03 $04 $05 $06 $07 $08 $09 $0A $0B $0C $0D $0E $0F $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $1A $1B $1C $1D $1E $1F Register Name Port A data Part B data Port C data Port D data Port E data Port F data Port G data Port A data direction Port B data direction Port C data direction Port D data direction Port E data direction Port F data direction Port G data direction Not used Not used SPI control SPI status SPI data I/O Row frequency control Column frequency control Tone control Event enable Miscellaneous Timer A control Timer A status Timer A input capture high Timer A input capture low Timer A output compare high Timer A output compare low Timer A counter high Timer A counter low Bit 7 bit 7 bit 7 bit 7 bit 7 bit 7 bit 7 Bit 6 bit 6 bit 6 bit 6 bit 6 bit 6 bit 6 Bit 5 bit 5 bit 5 bit 5 bit 5 bit 5 bit 5 Bit 4 bit 4 bit 4 bit 4 bit 4 bit 4 bit 4 Bit 3 bit 3 bit 3 bit 3 bit 3 bit 3 bit 3 Bit 2 bit 2 bit 2 bit 2 bit 2 bit 2 bit 2 DDR7 DDR7 DDR7 DDR7 DDR7 DDR7 DDR6 DDR6 DDR6 DDR6 DDR6 DDR6 DDR5 DDR5 DDR5 DDR5 DDR5 DDR5 DDR4 DDR4 DDR4 DDR4 DDR4 DDR4 DDR3 DDR3 DDR3 DDR3 DDR3 DDR3 DDR2 DDR2 DDR2 DDR2 DDR2 DDR2 SPIE SPIF SPE DCOL FCR3 FCC3 FCR2 FCC2 MS1 TIMH POR ICIE ICF MS0 INTE1 INTF1 OCIE OCF Bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 bit 1 DDR1 DDR1 DDR1 DDR1 DDR1 DDR1 DDR1 Bit 0 bit 0 bit 0 bit 0 bit 0 bit 0 bit 0 bit 0 DDR0 DDR0 DDR0 DDR0 DDR0 DDR0 DDR0 FCR1 FCC1 FCR0 FCC0 IEDG OLVL 3 MSTR TGER INTE2 INTF2 TOIE TOF FCR4 FCC4 TGEC KEYF TPG MC68HC05F8 MEMORY AND REGISTERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 3-3 29 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 3-1 MC68HC05F8/MC68HC705F8 Registers Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 3 Address $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $2A $2B $2C $2D $2E $2F $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $3A $3B $3C $3D $3E $3F Register Name Timer A alternative counter high Timer A alternative counter low Timer B control Timer B preset counter high Timer B preset counter low Timer B counter high Timer B counter low Timer B alternative counter high Timer B alternative counter low Not used Not used Manchester coder control Manchester coder status Manchester encoder data Manchester decoder data Not used Reserved Not used Not used Not used Keyboard control System option Watchdog timer control Not used Not used Not used Not used Not used Reserved Reserved Not used EPROM programming control Bit 7 Bit 6 TMBE TBOIE NCE NCM NIE NCC Bit 5 CIE DCF Bit 4 DCE OVF KEYE WDTE TCSA1 WDTE TCSA0 INTN1 KWDT WDTOF Bit 3 Bit 2 Bit 1 Bit 0 TCSB1 TCSB0 TUF BR1 BR0 KEYX5 KEYX4 WDT1 WDT0 LAT EPGM DIE KEYX7 INTN2 KEYX6 TPG MOTOROLA 3-4 MEMORY AND REGISTERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 30 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 4 RESETS 4 The MC68HC05F8 can be reset in four ways: by the initial power-on reset function, by an active low input to the RESET pin, by an opcode fetch from an illegal address, and by a COP watchdog reset (if the watchdog timer is enabled). Any of these resets will cause the program to go to its starting address, specified by the contents of memory locations $FFFE and $FFFF, and cause the interrupt mask of the Condition Code register to be set. 4.1 Power-On Reset (POR) The power-on reset occurs when a positive transition is detected on the supply voltage, VDD. The power-on reset is used strictly for power-up conditions, and should not be used to detect any drops in the power supply voltage. There is no provision for a power-down reset. The power-on circuitry provides for a 4064 tcyc delay from the time that the oscillator becomes active. If the external RESET pin is low at the end of the 4064 tcyc time out, the processor remains in the reset condition until RESET goes high. The user must ensure that VDD has risen to a point where the MCU can operate properly prior to the time the 4064 POR cycles have elapsed. If there is doubt, the external RESET pin should remain low until such time that VDD has risen to the minimum operating voltage specified. After a power-on reset the POR bit in the Miscellaneous register (bit 7 of address $17) is set, indicating the reset was cause by a power-on, not COP watchdog time-out or external reset. The POR bit is cleared by writing a logic “0” to the bit. The POR cannot be set by software. 4.2 RESET Pin The RESET input pin is used to reset the MCU to provide an orderly software start-up procedure. When using the external reset, the RESET pin must stay low for a minimum of 1.5tcyc. The RESET pin contains an internal Schmitt Trigger as part of its input to improve noise immunity. TPG MC68HC05F8 RESETS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 4-1 31 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 4.3 Illegal Address (ILADR) Reset The MCU monitors all opcode fetches. If an illegal address space is accessed during an opcode fetch, an internal reset is generated. Illegal address spaces consist of all unused locations within the memory map and the I/O registers (see Figure 3-1). Because the internal reset signal is used, the MCU comes out of an ILADR reset in the same operating mode it was in when the opcode was fetched. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 4 4.4 Computer Operating Properly (COP) Reset The MCU contains a watchdog timer that automatically times out if not reset (cleared) within a specific amount of time by a program reset sequence. Note: COP time-out is prevented by periodically writing a logic 1 to bit 7 of address $36. If the watchdog timer is allowed to time-out, an internal reset is generated to reset the MCU. Because the internal reset signal is used, the MCU comes out of a COP reset in the same operating mode it was in when the COP time-out was generated. The watchdog timer is initially disabled after a reset, it is enabled by writing a ‘1’ to bit 7 of address $36. Once enabled, it cannot be disabled by software. Refer to Section 6.3 for detailed description of the COP watchdog system. Table 4-1 shows the internal circuit actions on reset, but not necessary in order of occurrence. TPG MOTOROLA 4-2 RESETS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 32 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 4-1 Reset Action on Internal Circuit DEFAULT CONDITIONS AFTER RESET Timer A not inhibited (TIMHA bit cleared). Timer A prescaler reset to zero state. Timer A counter configures to $FFFC. Timer A output compare (TCMP) bit is reset to zero. Timer A clock=internal bus clock ÷ 4 (TCSA1=TCSA0=0). All timer A interrupt enable bits cleared (ICIE, OCIE, and TOIE) to disable timer interrupts. 6 The OLVL timer bit is also cleared by reset. 7 Timer B is disabled (TMBE bit cleared). 8 Timer B prescaler reset to zero (TCSB0=TCSB1=0). 9 All data direction registers cleared to zero (default as inputs). 10 Stack pointer configured to $00FF. 11 Internal address bus forced to restart vector ($FFFE-$FFFF). 12 I bit of condition code register set to logic 1. 13* STOP latch cleared. 14 WAIT latch cleared. 15 External interrupt latch cleared (INTF1=INTF2=0). 16 External interrupt enable bits cleared (INTE1 & INTE2). SPI disabled (serial output enable control bit SPE=0). 17 Other SPI bits cleared are SPIE, MSTR, SPIF, and DCOL. 18 SPI system configured to slave mode (MSTR=0). 19 Keyboard interrupt enabled (KEYE) and keyboard interrupt flag (KEYF) bits are cleared. 20 Disable MANCD (NCD=DCE=0). 21 Disable tone generation in DMG (TGER=TGEC=0). 22 Place DMG in DTMF mode (MS1=MS0=0). 23 Watchdog timer is inhibited (WDTE=0), kill function is disabled (KWDT=0). 24 If reset is by POR, set POR bit. * Indicates that time-out still occurs. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 2 3 4 5 4 Listed numbers do not represent order of occurrence. TPG MC68HC05F8 RESETS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 4-3 33 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. t VDDR VDD VDD THRESHOLD (TYPICALLY 1-2V) Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 4 OSC1 PIN1 toxov 4064 tcyc tcyc INTERNAL CLOCK2 INTERNAL ADDRESS BUS2 INTERNAL DATA BUS2 FFFE NEW PCL FFFF NEW PCH NEW PC OP CODE FFFE FFFE FFFF NEW PC PCL OP CODE PCH tRL =1.5tcyc 3 RESET NOTES: 1. OSC1 is not meant to represent frequency. It is only used to represent time. 2. Internal clock, internal address bus, and internal data bus signals are not available externally. 3. Next rising edge of internal clock after rising edge of RESET initiates reset sequence. Figure 4-1 Power-On Reset and RESET Timing TPG MOTOROLA 4-4 RESETS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 34 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5 INTERRUPTS The MC68HC05F8 is capable of handling eight types of interrupt, seven hardware and one software. The interrupt mask bit (“I” bit in the Condition Code register), if set, masks all interrupts except the software interrupt, SWI. Interrupts such as IRQ, Timers, and MANCD have several flags which will cause the interrupt. Interrupt flags are found in “read only” status registers, while their enables are in associated control registers. They are never mixed in the same register. If the enable bit is “0”, it masks the interrupt from occurring but does not inhibit the flag from being set. A reset clears all enable bits. The general sequence for clearing an interrupt is a software sequence of reading the status register while the flag is set followed by a read or write of an associated register. When any of these interrupts occur, and if enabled, normal processing is suspended at the end of the current instruction execution. The state of the machine is pushed onto the stack (see Figure 5-1 for stacking order) and the appropriate vector points to the starting address of the interrupt service routine (see Table 5-1). Also, the interrupt mask bit in the condition code register is set. This masks further interrupts. At the completion of the service routine, the software normally contains an RTI instruction which, when executed, restores the machine state and continues executing the interrupted program. Figure 5-2 is a flowchart showing the program flow and interrupt priority for hardware interrupts. Note: 5 The interrupt mask bit (I bit) will be cleared if and only if the corresponding bit stored on the stack is zero. TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-1 35 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. $00C0 (BOTTOM OF STACK) $00C1 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... UNSTACKING ORDER 5 $00C2 • • • • • • CONDITION CODE REGISTER 5 1 4 2 ACCUMULATOR 3 3 INDEX REGISTER 2 4 PROGRAM COUNTER (HIGH BYTE) 1 5 PROGRAM COUNTER (LOW BYTE) STACKING ORDER • • • • • • $00FD $00FE $00FF (TOP OF STACK) Figure 5-1 Interrupt Stacking Order Table 5-1 Reset/Interrupt Vector Addresses Register – – Miscellaneous Timer B Control & Status Timer A Status SPI Status MANCD Status Miscellaneous Flag Name – – INTF 1 INTF 2 Interrupt Reset Software External Interrupt 1 External Interrupt 2 CPU Interrupt RESET SWI Vector Address $FFFE-$FFFF $FFFC-$FFFD IRQ $FFFA-$FFFB TUF Timer Underflow TIMER B $FFF8-$FFF9 ICF OCF TOF SPIF NCM NCC DCF OVF KEYF Input Capture Output Compare Timer Overflow SPI Interrupt Encoder Data Register Empty Encoder Completion Decoder Data Register Full Overrun Interrupt Keyboard TIMER A $FFF6-$FFF7 SPI $FFF4-$FFF5 Manchester Coder $FFF2-$FFF3 KB $FFF0-$FFF1 TPG MOTOROLA 5-2 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 36 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. From reset Is I bit set ? N Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Y IRQx external interrupt ? Y Stack PC, X, A, CCR N Timer B underflow interrupt ? 5 Set I bit Y Load PC from interrupt vectors N Timer A internal interrupt ? Y Complete interrupt routine and execute RTI N SPI internal interrupt ? Y N Manchester encoder/decoder interrupt ? Y N Keyboard external interrupt ? Y N Fetch next instruction Execute instruction Figure 5-2 Hardware Interrupt Flowchart TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-3 37 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 5.1 Hardware Controlled Sequences Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The following three functions are not strictly interrupts, however, they are tied very closely to the interrupts. These functions are RESET, STOP, WAIT. 1) RESET The RESET input pin causes the program to go to its starting address. This address is specified by the contents of memory locations $FFFE and $FFFF. The interrupt mask of the condition code register is also set. Most parts of the MCU is configured to some known state as described in Table 4-1. 2) STOP The STOP instruction causes the oscillator to be turned off and the processor “sleeps” until an external interrupt (IRQ), keyboard interrupt, or RESET occurs. See Section 11 on Low Power Modes. 3) WAIT The WAIT instruction causes all processor clocks to stop, but leaves the Timer A, Timer B, MANCD and SPI clocks running. This “rest” state of the processor can be exited by RESET, an external interrupt (IRQ), keyboard interrupt, Timer or SPI interrupt. There are no special wait vectors for these individual interrupts. See Section 11 on Low Power Modes. 5 5.2 Software Interrupt (SWI) The software interrupt is an executable instruction. The action of the SWI instruction is similar to the hardware interrupts. The SWI is executed regardless of the state of the interrupt mask in the condition code register. The service routine address is specified by the contents of memory location $FFFC and $FFFD. 5.3 External Interrupts (IRQ1 & IRQ2) The external interrupts IRQ1 and IRQ2 can be software configured for “negative-edge” or “negative-edge and level” sensitive triggering. When the signal of the external interrupt pin, IRQ1 or IRQ2, satisfies the condition selected by the INTN1 and INTN2 bit in the System Option register (bits 4 & 3 of address $35), an external interrupt occurs, and the appropriate INTF flag will be set. The actual processor interrupt is generated only if the interrupt mask bit of the condition code register is also cleared. When the interrupt is recognized, the current state of the processor is pushed onto the stack and the interrupt mask bit in the condition code register is set. This masks further interrupts until the present one is serviced. The service routine address is specified by the contents of $FFFA & $FFFB for both IRQ1 & IRQ2. After servicing the interrupt, flags are cleared by writing a logic “0” to the corresponding flag; otherwise the CPU will keep servicing the interrupt. TPG MOTOROLA 5-4 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 38 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. IRQx sensitivity option INTNx + VDD Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... INTFx bit INTERRUPT PIN IRQx + & Q D C EXTERNAL INTERRUPT REQUEST 5 Q R I BIT (CC) POWER ON RESET + EXTERNAL RESET WRITE “0” TO CLEAR INTFx (a) Interrupt Function Diagram EDGE SENSITIVE TRIGGER CONDITION IRQx tILIH tILIL tILIL The minimum pulse width tILIH is either 140ns (VDD=5V) or 280ns (VDD=3V). The period tILIL should not be less than the number of tcyc cycles it takes to execute the interrupt service routine plus 21 tcyc cycles. IRQi LEVEL SENSITIVE TRIGGER CONDITION Wired ORed Interrupt signals If after servicing an interrupt the external interrupt pins remain low, then the next interrupt is recognized. Normally used with wired OR connection. IRQn IRQ (MCU) (b) Interrupt Mode Diagram Figure 5-3 External Interrupt Circuit and Timing TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-5 39 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. The interrupt logic recognizes negative edge transitions and pulses (special case of negative edges) on the external interrupt lines. Figure 5-3 shows both a block diagram and timing for the interrupt lines (IRQ1, IRQ2) to the processor. The first method is used if pulses on the interrupt line are spaced far enough apart to be serviced. The minimum time between pulses is equal to the number of cycles required to execute the interrupt service routine plus 21 cycles. Once a pulse occurs, the next pulse should not occur until the MCU software has exited the routine (an RTI occurs). The second configuration shows several interrupt lines wired-OR to perform the interrupt at the processor. Thus, if the interrupt lines remain low after servicing one interrupt, the next interrupt is recognized. Note: 5 The internal interrupt latch is cleared in the first part of the service routine; therefore, one (and only one) external interrupt pulse could be latched during tILIL and serviced as soon as the I bit is cleared. 5.3.1 External Interrupt Triggering Options (INTN1 & INTN2) Address bit 7 System Option Register $35 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 TCSA1 TCSA0 INTN1 INTN2 State on reset -000 0--- INTN1 1 (set) – Negative edge triggering for IRQ1 only. 0 (clear) – Level and negative edge triggering for IRQ1. 1 (set) Negative triggering for IRQ2 only. INTN2 – 0 (clear) – 5.3.2 Level and negative edge triggering for IRQ2. External Interrupt Enable (INTE1 & INTE2) Address bit 7 Event Enable Register $16 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 TIMHA INT1E INT2E bit 0 State on reset 000- ---- INT1E 1 (set) – External interrupt IRQ1 enabled. 0 (clear) – External interrupt IRQ1 disabled. TPG MOTOROLA 5-6 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 40 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. INT2E 1 (set) – External interrupt IRQ2 enabled. 0 (clear) – External interrupt IRQ2 disabled. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5.3.3 External Interrupt Flags (INTF1 & INTF2) Address bit 7 Miscellaneous Register $17 bit 6 POR bit 5 bit 4 bit 3 bit 2 bit 1 INTF1 INTF2 KEYF bit 0 State on reset r000 ---- r=1 for POR; r=0 for RESET 5 INTF1 1 (set) – 0 (clear) – An interrupt on IRQ1 pin has occurred. An interrupt on IRQ1 pin has not occurred. After servicing this interrupt, this flag should be cleared by writing a “0” to this bit. INTF2 1 (set) – 0 (clear) – An interrupt on IRQ2 pin has occurred. An interrupt on IRQ2 pin has not occurred. After servicing this interrupt, this flag should be cleared by writing a “0” to this bit. 5.4 Keyboard Interrupt Port pins PA0-PA7 can be configured as keyboard interrupt lines with internal pull-up when the control bits KEYE, KEYX4, KEYX5, KEYX6, and KEYX7 are set. A falling edge of negative pulse with minimum width of TILIH (250ns) on any configured port A pins will cause a keyboard interrupt to occur. A keyboard interrupt is recognized by the interrupt flag KEYF in the Miscellaneous register (bit 4 of address $17). This flag is cleared by writing a logic “0” to this bit. When the interrupt is recognized, the current state of the machine is pushed onto the stack and the interrupt mask bit in the condition code register is set. This masks any further interrupt until the present one is serviced. The keyboard interrupt causes the program counter to vector to memory location $FFF0 and $FFF1 which contains the starting address of the interrupt’s service routine. When configured, the keyboard interrupt lines remain active in during Stop mode. This allows a keyboard interrupt to wake up the MCU when in Stop mode. See Figure 5-4 for keyboard interrupt circuit. TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-7 41 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 5.4.1 Keyboard Control Register Address bit 7 $34 KEYE bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset KEYX7 KEYX6 KEYX5 KEYX4 0--- 000 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... KEYE 5 1 (set) – 0 (clear) – PA0-PA3 are configured as keyboard interrupt lines with internal pull-up. PA0-PA3 are configured as standard I/O lines. KEYX7, KEYX6, KEYX5, KEYX4 These four bits configure their corresponding port A lines. 1 (set) – 0 (clear) – 5.5 PAx is configured as a keyboard line with internal pull-up. PAx is configured as a standard I/O line. Programmable Timer (Timer A) Interrupt Three timer interrupt flags are found in the three most significant bits of the Timer Status register (TSR) at location $19. All three interrupts will vector to the same address at location $FFF6-$FFF7. Address bit 7 Timer Status Register $19 ICF bit 6 bit 5 OCF TOF bit 4 bit 3 bit 2 bit 1 bit 0 State on reset uuu- ---- Each flag bit is defined as follows: TOF - Timer Overflow Flag TOF is set during the counter transition of $FFFF to $0000. It is cleared by reading the TSR (with TOF set) followed by reading the counter least significant byte ($1F). OCF - Output Compare Flag OCF is set when the Output Compare register matches the Counter register. It is cleared by reading the TSR (with OCF set) and then accessing the Output Compare register least significant byte ($1D). TPG MOTOROLA 5-8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 42 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. VDD x is a port A line KEY is KEYE for PA0-PA3 and KEYX4-KEYX7 for PA4-PA7 respectively Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... KEY + 250KΩ DDRA bit x line PORT A DDR Bit x select To CPU 5 Port A bit x data line PAx PORT A DATA BIT x (a) Pull-up circuit for port A lines PA0 PA1 PA2 PA3 & & & PA4 & & Keyboard interrupt PA5 & PA6 & PA7 KEYE KEYX7 KEYX6 KEYX5 KEYX4 Keyboard Control Register (b) Keyboard interrupt circuit Figure 5-4 Keyboard Interrupt Circuit TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-9 43 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. ICF - Input Capture Flag Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... ICF is set when a proper edge has been sensed by the input capture edge detector. It is cleared by an CPU read of the TSR (with ICF set) followed by accessing the Input Capture register least significant byte ($1B). 5 All three timer interrupt flags have corresponding enable bits (ICIE, OCIE, and TOIE) found in the Timer Control register (TCR) at location $18. Reset clears all enable bits preventing an interrupt from occurring. The actual processor interrupt is generated only if the interrupt mask bit of the condition code register is also cleared. When the interrupt is recognized, the current state of the machine is pushed onto the stack and the interrupt mask bit in the condition code register is set. This masks further interrupts until the present one is serviced. The service routine address is specified by the contents of $FFF6 and $FFF7. Refer to Section 6.1 for detailed description of Programmable Timer. 5.6 Reloadable Timer (Timer B) Interrupt Timer B interrupt (TUF) occurs only when the timer B counter rolls over from $0001 to $0000 if the Timer B interrupt enable bit (TBOIE in Timer B Control & Status register $22) is set. Address bit 7 bit 6 $22 TMBE TBOIE bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset TCSB1 TCSB0 TUF 00-- -000 The interrupt service routine address is specified by the contents of memory location $FFF8-$FFF9. Refer to Section 6.2 - Reloadable Timer B for detailed description. 5.7 SPI Interrupt An interrupt in the serial peripheral interface (SPI) occurs when the SPI interrupt flag in the Serial Peripheral Status register (bit 7 of address $11) is set, provided the interrupt mask bit in the Condition Code register is cleared and the enable bit in the Serial Peripheral Control register ($10) is enabled. When the interrupt is recognized, the current state of the CPU is pushed onto the stack and the interrupt mask bit in the condition code register is set. This masks any further interrupt until the present one is serviced. The SPI interrupt causes the program counter to vector to memory location $FFF4 and $FFF5 which contains the starting address of the interrupt’s service routine. The SPI flag is cleared by accessing the Serial Peripheral Status register (with SPIF set) followed by a read or write of the Serial Peripheral Data register, at location $12. Refer to Section 7 for detailed description of the Serial Peripheral Interface. TPG MOTOROLA 5-10 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 44 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5.8 Manchester Coder (MANCD) Interrupt A Manchester Coder interrupt occurs when one of the interrupt flags in the MANCD Status register (location $2C) is set, provided the interrupt mask bit in the Condition Code register is cleared and the enable bit in the MANCD Control register ($2B) is enabled. When the interrupt is recognized, the current state of the CPU is pushed onto the stack and the interrupt mask bit in the condition code register is set. This masks any further interrupt until the present one is serviced. The MANCD interrupt causes the program counter to vector to memory location $FFF2 and $FFF3 which contains the starting address of the interrupt’s service routine. Software in the MANCD interrupt service routine must determine the priority and the cause of the MANCD interrupt by examining the interrupt flags located in the MANCD Status register. 5 There are four interrupt flags associated with MANCD interrupts: Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset $2C NCM NCC DCF OVF - - - - 1100 ---- NCM - Encoder Data Register Empty Flag 1 (set) – 0 (clear) – Encoder Data register is empty. Encoder Data register is not empty. This bit is cleared by accessing the MANCD Status register (with NCM set), followed by writing to the Encoder Data register. NCC - Encoding Completion Flag 1 (set) – 0 (clear) – Encoder is disabled (NCE=0) or, NCE=1 and transmission of the data in the shift register is completed. Transmission of data in process. This bit is cleared by writing to the Encoder Data register when NCE bit is set. DCF - Decoder Data Register Full Flag 1 (set) – 0 (clear) – One byte of data received with end pattern verified. Decoder Data register not full. This bit is cleared when the MANCD Status register is accessed (with DCF set) followed by a read of the Decoder Data register, or by clearing the DCE bit. OVF - Overrun Flag 1 (set) – 0 (clear) – An overrun has occurred. An overrun has not occurred. TPG MC68HC05F8 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 5-11 45 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. This bit is cleared when the DCE bit is cleared. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Refer to Section 8 for detailed description of the Manchester Encoder/Decoder (MANCD). 5 TPG MOTOROLA 5-12 INTERRUPTS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 46 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 6 TIMERS 6.1 TIMER A - PROGRAMMABLE TIMER The timer consists of a 16-bit free-running counter driven by a fixed divide-by-four prescaler. This timer can be used for many purposes, including input waveform measurements while simultaneously generating an output waveform. Pulse widths can vary from several microseconds to many seconds. Figure 6-1 shows a block diagram for the Programmable Timer. 6 Because the timer has a 16-bit architecture, the I/O registers for the input capture and output compare functions are pairs of 8-bit registers (high byte and low byte). Generally, assessing 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. Note: The I bit in the condition code register should be set while manipulating both the high and low byte register of a specific timer function to ensure that an interrupt does not occur. Ten 8-bit registers are associated with the programmable timer. – Timer Control Register (TCR) $18 – Timer Status Register (TSR) $19 – Input Capture Register High byte - $1A, Low byte - $1B – Output Compare Register High byte - $1C, Low byte - $1D – Counter Register High byte - $1E, Low byte - $1F – Alternate Counter Register High byte - $20, Low byte - $21 A description of each register is provided in the following paragraphs. 6.1.1 Counter – Timer A Counter High byte - $1E, Low byte - $1F – Timer A Alternate Counter High byte - $20, Low byte - $21 TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-1 47 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. MC68HC05F8 INTERNAL BUS INTERNAL PROCESSOR CLOCK ÷M (M=1, 4, 8, or 16) TCSA0 Freescale Semiconductor, Inc... 6 8 BIT BUFFER TIMHA & Freescale Semiconductor, Inc... TCSA1 OUTPUT COMPARE REGISTER INPUT CAPTURE REGISTER ÷4 Timer internal clock 16 BIT FREE RUNNING COUNTER COUNTER ALTERNATE REGISTER OUTPUT COMPARE CIRCUIT ICF OCF EDGE DETECT REGISTER OVERFLOW DETECT CRCUIT TOF Q D TIMER STATUS REGISTER EDGE INPUT (TCAP) OUTPUT LEVEL (TCMP) C TIMER CONTROL REGISTER ICIE OCIE TOIE R IEDG OUTPUT LEVEL REGISTER OLVL RESET INTERRUPT CIRCUIT Figure 6-1 Programmable Timer Block Diagram TPG MOTOROLA 6-2 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 48 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The key element in the programmable timer is a 16-bit, free-running counter or counter register, preceded by two prescalers. The first stage programmable prescaler provides a slow timer clock by dividing the internal processor clock either by 1, 4, 8, or 16. The second stage is a fixed divide by four prescaler. See Figure 6-1 and Table 6-1 for prescaler values. The counter is incremented during the low portion of the internal bus clock, and the counting can be inhibited by setting the TIMHA bit in the Event Enable register (bit 7 of address $16). Software can read the counter at any time without affecting its value. Address bit 7 System Option Register $35 - bit 6 bit 5 bit 4 bit 3 TCSA1 TCSA0 INTN1 INTN2 bit 2 bit 1 bit 0 State on reset - - - -000 0--- Table 6-1 Timer A Clock Frequency Selection TCSA1 TCSA0 0 0 0 1 1 0 1 1 Where E = internal bus clock 6 Clock Frequency of Timer A E/4 E/16 E/32 E/64 The double-byte, free-running counter can be read from either of two locations, $1E & $1F (counter register) or $20 & $21 (counter alternate register). Reading only the least significant byte (LSB) of the free-running counter ($1F or $21) receives the count value at the time of the read. If the most significant byte (MSB) ($1E or $20) is read first, the LSB ($1F or $21) is transferred to a buffer. This buffer value remains fixed after the first MSB read, even if the MSB is read several times. This buffer is accessed when the LSB ($1F or $21) is read, and thus, completes a read sequence of the complete counter value. Reading the timer counter register low byte after reading the timer status register clears the timer overflow flag (TOF), but reading the counter alternate register does not affect TOF. Therefore, the counter alternate register can be read any time without risk of missing timer overflow interrupts due to a cleared TOF. The free-running counter is preset to $FFFC during reset and is always a read-only register. During a power-on reset, the counter is also preset to $FFFC and begins running after the oscillator start-up delay. The value in the free-running counter repeats every (262144÷RTB) internal bus clock cycles (tCYC). RTB is the ratio of timer clock to bus clock frequency, and is dependent on the values of TCSA0 and TCSA1 bits. TOF is set when the counter overflows (from $FFFF to $0000); this will cause an interrupt if TOIE in the Timer Control register is set (bit 5 of address $18). TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-3 49 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 6.1.2 Output Compare Registers – Output Compare Register High byte - $1C, Low byte - $1D Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The 16-bit Output Compare register is made up of two 8-bit registers. This Output Compare register is used for several purposes, such as indicating when a period of time has elapsed. All bits are readable and writable and are not affected by the timer hardware or reset. If the compare function is not needed, the Output Compare register can be used as storage locations. 6 The contents of the Output Compare register are continually compared with the contents of the free-running counter and, if a match is found, the Output Compare Flag (OCF) in the Timer Status register is set; and the output level (OLVL) bit is clocked to an Output Level register. The Output Compare register value and the output level bit should be changed after each successful comparison to establish a new elapsed time-out. An interrupt can also accompany a successful output compare provided the interrupt enable bit (OCIE) is set. (The free-running counter is updated every 4÷RTB internal bus clock cycles.) After a processor write cycle to the output compare register containing the MSB ($1D), the output compare function is inhibited until the LSB ($1D) is also written. The user must write both bytes (locations) if the MSB is written first. A write made only to the LSB ($1D) will not inhibit the compare function. The processor can write to either byte of an output compare register without affecting the other byte. The minimum time required to update the output compare registers is a function of the program rather than the internal hardware. Because the output compare flag and output compare register are not defined at power-on, and not affected by reset, care must be taken when initializing output compare functions with software. The following procedure is recommended: 1) write to Output Compare register high-byte to inhibit further compares; 2) read the Timer Status register to clear OCF; 3) write to Output Compare register low-byte to enable the output compare function. The output level (OLVL) bit is clocked to the output level register regardless of whether the output compare flag (OCF) is set or clear. 6.1.3 Input Capture Registers – Input Capture Register High byte - $1A, Low byte - $1B ‘Input Capture’ is a technique whereby an external signal (connected to TCAP pin) is used to trigger a read of the free-running counter. In this way it is possible to relate the timing of an external signal to the internal counter value, and hence to elapsed time. The two 8-bit registers that make up the 16-bit Input Capture register, are read-only, and are used to latch the value of the free-running counter after the corresponding input capture edge detector senses a valid transition. The level transition that triggers the counter transfer is defined by the TPG MOTOROLA 6-4 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 50 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. corresponding input edge bit (IEDG). Reset does not affect the contents of the Input Capture register. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The result obtained from an input capture will be one greater than the value of the free-running counter on the rising edge of the internal bus clock preceding the external transition. This delay is required for internal synchronization. Resolution is zero or one count of the free-running counter, which is 4xRTB internal bus clock cycles. The free-running counter contents are transferred to the Input Capture register on each valid signal transition whether the input capture flag (ICF) is set or clear. The Input Capture register always contains the free-running counter value that corresponds to the most recent input capture.After a read of the input capture register MSB ($1A), the counter transfer is inhibited until the LSB ($1B) is also read. This characteristic causes the time used in the input capture software routine and its interaction with the main program to determine the minimum pulse period. A read of the input capture register LSB ($1B) does not inhibit the free-running counter transfer since they occur on opposite edges of the internal bus clock. 6 6.1.4 Timer Control Register (TCR) Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on Reset $18 ICIE OCIE TOIE 0 0 0 IEDG OLVL 0000 00u0 The TCR is a read/write register containing five control bits. Three bits control interrupts associated with the three flag bits found in the timer status register (discussed below). The other two bits control: 1) which edge is significant to the input capture edge detector (i.e., negative or positive), and 2) the next value to be clocked to the Output Level registers in response to a successful output compare. The Timer Control register and the free-running counter are the only sections of the timer affected by reset. The TCMP pin is forced low during external reset and stays low until a valid compare changes them to high. Definition of each bit is as follows: ICIE - Input Capture Interrupt Enable 1 (set) – Input Capture interrupt enabled. 0 (clear) – Input Capture interrupt disabled. OCIE - Output Compare Interrupt Enable 1 (set) – Output Compare interrupt enabled. 0 (clear) – Output Compare interrupt disabled. TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-5 51 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. TOIE - Timer Overflow Interrupt Enable 1 (set) – Timer Overflow interrupt enabled. 0 (clear) – Timer Overflow interrupt disabled. IEDG - Input Edge Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 (set) – 0 (clear) – TCAP is positive-going edge sensitive. TCAP is negative-going edge sensitive. When IEDG is set, a positive-going edge on the TCAP pin will trigger a transfer of the free-running counter value to the input capture registers. When clear, a negative-going edge triggers the transfer. OLVL - Output Level Voltage Latch 1 (set) 6 – High output on TCMP pin if counter compare is true. 0 (clear) – Low output on TCMP pin if counter compare is true. There is a bit in the Event Enable register which may be used to disable and enable the programmable timer. Address bit 7 Event Enable Register $16 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset 0 0 0 0 0 0000 0000 TIMHA INTE1 INTE2 TIMHA - Timer A Enable/Disable 1 (set) – 0 (clear) – 6.1.5 Timer inhibit Enable timer (default at reset) Timer A Status Register (TSR) Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on Reset $19 ICF OCF TOF 0 0 0 0 0 uuu0 0000 The Timer Status register ($19) contains the status bits for the above three interrupt conditions ICF, OCF, TOF. Accessing the timer status register satisfies the first condition required to clear the status bits. The remaining step is to access the register corresponding to the status bit. TPG MOTOROLA 6-6 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 52 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. ICF - Input Capture Flag 1 (set) – 0 (clear) – A valid input capture has occurred. No input capture has occurred. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... This bit is set when the selected polarity of edge is detected by the input capture edge detector; an input capture interrupt will be generated, if ICIE is set, ICF is cleared by reading the TSR and then the Input Capture Low register ($1B) OCF - Output Compare Flag 1 (set) – 0 (clear) – A valid output compare has occurred on output compare register. No output compare has occurred on output compare register. OCF will be set when its output compare register contents match that of the free-running counter; an output compare interrupt will be generated, if OCIE is set. OCF is cleared by reading the TSR and then the Output Compare Low register ($1D). 6 TOF - Timer Overflow Flag 1 (set) – 0 (clear) – Timer Overflow has occurred. No timer overflow has occurred. This bit is set when the free-running counter overflows from $FFFF to $0000; a timer overflow interrupt will occur, if TOIE (bit 5 in Timer Control register $18) is set. TOF is cleared by reading the TSR and the Counter Low register ($1F). When using the timer overflow function and reading the free-running counter at random times to measure an elapsed time, a problem may occur whereby the timer overflow flag is unintentionally cleared if: 1) the timer status register is read or written when the TOF is set, and 2) the LSB of the free-running counter is read, but not for the purpose of servicing the flag. Reading the alternate counter register instead of the counter register will avoid this potential problem. 6.1.6 Programmable Timer Timing Diagrams The relationships between the internal clock signals, the counter contents and the status of the flag bits are shown in the following diagrams. It should be noted that the signals labelled ‘internal’ (processor clock, timer clocks and Reset) are not available to the user. The timing diagrams TCSA0=TCSA1=0. are for a timer clock frequency of internal bus clock÷4; TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-7 53 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. INTERNAL PROCESSOR CLOCK INTERNAL RESET T00 T01 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... INTERNAL TIMER CLOCKS 6 T10 T11 COUNTER (16 BIT) $FFFC $FFFD $FFFE $FFFF RESET (external or end of POR) Notes: RESET affects only the Counter register and Timer Control register. Figure 6-2 Timer State Timing Diagram for Reset INTERNAL PROCESSOR CLOCK T00 INTERNAL TIMER CLOCKS T01 T10 T11 COUNTER (16 BIT) $F123 $F124 $F125 $F126 $F127 INPUT EDGE (SEE NOTE) INTERNAL CAPTURE LATCH INPUT CAPTURE REGISTER $???? $F125 INPUT CAPTURE FLAG Note: If the input edge occurs in the shaded area from one timer state T10 to the other timer state T10 the input capture flag is set during the next state T11. Figure 6-3 Timer State Timing Diagram for Input Capture TPG MOTOROLA 6-8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 54 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. INTERNAL PROCESSOR CLOCK T00 INTERNAL TIMER CLOCKS T01 T10 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... T11 COUNTER (16 BIT) $F455 $F456 $F457 $F458 $F459 Note 1 OUTPUT COMPARE REGISTER CPU writes $F457 $F457 Note 1 6 COMPARE REGISTER LATCH Note 2 OUTPUT COMPARE Flag (OCF) and TCMP Note: 1. The CPU write to the compare registers may take place at any time, but a compare only occurs at the timer state T01. Thus a 4-cycle difference may exist between the write to the compare register and the actual compare. 2. The output compare flag is set at the timer state T11 that follows the comparison match ($F547 in this example). Figure 6-4 Timer State Timing Diagram for Output Compare INTERNAL PROCESSOR CLOCK T00 INTERNAL TIMER CLOCKS T01 T10 T11 COUNTER (16 BIT) $FFFE $FFFF $0000 $0001 $0002 TIMER OVERFLOW FLAG (TOF) Note: The TOF bit is set at timer state T11 (transition of counter from $FFFF to $0000). It is cleared by a read of the timer status register during the internal processor clock high time followed by a read of the counter low register. Figure 6-5 Timer State Diagram for Timer Overflow TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-9 55 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 6.2 TIMER B - RELOADABLE TIMER Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The Reloadable Timer is similar to the Free-running Timer, with the following differences: 6 • The 16-bit timer counter is automatically reloaded from the preset timer registers upon underflow occurs. • There is no input capture function, i.e. no TCAP. • There is no output compare function, i.e. no TCMP. The Reloadable Timer is convenient for generating periodic interrupts without the aid of software. In addition, the timer counter value can be read in a similar way to timer A. 6.2.1 Functional Description See Figure 6-6 for a block diagram of the Reloadable Timer. The timer B is driven by a clock which is derived from E divided by 4, 8, 16 or 32. In the Control Register, two bits TCSB0 and TCSB1 are used to select the divider for the prescaler, TBOIE is an interrupt enable bit, TMEB is a Timer B enable bit which will inhibit the driving clock when it is clear. Upon reset, the Control Register is cleared, Timer B is disabled, Timer B interrupt is inhibited, the free running counter and the Preset Register are all configured to $FFFF. The preset register should be written with proper value before enable the Timer B. A low to high transition of the TMBE bit loads the timer counter with the content in the preset register and activates the driving clock, then the free running counter starts to count down, when it rolls over from $0001 to $0000 an interrupt is generated with timer B underflow flag set if the TBOIE is set, meanwhile a “load” signal is produced to reload the counter with the content of the preset register, thus interruption will occur periodically. 6.2.2 Resolution and Maximum Period When a 3.579MHz crystal is used, the timer resolution and its maximum period are shown in Table 6-2. Table 6-2 Reloadable Timer Resolution and Maximum Period TCSB1 TCSB0 0 0 0 1 1 0 1 1 Where E = internal bus clock FREQUENCY E/4 E/8 E/16 E/32 RESOLUTION 2.25µs 4.5µs 9µs 18µs MAX. PERIOD PRESET $FFFF 147ms 294ms 588ms 1176ms TPG MOTOROLA 6-10 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 56 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. MC68HC05F8 INTERNAL BUS INTERNAL PROCESSOR CLOCK TCSB1 ÷4/8/16/32 Freescale Semiconductor, Inc... 8 BIT BUFFER & 16 BIT FREE RUNNING COUNTER ACTIVE LOGIC 6 16 BIT TIMER PRESET REGISTER LOAD COUNTER ALTERNATE REGISTER UNDERFLOW DETECT CRCUIT TCSB1 TCSB0 TMBE TBOIE TUF & Freescale Semiconductor, Inc... TCSB0 TIMER B CONTROL REGISTER TIMER B INTERRUPT Figure 6-6 Reloadable Timer Block Diagram 6.2.3 Timer B Counter – Timer B Counter High byte - $25, Low byte - $26 – Timer B Alternate Counter High byte - $27, Low byte - $28 The double-byte, reloadable timer counter can be read from either of two locations, $25 & $26 (Timer B counter register) or $27 & $28 (Timer B counter alternate register). Reading only the least significant byte (LSB) of the free-running counter ($26 or $28) receives the count value at TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-11 57 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. the time of the read. If the most significant byte (MSB) ($25 or $27) is read first, the LSB ($26 or $28) is transferred to a buffer. This buffer value remains fixed after the first MSB read, even if the MSB is read several times. This buffer is accessed when the LSB ($26 or $28) is read, and thus, completes a read sequence of the complete counter value. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 6.2.4 6 Timer B Preset Register – Timer B Preset Register High byte - $23, Low byte - $24 On the low to high transition of the TMBE bit, the reloadable timer is loaded with the value set in this 16-bit register. 6.2.5 Timer B Control Status Register Address bit 7 bit 6 $22 TMBE TOIE bit 5 bit 4 bit 2 bit 1 bit 0 State on reset TCSB1 TCSB0 TUF 00-- -000 bit 3 TMBE - Timer B Enable/Disable 1 (set) – Timer B enabled. 0 (clear) – Timer B disabled. Upon reset, this bit is cleared and the driving clock of timer B is inhibited, a low to high transition of this bit loads the timer B counter with the contents of the preset register and activates the driving clock. TBOIE - Timer B Time-out Interrupt Enable/Disable 1 (set) – Timer B time-out interrupt enabled. 0 (clear) – Timer B time-out interrupt disabled. When this bit is set, timer B time out interrupt will occur if the time out flag (TUF) is set; otherwise, time out interrupt is disabled. TCSB1, TCSB0 - Timer B Clock Frequency Select These two bits are used to select the frequency of timer B driving clock. See Table 6-2. TUF - Timer B Underflow Flag This bit is set when the counter of Timer B rolls from $0001 to $0000. It should be cleared by software in the timer B interrupt service routine. TPG MOTOROLA 6-12 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 58 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 6.3 COP WATCHDOG Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... A COP (Computer Operating Properly) Watchdog Timer is implemented to restore system operation in the event of system lock-up. This timer consists of a counter which is clocked by a 4Hz signal; the time-out period is software programmable to approximately 0.5, 1, 2 or 4 seconds (default time out period is 0.5s after a reset). A watchdog reset occurs when the Watchdog Timer times out, unless the timer is periodically reset by writing to the Watchdog Timer Control Status register. MC68HC05F8 INTERNAL BUS RESET 6 & WDTOF 4Hz CLOCK WATCHDOG TIMER COUNTER & WAKE-UP TIME-OUT VALUE STOPM ACTIVE LOGIC & + WDTE TIME-OUT DETECTOR WAITM KWDT WDTOF WDT1 WDT0 WATCHDOG CONTROL REGISTER Figure 6-7 Watchdog Timer Block Diagram 6.3.1 Watchdog Timer Time-Out Flag A watchdog time-out flag (WDTOF) is provided in the Watchdog Control Status register (WDCSR, $36), to allow the user to distinguish between a normal reset (power-on-reset or external reset) and a Watchdog Timer reset. This bit is a logic “1” if the reset was due to a watchdog time-out and logic “0” for a normal reset; and is cleared by reading the WDCSR register. Writing a logic “1” to this bit has no effect on its value other than resetting the watchdog timer counter. TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-13 59 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 6.3.2 COP System Enable and Operation A watchdog timer enable (WDTE) bit in the WDCSR is used to enable the COP watchdog system. Its default value is “0” at reset (watchdog disabled). Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Writing a “1” to this bit will load the watchdog timer counter with the initial value selected by WDT0 & WDT1 bits and activate the watchdog timer clock. When the watchdog timer counter reaches zero, a watchdog time-out signal is generated to reset the MCU with WDTOF set. 6 Once the watchdog is enabled, it cannot be disabled by software; writing a “0” to the WDTE bit has no effect. 6.3.3 Disable COP Function in Stop or Wait Mode A kill watchdog timer (KWDT) bit is provided in the WDCSR to optionally disable and reset the watchdog timer when the STOP or WAIT instruction is executed. This allows the CPU to go into an extended sleep or Wait mode without watchdog timer resets. This feature is not enabled if the KWDT bit is set to “0”. The KWDT bit permits a “STOP” or “WAIT” instruction to disable the Watchdog Timer. To do so, KWDT must be written to a logic “1” on the first write to the WDCSR after a reset. However, this first write only enables the “kill” feature. A second write of a logic “0” to KWDT must be performed to engage the “kill” feature. After the second write, the execution of a STOP or WAIT instruction will reset the Watchdog Timer and disable the COP watchdog system. Two specific writes are required for this feature to prevent accidental engagement by a single spurious write. The watchdog counter resumes counting when the MCU exits Stop or Wait mode. 6.3.4 Watchdog Timer Control Status Register (WDCSR) Address bit 7 bit 6 bit 5 $36 WDTE KWDT WDTOF bit 4 bit 3 bit 2 bit 1 bit 0 State on reset WDT1 WDT0 000- --00 WDTE - Watchdog Timer Enable/Disable 1 (set) – Watchdog timer enabled. 0 (clear) – Watchdog timer disabled. The default for the watchdog timer at reset is disabled. Once enabled by writing a logic “1” to this bit, it cannot be disabled by software. Writing a logic “0” have no effect to this bit. TPG MOTOROLA 6-14 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 60 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. KWDT - Kill Watchdog Timer Bit 1 (set) – Enable watchdog “kill” feature. 0 (clear) – Disable watchdog “kill” feature. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... When this watchdog “kill” feature is set by writing a logic “1” to this bit immediately after a reset, the watchdog timer will be disabled when the MCU in Stop or Wait mode. The default for the watchdog timer “kill” feature at reset is disabled. Reading this bit will show the value of first write after Reset or the default value upon reset. WDTOF - Watchdog Timer Time-out Flag 1 (set) – 0 (clear) – A watchdog timer time-out has occurred. A watchdog timer time-out has not occurred. This flag is cleared by writing a logic “0” to this bit. Writing a logic “1” to this bit will reset the watchdog timer counter, and hence avoiding a watchdog time-out. The write does not affect the time-out flag. 6 WDT1, WDT0 - Time-out Period Select WDT1 WDT0 0 0 1 1 0 1 0 1 Time-Out Period Min. (s) Max. (s) 0.25 0.5 0.75 1.0 1.75 2.0 3.75 4.0 TPG MC68HC05F8 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 6-15 61 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. 6 THIS PAGE LEFT BLANK INTENTIONALLY TPG MOTOROLA 6-16 TIMERS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 62 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 7 SERIAL PERIPHERAL INTERFACE The serial peripheral interface (SPI) is an interface built into the MC68HC05F8 MCU which allows two MC68HC05F8 MCUs to be interconnected within a single “black box” or on the same printed circuit board. In a serial peripheral interface (SPI), separate wires (signals) are required for data and clock. In the SPI format, the clock is not included in the data stream and must be furnished as a separate signal. An SPI system may be configured in one containing one master and one slave MCUs. Figure 7-1 illustrates a normal system configurations. In this system three basic lines (signals) are required for the Serial Clock (SCK), Serial Data Input (SDI), and Serial Data Output (SDO) lines. 7.1 Features • Full duplex, three-wire synchronous transfer • Master or slave operation • 447.5 KHz master bit frequency • 1.79MHz (Max.) slave bit frequency • End of transmission interrupt flag • Data collision flag protection 7.2 7 Signal Description The three basic signals (SCK, SDO and SDI) are described in the following paragraphs. Each signal function is described for both the master and slave mode. Figure 7-2 summarizes the SPI port timing for data exchange operation. TPG MC68HC05F8 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 7-1 63 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. SLAVE MASTER Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 8-BIT SHIFT REGISTER 7 SPI CLOCK GENERATOR (447.5KHz) SDI SDO SDO SDI SCK SCK 8-BIT SHIFT REGISTER Figure 7-1 SPI Master-Slave Interconnection SCK SDO BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 SDI BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 112ns 112ns Figure 7-2 SPI Port Timing 7.2.1 Serial Clock (SCK) The state of SCK between transmissions must be logic “1”. The first falling edge of SCK signals the beginning of a transmission. At this time the MSB bit of received data is accepted at the SDI pin and the MSB bit of transmitted data is presented at the SDO pin. Data is captured at the SDI pin on the rising edge of SCK. Subsequent falling edges shift the data, and accept the next received data bit at SDI pin, and present the next transmitted data bit at SDO pin. The transmission is ended upon the receipt of the LSB bit. In Master Mode, the format is identical except that the SCK pin is an output and the shift clock now originates internally. The Master Mode transmission frequency is fixed at E/4. Care should be taken when enabling the SPI; additional clock edges may be present when the port is switched from standard I/O to SPI. TPG MOTOROLA 7-2 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 64 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 7.2.2 Serial Data Output (SDO) Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Data is transmitted in MSB first format. The state of the SDO pin will always reflect the value of the first bit receive on the previous transmission if there was one. Prior to enabling the SPI, PD5 can be initialized to determine the beginning state if a standard output since that pin is coupled to the last stage of the serial shift register. On the first falling edge of SCK the first data bit to be shifted out is presented to the output pin. 7.2.3 Serial Data Input (SDI) The SDI pin becomes an input as soon as the SPI pin on the falling edge of SCK. Valid data must be present at least 112ns before the rising edge of the clock and remain valid for 112ns after the edge. 7.3 General Operation A block diagram of the serial peripheral interface (SPI) is shown in Figure 7-3. In a master configuration, the master start logic originates the system clock (SCK) based on the 447.5KHz (or the E/4) clock. This clock is also used internally to control the state controller as well as the 8-bit shift register. As a master device, data is parallel loaded into the 8-bit shift register (from the internal bus) during a write cycle, data is applied serially from a slave device via SDI pin to the 8-bit shift register. After the 8-bit shift register is loaded, its data is parallel transferred to the read buffer and then is made available to the internal data bus a CPU read cycle. 7 In a slave configuration, the slave start logic receives a system clock input (from the master device) at SCK pin. Thus, the slave is synchronized with the master. Data from the master is received serially at the slave SDI and loads the 8-bit shift register. After the 8-bit shift register is loaded, its data is parallel transferred to the read buffer and then is made available to the internal data bus during a CPU read cycle. During a write cycle, data is parallel loaded into the 8-bit shift register from the internal data bus and then shifted out serially to the SDO pin for application to the master device. One point to be noted, the SCK pin needs to be externally pulled high with 10K Ohms, in order to bias the initial states at logic high. 7.4 SPI Registers There are three registers associated with the serial parallel interface. They are the Serial Peripheral Control register (SPCR, location $10), the Serial Peripheral Status register (SPSR, location $11), and the Serial Peripheral Data I/O register (SPDR, location $12). Each register are described below. TPG MC68HC05F8 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 7-3 65 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. SCK SDO SDI READ MASTER START LOGIC (LOAD) SPIF 8 8-BIT SHIFT REGISTER SLAVE START LOGIC (FULL) 8 INTERNAL DATA BUS Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 8 READ BUFFER E/4 CLOCK WRITE SPCR STATE CONTROLLER CONTROL BITS 7 SPSR 2 FLAGS 3 Note: SCK, MOSI, and MISO are external pins; where SCK - provides system clock when device is configured as a master unit. Receives system clock when device is configured as a slave unit. SDI - provides serial output to slave unit when device is configured as a master. Receives serial input from master when device is configured as a slave unit. SDO - receives serial input from slave unit when device is configured as a master. Provides serial output to master when device is configured as a slave unit. Figure 7-3 SPI Block Diagram 7.4.1 SPI Control Register (SPCR) Address bit 7 bit 6 $10 SPIE SPE bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 MSTR State on reset 00-0 ---- SPIE - Serial Peripheral Interrupt Enable When the serial peripheral interrupt enable bit is high, it allows the occurrence of a processor interrupt and forces the proper vector to be loaded into the program counter if the serial peripheral TPG MOTOROLA 7-4 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 66 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. status register bit (SPIF) is set to a logic one. It does not inhibit the setting of a status bit. The SPIE bit is cleared by reset. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... SPE - Serial Peripheral Enable When set, this bit enables the Serial I/O Port and initializes the Port D DDR such that PD5 (SDO) is output, PD6 (SDI) is input and PD7 (SCK) is input (Slave Mode only). The Port D DDR can be subsequently altered as the application requires and the Port D data register (except for PD5) can be manipulated as usual, however these actions could affect the transmitted or received data. When SPE is cleared, Port D reverts to standard parallel I/O without affecting the Port D data register or DDR. SPE can be read or written any time, but clearing SPE while a transmission is in progress will abort the transmission, reset the bit count and return Port D to its normal I/O function. Reset clears this bit. MSTR - Master Bit When set, this bit configures the SPI for Master Mode. This means that the transmission is initiated by a write to the data register and the SCK pin becomes an output providing a synchronous data clock at a fixed rate of E clock divided by 4. While the device is in Master Mode, the SDO and SDI pins do not change function. These pins behave exactly as they would in Slave Mode. Reset clears this bit and configures the SPI for Slave operation. MSTR may be set at any time regardless of the state of SPE. Clearing MSTR will abort any transmission in progress. 7.4.2 7 SPI Status Register (SPSR) Address bit 7 bit 6 $11 SPIF DCOL bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset 00-- ---- SPIF - Serial Peripheral Interface Flag The serial peripheral data transfer flag bit notifies the user that a data transfer between the device and an external device has been completed. With the completion of the data transfer, SPIF is set, and if SPIE is set, a serial peripheral interrupt (SPI) is generated. During the clock cycle that SPIF is being set, a copy of the received data byte in the shift register is moved to a buffer. When the data register is read, it is the buffer that is read. The transfer of data is initiated by the master device writing its serial peripheral data register. Clearing the SPIF bit is accomplished by a software sequence of accessing the serial peripheral status register while SPIF is set and followed by a write to or a read of the serial peripheral data register. While SPIF is set, all writes to the serial peripheral data register are inhibited until the serial peripheral status register is read. This occurs in the master device. In the slave device, SPIF can be cleared before the second SPIF in order to prevent an overrun condition. The SPIF bit is cleared by reset. TPG MC68HC05F8 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 7-5 67 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. DCOL - Data Collision This is a read only status bit which indicates that an invalid access to the data register has been made. This can occur any time after the first falling edge of SCK and before SPIF is set. A read or write of the data register during this time will result in invalid data being transmitted or received. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... DCOL is cleared by reading the status register with SPIF set followed by a read or write of the data register. If the last part of the clearing sequence is done after another transmission has been started, DCOL will be set again. Reset also clears this bit. 7 7.4.3 Serial Peripheral Data Register (SPDR) Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 $12 The serial peripheral data I/O register is used to transmit and receive data on the serial bus. Only a write to this register will initiate transmission/reception of another byte and this will only occur in the master device. A slave device writing to its data I/O register will not initiate a transmission. At the completion of transmitting a byte of data, the SPIF status bit is set in both the master and slave devices. A write or read of the serial peripheral data I/O register, after accessing the serial peripheral status register with SPIF set, will clear SPIF. During the clock cycle that the SPIF bit is being set, a copy of the received data byte in the shift register is being moved to a buffer. When the user reads the serial peripheral data I/O register, the buffer is actually being read. During an overrun condition, when the master device has sent several bytes of data and the slave device has not internally responded to clear the first SPIF, only the first byte is contained in the receive buffer at any time. The first SPIF must be cleared by the time a second transfer of data from the shift register to the read buffer is initiated or an overrun condition will exist. A write to the serial peripheral data I/O register is not buffered and places data directly into the shift register for transmission. The ability to access the serial peripheral data I/O register is limited when a transmission is taking place. It is important to read the discussion defining the DCOL and SPIF status bits to understand the limits on using the serial peripheral data I/O register. TPG MOTOROLA 7-6 SERIAL PERIPHERAL INTERFACE For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 68 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 8 MANCHESTER ENCODER/DECODER The built-in full duplex Manchester Coder (MANCD) performs data format conversion between parallel NRZ and serial Manchester code. The bit rate is programmable, in four steps between 600 and 4800 baud when a 3.579MHz crystal is used. Data are encoded to Manchester codes by writing to the Encode register before it is output to the ENCOOUT pin. The data transfer format is 2 sync bits followed by 8 data bits and a trailing bit. Two low level bits are used as a pause between byte transfers. Figure 8-3 shows the one byte data transfer. Manchester codes enter the MCU, LSB first, at the DECOIN pin to the Decode register, gets decoded before processing. The idle state of the DECOIN pin is a logic high. A Schmitt trigger is built in at the DECOIN input to improve noise immunity. 8 8.1 Features • Four programmable bit rates • Buffered encode data register and decode data register • Encode data register empty flag and interrupt • Encoding complete flag • Decode data register full flag and interrupt • Decode overrun flag and interrupt • Bit format error detection • Bit rate error detection • Built-in front end Schmitt trigger in decoder TPG MC68HC05F8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 8-1 69 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 8.2 General Operation Figure 8-1 shows a block diagram of the Manchester encoder/decoder. Logic flow of the hardware operation of the encoder and decoder are shown in Figure 8-2 and Figure 8-3 respectively. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... MC68HC05F8 INTERNAL BUS INTERNAL BUS CLOCK INT DIVIDER ENCODE REGISTER PRESCALER ENCOOUT ENCODE SHIFT REGISTER MANCHESTER ENCODER LOGIC INTERRUPT GENERATOR ENCODE CONTROL 8 NCE NIE CIE DCE DIE BR1 BR0 MANCD CONTROL REGISTER NCM DECODE REGISTER NCC DCF OVF MANCD STATUS REGISTER DECODE CONTROL MANCHESTER DECODER LOGIC DECODE SHIFT REGISTER DECOIN Figure 8-1 Manchester Encoder/Decoder Block Diagram 8.2.1 Encoder The Manchester Encoder is used to convert data from NRZ format to Manchester Code format; and output onto the ENCOOUT pin. TPG MOTOROLA 8-2 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 70 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 8.2.1.1 Idle State of Encoder Upon reset the encoder enable bit (NCE) is cleared, ENCOOUT pin is at high impedance, internal encoding clock is inhibited, and the encoder is in the idle state. The encode data register empty flag (NCM) and the encoding completion flag (NCC) in the status register are both set. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 8.2.1.2 Initialization of Encoder The encoder is initialized by configuring the bit rate control bits (BR0, BS1) and setting NCE=1 to place the encoder in the standby state. The encoding process is initiated by writing to the Encoder Data register, which is then transferred to the encode data shift register ready for encoding. After 2 delay bits (ENCOOUT pin is low) and 2 sync bits, the encoded data is shifted out to the ENCOOUT pin, LSB first. See Figure 8-3 for a graphical representation. 8.2.1.3 Encode Data Register Empty Flag (NCM) and Encode Interrupt After the last data bit in the encode data shift register is encoded and output to ENCOOUT, a trailing bit followed by two pause bits are generated to conclude a one byte transmission. After this, if the Encode Data register is not empty, the encoding process is repeated. When data from the encode data register is transferred to the encode data shift register, the encoder data register empty flag (NCM) is set, causing an interrupt to be generated if the encode interrupt is enabled (i.e. NIE = 1). The next byte of data to be encoded can be written in to the encoder data register in an interrupt service routine. The NCM bit is automatically cleared by writing to the encode data register after accessing the MANCD Status register. 8.2.1.4 8 End Pattern Generation and Next Data Byte Encoding The end pattern of one byte sequence is generated automatically after the last bit. This pattern consists of a trailing bit and two pause bits. After this, if the Encode Data register is empty, ENCOOUT is set to high impedance, and the encoder returns to the standby state. The encoding complete flag (NCC) will be set, and an interrupt is generated if the encoding complete interrupt enable bit (CIE) is set. If the encode data register is not empty, the next encoding is started. 8.2.1.5 Disable Encoder The encoder is disabled by setting NCE=0; causing the ENCOOUT pin to be tri-stated. If the NCE bit is cleared while an encoding is in progress (indicated by NCC=0), the encoder will complete encoding of the current byte, plus the end patterns, before going into idle. TPG MC68HC05F8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 8-3 71 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. IDLE N NCE=0, NIE=0, NCM=1, NCC=1 ENCOOUT pin Hi Z NCE=1? Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Y STANDBY N Write to Encode Data register? Y ENCOOUT Hi Z → Low Level (Sync with internal transmit clock) 2 bits - Time Delay Move data from Encode register to encode shift Register NCF 0 → 1 and generate INT if NIE=1 8 Generate 2 SYNC bits NCC 0 → 1 Generate INT if CIE=1 ENCOOUT Hi Z Encode data in the Encode register and output Generate 2 bits pause Generate trailing bit NCE=0? Y N Encode register empty? (NCM=1?) Y N Figure 8-2 Logic Flow of Encoder Hardware Operation TPG MOTOROLA 8-4 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 72 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. t≤1 bit time NCE (encode enable) A sequence of one byte data 2 bits DELAY 8 bits data 2 bits SYNC 2 bits PAUSE Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... High Z High Z ENCOOUT D0 1st 2nd SYN bit SYN bit 0 D1 0 D2 1 D3 1 D4 1 D5 0 D6 1 D7 0 2 3 4 5 6 7 8 Trailing bit ENCODER OUT 1 Figure 8-3 Encoder Timing Diagram 8.2.2 Decoder The Manchester decoder is used to convert incoming Manchester codes on the DECOIN pin to NRZ data format for processing. 8 Upon reset the decoder is disabled, decoder enable bit DCE=0. To initiate the decoding process, the bit rate is first configured. Setting DCE activates the internal decoding clock, the decoder enters the start state and the DECOIN pin begins to be sampled. After a low state is confirmed, the receiver starts to hunt for the 2 bits SYNC pattern. if it is detected, the decoding procedure starts, the decode logic converts the data bits from Manchester code format to NRZ format and shifts the result to the decode shift register bit by bit. After all 8 bits have been received and converted to one data byte, the end pattern of a trailing bit plus two bit pause is verified. If the pattern followed is correct, the decode flag is set and an interrupt is generated, otherwise the decoder is reset and returns to the start state. 8.2.2.1 Decoder Overrun After one byte of data is received and end pattern verified, the decode output flag (DCF) is checked first, if it is zero (indicating the Decode Register is empty), one byte of data which has been received is loaded to the Decode Register and interrupt is generated with the decode output flag set (DCF=1), otherwise the receive overrun flag is set and an interrupt is generated. TPG MC68HC05F8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 8-5 73 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 8.2.2.2 Data Bit Format Error Detection During decoding, a bit format error detection is performed. If 00 or 11 appears at a time interval in which one bit of data is expected, which means that bit format error occurs, then the decoder is reset and returns to the start state. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 8.2.2.3 8 Bit Rate Error Detection During decoding, the input data is sampled by an internal clock, of which the frequency is 8 times of the selected bit rate. If the bit rate of the input data varies exceeding 10% with reference to the nominal value (see bit rate selection table), a bit rate error occurs and the data which is being received is discarded. In this case the decoder is initialized and returns to the start state. 8.3 Manchester Encoder/Decoder Registers 8.3.1 MANCD Control Register Address bit 7 bit 6 bit 5 bit 4 bit 3 $2B NCE NIE CIE DCE DIE bit 2 bit 1 bit 0 State on reset BR1 BR0 0000 0-00 NCE - Encoder Enable Bit 1 (set) – 0 (clear) – Enable the encoder. A transition from 0 to 1 of this bit initiates transmission sequence of one byte data, including 2 proceeding idle bits and 2 ending pause bits. Disable the encoder. When this bit is cleared, the encoder (except the control bits) is reset and put in idle state. If the NCE bit is cleared while an encoding is in progress (indicated by NCC=0), the encoder will complete encoding of the current byte, plus the end patterns, before going idle. Clearing and setting the NCE bit during encoding of a byte has no effect on the encoder operation. Normally, after the last byte of data is written to the Encode Data register, the NCM bit will generate an interrupt (if NIE=1), indicating that data have been transferred to the encode data shift register. The user should then clear the NCE bit to put the encoder in the idle state. NIE - Encoder Interrupt Enable Bit 1 (set) – 0 (clear) – Enable the encoder interrupt. If this bit is set, interrupt is generated when the NCM flag is set. Disable the encoder interrupt. TPG MOTOROLA 8-6 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 74 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. RESET N Decoder enabled ? (DCE=1) Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Y N DECDAIN low ? Initialize decoder Y 2 SYNC bit received ? N Y D0 Received with correct format ? N Y D1 Received with correct format ? N 8 Y D7 Received with correct format ? N Y Detect correct end pattern ? N Y DCF set ? Y Set Overrun flag Generate INT if DIE set N Load Decode register with received data, set DCF and generate INT if DIE set Figure 8-4 Logic Flow of Decoder Hardware Operation TPG MC68HC05F8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 8-7 75 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. CIE - Encoding Complete Interrupt Enable Bit 1 (set) – Enable encoding complete interrupt. If this bit is set, interrupt is generated when the NCC flag is set. 0 (clear) – Disable the encoding complete interrupt. DCE - Decoder Enable Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1 (set) – Enable the decoder. 0 (clear) – Disable the decoder. When this bit is cleared, the decoder is reset, receive and decode function is disabled. DIE - Decode Interrupt Enable 1 (set) – Enable the decoder interrupt. If this bit is set, interrupt is generated when the DCF or OVF flag is set. 0 (clear) – Disable the decoder interrupt. BR1 & BR0 - Bit Rate Select These two bits are used to select the transfer bit rate. 8 BR1 BR0 Bit Cycle Bit rate (3.579MHz crystal) 0 0 1/8 (E/372) 601 0 1 1/4 (E/372) 1203 1 0 1/2 (E/372) 2405 1 1 E/372 4810 “bit” refers to bit unit in NRZ format, i.e. one bit is twice the bit unit in Manchester format. E = internal bus clock 8.3.2 MANCD Status Register Address bit 7 bit 6 bit 5 bit 4 $2C NCM NCC DCF OVF bit 3 bit 2 bit 1 bit 0 State on reset 1100 ---- NCM - Encoder Data Register Empty Flag The Encoder Data register empty flag is set to indicate the contents of the Encoder Data register have been transferred to the encode data shift register. If the NCM bit is clear, it indicates that the transfer has not yet occurred and a write to the Encode Data register will overwrite the previous value. This bit is cleared by accessing the MANCD status register (with NCM set), followed by writing to the Encode Data register. Reset sets the NCM bit. TPG MOTOROLA 8-8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 76 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. NCC - Encoding Completion Flag This bit is set to indicate that no data transmitting or encoding is in progress. It is set when one of the following cases occurs: Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 1) The encoder is disabled, i.e. NCE=0, transmission of the data in the encode data shift register is completed. 2) The encoder is enabled, NCE=1, the encode data register is empty (NCM=1) and transmission of the data in the encode data shift register is completed. Writing to the Encoder Data register when the NCE bit is set clears this flag. Reset or clearing the NCE bit sets this NCC bit. DCF - Decoder Data Register Full Flag This bit is set when one byte of data is received with end pattern verified, and an interrupt is generated if the decoder interrupt is enabled (DIE=1). This flag is cleared when the Status register is accessed (with DCF set) followed by a read of the Decode Data register, or by clearing the DCE bit. OVF - Overrun Flag When an overrun occurs, this flag is set, and an interrupt is generated if the decode interrupt is enabled. Clearing the DCE bit will reset the decoder and thus clearing this flag. See Section 8.2.2.1 for definition of an overrun condition. 8.3.3 8 Encode Data Register ($2D) Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 $2D This is a write only register. Data written to this register will be encoded to Manchester format and then transmitted out to the ENCOOUT pin in sequential format. 8.3.4 Decode Data Register ($2E) Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 $2E The is a read only register. Data in Manchester format entering the DECOIN pin will be decoded and the result placed in this register. TPG MC68HC05F8 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 8-9 77 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY 8 TPG MOTOROLA 8-10 MANCHESTER ENCODER/DECODER For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 78 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 9 DTMF/MELODY GENERATOR The DTMF/Melody Generator (DMG) is a multi-function tone generator built into the MC68HC05F8 MCU, supporting DTMF dialling, melody-on-hold, and pacifier tone functions. The associated output pins are TONEOUT and TONEX. 9.1 Features • 4 row and 4 column frequencies for DTMF dialling • 24 row and 24 column frequencies for dual tone melody • 28 frequencies for pacifier tone to acknowledge button pressed for pulse dialling • Power saving mechanism for no tone condition • 3.579MHz ÷ 2 operation • 6-bit D/A converter and 28 time steps for sine wave generation • Sine wave or square wave selectable output for melody or DTMF • Single or dual tone capability for melody or DTMF 9.2 9 General Operation In Figure 9-1, the DMG consists of a row tone and a column tone generation path. The tone frequency of each path is controlled by their respective frequency control registers; Row Frequency Control register (FCR) and Column Frequency Control register (FCC). At the TONEOUT output, single/dual sine/square wave tones of DTMF and melody frequencies are possible, whereas at the TONEX output, only single square wave tones are possible. To generate a sine wave tone with programmable frequency in a path, the internal clock (i.e. the 3.58MHz ÷ 2) is first divided by a frequency divider, whose value is set by the frequency control register (FCR or FCC). The output of the divider is a periodic pulse train whose frequency is the TPG MC68HC05F8 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 9-1 79 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 3.58MHz ÷ 2 TONEX MSB Row Frequency Divider PLA Scanner Sinewave PLA 28 x 6-bits 6 Sine/Square Wave Select MUX LSB 6-bit Resistor Ladder 5 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5 9 Tone Control register bits 4 & 5 Row Frequency Control Register Column Frequency Control Register Data Validator Tone Control register bits 6 & 7 TGER TGEC MS1 MS0 + + TONEOUT current summer + active low-pass filter 5 Column Frequency Divider PLA Scanner Sinewave PLA 28 x 6-bits 6 Sine/Square Wave Select 6 6-bit Resistor Ladder High Group Pre-emphasis Figure 9-1 DTMF/Melody Generator Block Diagram sampling rate of the desired “staircase sine wave”. This pulse train then clocks a divide-by-28 binary counter (PLA scanner) whose 28 decoded outputs sequentially scan 28 memory locations of a 28x6 sine wave generator (PLA) in 28 time steps (M). The 6 resulting digital sine wave bits are then fed separately to a 6-bit resistor ladder to produce a current signal. The method for generating a square wave tone in a path is similar to that of a sine wave tone except that only the most significant bit of a sine wave PLA is fed to the 6-bit resistor ladder (the other 5 bits are masked by the Sine/Square wave select) to produce a current signal. The resulting square wave tone has exactly the same frequency and phase as a sine wave tone for the same frequency control register value. After obtaining the current signals from the row and column paths, the row current signal is first attenuated by 2dB, and is then summed with the column current signal, and is finally fed to an active 7KHz low pass filter to reduce harmonic distortion. The resulting DTMF or melody signal is output to the TONEOUT pin, which is normally buffered to drive a buzzer. The generator provides not only DTMF and melody but also a square wave pacifier tone (Tone). This signal is also extracted from the most significant bit of the sine wave PLA of the row path, but is not subjected to the filter. The ToneX signal is output to the TONEX pin, which is normally connected to a loudspeaker. TPG MOTOROLA 9-2 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 80 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 9.3 DMG Registers The DMG has three registers, Row Frequency Control register and Column Frequency Control register, for row and column frequencies selection respectively; and Tone Control register for tone output control and mode selection. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 9.3.1 Row Frequency Control Register (FCR) Column Frequency Control Register (FCC) Address bit 7 Row Frequency Control bit 6 bit 5 $13 Address bit 7 Column Frequency Control bit 6 bit 5 $14 State on reset bit 4 bit 3 bit 2 bit 1 bit 0 FCR4 FCR3 FCR2 FCR1 FCR0 000u uuuu bit 4 bit 3 bit 2 bit 1 bit 0 FCC4 FCC3 FCC2 FCC1 FCC0 000u uuuu State on reset FCR0-4 and FCC0-4 control the frequencies of the tone signals on the row and the column paths respectively. The bit description for DTMF and Melody tone generation are shown in Table 9-1 and Table 9-2 respectively. Table 9-1 Bit Description for DTMF Generation FCR Note: FCC $00 $01 $02 $03 See Note See note $10 $11 $12 $13 TONE fR1 fR2 fR3 fR4 fC1 fC2 fC3 fC4 Standard Frequency (Hz) 697 770 852 941 1209 1336 1477 1633 Tone Output Frequency (Hz) 694.8 770.1 854.2 940.0 1206.0 1331.7 1486.5 1639.0 9 Frequency Deviation (%) 0.32 –0.02 –0.03 0.11 0.244 0.324 –0.645 –0.367 The legal values in the FCR are illegal to the FCC, and vice versa. An illegal value to these registers will produce a tri-state at the TONEOUT output pin, and a logic high at the TONEX output pin. TPG MC68HC05F8 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 9-3 81 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 9-2 Bit Description for Melody Generation 9 9.3.2 FCR/FCC Tone $04 $05 $06 $07 $08 $09 $0A $0B $0C $0D $0E $0F $14 $15 $16 $17 $18 $19 $1A $1B $1C $1D $1E $1F D#5 E5 F5 F#5 G5 G#5 A5 A#5 B5 C6 C#6 D6 D#6 E6 F6 F#6 G6 G#6 A6 A#6 B6 C7 C#7 D7 Standard Frequency (Hz) 622.3 659.3 698.5 740.0 784.0 830.6 880.6 932.3 987.8 1046.5 1108.7 1174.7 1224.5 1318.5 1396.9 1480.0 1568.0 1661.2 1760.0 1864.7 1975.5 2093.0 2217.5 2349.3 Tone Output Frequency (Hz) 620.6 659.0 694.8 743.3 779.5 830.1 875.6 926.4 983.4 1047.9 1102.1 1183.7 1253.3 1331.7 1389.6 1486.5 1559.0 1682.1 1775.6 1880.0 1997.5 2062.0 2204.2 2367.4 Frequency Deviation (%) 0.28 0.05 0.53 –0.44 0.57 0.06 0.50 0.64 0.45 –0.13 0.60 –0.77 –0.71 –1.00 0.52 –0.44 0.57 –1.26 –0.89 –0.82 –1.11 1.49 0.60 –0.771 Tone Control Register (TNCR) Address bit 7 bit 6 bit 5 bit 4 $15 MS1 MS0 TGER TGEC bit 3 bit 2 bit 1 bit 0 State on reset 0000 0000 This register controls the internal configuration and tone output timing of the DTMF/Melody Generator. MS1, MS0 - Mode Select These bits control the operating mode of the DTMF/Melody Generator. These are sine wave, square wave, ToneX, and square wave+ToneX modes. Table 9-3 shows the bit configurations. TPG MOTOROLA 9-4 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 82 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. When one mode is selected, the pin associated with that mode will be activated, but the other pin will remain at its idle state. The idle state for TONEOUT output pin is a tri-state, and TONEX output pin is a logic high. The final state of an active pin is dependent on the values of TGER, TGEC (see Table 9-4), FCR and FCC bits (when illegal values is input). Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... When both MS1 and MS0 are set, the generator can generate both single tone melody at the column path and ToneX at the row path simultaneously. Table 9-3 DMG Operating Modes MS1 0 0 1 1 MS0 0 1 0 1 Mode Sine Wave Square Wave ToneX Square Wave+ToneX TONEOUT output DTMF/Melody Melody tri-state Monotonic Melody TONEX output High High ToneX ToneX TGER, TGEC - Tone Generation Enable for Row and Column Paths When both bits are held low, the DMG is disabled by forcing the two frequency counters and the two PLA scanning counters to their reset states. The TONEOUT output is set to tri-state, the TONEX output is set to logic low, and the active filter is turned off by shutting down all related current sources to prevent DC power dissipation. When a TGE bit for a path is held high (provided that the value in the frequency control register for that path is legal, and the mode chosen is not ToneX mode) the generator is enabled. All the counters associated with that path are then run from their reset states, and the active filter is turned on to allow generated tone of that path to be output. 9 In DTMF dialling, the row and column tone values are first entered to the FCR and FCC registers, and then the TGER and TGEC bits are set or reset simultaneously to achieve dual tone multiple frequency. Similarly, in melody generation, one path is chosen as the high part, and the other, the low part. The TGER and TGEC bits are then set and reset according to the rhythm required by the musical tune. Of course, one can exhibits only single tone melody by disabling either TGER or TGEC permanently. The DTMF column and row frequency tones can also be output separately for testing by enabling just the one path. Table 9-4 Effect of Tone Generation Enable on DMG TGER TGEC Row Path Column Path Filter 0 0 Off Off Off 0 1 Off Active Active 1 0 Active Off Active* 1 1 Active Active Active * In ToneX mode, the filter is off and only single tone can be generated. Tone Silent Single Single Dual* TPG MC68HC05F8 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 9-5 83 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Note: The reset state of a frequency counter defines the time=0 state of a time step, whereas the PLA scanning counters at its reset state scanning the memory location contained the DC value of staircase sine wave. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 9.4 9 Programming the DMG The recommended operating procedures for the DMG are described in the below paragraphs. Since the TONEOUT pin is an open-collector output, an external pull-up resistor of 1K to 10KΩ is required (see Section 13 - Electrical Characteristics). 9.4.1 DTMF Dialling To operate DTMF dialling, the sine wave mode selected. The required dual-tone (digit) are selected through the FCR and FCC registers, and are thus output to TONEOUT pin by setting both TGER and TGEC bits simultaneously for a period of 80ms. After generating a dual-tone, an inter-digit delay, which is produced by tri-stating the TONEOUT output, of another 80ms before the next dual-tone (digit) is output. This can be achieved by clearing both the TGER and TGEC bits simultaneously, or by writing an illegal value to FCR or FCC registers. 9.4.2 Melody Generation For melody generation, either sine wave or square wave mode can be selected for full programmability. The sine wave has a flute like sound, while the square wave possesses much richer harmonics. The required tones are selected through the FCR and FCC registers. The selected tone is generated when the corresponding TGER or TGEC bit is set. 9.4.3 ToneX Generation To operate ToneX generation, the ToneX mode is selected. The required tone is selected through the FCR register. The timing of the tone can be controlled by the TGER bit. 9.4.4 Melody+ToneX Generation To operate Melody+ToneX generation, the ToneX+Melody mode is selected. The frequencies of the Melody tone and ToneX are selected through the FCR and FCC registers respectively, whereas the timings of the Melody and ToneX are controlled separately by TGER and TGEC respectively. TPG MOTOROLA 9-6 DTMF/MELODY GENERATOR For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 84 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 10 CPU CORE AND INSTRUCTION SET This section provides a description of the CPU core registers, the instruction set and the addressing modes of the MC68HC05F8. 10.1 Registers The MCU contains five registers, as shown in the programming model of Figure 10-1. The interrupt stacking order is shown in Figure 10-2. 7 0 7 0 7 0 Accumulator Index register 15 Program counter 15 7 0 0 0 0 0 0 0 0 0 1 1 7 0 1 1 1 H I N Z C Stack pointer 10 Condition code register Carry / borrow Zero Negative Interrupt mask Half carry Figure 10-1 Programming model 10.1.1 Accumulator (A) The accumulator is a general purpose 8-bit register used to hold operands and results of arithmetic calculations or data manipulations. TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-1 85 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Unstack Stack 0 Condition code register Accumulator Index register Program counter high Program counter low Interrupt Increasing memory address Return 7 Decreasing memory address Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Figure 10-2 Stacking order 10 10.1.2 Index register (X) The index register is an 8-bit register, which can contain the indexed addressing value used to create an effective address. The index register may also be used as a temporary storage area. 10.1.3 Program counter (PC) The program counter is a 16-bit register, which contains the address of the next byte to be fetched. 10.1.4 Stack pointer (SP) The stack pointer is a 16-bit register, which contains the address of the next free location on the stack. During an MCU reset or the reset stack pointer (RSP) instruction, the stack pointer is set to location $00FF. The stack pointer is then decremented as data is pushed onto the stack and incremented as data is pulled from the stack. When accessing memory, the ten most significant bits are permanently set to 0000000011. These ten bits are appended to the six least significant register bits to produce an address within the range of $00C0 to $00FF. Subroutines and interrupts may use up to 64 (decimal) locations. If 64 locations are exceeded, the stack pointer wraps around and overwrites the previously stored information. A subroutine call occupies two locations on the stack; an interrupt uses five locations. 10.1.5 Condition code register (CCR) The CCR is a 5-bit register in which four bits are used to indicate the results of the instruction just executed, and the fifth bit indicates whether interrupts are masked. These bits can be individually tested by a program, and specific actions can be taken as a result of their state. Each bit is explained in the following paragraphs. Half carry (H) This bit is set during ADD and ADC operations to indicate that a carry occurred between bits 3 and 4. TPG MOTOROLA 10-2 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 86 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Interrupt (I) When this bit is set, all maskable interrupts are masked. If an interrupt occurs while this bit is set, the interrupt is latched and remains pending until the interrupt bit is cleared. Negative (N) Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... When set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was negative. Zero (Z) When set, this bit indicates that the result of the last arithmetic, logical, or data manipulation was zero. Carry/borrow (C) When set, this bit indicates that a carry or borrow out of the arithmetic logical unit (ALU) occurred during the last arithmetic operation. This bit is also affected during bit test and branch instructions and during shifts and rotates. 10.2 Instruction set The MCU has a set of 62 basic instructions. They can be grouped into five different types as follows: – Register/memory – Read/modify/write – Branch – Bit manipulation – Control 10 The following paragraphs briefly explain each type. All the instructions within a given type are presented in individual tables. This MCU uses all the instructions available in the M146805 CMOS family plus one more: the unsigned multiply (MUL) instruction. This instruction allows unsigned multiplication of the contents of the accumulator (A) and the index register (X). The high-order product is then stored in the index register and the low-order product is stored in the accumulator. A detailed definition of the MUL instruction is shown in Table 10-1. TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-3 87 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 10.2.1 Register/memory Instructions Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Most of these instructions use two operands. The first operand is either the accumulator or the index register. The second operand is obtained from memory using one of the addressing modes. The jump unconditional (JMP) and jump to subroutine (JSR) instructions have no register operand. Refer to Table 10-2 for a complete list of register/memory instructions. 10 10.2.2 Branch instructions These instructions cause the program to branch if a particular condition is met; otherwise, no operation is performed. Branch instructions are two-byte instructions. Refer to Table 10-3. 10.2.3 Bit manipulation instructions The MCU can set or clear any writable bit that resides in the first 256 bytes of the memory space (page 0). All port data and data direction registers, timer and serial interface registers, control/status registers and a portion of the on-chip RAM reside in page 0. An additional feature allows the software to test and branch on the state of any bit within these locations. The bit set, bit clear, bit test and branch functions are all implemented with single instructions. For the test and branch instructions, the value of the bit tested is also placed in the carry bit of the condition code register. Refer to Table 10-4. 10.2.4 Read/modify/write instructions These instructions read a memory location or a register, modify or test its contents, and write the modified value back to memory or to the register. The test for negative or zero (TST) instruction is an exception to this sequence of reading, modifying and writing, since it does not modify the value. Refer to Table 10-5 for a complete list of read/modify/write instructions. 10.2.5 Control instructions These instructions are register reference instructions and are used to control processor operation during program execution. Refer to Table 10-6 for a complete list of control instructions. 10.2.6 Tables Tables for all the instruction types listed above follow. In addition there is a complete alphabetical listing of all the instructions (see Table 10-7), and an opcode map for the instruction set of the M68HC05 MCU family (see Table 10-8). TPG MOTOROLA 10-4 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 88 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-1 MUL instruction X:A ← X*A Multiplies the eight bits in the index register by the eight Description bits in the accumulator and places the 16-bit result in the concatenated accumulator and index register. H : Cleared I : Not affected Condition N : Not affected codes Z : Not affected C : Cleared Source MUL Addressing mode Cycles Bytes Opcode Form Inherent 11 1 $42 Table 10-2 Register/memory instructions Addressing modes # Cycles # Bytes Opcode Indexed (16-bit offset) # Cycles # Bytes Opcode Indexed (8-bit offset) # Cycles Opcode # Cycles # Bytes Opcode # Bytes Indexed (no offset) Extended # Cycles # Bytes Direct Opcode # Cycles Opcode Function # Bytes Immediate Mnemonic Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Operation Load A from memory LDA A6 2 2 B6 2 3 C6 3 4 F6 1 3 E6 2 4 D6 3 5 Load X from memory LDX AE 2 2 BE 2 3 CE 3 4 FE 1 3 EE 2 4 DE 3 5 Store A in memory STA B7 2 4 C7 3 5 F7 1 4 E7 2 5 D7 3 6 Store X in memory STX BF 2 4 CF 3 5 FF 1 4 EF 2 5 DF 3 6 Add memory to A ADD AB 2 2 BB 2 3 CB 3 4 FB 1 3 EB 2 4 DB 3 5 Add memory and carry to A ADC A9 2 2 B9 2 3 C9 3 4 F9 1 3 E9 2 4 D9 3 5 Subtract memory SUB A0 2 2 B0 2 3 C0 3 4 F0 1 3 E0 2 4 D0 3 5 Subtract memory from A with borrow SBC A2 2 2 B2 2 3 C2 3 4 F2 1 3 E2 2 4 D2 3 5 AND memory with A AND A4 2 2 B4 2 3 C4 3 4 F4 1 3 E4 2 4 D4 3 5 OR memory with A ORA AA 2 2 BA 2 3 CA 3 4 FA 1 3 EA 2 4 DA 3 5 Exclusive OR memory with A EOR A8 2 2 B8 2 3 C8 3 4 F8 1 3 E8 2 4 D8 3 5 Arithmetic compare A with memory CMP A1 2 2 B1 2 3 C1 3 4 F1 1 3 E1 2 4 D1 3 5 Arithmetic compare X with memory CPX A3 2 2 B3 2 3 C3 3 4 F3 1 3 E3 2 4 D3 3 5 Bit test memory with A (logical compare) BIT A5 2 2 B5 2 3 C5 3 4 F5 1 3 E5 2 4 D5 3 5 Jump unconditional JMP BC 2 2 CC 3 3 FC 1 2 EC 2 3 DC 3 4 Jump to subroutine JSR BD 2 5 CD 3 6 FD 1 5 ED 2 6 DD 3 7 10 TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-5 89 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-3 Branch instructions Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Function 10 Branch always Branch never Branch if higher Branch if lower or same Branch if carry clear (Branch if higher or same) Branch if carry set (Branch if lower) Branch if not equal Branch if equal Branch if half carry clear Branch if half carry set Branch if plus Branch if minus Branch if interrupt mask bit is clear Branch if interrupt mask bit is set Branch if interrupt line is low Branch if interrupt line is high Branch to subroutine Mnemonic BRA BRN BHI BLS BCC (BHS) BCS (BLO) BNE BEQ BHCC BHCS BPL BMI BMC BMS BIL BIH BSR Relative addressing mode Opcode # Bytes # Cycles 20 2 3 21 2 3 22 2 3 23 2 3 24 2 3 24 2 3 25 2 3 25 2 3 26 2 3 27 2 3 28 2 3 29 2 3 2A 2 3 2B 2 3 2C 2 3 2D 2 3 2E 2 3 2F 2 3 AD 2 6 Table 10-4 Bit manipulation instructions Function Branch if bit n is set Branch if bit n is clear Set bit n Clear bit n Mnemonic BRSET n (n=0–7) BRCLR n (n=0–7) BSET n (n=0–7) BCLR n (n=0–7) Addressing modes Bit set/clear Bit test and branch Opcode # Bytes # Cycles Opcode # Bytes # Cycles 2•n 3 5 01+2•n 3 5 10+2•n 2 5 11+2•n 2 5 TPG MOTOROLA 10-6 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 90 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-5 Read/modify/write instructions Addressing modes # Cycles Opcode # Bytes # Cycles Opcode # Bytes # Cycles Opcode # Bytes # Cycles Opcode # Bytes # Cycles Indexed (8-bit offset) # Bytes Increment Decrement Clear Complement Negate (two’s complement) Rotate left through carry Rotate right through carry Logical shift left Logical shift right Arithmetic shift right Test for negative or zero Multiply Indexed (no offset) Direct Opcode Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Function Inherent (X) Mnemonic Inherent (A) INC DEC CLR COM NEG ROL ROR LSL LSR ASR TST MUL 4C 4A 4F 43 40 49 46 48 44 47 4D 42 1 1 1 1 1 1 1 1 1 1 1 1 3 5C 3 5A 3 5F 3 53 3 50 3 59 3 56 3 58 3 54 3 57 3 5D 11 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3C 3A 3F 33 30 39 36 38 34 37 3D 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 4 7C 7A 7F 73 70 79 76 78 74 77 7D 1 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 5 4 6C 6A 6F 63 60 69 66 68 64 67 6D 2 2 2 2 2 2 2 2 2 2 2 6 6 6 6 6 6 6 6 6 6 5 Table 10-6 Control instructions Function Transfer A to X Transfer X to A Set carry bit Clear carry bit Set interrupt mask bit Clear interrupt mask bit Software interrupt Return from subroutine Return from interrupt Reset stack pointer No-operation Stop Wait Mnemonic TAX TXA SEC CLC SEI CLI SWI RTS RTI RSP NOP STOP WAIT Inherent addressing mode Opcode # Bytes # Cycles 97 1 2 9F 1 2 99 1 2 98 1 2 9B 1 2 9A 1 2 83 1 10 81 1 6 80 1 9 9C 1 2 9D 1 2 8E 1 2 8F 1 2 10 TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-7 91 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-7 Instruction set Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Mnemonic 10 INH IMM DIR Addressing modes EXT REL IX IX1 IX2 BSC BTB H ◊ ◊ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • ADC ADD AND ASL ASR BCC BCLR BCS BEQ BHCC BHCS BHI BHS BIH BIL BIT BLO BLS BMC BMI BMS BNE BPL BRA BRN BRCLR BRSET BSET BSR CLC CLI CLR CMP Address mode abbreviations BSC Bit set/clear IMM Immediate BTB Bit test & branch IX Indexed (no offset) DIR Direct IX1 EXT Extended IX2 INH Inherent REL Relative Condition codes I N Z • ◊ ◊ • ◊ ◊ • ◊ ◊ • ◊ ◊ • ◊ ◊ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • ◊ ◊ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • 0 • • • 0 1 • ◊ ◊ C ◊ ◊ • ◊ ◊ • • • • • • • • • • • • • • • • • • • • ◊ ◊ • • 0 • • ◊ Condition code symbols ◊ Tested and set if true, cleared otherwise H Half carry (from bit 3) Indexed, 1 byte offset I Interrupt mask • Not affected Indexed, 2 byte offset N Negate (sign bit) ? Load CCR from stack Z Zero 0 Cleared C Carry/borrow 1 Set Not implemented TPG MOTOROLA 10-8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 92 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-7 Instruction set (Continued) Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Mnemonic INH IMM DIR Addressing modes EXT REL IX IX1 IX2 BSC BTB COM CPX DEC EOR INC JMP JSR LDA LDX LSL LSR MUL NEG NOP ORA ROL ROR RSP RTI RTS SBC SEC SEI STA STOP STX SUB SWI TAX TST TXA WAIT Address mode abbreviations BSC Bit set/clear IMM Immediate BTB Bit test & branch IX Indexed (no offset) DIR Direct IX1 EXT Extended IX2 INH Inherent REL Relative Condition codes I N Z • ◊ ◊ • ◊ ◊ • ◊ ◊ • ◊ ◊ • ◊ ◊ • • • • • • • ◊ ◊ • ◊ ◊ • ◊ ◊ • 0 ◊ • • • • ◊ ◊ • • • • ◊ ◊ • ◊ ◊ • ◊ ◊ • • • ? ? ? • • • • ◊ ◊ • • • 1 • • • ◊ ◊ 0 • • • ◊ ◊ • ◊ ◊ 1 • • • • • • ◊ ◊ • • • 0 • • H • • • • • • • • • • • 0 • • • • • • ? • • • • • • • • • • • • • C 1 ◊ • • • • • • • ◊ ◊ 0 ◊ • • ◊ ◊ • ? • ◊ 1 • • • • ◊ • • • • • 10 Condition code symbols ◊ Tested and set if true, cleared otherwise H Half carry (from bit 3) Indexed, 1 byte offset I Interrupt mask • Not affected Indexed, 2 byte offset N Negate (sign bit) ? Load CCR from stack Z Zero 0 Cleared C Carry/borrow 1 Set Not implemented TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-9 93 MOTOROLA 10-10 BTB 2 5 BTB 2 5 BTB 2 5 3 3 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 5 BTB 2 3 3 3 3 3 3 3 3 3 3 BRCLR7 BRSET7 BRCLR6 BRSET6 BRCLR5 BRSET5 BRCLR4 BRSET4 BRCLR3 BRSET3 BTB 2 5 3 BRCLR2 3 BRSET2 BRCLR1 BRSET1 BTB 2 5 3 BRCLR0 3 BRSET0 5 BSC 2 BSC 2 5 BCLR7 BSET7 BSC 2 5 BSC 2 5 BCLR6 BSET6 BSC 2 5 BSC 2 5 BCLR5 BSET5 BSC 2 5 BCLR4 BSC 2 5 BSET4 BSC 2 5 BSC 2 5 BCLR3 BSET3 BSC 2 5 BSC 2 5 BCLR2 BSET2 BSC 2 5 BSC 2 5 BCLR1 BSET1 BSC 2 5 BSC 2 5 BCLR0 BSET0 5 BIH BIL BMS BMC BMI BPL REL 2 REL 3 REL 2 3 REL 2 3 REL 3 REL 2 3 REL 2 3 BHCS REL 2 3 REL 2 3 REL 2 3 REL 3 REL 2 3 REL 2 3 REL 3 REL 3 REL 2 3 BHCC BEQ BNE BCS BCC BLS BHI BRN BRA 3 BSC BTB DIR EXT INH IMM Bit set/clear Bit test and branch Direct Extended Inherent Immediate IX IX1 IX2 REL A X Abbreviations for address modes and registers 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Low High Branch REL 2 0010 CLR TST INC DEC ROL LSL ASR ROR LSR COM NEG DIR 3 0011 1 CLRA TSTA INCA DECA ROLA LSLA ASRA RORA LSRA COMA MUL NEGA INH 1 3 INH 1 INH 1 3 3 INH 1 INH 1 3 INH 1 3 INH 1 3 INH 1 3 3 INH 1 INH 1 3 INH 3 11 INH 1 3 CLRX TSTX INCX DECX ROLX LSLX ASRX RORX LSRX COMX NEGX INH 2 3 INH 2 INH 2 3 3 INH 2 INH 2 3 INH 2 3 INH 2 3 INH 2 3 3 INH 2 INH 2 3 3 INH 2 3 CLR TST INC DEC ROL LSL ASR ROR LSR COM NEG Read/modify/write INH IX1 5 6 0101 0110 Indexed (no offset) Indexed, 1 byte (8-bit) offset Indexed, 2 byte (16-bit) offset Relative Accumulator Index register DIR 1 5 DIR 1 DIR 1 4 5 DIR 1 DIR 1 5 DIR 1 5 DIR 1 5 DIR 1 5 5 DIR 1 DIR 1 5 5 DIR 1 5 INH 4 0100 10 Bit manipulation BTB BSC 0 1 0000 0001 IX1 1 6 IX1 1 IX1 1 5 6 IX1 1 IX1 1 6 IX1 1 6 IX1 1 6 IX1 1 6 6 IX1 1 IX1 1 6 6 IX1 1 6 CLR TST INC DEC ROL LSL ASR ROR LSR COM NEG IX 7 0111 5 1 WAIT STOP SWI RTS RTI 1 1 1 1 1 1 1 INH 1 INH 2 2 INH 10 INH INH 6 9 TXA NOP RSP SEI CLI SEC CLC TAX INH 9 1001 Control Not implemented IX 1 5 IX IX 4 5 IX IX 5 IX 5 IX 5 IX 5 5 IX IX 1 5 1 IX 1 5 INH 8 1000 2 2 INH 2 2 INH 2 INH 2 INH 2 2 INH 2 2 INH 2 2 INH 2 2 INH 2 2 2 2 2 2 2 LDX BSR ADD ORA ADC EOR LDA BIT AND CPX SBC CMP SUB IMM A 1010 2 2 STX LDX JSR JMP ADD ORA ADC EOR STA LDA BIT AND CPX SBC CMP SUB 3 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com Bytes 1 STX LDX JSR JMP ADD ORA ADC EOR STA LDA BIT AND CPX SBC CMP SUB SUB F 1111 EXT 3 EXT 3 5 EXT 3 4 EXT 3 6 EXT 3 3 EXT 3 4 EXT 3 4 EXT 3 4 EXT 3 4 EXT 3 5 EXT 3 4 EXT 3 4 EXT 3 4 EXT 3 4 EXT 3 4 EXT 3 4 4 IX 3 0 0000 IX2 2 IX2 2 6 IX2 2 5 IX2 2 7 IX2 2 4 IX2 2 5 IX2 2 5 IX2 2 5 IX2 2 5 IX2 2 6 IX2 2 5 IX2 2 5 IX2 2 5 IX2 2 5 IX2 2 5 IX2 2 5 5 STX LDX JSR JMP ADD ORA ADC EOR STA LDA BIT AND CPX SBC CMP SUB IX1 E 1110 Address mode STX LDX JSR JMP ADD ORA ADC EOR STA LDA BIT AND CPX SBC CMP SUB Register/memory EXT IX2 C D 1100 1101 Cycles DIR 3 DIR 3 4 DIR 3 3 DIR 3 5 DIR 3 2 DIR 3 3 DIR 3 3 DIR 3 3 DIR 3 3 DIR 3 4 DIR 3 3 DIR 3 3 DIR 3 3 DIR 3 3 DIR 3 3 DIR 3 3 Mnemonic Legend 2 IMM 2 REL 2 2 6 IMM 2 IMM 2 2 IMM 2 2 IMM 2 2 2 IMM 2 IMM 2 2 IMM 2 2 IMM 2 2 IMM 2 2 IMM 2 2 IMM 2 2 2 DIR B 1011 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... STX LDX JSR JMP ADD ORA ADC EOR STA LDA BIT AND CPX SBC CMP SUB IX IX 4 IX 3 IX 5 IX 2 IX 3 IX 3 IX 3 IX 3 IX 4 IX 3 IX 3 IX 3 IX 3 IX 3 IX 3 3 Low 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 High Opcode in binary Opcode in hexadecimal IX1 1 IX1 1 5 IX1 1 4 IX1 1 6 IX1 1 3 IX1 1 4 IX1 1 4 IX1 1 4 IX1 1 4 IX1 1 5 IX1 1 4 IX1 1 4 IX1 1 4 IX1 1 4 IX1 1 4 IX1 1 4 4 IX F 1111 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 10-8 M68HC05 opcode map MC68HC05F8 TPG 94 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 10.3 Addressing modes Ten different addressing modes provide programmers with the flexibility to optimize their code for all situations. The various indexed addressing modes make it possible to locate data tables, code conversion tables and scaling tables anywhere in the memory space. Short indexed accesses are single byte instructions; the longest instructions (three bytes) enable access to tables throughout memory. Short absolute (direct) and long absolute (extended) addressing are also included. One or two byte direct addressing instructions access all data bytes in most applications. Extended addressing permits jump instructions to reach all memory locations. The term ‘effective address’ (EA) is used in describing the various addressing modes. The effective address is defined as the address from which the argument for an instruction is fetched or stored. The ten addressing modes of the processor are described below. Parentheses are used to indicate ‘contents of’ the location or register referred to. For example, (PC) indicates the contents of the location pointed to by the PC (program counter). An arrow indicates ‘is replaced by’ and a colon indicates concatenation of two bytes. For additional details and graphical illustrations, refer to the M68HC05 Applications Guide. 10.3.1 Inherent In the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. Operations specifying only the index register or accumulator, as well as the control instruction, with no other arguments are included in this mode. These instructions are one byte long. 10.3.2 Immediate In the immediate addressing mode, the operand is contained in the byte immediately following the opcode. The immediate addressing mode is used to access constants that do not change during program execution (e.g. a constant used to initialize a loop counter). 10 EA = PC+1; PC ← PC+2 10.3.3 Direct In the direct addressing mode, the effective address of the argument is contained in a single byte following the opcode byte. Direct addressing allows the user to directly address the lowest 256 bytes in memory with a single two-byte instruction. EA = (PC+1); PC ← PC+2 Address bus high ← 0; Address bus low ← (PC+1) TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-11 95 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 10.3.4 Extended Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... In the extended addressing mode, the effective address of the argument is contained in the two bytes following the opcode byte. Instructions with extended addressing mode are capable of referencing arguments anywhere in memory with a single three-byte instruction. When using the Motorola assembler, the user need not specify whether an instruction uses direct or extended addressing. The assembler automatically selects the short form of the instruction. EA = (PC+1):(PC+2); PC ← PC+3 Address bus high ← (PC+1); Address bus low ← (PC+2) 10.3.5 Indexed, no offset In the indexed, no offset addressing mode, the effective address of the argument is contained in the 8-bit index register. This addressing mode can access the first 256 memory locations. These instructions are only one byte long. This mode is often used to move a pointer through a table or to hold the address of a frequently referenced RAM or I/O location. EA = X; PC ← PC+1 Address bus high ← 0; Address bus low ← X 10.3.6 Indexed, 8-bit offset In the indexed, 8-bit offset addressing mode, the effective address is the sum of the contents of the unsigned 8-bit index register and the unsigned byte following the opcode. Therefore the operand can be located anywhere within the lowest 511 memory locations. This addressing mode is useful for selecting the mth element in an n element table. 10 EA = X+(PC+1); PC ← PC+2 Address bus high ← K; Address bus low ← X+(PC+1) where K = the carry from the addition of X and (PC+1) 10.3.7 Indexed, 16-bit offset In the indexed, 16-bit offset addressing mode, the effective address is the sum of the contents of the unsigned 8-bit index register and the two unsigned bytes following the opcode. This address mode can be used in a manner similar to indexed, 8-bit offset except that this three-byte instruction allows tables to be anywhere in memory. As with direct and extended addressing, the Motorola assembler determines the shortest form of indexed addressing. EA = X+[(PC+1):(PC+2)]; PC ← PC+3 Address bus high ← (PC+1)+K; Address bus low ← X+(PC+2) where K = the carry from the addition of X and (PC+2) TPG MOTOROLA 10-12 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 96 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 10.3.8 Relative Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The relative addressing mode is only used in branch instructions. In relative addressing, the contents of the 8-bit signed byte (the offset) following the opcode are added to the PC if, and only if, the branch conditions are true. Otherwise, control proceeds to the next instruction. The span of relative addressing is from –126 to +129 from the opcode address. The programmer need not calculate the offset when using the Motorola assembler, since it calculates the proper offset and checks to see that it is within the span of the branch. EA = PC+2+(PC+1); PC ← EA if branch taken; otherwise EA = PC ← PC+2 10.3.9 Bit set/clear In the bit set/clear addressing mode, the bit to be set or cleared is part of the opcode. The byte following the opcode specifies the address of the byte in which the specified bit is to be set or cleared. Any read/write bit in the first 256 locations of memory, including I/O, can be selectively set or cleared with a single two-byte instruction. EA = (PC+1); PC ← PC+2 Address bus high ← 0; Address bus low ← (PC+1) 10.3.10 Bit test and branch The bit test and branch addressing mode is a combination of direct addressing and relative addressing. The bit to be tested and its condition (set or clear) is included in the opcode. The address of the byte to be tested is in the single byte immediately following the opcode byte (EA1). The signed relative 8-bit offset in the third byte (EA2) is added to the PC if the specified bit is set or cleared in the specified memory location. This single three-byte instruction allows the program to branch based on the condition of any readable bit in the first 256 locations of memory. The span of branch is from –125 to +130 from the opcode address. The state of the tested bit is also transferred to the carry bit of the condition code register. 10 EA1 = (PC+1); PC ← PC+2 Address bus high ← 0; Address bus low ← (PC+1) EA2 = PC+3+(PC+2); PC ← EA2 if branch taken; otherwise PC ← PC+3 TPG MC68HC05F8 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 10-13 97 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY 10 TPG MOTOROLA 10-14 CPU CORE AND INSTRUCTION SET For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 98 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 11 LOW POWER MODES The STOP and WAIT instructions have different effects on the Timers, Serial Peripheral Interface (SPI), and DTMF/Melody Generator (DMG). These are discussed in the following paragraphs. 11.1 Stop Mode When the processor executes the STOP instruction, the internal clock is turned off. This halts all internal CPU processing, including the operation of the Programmable Timer, SPI and DMG. The I bit in the Condition Code register is cleared to enable external interrupts (INTE1, INTE2 and KEYE bits are unaltered). All registers and memory remain unaltered, and all input/output lines remain unchanged. The MCU is exited from Stop mode by an interrupt on either IRQ1 or IRQ2, or any keyboard interrupts, or any resets (logic low on RESET pin or a power-on reset). On exit from Stop mode, the program counter is loaded with the corresponding interrupt vector (see Table 5-1). The effects of the Stop mode on each of the MCU peripheral systems are described separately. 11.1.1 Timer A during Stop Mode When Stop mode is entered, the timer A (programmable timer) counter stops counting (the internal processor clock is stopped) and remains at that particular count value until the Stop mode is exited. If the exit was caused by reset, the counter is forced to $FFFC. If the Stop mode is exited by an interrupt (IRQ1, IRQ2, or keyboard interrupt), the counter resumes counting from the value when it entered the Stop mode. Another feature of the programmable timer in the Stop mode is, that if at least one valid input capture edge occurs at the TCAP pin, the input capture detect circuitry is armed. This action does not set any timer flags or “wake up” the MCU, but when the MCU does “wake up” there will be an active input capture flag (and data) from that first valid edge which occurred during the Stop mode. Notice that an exit by a reset will reset the entire MCU and thus, this function on the TCAP will not happen. 11 TPG MC68HC05F8 LOW POWER MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 11-1 99 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 11.1.2 Timer B during Stop Mode Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... When Stop mode is entered, the timer B (reloadable timer) counter stops counting (the internal processor clock is stopped) and remains at that particular count value until the Stop mode is exited. If the exit was caused by reset, the reloadable timer is disabled. If the Stop mode is exited by an interrupt (IRQ1, IRQ2, or keyboard interrupt), the counter resumes counting from the value when it entered the Stop mode. 11.1.3 SPI during Stop Mode When the Stop mode is entered, the baud rate generator driving the SPI shuts down. This stops all master mode SPI operations, thus the master SPI is unable to transmit or receive any data. If the STOP instruction is executed during an SPI transfer, that transfer is halted until the MCU exits the Stop mode by an interrupt (IRQ1, IRQ2, or keyboard interrupt). If the Stop mode is exited by a reset, the appropriate control/status bits are cleared and the SPI is disabled. If the device is in the slave mode when the STOP instruction is executed, the slave SPI will still operate. It can still accept data, clock information, and transmit data back to a master device, but no flags are set at the end of the transmission until the Stop mode is exited by an interrupt. The user should be careful when using the SPI as slave during the Stop mode because data protection features are not active (e.g. write collision). It should also be noted that when the MCU is in the Stop mode, the enabled output drivers (TCMP, SDO, SDI, and SCK ports) remain active, and any sourcing currents from these outputs will be part of the total supply current required by the device. 11.1.4 DMG during Stop Mode When the Stop mode is entered, all counters which generate the timings for the DTMF and Melody, and all current sources of the active filter will be shut down. The TONEOUT pin of the DMG will be tri-stated and the TONEX pin will be at logic high. All DMG operations are halted. 11 11.1.5 COP during Stop Mode If the COP system is enabled and the “kill” watchdog timer feature is not activated, the watchdog timer will continue to run in Stop mode, and eventually time-out, causing a reset to the MCU. If the COP system is enabled and the “kill” watchdog timer is activated, a STOP instruction will reset the watchdog timer and disable the COP system. If the WDTE bit is set, when the MCU exits Stop mode (by an interrupt), the COP system is automatically enabled and the watchdog timer counter is loaded with the initial value. The COP system remains inactive if WDTE bit is cleared. TPG MOTOROLA 11-2 LOW POWER MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 100 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 11.2 Wait Mode When the MCU enters the Wait mode, the CPU clock is halted. All CPU activities and the DTMF/Melody Generation are halted, as in Stop mode; however, the timers (A and B) and SPI system remain active. An interrupt from the timer, keyboard, SPI, or IRQ1/IRQ2 causes the processor to exit the Wait mode. A reset will also take the MCU out of Wait mode. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... The operation of the COP system in Wait mode is as for Stop mode. The Wait mode power consumption depends on how many systems are active. The power consumption will be the least when the SPI and timer are disabled. If a non-reset exit from the Wait mode is performed (e.g. timer overflow interrupt exit), the state of the remaining systems will be unchanged. If a reset exit from the wait mode is performed, all the systems revert to the disabled reset state. 11 TPG MC68HC05F8 LOW POWER MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 11-3 101 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY 11 TPG MOTOROLA 11-4 LOW POWER MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 102 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 12 OPERATING MODES The MC68HC05F8/MC68HC705F8 MCU has two modes of operation, the User Mode and the Self-Check/Bootstrap Mode. Figure 12-1 shows the flowchart of entry to these two modes, and Table 12-1 shows operating mode selection. 5V RESET 9V IRQ1 ? N USER MODE (NORMAL MODE) Y TCAP = VDD ? Y SELF-CHECK/ BOOTSTRAP MODE Note: Self-check for MC68HC05F8 Bootstrap mode for MC68HC705F8 12 Figure 12-1 Flowchart of Mode Entering TPG MC68HC05F8 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 12-1 103 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Table 12-1 Mode Selection RESET 5V Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 5V IRQ1 TCAP MODE VSS to VDD VSS to VDD USER VDD SELF-CHECK/ BOOTSTRAP 9V +9V Rising Edge* * Minimum hold time should be 2 clock cycles, after that it can be used as a normal IRQ1 function pin. 12.1 User Mode (Normal Operation) The normal operating mode of the MC68HC05F8/MC68HC705F8 is the user mode. The user mode is entered if the RESET line is brought low, and the IRQ1 pin is within its normal operating range (VSS to VDD), the rising edge of the RESET will cause the MCU to enter the user mode. 12.2 Self-Check Mode The self-check mode is available on the MC68HC05F8 only, and is for the user to check device functions with an on-chip self-check program masked at location $FE00 to $FEDF under minimum hardware support. The self-check circuit is shown in Figure 12-3. Figure 12-2 is the criteria to enter self-check mode, where TCAP’s condition is latched within first two clock cycles after the rising edge of the reset. TCAP can then be used for other purposes. After entering the self-check mode, CPU branches to the self-check program and carries out the self-check. Self-check is a repetitive test, i.e. if all parts are checked to be good, the CPU will repeat the self-check again. Therefore, the LEDs attached to Port A will be flashing if the device is good; else the combination of LEDs’ on-off pattern will indicate which part of the device is suspected to be bad. Table 12-2 lists the LEDs’ on-off patterns and their corresponding indications. +5V 12 TCAP +9V IRQ1 +5V RESET Figure 12-2 Self-Check Mode Timing TPG MOTOROLA 12-2 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 104 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. OSC1 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 3.58MHz OSC2 10M +5V 22p RESET 22p 100K PD0 PD1 PD2 PD3 PD4 PD5 PD6 PD7 RESET + 1µ MC68HC05F8 +5V 4K7 DECOIN ENCOOUT IRQA IRQB PE0 PE1 PE2 PE3 PE4 PE5 PE6 PE7 PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 PF0 PF1 PF2 PF3 PF4 PF5 PF6 PF7 PA0 PG0 PG1 4K7 TCAP +9V 10K 10K 2N4400 +5V 390 PA4 390 PA1 +5V PA5 390 390 PA2 VPP PA6 VDD PA3 12 VSS PA7 Figure 12-3 Self-Test Circuit TPG MC68HC05F8 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 12-3 105 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 12-2 Self-Check Report 12 PA3 1 1 1 1 1 1 1 1 0 PA2 PA1 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 Flashing All Others 1=LED off; 0=LED on. 12.3 PA0 1 0 1 0 1 0 1 0 1 REMARKS Faulty part, port A bad Bad I/O Bad RAM Bad ROM Bad Timer A Bad Timer B Bad SPI Bad MANCD Bad Interrupts Good Device Bad device, port A, etc. Bootstrap Mode The bootstrap mode is available on the MC68HC705F8 only, and it is a mean of self-programming its EPROM with minimal circuitry. It is entered on the rising edge of RESET if IRQ1 pin is at 1.8VDD and TCAP is at logic one. RESET must be held low for 4064 cycles after POR (power-on reset) or for a time tRL for any other reset. Table 12-3 shows the options that are available once bootstrap mode is entered. The execution result is indicated by two LEDs. The EPROM programming circuit for bootstrap mode is shown in Figure 12-5. Table 12-3 Bootstrap Mode Options PB0 0 1 12.3.1 REMARKS Program & Verify Verify EPROM Program Control Register Address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 State on reset $3F 0 0 0 0 0 0 LAT EPGM 0000 0000 EPROM programming is controlled by the Program Control Register at location $3F. TPG MOTOROLA 12-4 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 106 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. LAT - Latch EPROM Data and Address 1 (set) – EPROM address and data buses configured for programming. 0 (clear) – EPROM address and data buses configured for normal reads. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... LAT causes address and data buses to be latched when a write to EPROM is carried out. The EPROM cannot be read if LAT=1. This bit should not be set unless a programming voltage is applied to the VPP pin. EPGM - EPROM Programming Mode Enable 1 (set) – 0 (clear) – Programming power connected to the EPROM array. Programming power disconnected from the EPROM array. LAT and EPMG cannot be set on the same write operation. EPMG can only be set if LAT is set. EPMG is automatically cleared when LAT is cleared. 12.3.2 EPROM Programming Sequence In the bootstrap, the user program contained in an external EPROM is copied into the internal EPROM of the MC68HC705F8 device (see Figure 12-5). The MC68HC705F8 device is inserted into the programming circuit as shown in Figure 12-5. Programming routine is selected via mode switch S1, and +5V and VPP power is applied to the programming circuitry. The MCU is removed from the reset state and placed in the run mode of operation via switch S4, and MCU control is transferred to the bootstrap ROM. The selected programming routine is then executed. Programming sequence of events are as follows: 1) Place switch S4 to RESET position (switch close). 2) Select programming routine via switches S1. 3) Apply +5 V and VPP power to programming circuitry. 4) Place switch S4 to RUN position (switch open). 5) Programming routine is executed. 6) Place switch S4 to RESET position. 7) Remove VPP and +5 V power, or select and run new routine. Once the bootstrap mode is entered, mode switch setting is scanned to establish the routine to be executed. The routines are: Note: – Program and Verify EPROM – Verify EPROM Contents 12 When programming the window part MC68HC705F8, the window should be covered up to prevent erratic device behaviour. TPG MC68HC05F8 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 12-5 107 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. START Vpp on Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... LAT=1 12 Write EPROM byte EPMG=1 Wait 2ms EPMG=8 Wait 1ms Write additional byte? Y N Vpp off END Figure 12-4 EPROM Programming Sequence 12.3.3 Program and Verify EPROM In the Program and Verify EPROM routine, the contents of the external EPROM are copied into the EPROM areas of the MC68HC705F8 device. There is a direct correspondence of addresses between the two devices. Non-EPROM addresses are ignored so data contained in those areas are not accessed. Unprogrammed EPROM address locations should contain $FF to speed up the programming operation. During the programming routine the Program/Verify LED is illuminated. At the end of the programming routine, the LED is turned off, and the verification routine is entered. If the contents of the EPROM and external EPROM exactly match, then the Verified LED is illuminated. The verification routine stops if a discrepancy has been detected. TPG MOTOROLA 12-6 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 108 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. VPP VCC VPP TCAP 1N914 1K Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... reset S4 100K IRQ1 + 1µ PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 D0 D1 D2 D3 D4 D5 D6 D7 PB3 OE A0 A1 A2 A3 R QA QB HC393 QC QD CLR A4 A5 A6 A7 R QA QB HC393 QC QD CLR A8 A9 A10 A11 R QA QB HC393 QC QD CLR A12 A13 A14 R QA QB HC393 QC QD CLR 27256 1N914 RESET 0.01µ +5V OSC1 3.58MHz VPP OSC2 CE 10M MC68HC705F8 PB4 PB5 22p 22p +5V S1 PB0 10K Program/Verify +5V PB1 470 Open - Program & Verify Closed - Verify 10K PB2 PB6 10K 470 PB7 Verify VSS VDD +5V Figure 12-5 EPROM Programming Circuit for Bootstrap Mode 12.3.4 Verify EPROM Contents The Verify EPROM Contents routine is normally entered automatically after the EPROM is programmed. Direct entry of this mode will cause the EPROM contents to be compared to external memory contents residing at the same address locations. During execution of the verification routine, the Program/Verify LED is illuminated. Upon completion of the verification routine (every location verified) the Program/Verify LED is turned off and the Verified LED is turned on. If the Program/Verify LED does not illuminate, a discrepancy has been detected and the error address location will be placed on the external memory address bus. 12 TPG MC68HC05F8 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 12-7 109 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY 12 TPG MOTOROLA 12-8 OPERATING MODES For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 110 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 13 ELECTRICAL SPECIFICATIONS This section contains the electrical specifications for the MC68HC05F8. 13.1 Maximum Ratings Voltages referenced to VSS RATINGS Supply Voltage Input Voltage IRQ Current Drain per pin excluding VDD and VSS Operating Temperature Storage Temperature Range SYMBOL VDD Vin Vin ID TA Tstg VALUE –0.3 to +7.0 VSS –0.3 to VDD +0.3 VSS –0.3 to 2xVDD +0.3 25 0 to 70 –65 to +150 UNIT V V V mA °C °C This device contains circuitry to protect the inputs against damage due to high static voltages or electric fields. However, it is advised that normal precautions should be taken to avoid application of any voltage higher than the maximum rated voltages to this high impedance circuit. For proper operation it is recommended that Vin and Vout be constrained to the range VSS ≤(Vin or Vout)≤VDD. Reliability of operation is enhanced if unused inputs are connected to an appropriate logic voltage level (e.g. either VSS or VDD). 13.2 Thermal Characteristics CHARACTERISTICS Thermal resistance - Plastic 56-pin SDIP package - Plastic 64-pin QFP package SYMBOL VALUE UNIT θJA θJA 50 50 °C/W °C/W 13 TPG MC68HC05F8 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 13-1 111 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 13.3 DC Electrical Characteristics Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 13-1 DC Electrical Characteristics for 5V Operation VDD =5.0Vdc ±10%, VSS =0Vdc, temperature range=0 to 70°C CHARACTERISTICS SYMBOL MINIMUM Output voltage ILOAD ≤ –10µA VOH VDD-0.1 ILOAD ≤ +10µA VOL – Output high voltage (ILOAD=1.6mA) PA4-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VOH VDD-0.8 TCMP, TNX Output low voltage (ILOAD=1.6mA) PA4-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VOL – TCMP, TNX Input high voltage PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VIH 0.7xVDD TCAP, IRQ1, IRQ2, RESET, OSC1 Input low voltage PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VIL VSS TCAP, IRQ1, IRQ2, RESET, OSC1 Data Retention Mode VRM 2.0 Supply current Run IDD – Wait Stop I/O ports high-Z leakage current IIL – PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7 Input current IIN – TCAP, IRQ1, IRQ2, RESET, DECOIN, OSC1 Capacitance ports (as input or output), RESET, IRQ1, COUT – IRQ2, TCAP, OSC1 CIN – Port C high current sinking capability ISK – (for 1V saturation) TYPICAL MAXIMUM UNIT – – – 0.1 V V – – V – 0.4 V – VDD V – 0.2xVDD V – – V 3.8 1.1 0.9 5 2 1.5 mA mA µA – ±10 µA – ±1 µA – – 12 8 pF 10 – mA 13 TPG MOTOROLA 13-2 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 112 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 13-2 DC Electrical Characteristics for 2.7V Operation VDD =2.7Vdc ±10%, VSS =0Vdc, temperature range=0 to 70°C CHARACTERISTICS SYMBOL MINIMUM Output voltage ILOAD ≤ –10µA VOH VDD-0.1 ILOAD ≤ +10µA VOL – Output high voltage (ILOAD=1.6mA) PA4-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VOH VDD-0.3 TCMP, TNX Output low voltage (ILOAD=1.6mA) PA4-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VOL – TCMP, TNX Input high voltage PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VIH 0.7xVDD TCAP, IRQ1, IRQ2, RESET, OSC1 Input low voltage PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7, VIL VSS TCAP, IRQ1, IRQ2, RESET, OSC1 Data Retention Mode VRM 2.0 Supply current Run IDD – Wait Stop I/O ports high-Z leakage current IIL – PA0-PA5, PB0-PB7, PC0-PC7, PD0-PD7 Input current IIN – TCAP, IRQ1, IRQ2, RESET, DECOIN, OSC1 Capacitance ports (as input or output), RESET, IRQ1, COUT – IRQ2, TCAP, OSC1 CIN – Port C high current sinking capability ISK – (for 1V saturation) TYPICAL MAXIMUM UNIT – – – 0.1 V V – – V – 0.3 V – VDD V – 0.2xVDD V – – V 1.5 450 360 TBD TBD TBD mA µA nA – ±10 µA – ±1 µA – – 12 8 pF 10 – mA 13 TPG MC68HC05F8 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 13-3 113 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 13.4 DTMF/Melody Generator Electrical Characteristics Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 13-3 Electrical Specification of sine wave tones at TONEOUT output (including DTMF) CHARACTERISTICS Operating voltage Tone output level: Low group - row High group - column Frequency deviation (DTMF) Frequency deviation (Melody) Tone output DC level High group pre-emphasis MINIMUM 2.5 TYPICAL – MAXIMUM 5.5 UNIT V 0.125 0.158 –0.65 –1.5 0.45 1 0.15 0.192 – – 0.50 2 0.16 0.205 +0.65 +1.5 0.55 3 VRMS VRMS % % VDD dB Table 13-4 Electrical Specification of square wave tones at TONEOUT output CHARACTERISTICS Operating voltage Tone output level: Low group - row High group - column Frequency deviation (Melody) Tone output DC level (+0.5 VP-P value) MINIMUM 2.5 TYPICAL – MAXIMUM 5.5 UNIT V 0.19 0.24 –1.5 0.45 0.21 0.27 – 0.50 0.24 0.30 +1.5 0.55 VP-P VP-P % VDD Table 13-5 Electrical Specification of ToneX at TONEX output CHARACTERISTICS Tone output level (square wave) Frequency deviation Tone output DC level MINIMUM – –1.5 0.45 TYPICAL VDD – 0.50 MAXIMUM – 1.5 0.55 UNIT VP-P % VDD 13 TPG MOTOROLA 13-4 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 114 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 13.5 Control Timing Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 13-6 Control Timing for 5V Operation (VDD =5.0Vdc ±10%, VSS =0Vdc, temperature range=0 to 70°C) CHARACTERISTICS SYMBOL MINIMUM Frequency of operation – Crystal option fOSC dc External clock option Internal operating frequency (fOSC/2) Crystal fOP – External clock fOP dc Processor cycle time tCYC 556 Crystal oscillator start-up time tOXOV – Stop recovery start-up time (crystal oscillator) tILCH External RESET pulse width tRL 1.5 Power-on RESET output pulse width 4064 cycle tPORL 4064 16 cycle tPORL 16 Watchdog RESET output pulse width tDOGL 1.5 Watchdog time-out tDOG 0.25 Timer A Resolution(1) tARESL 4 Input capture pulse width tTH, tTL 125 Input capture pulse period tTLTL –(2) Timer B Resolution tBRESL 2.25 125 Interrupt pulse width (edge-triggered) tILIH Interrupt pulse period tILIL –(3) MAXIMUM UNIT 3.58 3.58 MHz MHz 1.8 1.8 – 100 100 – MHz MHz ns ms ms tCYC – – – 4 tCYC tCYC tCYC sec 64 – – tCYC ns tCYC 18 – – µs ns tCYC (1) Since a 2-bit prescaler in the timer must count four external cycles (tCYC), this is the limiting factor in determining the timer resolution. (2) The minimum period tTLTL should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 tCYC. (3) The minimum period tILIL should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 tCYC. 13 TPG MC68HC05F8 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 13-5 115 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Table 13-7 Control Timing for 2.7V Operation (VDD =3.3Vdc ±10%, VSS =0Vdc, temperature range=0 to 70°C) CHARACTERISTICS SYMBOL MINIMUM Frequency of operation – Crystal option fOSC dc External clock option Internal operating frequency (fOSC/2) Crystal fOP – External clock fOP dc Processor cycle time tCYC 556 Crystal oscillator start-up time tOXOV – Stop recovery start-up time (crystal oscillator) tILCH External RESET pulse width tRL 1.5 Power-on RESET output pulse width 4064 cycle tPORL 4064 16 cycle tPORL 16 Watchdog RESET output pulse width tDOGL 1.5 Watchdog time-out tDOG 0.25 Timer A Resolution(1) tARESL 4 Input capture pulse width tTH, tTL 250 Input capture pulse period tTLTL –(2) Timer B Resolution tBRESL 2.25 250 Interrupt pulse width (edge-triggered) tILIH Interrupt pulse period tILIL –(3) MAXIMUM UNIT 3.58 3.58 MHz MHz 1.8 1.8 – 100 100 – MHz MHz ns ms ms tCYC – – – 4 tCYC tCYC tCYC sec 64 – – tCYC ns tCYC 18 – – µs ns tCYC (1) Since a 2-bit prescaler in the timer must count four external cycles (tCYC), this is the limiting factor in determining the timer resolution. (2) The minimum period tTLTL should not be less than the number of cycle times it takes to execute the capture interrupt service routine plus 24 tCYC. (3) The minimum period tILIL should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 tCYC. 13 TPG MOTOROLA 13-6 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 116 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 13.6 Programming Operation Electrical Characteristics VDD=5.0Vdc ±5%, VSS=0Vdc, temperature range=20 to 30°C) CHARACTERISTICS SYMBOL MINIMUM Programming voltage VPP 13 VPP supply current VPP =VDD IPP 3 VPP =14V – Programming bus frequency FBUS 1.70 Bootstrap programming mode voltage VIHTP 9.0 (IRQ1 pin, IIN =100µA max.) TYPICAL 14 MAXIMUM 15 UNIT V 4 4 1.79 5 8 1.89 µA mA MHz 10.0 10.3 V 13 TPG MC68HC05F8 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 13-7 117 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. THIS PAGE LEFT BLANK INTENTIONALLY 13 TPG MOTOROLA 13-8 ELECTRICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 118 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 14 MECHANICAL SPECIFICATIONS This section provides the mechanical dimension for the 56-pin SDIP and 64-pin QFP packages for the MC68HC05F8. 14.1 56-pin SDIP Package -A- L H 56 29 Case No. 859-01 56 lead SDIP -B- 1 28 M J 0.25 M T B S C -TSeating Plane K G E F N P D 0.25 M T A S Dim. A B C D E F G Min. Max. 51.69 52.45 13.72 14.22 3.94 5.08 0.36 0.56 0.89 BSC 0.81 1.17 1.778 BSC Notes 1. 2. 3. 4. Dimensions and tolerancing per ANSI Y 14.5 1982. All dimensions in mm. Dimension L to centre of lead when formed parallel. Dimensions A and B do not include mould flash. Allowable mould flash is 0.25 mm. Dim. H J K L M N P Min. Max. 7.62 BSC 0.20 0.38 2.92 3.43 15.24 BSC 0° 15° 0.51 1.02 1.78 2.29 14 Figure 14-1 56-pin SDIP Mechanical Dimensions TPG MC68HC05F8 MECHANICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MOTOROLA 14-1 119 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 14.2 64-pin QFP Package L B 33 -B- Case No. 840C 64 lead QFP B 0.05 A – B -AL P B 32 0.20 M C A – B S D S Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 49 V 0.20 M H A – B S D S 48 - A, B, D Detail “A” F Detail “A” 64 17 1 N J 16 -D- Base Metal D A 0.20 M C A – B S D S Section B–B 0.05 A – B 0.20 M C A – B S D S S 0.20 M H A – B S D S U T Detail “C” M E Q C -CSeating Plane R Datum -H- Plane H K G W M X Dim. A B C D E F G H J K L Min. Max. 13.90 14.10 13.90 14.10 2.067 2.457 0.30 0.45 2.00 2.40 0.30 — 0.80 BSC 0.067 0.250 0.130 0.230 0.50 0.66 12.00 REF Notes 1. Datum Plane –H– is located at bottom of lead and is coincident with the lead where the lead exits the plastic body at the bottom of the parting line. 2. Datums –A–, –B– and –D– to be determined at Datum Plane –H–. 3. Dimensions S and V to be determined at seating plane –C–. 4. Dimensions A and B do not include mould protrusion. Allowable mould protrusion is 0.25mm per side. Dimensions A and B do include mould mismatch and are determined at Datum Plane –H–. 5. Dimension D does not include dambar protrusion. Allowable dambar protrusion shall be 0.08 total in excess of the D dimension at maximum material condition. Dambar cannot be located on the lower radius or the foot. 6. Dimensions and tolerancing per ANSI Y 14.5M, 1982. 7. All dimensions in mm. Dim. M N P Q R S T U V W X Min. Max. 5° 10° 0.130 0.170 0.40 BSC 2° 8° 0.13 0.30 16.20 16.60 0.20 REF 9° 15° 16.20 16.60 0.042 NOM 1.10 1.30 Figure 14-2 64-pin QFP Mechanical Dimensions 14 TPG MOTOROLA 14-2 MECHANICAL SPECIFICATIONS For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com MC68HC05F8 120 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. GENERAL DESCRIPTION 1 PIN DESCRIPTIONS 2 MEMORY AND REGISTERS 3 RESETS 4 INTERRUPTS 5 TIMERS 6 SERIAL PERIPHERAL INTERFACE 7 MANCHESTER ENCODER/DECODER 8 DTMF/MELODY GENERATOR 9 CPU CORE AND INSTRUCTION SET 10 LOW POWER MODES 11 OPERATING MODES 12 ELECTRICAL SPECIFICATIONS 13 MECHANICAL SPECIFICATIONS 14 TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 121 Freescale Semiconductor, Inc. 1 GENERAL DESCRIPTION 2 PIN DESCRIPTIONS 3 MEMORY AND REGISTERS 4 RESETS 5 INTERRUPTS 6 TIMERS 7 SERIAL PERIPHERAL INTERFACE 8 MANCHESTER ENCODER/DECODER 9 DTMF/MELODY GENERATOR Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... Freescale Semiconductor, Inc. 10 CPU CORE AND INSTRUCTION SET 11 LOW POWER MODES 12 OPERATING MODES 13 ELECTRICAL SPECIFICATIONS 14 MECHANICAL SPECIFICATIONS TPG For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 122 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 1 2 4 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 3 5 6 7 8 9 10 11 12 13 14 For More Information On This Product, Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com 15 Freescale Semiconductor, Inc. Freescale Semiconductor, Inc. 1 2 3 Freescale Semiconductor, Inc... Freescale Semiconductor, Inc... 4 5 6 7 8 9 10 11 12 13 14 How to reach us: MFAX: [email protected] – TOUCHTONE (602) 244-6609 INTERNET: http://Design-NET.com USA/EUROPE: Motorola Literature Distribution; P.O. Box 20912; Phoenix, Arizona 85036. 1-800-441-2447 JAPAN: Nippon Motorola Ltd.; Tatsumi-SPD-JLDC, Toshikatsu Otsuki, 6F Seibu-Butsuryu-Center, 3-14-2 Tatsumi Koto-Ku, Tokyo 135, Japan. 03-3521-8315 HONG KONG: Motorola Semiconductors H.K. Ltd.; 8B Tai Ping Industrial Park, 51 Ting Kok Road, Tai Po, N.T., Hong Kong. 852-26629298 15 !MOTOROLA For More Information On This Product, MC68HC05F8D/H Go to: www.freescale.com For More Information On This Product, Go to: www.freescale.com