Text preview for : 80C515.PDF part of Siemens SAB 80515 SAB 80515/SAB 80C515
8-Bit Single-Chip Microcontroller Family
Back to : 80c515.rar | Home
Microcomputer Components
SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family
User's Manual 08.95
SAB 80515 / SAB 80C515 Family Revision History: 8.95 Previous Releases: Page 30 39 80 105 106 109 137 152 243 301 12.90/10.92
Subjects (changes since last revision) Modified timing diagram (PSEN rising edge) More detailed description of ACMOS port structure Differential output impedance of analog reference supply voltage now: 1 k Second paragraph: additional description; WDT reset information added SWDT reset information added Figure 7-51 corrected Encoding of ADD A, direct corrected Encoding of CPL bit corrected New release of SAB 80C515 / SAB 80C535 data sheet inserted New release of SAB 80515 / SAB 80535 data sheet inserted
Edition 08.95 Published by Siemens AG, Bereich Halbleiter, MarketingKommunikation, Balanstraße 73, 81541 München © Siemens AG 1995. All Rights Reserved. Attention please! As far as patents or other rights of third parties are concerned, liability is only assumed for components, not for applications, processes and circuits implemented within components or assemblies. The information describes the type of component and shall not be considered as assured characteristics. Terms of delivery and rights to change design reserved. For questions on technology, delivery and prices please contact the Semiconductor Group Offices in Germany or the Siemens Companies and Representatives worldwide (see address list). Due to technical requirements components may contain dangerous substances. For information on the types in question please contact your nearest Siemens Office, Semiconductor Group. Siemens AG is an approved CECC manufacturer. Packing Please use the recycling operators known to you. We can also help you get in touch with your nearest sales office. By agreement we will take packing material back, if it is sorted. You must bear the costs of transport. For packing material that is returned to us unsorted or which we are not obliged to accept, we shall have to invoice you for any costs incurred. Components used in life-support devices or systems must be expressly authorized for such purpose! Critical components1 of the Semiconductor Group of Siemens AG, may only be used in life-support devices or systems2 with the express written approval of the Semiconductor Group of Siemens AG. 1 A critical component is a component used in a life-support device or system whose failure can reasonably be expected to cause the failure of that life-support device or system, or to affect its safety or effectiveness of that device or system. 2 Life support devices or systems are intended (a) to be implanted in the human body, or (b) to support and/or maintain and sustain human life. If they fail, it is reasonable to assume that the health of the user may be endangered.
Contents
Contents 1 2 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 3 3.1 3.2 4 4.1 4.2 4.3 4.4 5 5.1 5.2 5.3 5.4 6 6.1 6.1.1 6.1.2 7 7.1 7.1.1 7.1.1.1 7.1.1.2 7.1.1.3 7.1.2 7.1.3 7.1.4 7.1.4.1
Page
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Fundamental Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Differences between MYMOS (SAB 80515/80535) and ACMOS (SAB 80C515/80C535) Versions . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Power Saving Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Special Function Register PCON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Port Driver Circuitries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 The A/D Converter Input Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 A/D Converter Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 The Oscillator and Clock Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 The VBB Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 Central Processing Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 CPU Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 General Purpose Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 Special Function Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 External Bus Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 Accessing External Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 PSEN, Program Store Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 ALE, Address Latch Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 Overlapping External Data and Program Memory Spaces . . . . . . . . . . . . . .29 System Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 Hardware Reset and Power-Up Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 Reset Function and Circuitries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 Hardware Reset Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 On-Chip Peripheral Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Parallel I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Port Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Digital I/O Port Circuitry (MYMOS/ACMOS) . . . . . . . . . . . . . . . . . . . . . . . . .36 MYMOS Port Driver Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 ACMOS Port Driver Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 Port 0 and Port 2 Used as Address/Data Bus . . . . . . . . . . . . . . . . . . . . . . . .41 Alternate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 Port Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Port Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
3
Semiconductor Group
Contents
Contents 7.1.4.2 7.1.4.3 7.2 7.2.1 7.2.2 7.2.3 7.2.4 7.2.4.1 7.2.4.2 7.2.4.3 7.2.4.4 7.3 7.3.1 7.3.2 7.3.3 7.3.4 7.4 7.4.1 7.4.1.1 7.4.1.2 7.4.2 7.4.3 7.5 7.5.1 7.5.2 7.5.2.1 7.5.2.2 7.5.2.3 7.5.3 7.6 7.6.1 7.6.1.1 7.6.2 7.6.2.1 7.6.2.2 7.7
Page
Port Loading and Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 Read-Modify-Write Feature of Ports 0 through 5 . . . . . . . . . . . . . . . . . . . . . .45 Serial Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Operating Modes of Serial Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Multiprocessor Communication Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Baud Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Detailed Description of the Operating Modes . . . . . . . . . . . . . . . . . . . . . . . .54 Mode 0, Synchronous Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 Mode 1, 8-Bit UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 Mode 2, 9-Bit UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 Mode 3, 9-Bit UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 Timer 0 and Timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 Mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 A/D Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 Function and Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 lnitialization and Input Channel Selection . . . . . . . . . . . . . . . . . . . . . . . . . . .74 Start of Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 Reference Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 A/D Converter Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 Timer 2 with Additional Compare/Capture/Reload . . . . . . . . . . . . . . . . . . . . .82 Timer 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 Compare Function of Registers CRC, CC1 to CC3 . . . . . . . . . . . . . . . . . . . .88 Compare Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 Compare Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 Using Interrupts in Combination with the Compare Function . . . . . . . . . . . . .94 Capture Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 Power Saving Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 Power Saving Modes of the SAB 80515/80535 . . . . . . . . . . . . . . . . . . . . . . .99 Power-Down Mode of the SAB 80515/80535 . . . . . . . . . . . . . . . . . . . . . . . .99 Power Saving Modes of the SAB 80515/80535 . . . . . . . . . . . . . . . . . . . . . .100 Power-Down Mode of the SAB 80C515/80C535 . . . . . . . . . . . . . . . . . . . . .101 Idle Mode of the SAB 80C515/80C535 . . . . . . . . . . . . . . . . . . . . . . . . . . . .102 Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
Semiconductor Group
4
Contents
Contents 7.8 7.8.1 7.8.2 7.8.2.1 7.8.2.2 7.9 8 8.1 8.2 8.3 8.4 8.5 9 9.1 9.2 9.2.1 9.2.2 9.2.3 9.2.4 9.3 10
Page
Oscillator and Clock Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 Crystal Oscillator Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 Driving for External Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 Driving the SAB 80515/80535 from External Source . . . . . . . . . . . . . . . . . .108 Driving the SAB 80C515/80C535 from External Source . . . . . . . . . . . . . . .109 System Clock Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 Interrupt System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 Interrupt Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 Priority Level Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 How Interrupts are Handled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126 Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 Introduction to the Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 Control Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 Instruction Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134 Device Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214
Semiconductor Group
5
Introduction
1
Introduction
The SAB 80C515/80C535 is a new, powerful member of the Siemens SAB 8051 family of 8-bit microcontrollers. lt is designed in Siemens ACMOS technology and is functionally compatible with the SAB 80515/80535 devices designed in MYMOS technology. The ACMOS and the MYMOS versions 1) 2) are stand-alone, high-performance single-chip microcontrollers based on the SAB 8051/80C51 architecture. While maintaining all the SAB 80(C)51 operating characteristics, the SAB 80(C)515/80(C)535 3) incorporate several enhancements which significantly increase design flexibility and overall system performance. The low-power properties of Siemens ACMOS technology allow applications where power consumption and dissipation are critical. Furthermore, the SAB 80C515/80C535 has two softwareselectable modes of reduced activity for further power reduction: idle and power-down mode. The SAB 80(C)535 is identical to the SAB 80(C)515 except that it lacks the on-chip program memory. The SAB 80(C)515/80(C)535 is supplied in a 68-pin plastic leaded chip carrier package (P-LCC-68). In addition to the standard temperature range version (0 ° to + 70 °C) there are also versions for extended temperature ranges available (see data sheets). Functional Description The members of the SAB 80515 family of microcontrollers are: SAB 80C515: Microcontroller, designed in Siemens ACMOS technology, with 8-Kbyte factory mask-programmable ROM SAB 80C535: ROM-less version, identical to the SAB 80C515 SAB 80515: Microcontroller, designed in Siemens MYMOS technology, with 8-Kbyte factory mask-programmable ROM SAB 80535: ROM-less version, identical to the SAB 80515 SAB 80515K: Special ROM-less version of the SAB 80515 with an additional interface for program memory accesses. An external ROM that is accessed via the interface substitutes the SAB 80515's internal ROM.
1 2 3
In this User's Manual the term "ACMOS versions" is used to refer to both the SAB 80C515 and SAB 80C535. The term "MYMOS versions" stands for SAB 80535 and SAB 80515. The term "SAB 80(C)515" refers to the SAB 80515 and the SAB 80C515, unless otherwise noted. 6
Semiconductor Group
Introduction
The SAB 80(C)515 features are: 8 Kbyte on-chip program memory 256 byte on-chip RAM Six 8-bit parallel I/O ports One input port for digital input 1) Full-duplex serial port, 4 modes of operation, fixed or variabie baud rates Three 16-bit timer/counters 16-bit reload, compare, capture capability A/D converter, 8 multiplexed analog inputs, programmable reference voltages 16-bit watchdog timer Power-down supply for 40 byte of RAM Boolean processor 256 directly addressable bits 12 interrupt sources (7 external, 5 internal), 4 priority levels Stack depth up to 256 byte 1 µs instruction cycle at 12-MHz operation 4 µs multiply and divide External program and data memory expandable up to 64 Kbyte each Compatible with standard SAB 8080/8085 peripherals and memories Space-saving P-LCC-68 package
For small-quantity applications and system development the SAB 80535 can be employed being the equivalent of an SAB 80515 without on-chip ROM.
1
Additional feature of the ACMOS versions
Semiconductor Group
7
Introduction
Figure 1-1 shows the logic symbol, figure 1-2 the block diagram of the SAB 80(C)515:
Figure 1-1 Logic Symbol
Semiconductor Group
8
Introduction
Figure 1-2 Block Diagram Semiconductor Group 9
Fundamental Structure
2
Fundamental Structure
The SAB 80(C)515/80(C)535 is a totally 8051-compatible microcontroller while its peripheral performance has been increased significantly. Some of the various peripherals have been added to support the 8-bit core in case of stringent embedded control requirements without loosing compatibility to the 8051 architecture. Furthermore, the SAB 80(C)515/80(C)535 contains e. g. an additional 8-bit A/D converter, two times as much ROM and RAM as the 80(C)51 and an additional timer with compare/capture/reload facilities for all kinds of digital signal processing. Figure 2.1 shows a block diagram of the SAB 80(C)515/80(C)535. The SAB 80C515/80C535 combines the powerful architecture of the industry standard controller SAB 80515/80535 with the advantages of the ACMOS technology (e. g. power-saving modes). The differences between MYMOS and ACMOS components are explained in section 2.1. Readers who are familiar with the SAB 8051 may concentrate on chapters 2.1, 6, 7 and 8 where the differences between MYMOS and ACMOS components, the reset conditions, the peripherals and the interrupt system are described. For newcomers to the 8051 family of microcontrollers, the following section gives a general view of the basic characteristics of the SAB 80515/80535. The details of operation are described later in chapters 3 and 4.
Semiconductor Group
10
Fundamental Structure
Central Processing Unit The CPU is designed to operate on bits and bytes. The instructions, which consist of up to 3 bytes, are performed in one, two or four machine cycles. One machine cycle requires twelve oscillator cycles. The instruction set has extensive facilities for data transfer, logic and arithmetic instructions. The Boolean processor has its own full-featured and bit-based instructions within the instruction set. The SAB 80(C)515/80(C)535 uses five addressing modes: direct access, immediate, register, register indirect access, and for accessing the external data or program memory portions a base register plus index-register indirect addressing. Memory Organization The SAB 80C515, 80515 have an internal ROM of 8 Kbyte. The program memory can externally be expanded up to 64 Kbyte (see bus expansion control). The internal RAM consists of 256 bytes. Within this address space there are 128 bit-addressable locations and four register banks, each with 8 general purpose registers. In addition to the internal RAM there is a further 128-byte address space for the special function registers, which are described in sections to follow. Because of its Harvard architecture, the SAB 80(C)515/80(C)535 distinguishes between an external program memory portion (as mentioned above) and up to 64 Kbyte external data memory accessed by a set of special instructions. Bus Expansion Control The external bus interface of the SAB 80(C)515/80(C)535 consists of an 8-bit data bus (port 0), a 16-bit address bus (port 0 and port 2) and five control lines. The address latch enable signal (ALE) is used to demultiplex address and data of port 0. The program memory is accessed by the program store enable signal (PSEN) twice a machine cycle. A separate external access line (EA) is used to inform the controller while executing out of the lower 8 Kbyte of the program memory, whether to operate out of the internal or external program memory. The read or write strobe (RD, WR) is used for accessing the external data memory. Peripheral Control All on-chip peripheral components - I/O ports, serial interface, timers, compare/capture registers, the interrupt controller and the A/D converter - are handled and controlled by the so-called special function registers. These registers constitute the easy-to-handle interface with the peripherals. This peripheral control concept, as implemented in the SAB 8051, provides the high flexibility for further expansion as done in the SAB 80(C)515/80(C)535. Moreover some of the special function registers, like accumulator, B-register, program status word (PSW), stack pointer (SP) and the data pointer (DPTR) are used by the CPU and maintain the machine status.
Semiconductor Group
11
Fundamental Structure
Figure 2-1 Detailed Block Diagram Semiconductor Group 12
Fundamental Structure
2.1
Differences between MYMOS (SAB 80515/80535) and ACMOS (SAB 80C515/80C535) Versions
There are some differences between MYMOS and ACMOS versions concerning: 2.1.1 Power Saving Modes Special Function Register PCON Port Driver Circuitry A/D Converter Input Ports A/D Converter Conversion Time Oscillator and Clock Circuit VBB Pin Power Saving Modes
The SAB 80515/80535 has just the power-down mode, which allows retention of the on-chip RAM contents through a backup supply connected to the VPD pin. The SAB 80C515/80C535 additionally has the following features: idle mode the same power supply pin VCC for active, power-down and idle mode an extra pin (PE) that allows enabling/disabling the power saving modes starting of the power-saving modes by software via special function register PCON (Power Control Register) protection against unintentional starting of the power-saving modes These items are described in detail in section 7.6. 2.1.2 Special Function Register PCON
In the MYMOS version SAB 80515/80535 the SFR PCON (address 87H ) contains only bit 7 (SMOD). In the ACMOS version SAB 80C515/80C535 there are additional bits used (see figure 2-2). The bits PDE, PDS and IDLE, IDLS select the power-down mode or idle mode, respectively, when the power saving modes are enabled by pin PE. Furthermore, register PCON of the ACMOS version contains two general-purpose flags. For example, the flag bits GF0 and GF1 can be used to indicate whether an interrupt has occurred during normal operation or during idle. Then an instruction that activates idle can also set one or both flag bits. When idle is terminated by an interrupt, the interrupt service routine can sample the flag bits.
Semiconductor Group
13
Fundamental Structure
2.1.3
Port Driver Circuitries
The port structures of the MYMOS and ACMOS versions are functionally compatible. For low power consumption the pullup arrangement is realized differently in both versions. Chapters 7.1.1.1, 7.1.1.2, 7.1.1.3 are dealing with the port structures in detail. 2.1.4 The A/D Converter Input Ports
The analog input ports (AN0 to AN7) of the SAB 80515/80535 can only be used as analog inputs for the A/D converter. The analog input ports (P6.0 to P6.7) of the SAB 80C515/80C535 can be used either as input channels for the A/D converter or as digital inputs (see chapter 7.4) Figure 2-2 Special Function Register PCON (Address 87H) 87H SMOD 7 PDS 6 IDLS 5 4 GF1 3 GF0 2 PDE 1 IDLE 0 PCON
These bits are available in the MYMOS version
Symbol SMOD PDS
Position PCON.7 PCON.6
Function When set, the baud rate of the serial channel in mode 1, 2, 3 is doubled. Power-down start bit. The instruction that sets the PDS flag bit is the last instruction before entering the power-down mode. Idle start bit. The instruction that sets the IDLS flag bit is the last instruction before entering the idle mode. Reserved General purpose flag General purpose flag Power-down enable bit. When set, starting of the power-down mode is enabled. Idle mode enable bit. When set, starting of the idle mode is enabled.
IDLS
PCON.5
GF1 GF0 PDE
PCON.4 PCON.3 PCON.2 PCON.1
IDLE
PCON.0
Semiconductor Group
14
Fundamental Structure
2.1.5
A/D Converter Timings
See the corresponding data sheets for the specification of tL (load time), tS (sample time), tC (conversion time). 2.1.6 The Oscillator and Clock Circuits
There is no difference between the MYMOS and ACMOS versions if they are driven from a crystal or a ceramic resonator. Please note that there is a difference between driving MYMOS and ACMOS components from external source. How to drive each device is described in chapter 7.8.2 and in each data sheet. 2.1.7 The VBB Pin
The SAB 80515/80535 has an extra VBB pin connected to the device's substrate. lt must be connected to VSS through a capacitor for proper operation of the A/D converter. The SAB 80C515/80C535 has no VBB pin. In ACMOS technology the substrate is directly connected to VCC ; therefore, the corresponding pin is used as an additional VCC pin.
Semiconductor Group
15
Central Processing Unit
3 3.1
Central Processing Unit General Description
The CPU (Central Processing Unit) of the SAB 80(C)515 consists of the instruction decoder, the arithmetic section and the program control section. Each program instruction is decoded by the instruction decoder. This unit generates the internal signals controlling the functions of the individual units within the CPU. They have an effect on the source and destination of data transfers, and control the ALU processing. The arithmetic section of the processor performs extensive data manipulation and is comprised of the Arithmetic/Logic Unit (ALU), an A register, B register and PSW register. The ALU accepts 8-bit data words from one or two sources and generates an 8-bit result under the control of the instruction decoder. The ALU performs the arithmetic operations add, subtract, multiply, divide, increment, decrement, BCD-decimal-add-adjust and compare, and the logic operations AND, OR, Exclusive OR, complement and rotate (right, left or swap nibble (left four)). Also included is a Boolean processor performing the bit operations of set, clear, complement, jump-if-not-set, jump-if-set-andclear and move to/from carry. Between any addressable bit (or its complement) and the carry flag, it can perform the bit operations of logical AND or logical OR with the result returned to the carry flag. The A, B and PSW registers are described in section 4.4. The program control section controls the sequence in which the instructions stored in program memory are executed. The 16-bit program counter (PC) holds the address of the next instruction to be executed. The PC is manipulated by the control transfer instructions listed in the chapter "Instruction Set". The conditional branch logic enables internal and external events to the processor to cause a change in the program execution sequence.
Semiconductor Group
16
Central Processing Unit
3.2
CPU Timing
A machine cycle consists of 6 states (12 oscillator periods). Each state is divided into a phase 1 half, during which the phase 1 clock is active, and a phase 2 half, during which the phase 2 clock is active. Thus, a machine cycle consists of 12 oscillator periods, numbered S1P1 (state 1, phase 1) through S6P2 (state 6, phase 2). Each state lasts for two oscillator periods. Typically, arithmetic and logical operations take place during phase 1 and internal register-to-register transfers take place during phase 2. The diagrams in figure 3-1 show the fetch/execute timing related to the internal states and phases. Since these internal clock signals are not user-accessible, the XTAL2 oscillator signals and the ALE (address latch enable) signal are shown for external reference. ALE is normally activated twice during each machine cycle: once during S1P2 and S2P1, and again during S4P2 and S5P1. Execution of a one-cycle instruction begins at S1P2, when the op-code is latched into the instruction register. lf it is a two-byte instruction, the second is read during S4 of the same machine cycle. lf it is a one-byte instruction, there is still a fetch at S4, but the byte read (which would be the next opcode) is ignored, and the program counter is not incremented. In any case, execution is completed at the end of S6P2. Figures 3-1 A) and B) show the timing of a 1-byte, 1-cycle instruction and for a 2-byte, 1-cycle instruction. Most SAB 80(C)515 instructions are executed in one cycle. MUL (multiply) and DIV (divide) are the only instructions that take more than two cycles to complete; they take four cycles. Normally two code bytes are fetched from the program memory during every machine cycle. The only exception to this is when a MOVX instruction is executed. MOVX is a one-byte, 2-cycle instruction that accesses external data memory. During a MOVX, the two fetches in the second cycle are skipped while the external data memory is being addressed and strobed. Figures 3-1 C) and D) show the timing for a normal 1-byte, 2-cycle instruction and for a MOVX instruction.
Semiconductor Group
17
Central Processing Unit
Figure 3-1 Fetch/Execute Sequence
Semiconductor Group
18
Memory Organization
4
Memory Organization
The SAB 80(C)515 CPU manipulates operands in the following four address spaces: 4.1 up to 64 Kbyte of program memory up to 64 Kbyte of external data memory 256 bytes of internal data memory a 128-byte special function register area Program Memory
The program memory of the SAB 80(C)515 consists of an internal and an external memory portion (see figure 4-1). 8 Kbyte of program memory may reside on-chip (SAB 80C515/80515 only), while the SAB 80C535/80535 has no internal ROM. The program memory can be externally expanded up to 64 Kbyte. If the EA pin is held high, the SAB 80(C)515 executes out of the internal program memory unless the address exceeds 1FFF H. Locations 2000H through 0FFFFH are then fetched from the external memory. If the EA pin is held low, the SAB 80(C)515 fetches all instructions from the external program memory. Since the SAB 80C535/80535 has no internal program memory, pin EA must be tied low when using this device. In either case, the 16-bit program counter is the addressing mechanism. Locations 03H through 93H in the program memory are used by interrupt service routines. 4.2 Data Memory
The data memory address space consists of an internal and an external memory portion. Internal Data Memory The internal data memory address space is divided into three physically separate and distinct blocks: the lower 128 bytes of RAM, the upper 128-byte RAM area, and the 128-byte special function register (SFR) area (see figure 4-2). Since the latter SFR area and the upper RAM area share the same address locations, they must be accessed through different addressing modes. The map in figure 4-2 and the following table show the addressing modes used for the different RAM/ SFR spaces.
Semiconductor Group
19
Memory Organization
Address Space Lower 128 bytes of RAM Upper 128 bytes of RAM Special function registers
Locations 00H to 7FH 80H to 0FFH 80H to 0FFH
Addressing Mode direct/indirect indirect direct
For details about the addressing modes see chapter 9.1.
Figure 4-1 Program Memory Address Space The lower 128 bytes of the internal RAM are again grouped in three address spaces (see figure 4-3): 1) 2) A general purpose register area occupies locations 0 through 1FH (see also section 4.3). The next 16 bytes, location 20H through 2FH, contain 128 directly addressable bits. Programming information: These bits can be referred to in two ways, both of which are acceptable for the ASM51. One way is to refer to their bit addresses, i.e. 0 to 7FH. The other way is by referencing to bytes 20H to 2FH. Thus bits 0 to 7 can also be referred to as bits 20.0 to 20.7, and bits 08H and 0FH are the same as 21.0 to 21.7 and so on. Each of the 16 bytes in this segment may also be addressed as a byte.) Locations 30H to 7FH can be used as a scratch pad area. 20
3)
Semiconductor Group
Memory Organization
Using the Stack Pointer (SP) - a special function register described in section 4.4 - the stack can be located anywhere in the whole internal data memory address space. The stack depth is limited only by the internal RAM available (256 byte maximum). However, the user has to take care that the stack is not overwritten by other data, and vice versa. External Data Memory Figure 4-2 and 4-3 contain memory maps which illustrate the internal/external data memory. To address data memory external to the chip, the "MOVX" instructions in combination with the 16-bit datapointer or an 8-bit general purpose register are used. Refer to chapter 9 (Instruction Set) or 5 (External Bus Interface) for detailed descriptions of these operations. A maximum of 64 Kbytes of external data memory can be accessed by instructions using 16-bit address.
Figure 4-2 Data Memory / SFR Address Space Semiconductor Group 21
Memory Organization
Figure 4-3 Mapping of the Lower Portion of the Internal Data Memory Semiconductor Group 22
Memory Organization
4.3
General Purpose Register
The lower 32 locations of the internal RAM are assigned to four banks with eight general purpose register (GPRs) each. Only one of these banks may be enabled at a time. Two bits in the program status word, PSW.3 and PSW.4, select the active register bank (see description of the PSW). This allows fast context switching, which is useful when entering subroutines or interrupt service routines. ASM51 and the device SAB 80(C)515 default to register bank 0. The 8 general purpose registers of the selected register bank may be accessed by register addressing. With register addressing the instruction op code indicates which register is to be used. For indirect accessing R0 and R1 are used as pointer or index register to address internal or external memory (e.g. MOV @R0). Reset initializes the stack pointer to location 07H and increments it once to start from location 08H which is also the first register (R0) of register bank 1. Thus, if one is going to use more than one register bank, the SP should be initiated to a different location of the RAM which is not used for data storage. 4.4 Special Function Registers
The Special Function Register (SFR) area has two important functions. Firstly, all CPU register except the program counter and the four register banks reside here. The CPU registers are the arithmetic registers like A, B, PSW and pointers like SP, DPH and DPL. Secondly, a number of registers constitute the interface between the CPU and all on-chip peripherals. That means, all control and data transfers from and to the peripherals use this register interface exclusively. The special function register area is located in the address space above the internal RAM from addresses 80H to FFH. All 41 special function registers of the SAB 80(C)515 reside here. Fifteen SFRs, that are located on addresses dividable by eight, are bit-addressable, thus allowing 128 bit-addressable locations within the SFR area. Since the SFR area is memory mapped, access to the special function registers is as easy as with internal RAM, and they may be processed with most instructions. In addition, if the special functions are not used, some of them may be used as general scratch pad registers. Note, however, all SFRs can be accessed by direct addressing only. The special function registers are listed in table 4-1. Bit- and byte-addressable special function registers are marked with an asterisk at the symbol name.
Semiconductor Group
23
Memory Organization
Table 4-1 Special Function Registers Symbol * P0 SP DPL DPH PCON TCON TMOD TL0 TL1 TH0 TH1 P1 SCON SBUF P2 IEN0 IP0 P3 IEN1 IP1 IRCON CCEN CCL1 CCH1 CCL2 CCH2 CCL3 CCH3 T2CON CRCL CRCH TL2 TH2 PSW ADCON ADDAT DAPR P6 ACC P4 B P5 Name Port 0 Stack pointer Data pointer, low byte Data pointer, high byte Power control register Timer control register Timer mode register Timer 0, low byte Timer 1, low byte Timer 0, high byte Timer 1, high byte Port 1 Serial channel control register Serial channel buffer register Port 2 Interrupt enable register 0 Interrupt priority register 0 Port 3 Interrupt enable register 1 Interrupt priority register 1 Interrupt request control register Compare/capture enable register Compare/capture register 1, low byte Compare/capture register 1, high byte Compare/capture register 2, low byte Compare/capture register 2, high byte Compare/capture register 3, low byte Compare/capture register 3, high byte Timer 2 control register Compare/reload/capture register, low byte Compare/reload/capture register, high byte Timer 2, low byte Timer 2, high byte Program status word register A/D converter control register A/D converter data register D/A converter program register Port 6 Accumulator Port 4 B register Port 5 Address 80H 81H 82H 83H 87H 88H 89H 8AH 8BH 8CH 8DH 90H 98H 99H 0A0H 0A8H 0A9H 0B0H 0B8H 0B9H 0C0H 0C1H 0C2H 0C3H 0C4H 0C5H 0C6H 0C7H 0C8H 0CAH 0CBH 0CCH 0CDH 0D0H 0D8H 0D9H 0DAH 0DBH 1) 0E0H 0E8H 0F0H 0F8H
*
* * * * * * *
*
* *
* * * *
The SFR's marked with an asterisk (*) are bit- and byte-addressable. 1) Additional feature of the ACMOS versions
Semiconductor Group
24
Memory Organization
The following paragraphs give a general overview of the special function register and refer to sections where a more detailed description can be found. Accumulator, SFR Address 0E0H ACC is the symbol for the accumulator register. The mnemonics for accumulator-specific instructions, however, refer to the accumulator simply as A. Figure 4-4 Program Status Word Register (PSW), SFR Address 0D0H 0D7H 0D0H CY 0D6H AC 0D5H F0 0D4H RS1 0D3H RS0 0D2H OV 0D1H F1 0D0H P PSW
The PSW register contains program status information. Bit CY AC F0 RS1 0 0 1 1 OV F1 P RS0 0 1 0 1 Function Carry flag Auxiliary carry flag (for BCD operations) General purpose user flag 0 Register bank select control bits Bank 0 selected, data address 00H - 07H Bank 1 selected, data address 08H - 0FH Bank 2 selected, data address 10H - 17H Bank 3 selected, data address 18H - 1F7 Overflow flag General purpose user flag Parity flag. Set/cleared by hardware each instruction cycle to indicate an odd/ even number of "one" bits in the accumulator, i.e. even parity.
B Register, SPF Address 0F0H The B register is used during multiply and divide and serves as both source and destination. For other instructions it can be treated as another scratch pad register. Stack Pointer, SFR Address 081H The Stack Pointer (SP) register is 8 bits wide. It is incriminated before data is stored during PUSH and CALL executions and decremented after data is popped during a POP and RET (RETI) execution, i.e. it always points to the last valid stack byte. While the stack may reside anywhere in on-chip RAM, the stack pointer is initialized to 07H after a reset. This causes the stack to begin at location 08H above register bank zero. The SP can be read or written under software control.
Semiconductor Group
25
Memory Organization
Datapointer, SFR Address 082H and 083H The 16-bit Datapointer (DPTR) register is a concatenation of registers DPH (data pointer's high order byte) and DPL (data pointer's low order byte). The data pointer is used in register-indirect addressing to move program memory constants and external data memory variables, as well as to branch within the 64 Kbyte program memory address space. Ports 0 to 5 P0 to P5 are the SFR latches to port 0 to 5, respectively. The port SFRs 0 to 5 are bit-addressable. Ports 0 to 5 are 8-bit I/O ports (that is in total 48 I/O lines) which may be used as general purpose ports and which provide alternate output functions dedicated to the on-chip peripherals of the SAB 80(C)515. Port 6 (AN0 to AN7) In the MYMOS versions, the analog input lines AN0 to AN7 can only be used as inputs for the A/D converter. In the ACMCS versions these lines may also be used as digital inputs. In this case they are addressed as an additional input port (port 6) via special function register P6 (0DBH). Since port 6 has no internal latch, the contents of SFR P6 only depends on the levels applied to the input lines. For details about this port please refer to section 7.1 (Parallel I/O). Peripheral Control, Data and Status Registers Most of the special function registers are used as control, status, and data registers to handle the on-chip peripherals. In the special function register table the register names are organized in groups and each of these groups refer to one peripheral unit. More details on how to program these registers are given in the descriptions of the following peripheral units: Unit Ports Serial Channel Timer 0/1 A/D-Converter Timer 2 with Comp/Capt/Reload Power Saving Modes Watchdog Timer Interrupt System Symbol ADC CCU WDT Section 7.1 7.2 7.3 7.4 7.5 7.6 7.7 8
Semiconductor Group
26
External Bus Interface
5
External Bus Interface
The SAB 80(C)515 allows for external memory expansion. To accomplish this, the external bus interface common to most 8051-based controllers is employed. 5.1 Accessing External Memory
lt is possible to distinguish between accesses to external program memory and external data memory or other peripheral components respectively. This distinction is made by hardware: accesses to external program memory use the signal PSEN (program store enable) as a read strobe. Accesses to external data memory use RD and WR to strobe the memory (alternate functions of P3.7 and P3.6, see section 7.1.). Port 0 and port 2 (with exceptions) are used to provide data and address signals. In this section only the port 0 and port 2 functions relevant to external memory accesses are described (for further details see chapter 7.1). Fetches from external program memory always use a 16-bit address. Accesses to external data memory can use either a 16-bit address (MOVX @DPTR) or an 8-bit address (MOVX @Ri). Role of P0 and P2 as Data/Address Bus When used for accessing external memory, port 0 provides the data byte time-multiplexed with the low byte of the address. In this state, port 0 is disconnected from its own port latch, and the address/ data signal drives both FETs in the port 0 output buffers. Thus, in this application, the port 0 pins are not open-drain outputs and do not require external pullup resistors. During any access to external memory, the CPU writes 0FFH to the port 0 latch (the special function register), thus obliterating whatever information the port 0 SFR may have been holding. Whenever a 16-bit address is used, the high byte of the address comes out on port 2, where it is held for the duration of the read or write cycle. During this time, the port 2 lines are disconnected from the port 2 latch (the special function register). Thus the port 2 latch does not have to contain 1 s, and the contents of the port 2 SFR are not modified. lf an 8-bit address is used (MOVX @Ri), the contents of the port 2 SFR remain at the port 2 pins throughout the external memory cycle. This will facilitate paging. lt should be noted that, if a port 2 pin outputs an address bit that is a 1, strong pullups will be used for the entire read/write cycle and not only for two oscillator periods.
Semiconductor Group
27
External Bus Interface
Timing The timing of the external bus interface, in particular the relationship between the control signals ALE, PSEN, RD and information on port 0 and port 2, is illustrated in figure 5-1 a) and b). Data memory: in a write cycle, the data byte to be written appears on port 0 just before WR is activated, and remains there until after WR is deactivated. In a read cycle, the incoming byte is accepted at port 0 before the read strobe is deactivated.
Program memory: signal PSEN functions as a read strobe. For further information see section 5.2. External Program Memory Access The external program memory is accessed under two conditions: whenever signal EA is active; or whenever the program counter (PC) contains a number that is larger than 01FFF H. This requires the ROM-less versions SAB 80C535/80535 to have EA wired low to allow the lower 8 K program bytes to be fetched from external memory. When the CPU is executing out of external program memory, all 8 bits of port 2 are dedicated to an output function and may not be used for general-purpose I/O. The contents of the port 2 SFR however is not affected. During external program memory fetches port 2 lines output the high byte of the PC, and during accesses to external data memory they output either DPH or the port 2 SFR (depending on whether the external data memory access is a MOVX @DPTR or a MOVX @Ri). Since the SAB 80C535/80535 has no internal program memory, accesses to program memory are always external, and port 2 is at all times dedicated to output the high-order address byte. This means that port 0 and port 2 of the SAB 80C535/80535 can never be used as general-purpose I/O. This also applies to the SAB 80C515/80515 when it is operated with only an external program memory.
Semiconductor Group
28
External Bus Interface
5.2
PSEN, Program Store Enable
The read strobe for external fetches is PSEN. PSEN is not activated for internal fetches. When the CPU is accessing external program memory, PSEN is activated twice every cycle (except during a MOVX instruction) no matter whether or not the byte fetched is actually needed for the current instruction. When PSEN is activated its timing is not the same as for RD. A complete RD cycle, including activation and deactivation of ALE and RD, takes 12 oscillator periods. A complete PSEN cycle, including activation and deactivation of ALE and PSEN takes 6 oscillator periods. The execution sequence for these two types of read cycles is shown in figure 5-1 a) and b). 5.3 ALE, Address Latch Enable
The main function of ALE is to provide a properly timed signal to latch the low byte of an address from P0 into an external latch during fetches from external memory. The address byte is valid at the negative transition of ALE. For that purpose, ALE is activated twice every machine cycle. This activation takes place even it the cycle involves no external fetch. The only time no ALE pulse comes out is during an access to external data memory when RD/WR signals are active. The first ALE of the second cycle of a MOVX instruction is missing (see figure 5-1b) ). Consequently, in any system that does not use data memory, ALE is activated at a constant rate of 1/6 of the oscillator frequency and can be used for external clocking or timing purposes. 5.4 Overlapping External Data and Program Memory Spaces
In some applications it is desirable to execute a program from the same physical memory that is used for storing data. In the SAB 80(C)515, the external program and data memory spaces can be combined by AND-ing PSEN and RD. A positive logic AND of these two signals produces an active low read strobe that can be used for the combined physical memory. Since the PSEN cycle is faster than the RD cycle, the external memory needs to be fast enough to adapt to the PSEN cycle.
Semiconductor Group
29
External Bus Interface
Figure 5-1 a) and b) External Program Memory Execution Semiconductor Group 30
System Reset
6 6.1 6.1.1
System Reset Hardware Reset and Power-Up Reset Reset Function and Circuitries
The hardware reset function incorporated in the SAB 80(C)515 allows for an easy automatic startup at a minimum of additional hardware and forces the controller to a predefined default state. The hardware reset function can also be used during normal operation in order to restart the device. This is particularly done when the power-down mode (see section 7.6) is to be terminated. In addition to the hardware reset, which is applied externally to the SAB 80(C)515, there is also the possibility of an internal hardware reset. This internal reset will be initiated by the watchdog timer (section 7.7). The reset input is an active low input at pin 10 (RESET). An internal Schmitt trigger is used at the input for noise rejection. Since the reset is synchronized internally, the RESET pin must be held low for at least two machine cycles (24 oscillator periods) while the oscillator is running. With the oscillator running the internal reset is executed during the second machine cycle in which RESET is low and is repeated every cycle until RESET goes high again. During reset, pins ALE and PSEN are configured as inputs and should not be stimulated externally. (An external stimulation at these lines during reset activates several test modes which are reserved for test purposes. This in turn may cause unpredictable output operations at several port pins). A pullup resistor is internally connected to VCC to allow a power-up reset with an external capacitor only. An automatic reset can be obtained when VCC is applied by connecting the reset pin to VSS via a capacitor as shown in figure 6-1 a) and c). After VCC has been turned on the capacitor must hold the voltage level at the reset pin for a specified time below the upper threshold of the Schmitt trigger to effect a complete reset. The time required is the oscillator start-up time plus 2 machine cycles, which, under normal conditions, must be at least 10 - 20 ms for a crystal oscillator. This requirement is usually met using a capacitor of 4.7 to 10 microfarad. The same considerations apply if the reset signal is generated externally (figure 6-1 b) ). In each case it must be assured that the oscillator has started up properly and that at least two machine cycles have passed before the reset signal goes inactive.
Semiconductor Group
31
System Reset
Figure 6-1 a) - c) Reset Circuitries A correct reset leaves the processor in a defined state. The program execution starts at location 0000H. The default values of the special function registers (SFR) during and after reset are listed in table 6-1. After reset is internally accomplished the contents of the port latches of port 0 to 5 is 0FFH. This leaves port 0 floating, since it is an open drain port when not used as data/address bus. All other I/O port lines (ports 1 through 5) output a one (1). In the MYMOS versions, the analog input lines AN0 to AN7 can only be used as inputs. In the ACMOS versions these lines may also be used as digital inputs. In this case they are addressed as an additional input port (port 6) via special function register P6 (0DBH) Since port 6 has no internal latch, the contents of SFR P6 only depends on the levels applied to the input lines. For details about this port please refer to section 7.1 (Parallel I/O). The contents of the internal RAM of the SAB 80(C)515 is not affected by a reset. After power-up the contents is undefined, while it remains unchanged during a reset if the power supply is not turned off.
Semiconductor Group
32
System Reset
Table 6-1 Register Contents after Reset Register P0 - P5 DPTR TCON TL0, TH0 TL2, TH2 IEN0, IEN1 IRCON CCL1, CCH1 CCL3, CCH3 T2CON ADCON DAPR B PC Contents 0FFH 0000H 00H 00H 00H 00H 00H 00H 00H 00H 00X0 0000B 00H 00H 0000H Register SP PCON TMOD TL1, TH1 SCON SBUF IP0 IP1 CCEN CCL2, CCH2 CRCL, CRCH PSW ADDAT ACC Watchdog Contents 07H 000X 0000B 00H 00H 00H undefined X000 0000B XX00 0000B 00H 00H 00H 00H 00H 00H 0000H
Semiconductor Group
33
System Reset
6.1.2
Hardware Reset Timing
This section describes the timing of the hardware reset signal. The input pin RESET is sampled once during each machine cycle. This happens in state 5 phase 2. Thus, the external reset signal is synchronized to the internal CPU timing. When the reset is found active (low level at pin 10) the internal reset procedure is started. lt needs two complete machine cycles to put the complete device to its correct reset state. i.e. all special function registers contain their default values, the port latches contain 1's etc. Note that this reset procedure is not performed if there is no clock available at the device. The RESET signal must be active for at least two machine cycles; after this time the SAB 80(C)515 remains in its reset state as long as the signal is active. When the signal goes inactive this transition is recognized in the following state 5 phase 2 of the machine cycle. Then the processor starts its address output (when configured for external ROM) in the following state 5 phase 1. One phase later (state 5 phase 2) the first falling edge at pin ALE occurs. Figure 6-2 shows this timing for a configuration with EA = 0 (external program memory). Thus, between the release of the RESET signal and the first falling edge at ALE there is a time period of at least one machine cycle but less than two machine cycles.
One Machine Cycle S4 S5 S6 S1 P1 P2 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2
RESET
P0
PCL OUT PCH OUT
Inst. PCL IN OUT PCH OUT
P2
ALE
MCT01879
Figure 6-2 CPU Timing after RESET
Semiconductor Group
34
On-Chip Peripheral Components
7
On-Chip Peripheral Components
This chapter gives detailed information about all on-chip peripherals of the SAB 80(C)515 except for the integrated interrupt controller, which is described separately in chapter 8. Sections 7.1 and 7.2 are associated with the general parallel and serial I/O facilities while the remaining sections describe the miscellaneous functions such as the timers, serial interface, A/D converter, power saving modes, watchdog timer, oscillator and clock circuitries, and system clock output. 7.1 7.1.1 Parallel I/O Port Structures
Digital I/O The SAB 80(C)515 allows for digital I/O on 48 lines grouped into 6 bidirectional 8-bit ports. Each port bit consists of a latch, an output driver and an input buffer. Read and write accesses to the I/O ports P0 through P5 are performed via their corresponding special function registers P0 to P5. The output drivers of port 0 and 2 and the input buffers of port 0 are also used for accessing external memory. In this application, port 0 outputs the low byte of the external memory address, timemultiplexed with the byte being written or read. Port 2 outputs the high byte of the external memory address when the address is 16 bits wide. Otherwise, the port 2 pins continue emitting the P2 SFR contents (see also chapter 7.1.2 and chapter 5 for more details about the external bus interface). Digital/Analog Input Ports The analog input lines AN0 to AN7 of the MYMOS versions can only be used as analog inputs. In the ACMOS versions these lines may also be used as digital inputs. In this case they are addressed as an additional input port (port 6) via special function register P6 (0DBH). Since port 6 has no internal latch, the contents of SFR P6 only depends on the levels applied to the input lines. When used as analog input the required analog channel is selected by a three-bit field in SFR ADCON , as described in section 7.4. Of course, it makes no sense to output a value to these inputonly ports by writing to the SFR P6 or P8; this will have no effect.
Semiconductor Group
35
On-Chip Peripheral Components
lf a digital value is to be read, the voltage levels are to be held within the input voltage specifications (VIL/VIH). Since P6 is not a bit-addressable register, all input lines of P6 are read at the same time by byte instructions. Nevertheless, it is possible to use port 6 simultaneously for analog and digital input. However, care must be taken that all bits of P6 are masked which have an undetermined value caused by their analog function . In order to guarantee a high-quality A/D conversion, digital input lines of port 6 should not toggle while a neighbouring port pin is executing an A/D conversion. This could produce crosstalk to the analog signal. 7.1.1.1 Digital I/O Port Circuitry (MYMOS/ACMOS) Figure 7-1 shows a functional diagram of a typical bit latch and I/O buffer, which is the core of each of the 6 I/O-ports. The bit latch (one bit in the port's SFR) is represented as a type-D flip-flop, which will clock in a value from the internal bus in response to a "write-to-latch" signal from the CPU. The Q output of the flip-flop is placed on the internal bus in response to a "read-latch" signal from the CPU. The level of the port pin itself is placed on the internal bus in response to a "read-pin" signal from the CPU. Some instructions that read from a port (i.e. from the corresponding port SFR P0 to P5) activate the "read-latch" signal, while others activate the "read-pin" signal (see section 7.1.4.3).
Figure 7-1 Basic Structure of a Port Circuitry Semiconductor Group 36
On-Chip Peripheral Components
Port 1 through 5 output drivers have internal pullup FET's (see figure 7-2). Each I/O line can be used independently as an input or output. To be used as an input, the port bit must contain a one (1) (that means for figure 7-2: Q = 0), which turns off the output driver FET n1. Then, for ports 1 through 5, the pin is pulled high by the internal pullups, but can be pulled low by an external source. When externally pulled low the port pins source current (IIL or ITL). For this reason these ports are sometimes called "quasi-bidirectional".
Figure 7-2 Basic Output Driver Circuit of Ports 1 through 5 In fact, the pullups mentioned before and included in figure 7-2 are pullup arrangements as shown in figure 7-3. These pullup arrangements are realized differently in the MYMOS and ACMOS versions. In the next two sections both versions are discussed separately.
Semiconductor Group
37
On-Chip Peripheral Components
Figure 7-3 Output Driver Circuits of Ports 1 through 5
Semiconductor Group
38
On-Chip Peripheral Components
7.1.1.2 MYMOS Port Driver Circuitry The output driver circuitry of the MYMOS version (figure 7-3) consists of two pullup FETs (pullup arrangements) and one pulldown FET: The transistor n1 is a very strong pullup transistor which is only activated for two oscillator periods, if a 0-to-1 transition is executed by this port bit. Transistor n1 is capable of driving high currents. The transistor n2 is a weak pullup transistor, which is always switched on. When the pin is pulled down (e.g. when the port is used as input), it sources a low current. This value can be found as the parameter IIL in the DC characteristics. The transistor n3 is a very strong pull-down transistor which is switched on when a "0" is programmed to the corresponding port latch. Transistor n3 is capable of sinking high currents (IOL in the DC characteristics). A short circuit to VCC must be avoided if the transistor is turned on because the high current might destroy the FET. 7.1.1.3 ACMOS Port Driver Circuitry The output driver circuitry of the ACMOS version (figure 7-3) is realized by three pullup FETs (pullup arrangement) and one pulldown FET: The pulldown FET n1 is of n-channel type. lt is a very strong driver transistor which is capable of sinking high currents (IOL); it is only activated if a "0" is programmed to the port pin. A short circuit to VCC must be avoided if the transistor is turned on, since the high current might destroy the FET. The pullup FET p1 is of p-channel type. lt is activated for two oscillator periods (S1P1 and S1P2) if a 0-to-1 transition is programmed to the port pin, i.e. a "1" is programmed to the port latch which contained a "0". The extra pullup can drive a similar current as the pulldown FET n1. This provides a fast transition of the logic levels at the pin. The pullup FET p2 is of p-channel type. lt is always activated when a "1" is in the port latch, thus providing the logic high output level. This pullup FET sources a much lower current than p1; therefore the pin may also be tied to ground, e.g. when used as input with logic low input level. The pullup FET p3 is of p-channel type. lt is only activated if the voltage at the port pin is higher than approximately 1.0 to 1.5 V. This provides an additional pullup current if a logic high level is to be output at the pin (and the voltage is not forced lower than approximately 1.0 to 1.5 V). However, this transistor is turned off if the pin is driven to a logic low level, e.g. when used as input. In this configuration only the weak pullup FET p2 is active, which sources the current IIL. lf, in addition, the pullup FET p3 is activated, a higher current can be sourced (ITL). Thus, an additional power consumption can be avoided if port pins are used as inputs with a low level applied. However, the driving cabability is stronger if a logic high level is output. The described activating and deactivating of the four different transistors translates into four states the pins can be: input low state (IL), p2 active only input high state (IH) = steady output high state (SOH) p2 and p3 active forced output high state (FOH), p1, p2 and p3 active output low state (OL), n1 active
Semiconductor Group
39
On-Chip Peripheral Components
If a pin is used as input and a low level is applied, it will be in IL state, if a high level is applied, it will switch to IH state. If the latch is loaded with "0", the pin will be in OL state. If the latch holds a "0" and is loaded with "1", the pin will enter FOH state for two cycles and then switch to SOH state. If the latch holds a "1" and is reloaded with a "1" no state change will occur. At the beginning of power-on reset the pins will be in IL state (latch is set to "1", voltage level on pin is below of the trip point of p3). Depending on the voltage level and load applied to the pin, it will remain in this state or will switch to IH (=SOH) state. If it is used as output, the weak pull-up p2 will pull the voltage level at the pin above p3's trip point after some time and p3 will turn on and provide a strong "1". Note, however, that if the load exceeds the drive capability of p2 (IIL), the pin might remain in the IL state and provide a week "1" until the first 0-to-1 transition on the latch occurs. Until this the output level might stay below the trip point of the external circuitry. The same is true if a pin is used as bidirectional line and the external circuitry is switched from outpout to input when the pin is held at "0" and the load then exceeds the p2 drive capabilities. If the load exceeds IIL the pin can be forced to "1" by writing a "0" followed by a "1" to the port pin. Port 0, in contrast to ports 1 through 5, is considered as "true" bidirectional, because the port 0 pins float when configured as inputs. Thus, this port differs in not having internal pullups. The pullup FET in the P0 output driver (see figure 7-4 a) ) is used only when the port is emitting 1 s during the external memory accesses. Otherwise, the pullup is always off. Consequently, P0 lines that are used as output port lines are open drain lines. Writing a "1" to the port latch leaves both output FETs off and the pin floats. In that condition it can be used as high-impedance input. lf port 0 is configured as general I/O port and has to emit logic high level (1), external pullups are required.
Figure 7-4 a) Port 0 Circuitry Semiconductor Group 40
On-Chip Peripheral Components
7.1.2
Port 0 and Port 2 Used as Address/Data Bus
As shown in figures 7-4 a) and 7-4 b), the output drivers of ports 0 and 2 can be switched to an internal address or address/data bus for use in external memory accesses. In this application they cannot be used as general purpose I/O, even if not all address lines are used externally. The switching is done by an internal control signal dependent on the input level at the EA pin and/or the contents of the program counter. lf the ports are configured as an address/data bus, the port latches are disconnected from the driver circuit. During this time, the P2 SFR remains unchanged while the P0 SFR has 1's written to it. Being an address/data bus, port 0 uses a pullup FET as shown in figure 7-4 a). When a 16-bit address is used, port 2 uses the additional strong pullups p1 to emit 1's for the entire external memory cycle instead of the weak ones (p2 and p3) used during normal port activity.
Figure 7-4 b) Port 2 Circuitry
Semiconductor Group
41
On-Chip Peripheral Components
7.1.3
Alternate Functions
Several pins of ports 1 and 3 are multifunctional. They are port pins and also serve to implement special features as listed in table 7-1. Table 7-1 Port P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Pin INT3/CC0 INT4/CC1 INT5/CC2 INT6/CC3 INT2 T2EX CLKOUT T2 RXD TXD INT0 INT1 T0 T1 WR RD Alternate Function Ext. interrupt 3 input, compare 0 output, capture 0 input Ext. interrupt 4 input, compare 1 output, capture 1 input Ext. interrupt 5 input, compare 2 output, capture 2 input Ext. interrupt 6 input, compare 3 output, capture 3 input Ext. interrupt 2 input Timer 2 external reload trigger input System clock output Timer 2 external reload trigger input Serial port's receiver data input (asynchronous) or data input/output (synchronous) Serial port's transmitter data output (asynchronous) or clock output (synchronous) External interrupt 0 input, timer 0 gate control External interrupt 1 input, timer 1 gate control Timer 0 external counter input Timer 1 external counter input External data memory write strobe External data memory read strobe
Semiconductor Group
42
On-Chip Peripheral Components
Figure 7-5 shows a fu