C515-LN [INFINEON]

8-Bit CMOS Microcontroller; 8位CMOS微控制器
C515-LN
型号: C515-LN
厂家: Infineon    Infineon
描述:

8-Bit CMOS Microcontroller
8位CMOS微控制器

微控制器
文件: 总160页 (文件大小:909K)
中文:  中文翻译
下载:  下载PDF数据表文档文件
C515  
8-Bit CMOS Microcontroller  
Users Manual 04.98  
Edition 04.98  
Published by Siemens AG,  
Bereich Halbleiter, Marketing-  
Kommunikation, Balanstraße 73,  
81541 München  
© Siemens AG 1998  
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 en-  
dangered.  
C515 User’s Manual  
Revision History :  
04.98  
08.97  
Previous Releases:  
Page (new Page (prev. Subjects (changes since last revision)  
version)  
version)  
1-2  
1-3  
1-4, 1-5  
1-5  
1-2  
1-3  
1-4  
1-4  
P-LCC-68 package is inlcuded in the features list  
PE pin is corrected as PE/SWD  
Pin configuration of P-LCC-68 package is included.  
PE pin is corrected as PE/SWD  
1-6 to 1-10 1-5 to 1-10 The Pin Definitions and Functions are added for P-LCC-68 package.  
The pin description is modified in ascending order starting from first pin  
of P-LCC-68 package  
1-6  
2-1  
3-4  
3-6  
4-4  
1-9  
2-1  
3-4  
3-6  
4-4  
The pin name and description is corrected for PE/SWD  
PE pin is corrected as PE/SWD in Figure 2.1  
SYSCON register description is updated  
PCON and SYSCON register descriptions are updated  
A note is added describing the non availability of ALE switch off feature  
in C515-LN/1RN versions  
6-65  
8-1  
6-65  
8-1  
The voltage specifications of VAREF and VAGND are changed  
The description on starting of watchdog timer is modified to include the  
automatic start by strapping the pin PE/SWD to VCC. The content is  
modified with detailed subheadings.  
8-2  
9-1  
8-2  
9-1  
In Figure 8-1 PE/SWD is added to include the option for the automatic  
start of watchdog timer  
A detailed description is added for “Hardware Enable for the Use of  
Power Saving Modes” and “Application Example for Switching Pin  
PE/SWD”  
9-2  
9-1  
The description of Slow down mode bit (SD) is modified to indicate the  
availability of this feature for C515-LM/1RM versions only  
10-2, 10-5, 10-2, 10-5, The device specifications are valid for ROMless versions also. So  
10-6 & 10-8 10-6 & 10-8 C515-1RM is modified to C515 in all these pages.  
10-6  
10-6  
CLKOUT timing table for 16 MHz is included  
CLKOUT timing table for 24 MHz is included  
Timing diagram for CLKOUT timing is included  
10-8  
10-8  
10-13  
10-14  
10-12  
10-13  
The title “ROM Verification Characteristics for the C515-1RM” is  
modified to “ROM Verification Characteristics for the C515-1R”  
10-17  
10-16  
The package information is added for P-LCC-68 (SMD)  
General Information  
C515  
Table of Contents  
Page  
1
1.1  
1.2  
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1  
Pin Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4  
Pin Definitions and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-6  
2
2.1  
2.2  
Fundamental Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1  
CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2  
CPU Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4  
3
Memory Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1  
Program Memory, "Code Space" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2  
Data Memory, "Data Space" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2  
General Purpose Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2  
Special Function Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-3  
3.1  
3.2  
3.3  
3.4  
4
4.1  
4.1.1  
4.1.2  
4.1.3  
4.2  
4.3  
4.4  
4.5  
4.6  
External Bus Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1  
Accessing External Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1  
Role of P0 and P2 as Data/Address Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1  
Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3  
External Program Memory Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3  
PSEN, Program Store Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3  
Overlapping External Data and Program Memory Spaces . . . . . . . . . . . . . . . . . . .4-3  
ALE, Address Latch Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4  
Enhanced Hooks Emulation Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-5  
ROM Protection for the C515 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6  
Unprotected ROM Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6  
Protected ROM Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7  
4.6.1  
4.6.2  
5
Reset and System Clock Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-1  
Hardware Reset Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-1  
Hardware Reset Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3  
Oscillator and Clock Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4  
System Clock Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6  
5.1  
5.2  
5.3  
5.4  
6
6.1  
On-Chip Peripheral Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1  
Parallel I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1  
Port Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1  
Standard I/O Port Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-3  
Port 0 Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-5  
Port 1, Port 3 to Port 5 Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-6  
Port 2 Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-7  
Detailed Output Driver Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-9  
Port Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-11  
Port Loading and Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-12  
Read-Modify-Write Feature of Ports 0 to 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-13  
Timers/Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-14  
Timer/Counter 0 and 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-14  
Timer/Counter 0 and 1 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-15  
Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-18  
Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-19  
6.1.1  
6.1.2  
6.1.2.1  
6.1.2.2  
6.1.2.3  
6.1.2.4  
6.1.3  
6.1.4  
6.1.5  
6.2  
6.2.1  
6.2.1.1  
6.2.1.2  
6.2.1.3  
Semiconductor Group  
5
General Information  
C515  
Table of Contents  
Page  
6.2.1.4  
6.2.1.5  
6.2.2  
Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-20  
Mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-21  
Timer/Counter 2 with Additional Compare/Capture/Reload . . . . . . . . . . . . . . . . .6-22  
Timer 2 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-24  
Timer 2 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-29  
Compare Function of Registers CRC, CC1 to CC3 . . . . . . . . . . . . . . . . . . . . . . . .6-31  
Compare Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-31  
Modulation Range in Compare Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-33  
Compare Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-35  
Using Interrupts in Combination with the Compare Function . . . . . . . . . . . . . . . .6-37  
Capture Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-39  
Serial Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-41  
Multiprocessor Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-42  
Serial Port Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-42  
Baud Rate Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-44  
Baud Rate in Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-45  
Baud Rate in Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-45  
Baud Rate in Mode 1 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46  
Using the Baud Rate Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46  
Using Timer 1 to Generate Baud Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46  
Details about Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-48  
Details about Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-51  
Details about Modes 2 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-54  
A/D Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-57  
A/D Converter Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-57  
A/D Converter Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-59  
A/D Converter Control Register ADCON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-59  
A/D Converter Data Register ADDAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-60  
A/D Converter Interrupt Control Bits in IEN1 and IRCON . . . . . . . . . . . . . . . . . . .6-61  
Programmable Reference Voltages of the A/D Converter (DAPR Register) . . . . .6-62  
A/D Conversion Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-66  
6.2.2.1  
6.2.2.2  
6.2.2.3  
6.2.2.3.1  
6.2.2.3.2  
6.2.2.3.3  
6.2.2.4  
6.2.2.5  
6.3  
6.3.1  
6.3.2  
6.3.3  
6.3.3.1  
6.3.3.2  
6.3.3.3  
6.3.3.3.1  
6.3.3.3.2  
6.3.4  
6.3.5  
6.3.6  
6.4  
6.4.1  
6.4.2  
6.4.2.1  
6.4.2.2  
6.4.2.3  
6.4.2.4  
6.4.3  
7
7.1  
7.1.1  
7.1.2  
7.1.3  
7.2  
7.3  
7.4  
7.5  
Interrupt System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-1  
Interrupt Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4  
Interrupt Enable Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4  
Interrupt Request / Control Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6  
Interrupt Priority Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-11  
Interrupt Priority Level Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-12  
How Interrupts are Handled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-13  
External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15  
Interrupt Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17  
8
8.1  
8.1.1  
8.1.2  
8.1.2.1  
Fail Safe Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1  
Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1  
General Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1  
Starting the Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1  
The First Possibility of Starting the Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . .8-1  
Semiconductor Group  
6
General Information  
C515  
Table of Contents  
Page  
8.1.2.2  
8.1.3  
8.1.4  
8.1.5  
The Second Possibility of Starting the Watchdog Timer . . . . . . . . . . . . . . . . . . . . .8-1  
Refreshing the Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2  
Watchdog Reset and Watchdog Status Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2  
WDT Control and Status Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-3  
9
Power Saving Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-1  
Hardware Enable for the Use of the Power Saving Modes . . . . . . . . . . . . . . . . . . .9-1  
Power Saving Mode Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2  
Idle Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-3  
Slow Down Mode Operation (C515-LM/1RM only) . . . . . . . . . . . . . . . . . . . . . . . . .9-5  
Power Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6  
Invoking Power Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6  
Exit from Power Down Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6  
State of Pins in the Power Saving Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-7  
9.1  
9.2  
9.3  
9.4  
9.5  
9.5.1  
9.5.2  
9.6  
10  
Device Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-1  
Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-1  
DC Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-2  
A/D Converter Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-5  
AC Characteristics (16 MHz) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-6  
AC Characteristics (24 MHz) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-8  
ROM Verification Characteristics for the C515-1R . . . . . . . . . . . . . . . . . . . . . . .10-14  
Package Information (P-LCC-68) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-17  
Package Information (P-MQFP-80) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-18  
10.1  
10.2  
10.3  
10.4  
10.5  
10.6  
10.7  
10.8  
11  
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-1  
Semiconductor Group  
7
Introduction  
C515  
1
Introduction  
The C515 is a member of the Siemens C500 family of 8-bit microcontrollers. lt is functionally fully  
upward compatible with the SAB-80C515/80C535 microcontrollers.  
The C515 basically operates with internal and/or external program memory. The C515-L is identical  
to the C515-1R, except that it lacks the on-chip porgram memory. Therefore, in this documentation  
the term C515 refers to all versions within this specification unless otherwise noted.  
Figure 1-1 shows the different functional units of the C515 and figure 1-2 shows the simplified logic  
symbol of the C515.  
Power  
Saving  
Modes  
Watchdog  
Timer  
RAM  
256 x 8  
Port 0  
Port 1  
Port 2  
Port 3  
I/O  
I/O  
I/O  
I/O  
T0  
T1  
8-Bit  
A/D  
Converter  
USART  
T2  
CPU  
ROM  
8 K x 8  
Port 6  
Port 5  
I/O  
Port 4  
I/O  
Analog/  
Digital  
Input  
MCA03198  
Figure 1-1  
C515 Functional Units  
Semiconductor Group  
1-1  
 
Introduction  
C515  
Listed below is a summary of the main features of the C515:  
¥ Full upward compatibility with SAB 80C515  
¥ Up to 24 MHz external operating frequency  
– 500 ns instruction cycle at 24 MHz operation  
¥ 8K byte on-chip ROM (with optional ROM protection)  
– alternatively up to 64K byte external program memory  
¥ Up to 64K byte external data memory  
¥ 256 byte on-chip RAM  
¥ On-chip emulation support logic (Enhanced Hooks Technology TM  
¥ Six 8-bit parallel I/O ports  
)
¥ One input port for analog/digital input  
¥ Full duplex serial interface (USART)  
– 4 operating modes, fixed or variabie baud rates  
¥ Three 16-bit timer/counters  
– Timer 0 / 1 (C501 compatible)  
– Timer 2 for 16-bit reload, compare, or capture functions  
¥ 8-bit A/D converter  
– 8 multiplexed analog inputs  
– programmable reference voltages  
¥ 16-bit watchdog timer  
¥ Power saving modes  
– Idle mode  
– Slow down mode (can be combined with idle mode)  
– Software power-down mode  
¥ 12 interrupt sources (7 external, 5 internal) selectable at four priority levels  
¥ ALE switch-off capability (C515-LM/1RM only)  
¥ P-LCC-68 and P-MQFP-80 packages  
¥ Temperature Ranges: SAB-C515  
SAF-C515  
TA = 0 to 70 °C  
TA = -40 to 85 °C  
SAH-C515  
TA = -40 to 110 °C (max. operating frequency: 16 MHz)  
Semiconductor Group  
1-2  
Introduction  
C515  
VCC  
VSS  
Port 0  
8 Bit Digital I/O  
XTAL1  
XTAL2  
Port 1  
8 Bit Digital I/O  
ALE  
PSEN  
EA  
Port 2  
8 Bit Digital I/O  
Port 3  
8 Bit Digital I/O  
C515  
RESET  
PE/SWD  
Port 4  
8 Bit Digital I/O  
Port 5  
8 Bit Digital I/O  
VAREF  
VAGND  
Port 6  
8 Bit Analog/  
Digital Input  
MCL03199  
Figure 1-2  
Logic Symbol  
Semiconductor Group  
1-3  
Introduction  
C515  
1.1 Pin Configurations  
This section describes the pin configuration of the C515.  
V
9
1 68  
61  
60  
RESET  
VAREF  
VAGND  
10  
P5.7  
P0.7  
P0.6  
P0.5  
P0.4  
P0.3  
P0.2  
P0.1  
P0.0  
EA  
P6.7  
P6.6  
P6.5  
P6.4  
P6.3  
P6.2  
P6.1  
C515-LN/1RN  
P6.0  
ALE  
PSEN  
P2.7  
P2.6  
P2.5  
P2.4  
P2.3  
RxD/P3.0  
TxD/P3.1  
INT0/P3.2  
INT1/P3.3  
T0/P3.4  
T1/P3.5  
26  
44  
43  
27  
MCP00092  
V
V
Figure 1-3  
Pin Configuration of P-LCC-68 Package (top view)  
Semiconductor Group  
1-4  
Introduction  
C515  
60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41  
P5.6  
P5.5  
P5.4  
P5.3  
P5.2  
P5.1  
P5.0  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
40  
39  
38  
37  
36  
35  
34  
33  
32  
31  
30  
29  
28  
27  
26  
25  
24  
23  
22  
21  
P2.2/A10  
P2.1/A9  
P2.0/A8  
XTAL1  
XTAL2  
N.C.  
VSS  
VCC  
N.C.  
VCC  
N.C.  
N.C.  
N.C.  
P4.0  
P4.1  
P4.2  
P1.0/INT3/CC0  
P1.1/INT4/CC1  
P1.2/INT5/CC2  
P1.3/INT6/CC3  
P1.4/INT2  
P1.5/T2EX  
P1.6/CLKOUT  
P1.7/T2  
C515  
PE/SWD  
P4.3  
P4.4  
P4.5  
P4.6  
P4.7  
N.C.  
P3.7/RD  
P3.6/WR  
1
2
3
4
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20  
V
V
MCP03200  
N.C. pins must not be connected  
Figure 1-4  
Pin Configuration of P-MQFP-80-1 Package (top view)  
Semiconductor Group  
1-5  
Introduction  
C515  
1.2 Pin Definitions and Functions  
This section describes all external signals of the C515 with its function.  
Table 1-1  
Pin Definitions and Functions  
Symbol  
Pin  
Number  
P-LCC-  
68  
Pin  
Number  
P-MQFP-  
80  
I/O*) Function  
P4.0-P4.7  
1-3, 5-9  
72-74,  
76-80  
I/O  
Port 4  
is an 8-bit quasi-bidirectional I/O port with internal  
pull-up resistors. Port 4 pins that have 1’s written to  
them are pulled high by the internal pull-up resistors,  
and in that state can be used as inputs. As inputs,  
port 4 pins being externally pulled low will source  
current (I IL, in the DC characteristics) because of the  
internal pull-up resistors.  
PE/SWD  
4
75  
I
Power saving mode enable/Start watchdog timer  
A low level at this pin allows the software to enter the  
power saving modes(idle mode, slow down mode  
and power down mode). It is impossible to enter the  
software controlled power saving modes if this pin is  
held at high level.  
A high level during the reset performs an automatic  
start of watchdog timer immidiately after reset.  
When left unconnected this pin is pulled high by a  
weak internal pull-up resistor.  
RESET  
10  
1
I
RESET  
A low level on this pin for the duration of two machine  
cycles while the oscillator is running resets the  
C515. A small internal pullup resistor permits power-  
on reset using only a capacitor connected to V  
Reference voltage for the A/D converter  
Reference ground for the A/D converter  
.
SS  
VAREF  
11  
3
I
VAGND  
P6.0-P6.7  
12  
4
13-20  
5-12  
Port 6  
is an 8-bit unidirectional input port to the A/D  
converter. Port pins can be used for digital input, if  
voltage levels simultaneously meet the  
specifications for high/low input voltages and for the  
eight multiplexed analog inputs.  
*) I = Input  
O = Output  
Semiconductor Group  
1-6  
Introduction  
C515  
Table 1-1  
Pin Definitions and Functions (cont’d)  
Symbol  
Pin  
Number  
P-LCC-  
68  
Pin  
Number  
P-MQFP-  
80  
I/O*) Function  
P3.0-P3.7  
21-28  
15-22  
I/O  
Port 3  
is an 8-bit quasi-bidirectional I/O port with internal  
pullup resistors. Port 3 pins that have 1's written to  
them are pulled high by the internal pullup resistors,  
and in that state can be used as inputs. As inputs,  
port 3 pins being externally pulled low will source  
current (I IL, in the DC characteristics) because of the  
internal pullup resistors. Port 3 also contains the  
interrupt, timer, serial port and external memory  
strobe pins that are used by various options. The  
output latch corresponding to a secondary function  
must be programmed to a one (1) for that function to  
operate. The secondary functions are assigned to  
the pins of port 3 as follows:  
21  
22  
23  
24  
15  
16  
17  
18  
P3.0 / RxD  
data  
Receiver data input (asynch.) or  
input/output (synch.) of serial  
interface  
P3.1 / TxD  
Transmitter data output (asynch.) or  
clock output (synch.) of serial  
interface  
25  
26  
27  
19  
20  
21  
P3.2 / INT0  
External interrupt 0 input /  
timer 0 gate control input  
External interrupt 1 input /  
timer 1 gate control input  
Timer 0 counter input  
P3.3 / INT1  
P3.4 / T0  
P3.5 / T1  
P3.6 / WR  
byte  
28  
22  
Timer 1 counter input  
WR control output; latches the data  
from port 0 into the external data  
memory  
P3.7 / RD  
RD control output; enables the  
external data memory  
*) I = Input  
O = Output  
Semiconductor Group  
1-7  
Introduction  
C515  
Table 1-1  
Pin Definitions and Functions (cont’d)  
Symbol  
Pin  
Number  
P-LCC-  
68  
Pin  
Number  
P-MQFP-  
80  
I/O*) Function  
P1.0 - P1.7 36-29  
31-24  
I/O  
Port 1  
is an 8-bit quasi-bidirectional I/O port with internal  
pullup resistors. Port 1 pins that have 1's written to  
them are pulled high by the internal pullup resistors,  
and in that state can be used as inputs. As inputs,  
port 1 pins being externally pulled low will source  
current (I IL, in the DC characteristics) because of the  
internal pullup resistors. The port is used for the low-  
order address byte during program verification. Port  
1 also contains the interrupt, timer, clock, capture  
and compare pins that are used by various options.  
The output latch corresponding to a secondary  
function must be programmed to a one (1) for that  
function to operate (except when used for the  
compare functions). The secondary functions are  
assigned to the port 1 pins as follows :  
36  
35  
34  
33  
31  
30  
29  
28  
P1.0 / INT3 /CC0  
P1.1 / INT4 /CC1  
P1.2 / INT5 /CC2  
P1.3 / INT6 /CC3  
Interrupt 3 input /  
compare 0 output /  
capture 0 input  
Interrupt 4 input /  
compare 1 output /  
capture 1 input  
Interrupt 5 input /  
compare 2 output /  
capture 2 input  
Interrupt 6 input /  
compare 3 output /  
capture 3 input  
32  
31  
27  
26  
P1.4 / INT2  
P1.5 / T2EX  
Interrupt 2 input  
Timer 2 external reload /  
trigger input  
30  
29  
25  
24  
P1.6 / CLKOUT  
P1.7 / T2  
System clock output  
Counter 2 input  
V
V
38  
34  
Ground (0 V)  
SS  
37, 68  
33, 69  
Supply voltage  
CC  
during normal, idle, and power-down operation.  
*) I = Input  
O = Output  
Semiconductor Group  
1-8  
Introduction  
C515  
Table 1-1  
Pin Definitions and Functions (cont’d)  
Symbol  
Pin  
Number  
P-LCC-  
68  
Pin  
Number  
P-MQFP-  
80  
I/O*) Function  
XTAL2  
39  
36  
XTAL2  
Input to the inverting oscillator amplifier and input to  
the internal clock generator circuits.  
To drive the device from an external clock source,  
XTAL2 should be driven, while XTAL1 is left  
unconnected. Minimum and maximum high and low  
times as well as rise/fall times specified in the AC  
characteristics must be observed.  
XTAL1  
40  
37  
XTAL1  
Output of the inverting oscillator amplifier.  
P2.0-P2.7  
41-48  
38-45  
I/O  
Port 2  
is an 8-bit quasi-bidirectional I/O port with internal  
pullup resistors. Port 2 pins that have 1's written to  
them are pulled high by the internal pullup resistors,  
and in that state can be used as inputs. As inputs,  
port 2 pins being externally pulled low will source  
current (I IL, in the DC characteristics) because of the  
internal pullup resistors.  
Port 2 emits the high-order address byte during  
fetches from external program memory and during  
accesses to external data memory that use 16-bit  
addresses (MOVX @DPTR). In this application it  
uses strong internal pullup resistors when issuing  
1's. During accesses to external data memory that  
use 8-bit addresses (MOVX @Ri), port 2 issues the  
contents of the P2 special function register.  
PSEN  
49  
47  
O
The Program Store Enable  
output is a control signal that enables the external  
program memory to the bus during external fetch  
operations. It is activated every six oscillator periods,  
except during external data memory accesses. The  
signal remains high during internal program  
execution.  
*) I = Input  
O = Output  
Semiconductor Group  
1-9  
Introduction  
C515  
Table 1-1  
Pin Definitions and Functions (cont’d)  
Symbol  
Pin  
Number  
P-LCC-  
68  
Pin  
Number  
P-MQFP-  
80  
I/O*) Function  
ALE  
50  
48  
O
The Address Latch enable  
output is used for latching the address into external  
memory during normal operation. It is activated  
every six oscillator periods, except during an  
external data memory access.  
EA  
51  
49  
I
External Access Enable  
When held high, the C515 executes instructions  
from the internal ROM (C515-1R) as long as the  
program counter is less than 2000 . When held low,  
H
the C515 fetches all instructions from ext. program  
memory. For the C515-L this pin must be tied low.  
P0.0-P0.7  
52-59  
52-59  
I/O  
Port 0  
is an 8-bit open-drain bidirectional I/O port. Port 0  
pins that have 1's written to them float, and in that  
state can be used as high-impedance inputs. Port 0  
is also the multiplexed low-order address and data  
bus during accesses to external program and data  
memory. In this application it uses strong internal  
pullup resistors when issuing 1's. Port 0 also outputs  
the code bytes during program verification in the  
C515-1R. External pullup resistors are required  
during program verification.  
P5.ß-P5.7  
67-60  
67-60  
I/O  
Port 5  
is an 8-bit quasi-bidirectional I/O port with internal  
pullup resistors. Port 5 pins that have 1's written to  
them are pulled high by the internal pullup resistors,  
and in that state can be used as inputs. As inputs,  
port 5 pins being externally pulled low will source  
current (I IL, in the DC characteristics) because of the  
internal pullup resistors.  
N.C.  
2, 13, 14,  
23, 32, 35,  
46, 50, 51,  
68, 70, 71  
Not connected  
These pins of the P-MQFP-80 package must not be  
connected.  
*) I = Input  
O = Output  
Semiconductor Group  
1-10  
Fundamental Structure  
C515  
2
Fundamental Structure  
The C515 is fully compatible to the architecture of the standard 8051/C501 microcontroller family.  
While maintaining all architectural and operational characteristics of the C501, the C515  
incorporates a 8-bit A/D converter, a timer 2 with capture/compare functions, as well as some  
enhancements in the Fail Save Mechanism unit. Figure 2-1 shows a block diagram of the C515.  
C515  
RAM  
256 x 8  
ROM  
8K x 8  
XTAL1  
XTAL2  
OSC & Timing  
CPU  
ALE  
PSEN  
EA  
Emulation  
Support  
Logic  
Programmable  
Watchdog Timer  
PE/SWD  
RESET  
Timer 0  
Timer 1  
Timer 2  
Port 0  
8 Bit Digital I/O  
Port 0  
Port 1  
Port 2  
Port 3  
Port 4  
Port 5  
Port 6  
Port 1  
8 Bit Digital I/O  
Port 2  
8 Bit Digital I/O  
USART  
Baud Rate Generator  
Port 3  
8 Bit Digital I/O  
Interrupt Unit  
Port 4  
8 Bit Digital I/O  
VAREF  
VAGND  
Programmable  
Reference Voltages  
Port 5  
8 Bit Digital I/O  
8-Bit  
A/D Converter  
Port 6  
8 Bit Digital I/O  
Digital Input  
Analog  
S & H  
MUX  
MCB03201  
Figure 2-1  
Block Diagram of the C515  
Semiconductor Group  
2-1  
 
Fundamental Structure  
C515  
2.1 CPU  
The C515 is efficient both as a controller and as an arithmetic processor. It has extensive facilities  
for binary and BCD arithmetic and excels in its bit-handling capabilities. Efficient use of program  
memory results from an instruction set consisting of 44% one-byte, 41% two-byte, and 15% three-  
byte instructions. With a 12 MHz external clock, 58% of the instructions execute in 1.0 ms (24 MHz  
500 ns).  
The CPU (Central Processing Unit) of the C515 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, substract,  
multiply, divide, increment, decrement, BDC-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 as set, clear, complement, jump-  
if-not-set, jump-if-set-and-clear 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 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 conditional branch logic enables internal and external events to the processor to  
cause a change in the program execution sequence.  
Accumulator  
ACC is the symbol for the accumulator register. The mnemonics for accumulator-specific  
instructions, however, refer to the accumulator simply as A.  
Program Status Word  
The Program Status Word (PSW) contains several status bits that reflect the current state of the  
CPU.  
Semiconductor Group  
2-2  
Fundamental Structure  
C515  
Special Function Register PSW (Address D0 )  
H
Reset Value : 00  
H
Bit No. MSB  
LSB  
D7  
D6  
D5  
D4  
D3  
D2  
D1  
D0  
H
H
H
H
H
H
H
H
D0  
CY  
AC  
F0  
RS1  
RS0  
OV  
F1  
P
PSW  
H
Bit  
Function  
CY  
Carry Flag  
Used by arithmetic instruction.  
AC  
F0  
Auxiliary Carry Flag  
Used by instructions which execute BCD operations.  
General Purpose Flag  
RS1  
RS0  
Register Bank select control bits  
These bits are used to select one of the four register banks.  
RS1  
RS0  
Function  
Bank 0 selected, data address 00 -07  
0
0
1
1
0
1
0
1
H
H
Bank 1 selected, data address 08 -0F  
H
H
Bank 2 selected, data address 10 -17  
H
H
Bank 3 selected, data address 18 -1F  
H
H
OV  
Overflow Flag  
Used by arithmetic instruction.  
General Purpose Flag  
Parity Flag  
F1  
P
Set/cleared by hardware after each instruction to indicate an odd/even  
number of "one" bits in the accumulator, i.e. even parity.  
B Register  
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  
The stack pointer (SP) register is 8 bits wide. It is incremented 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  
the on-chip RAM, the stack pointer is initialized to 07 after a reset. This causes the stack to begin  
H
a location = 08 above register bank zero. The SP can be read or written under software control.  
H
Semiconductor Group  
2-3  
Fundamental Structure  
C515  
2.2 CPU Timing  
A machine cycle of the C515 consists of 6 states (12 oscillator periods). Each state is devided into  
a phase 1 half and a phase 2 half. Thus, a machine cycle consists of 12 oscillator periods,  
numbererd S1P1 (state 1, phase 1) through S6P2 (state 6, phase 2). Each state lasts for two  
oscillator periods. Typically, arithmetic and logic operations take place during phase 1 and internal  
register-to-register transfers take place during phase 2.  
The diagrams in figure 2-2 show the fetch/execute timing related to the internal states and phases.  
Since these internal clock signals are not user-accessible, the XTAL1 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.  
Executing of a one-cycle instruction begins at S1P2, when the op-code is latched into the instruction  
register. If it is a two-byte instruction, the second reading takes place during S4 of the same  
machine cycle. If it is a one-byte instruction, there is still a fetch at S4, but the byte read (which would  
be the next op-code) is ignored (discarded fetch), and the program counter is not incremented. In  
any case, execution is completed at the end of S6P2. Figures 2-2 (a) and (b) show the timing of a  
1-byte, 1-cycle instruction and for a 2-byte, 1-cycle instruction.  
Most C515 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. Figure 2-2 (c) and (d) show the timing for  
a normal 1-byte, 2-cycle instruction and for a MOVX instruction.  
Semiconductor Group  
2-4  
Fundamental Structure  
C515  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2  
OSC  
(XTAL1)  
ALE  
Read  
Read next  
Opcode  
Opcode (Discard)  
Read next  
Opcode again  
S1  
S2  
S3  
S4  
S5  
S6  
a) 1-Byte,  
b) 2-Byte,  
1-Cycle Instruction, e.g. INC A  
Read  
Opcode  
Read 2nd  
Byte  
Read next  
Opcode  
S1  
S2  
S3  
S4  
S5  
S6  
1-Cycle Instruction, e.g. ADD A,  
# Data  
Read next Opcode again  
Read  
Opcode  
Read next Opcode (Discard)  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
c) 1-Byte,  
2-Cycle Instruction, e.g. INC DPTR  
Read next Opcode again  
Read  
Opcode  
(MOVX)  
Read next  
Opcode  
(Discard)  
No Fetch  
No ALE  
No Fetch  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
ADDR  
DATA  
d) MOVX (1-Byte, 2-Cycle)  
MCD03218  
Access External Memory  
Figure 2-2  
Fetch Execute Sequence  
Semiconductor Group  
2-5  
Memory Organization  
C515  
3
Memory Organization  
The C515 CPU manipulates operands in the following four address spaces:  
– up to 64 Kbyte of program memory (8K on-chip program memory for C515-1R)  
– up to 64 Kbyte of external data memory  
– 256 bytes of internal data memory  
– a 128 byte special function register area  
Figure 3-1 illustrates the memory address spaces of the C515.  
FFFF  
FFFF  
H
H
External  
External  
Indirect  
Address  
Direct  
Address  
FF  
80  
FF  
80  
H
H
H
H
Special  
Function  
Register  
Internal  
RAM  
2000  
H
7F  
H
1FFF  
H
H
Internal  
(EA = 1)  
External  
(EA = 0)  
Internal  
RAM  
0000  
0000  
00  
H
H
"Code Space"  
"Data Space"  
"Internal Data Space"  
MCD03202  
Figure 3-1  
C515 Memory Map  
Semiconductor Group  
3-1  
 
Memory Organization  
C515  
3.1 Program Memory, "Code Space"  
The C515-1R has 8 Kbytes of read-only program memory which can be externally expanded up to  
64 Kbytes. If the EA pin is held high, the C515-1R executes program code out of the internal ROM  
unless the program counter address exceeds 1FFF . Address locations 2000 through FFFF are  
H
H
H
then fetched from the external program memory. If the EA pin is held low, the C515 fetches all  
instructions from the external 64K byte program memory.  
3.2 Data Memory, "Data Space"  
The data memory address space consists of an internal and an external memory space. The  
internal data memory is divided into three physically separate and distinct blocks : the lower 128  
bytes of RAM, the upper 128 bytes of RAM, and the 128 byte special function register (SFR) area.  
While the upper 128 bytes of data memory and the SFR area share the same address locations,  
they are accessed through different addressing modes. The lower 128 bytes of data memory can be  
accessed through direct or register indirect addressing; the upper 128 bytes of RAM can be  
accessed through register indirect addressing; the special function registers are accessible through  
direct addressing. Four 8-register banks, each bank consisting of eight 8-bit general-purpose  
registers, occupy locations 0 through 1F in the lower RAM area. The next 16 bytes, locations 20  
H
H
through 2F , contain 128 directly addressable bit locations. The stack can be located anywhere in  
H
the internal RAM area, and the stack depth can be expanded up to 256 bytes.  
The external data memory can be expanded up to 64 Kbyte and can be accessed by instructions  
that use a 16-bit or an 8-bit address.  
3.3 General Purpose Registers  
The lower 32 locations of the internal RAM are assigned to four banks with eight general purpose  
registers (GPRs) each. Only one of these banks may be enabled at a time. Two bits in the program  
status word, RS0 (PSW.3) and RS1 (PSW.4), select the active register bank (see description of the  
PSW in chapter 2). This allows fast context switching, which is useful when entering subroutines or  
interrupt service routines.  
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 addressing 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 07 and increments it once to start from location 08  
H
H
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 initialized to a different location of the RAM which is not used for  
data storage.  
Semiconductor Group  
3-2  
Memory Organization  
C515  
3.5 Special Function Registers  
The registers, except the program counter and the four general purpose register banks, reside in  
the special function register area.  
The 43 special function registers (SFRs) include pointers and registers that provide an interface  
between the CPU and the other on-chip peripherals. All SFRs with addresses where address bits  
0-2 are 0 (e.g. 80 , 88 , 90 , 98 , ..., F8 , FF ) are bitaddressable.  
H
H
H
H
H
H
The SFRs of the C515 are listed in table 3-1 and table 3-2. In table 3-1 they are organized in groups  
which refer to the functional blocks of the C515. Table 3-2 illustrates the contents of the SFRs in  
numeric order of their addresses.  
Semiconductor Group  
3-3  
Memory Organization  
C515  
Table 3-1  
Special Function Registers - Functional Blocks  
Block  
Symbol  
Name  
Address Contents after  
Reset  
1)  
CPU  
ACC  
B
DPH  
DPL  
PSW  
SP  
Accumulator  
B-Register  
Data Pointer, High Byte  
Data Pointer, Low Byte  
Program Status Word Register  
Stack Pointer  
E0  
F0  
83  
82  
00  
00  
00  
00  
00  
07  
H
H
H
H
H
H
H
1)  
H
H
H
1)  
D0  
H
81  
B1  
B1  
H
H
H
3)  
3)  
SYSCON System Control Register  
SYSCON System Control Register  
XX1X XXXX  
XXXX XXXX  
B
B
4)  
1)  
3)  
A/D-  
ADCON 2) A/D Converter Control Register  
D8  
D9  
DA  
00X0 0000  
B
00  
H
00  
H
H
H
H
Converter ADDAT  
DAPR  
A/D Converter Data Register  
A/D Converter Program Register  
1)  
Interrupt  
System  
IEN0 2)  
IEN1 2)  
P0 2)  
IP1  
IRCON  
TCON  
Interrupt Enable Register 0  
Interrupt Enable Register 1  
Interrupt Priority Register 0  
Interrupt Priority Register 1  
Interrupt Request Control Register  
Timer Control Register  
A8  
B8  
00  
H
H
H
1)  
00  
H
A9  
B9  
00  
H
H
H
3)  
3)  
X000 0000  
B
1)  
C0  
88  
XX00 0000  
B
H
2)  
1)  
00  
H
H
2)  
1)  
T2CON  
SCON  
Timer 2 Control Register  
Serial Channel Control Register  
C8  
00  
H
H
H
2)  
1)  
1)  
98  
00  
H
Timer 0/  
Timer 1  
TCON 2)  
TH0  
TH1  
TL0  
TL1  
Timer 0/1 Control Register  
Timer 0, High Byte  
Timer 1, High Byte  
Timer 0, Low Byte  
Timer 1, Low Byte  
Timer Mode Register  
88  
00  
H
H
8C  
8D  
8A  
00  
H
H
H
00  
H
00  
H
H
H
H
8B  
89  
00  
H
TMOD  
00  
H
Compare/ CCEN  
Comp./Capture Enable Reg.  
Comp./Capture Reg. 1, High Byte  
Comp./Capture Reg. 2, High Byte  
Comp./Capture Reg. 3, High Byte  
Comp./Capture Reg. 1, Low Byte  
Comp./Capture Reg. 2, Low Byte  
Comp./Capture Reg. 3, Low Byte  
Com./Rel./Capt. Reg. High Byte  
Com./Rel./Capt. Reg. Low Byte  
Timer 2, High Byte  
C1  
00  
H
H
H
H
H
H
H
H
H
H
H
Capture  
Unit /  
CCH1  
CCH2  
CCH3  
CCL1  
CCL2  
CCL3  
CRCH  
CRCL  
TH2  
C3  
C5  
C7  
C2  
C4  
C6  
CB  
CA  
CD  
00  
H
00  
H
Timer 2  
00  
H
00  
H
00  
H
00  
H
00  
H
00  
H
00  
H
1) Bit-addressable special function registers  
2) This special function register is listed repeatedly since some bits of it also belong to other functional blocks.  
3) “X“ means that the value is undefined and the location is reserved  
4) For C515-LN/1RN only  
Semiconductor Group  
3-4  
Memory Organization  
C515  
Table 3-1  
Special Function Registers - Functional Blocks (cont’d)  
Block  
Symbol  
Name  
Address Contents after  
Reset  
TL2  
Timer 2, Low Byte  
CC  
00  
00  
H
H
H
1)  
T2CON 2) Timer 2 Control Register  
C8  
H
H
H
1)  
1)  
1)  
Ports  
P0  
P1  
P2  
P3  
P4  
P5  
P6  
Port 0  
Port 1  
Port 2  
Port 3  
Port 4  
Port 5  
80  
90  
FF  
FF  
FF  
FF  
FF  
FF  
H
H
H
H
H
H
A0  
B0  
E8  
F8  
DB  
H
H
H
H
1
1)  
1)  
Port 6, Analog/Digital Input  
H
1
3)  
Serial  
Channel  
ADCON2) A/D Converter Control Register  
D8  
00X0 0000  
H
B
PCON2)  
SBUF  
SCON 2)  
Power Control Register  
Serial Channel Buffer Register  
Serial Channel Control Register  
87  
99  
98  
00  
H
H
H
H
3)  
XX  
H
1)  
1)  
00  
H
Watchdog IEN0 2)  
IEN1 2)  
Interrupt Enable Register 0  
Interrupt Enable Register 1  
Interrupt Priority Register 0  
A8  
B8  
A9  
00  
H
H
H
H
1)  
00  
H
IP0 2)  
X000 0000  
3)  
B
Power  
Saving  
Modes  
PCON2)  
Power Control Register  
87  
00  
H
H
1) Bit-addressable special function registers  
2) This special function register is listed repeatedly since some bits of it also belong to other functional blocks.  
3) “X“ means that the value is undefined and the location is reserved  
Semiconductor Group  
3-5  
Memory Organization  
C515  
Table 3-2  
Contents of the SFRs, SFRs in Numeric Order of their Addresses  
Addr Register Content Bit 7  
after  
Bit 6  
Bit 5  
Bit 4  
Bit 3  
Bit 2  
Bit 1  
Bit 0  
1)  
Reset  
2)  
80  
81  
82  
83  
87  
87  
88  
89  
P0  
FF  
07  
.7  
.7  
.7  
.7  
.6  
.6  
.6  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
H
H
H
H
H
H
H
H
H
SP  
.5  
.4  
.3  
.2  
.1  
.0  
H
H
H
H
H
H
H
H
H
H
H
DPL  
DPH  
PCON  
PCON3)  
TCON  
TMOD  
TL0  
00  
00  
00  
00  
00  
00  
00  
00  
00  
00  
.5  
.4  
.3  
.2  
.1  
.0  
.5  
.4  
.3  
.2  
.1  
.0  
SMOD PDS  
SMOD PDS  
IDLS  
IDLS  
TF0  
M1  
.5  
SD  
_
GF1  
GF1  
IE1  
GF0  
GF0  
IT1  
PDE  
PDE  
IE0  
M1  
.1  
IDLE  
IDLE  
IT0  
M0  
.0  
2)  
TF1  
TR1  
TR0  
M0  
.4  
GATE C/T  
GATE C/T  
8A  
.7  
.7  
.7  
.7  
T2  
.6  
.6  
.6  
.6  
.3  
.2  
H
H
8B  
TL1  
.5  
.4  
.3  
.2  
.1  
.0  
8C  
8D  
90  
TH0  
.5  
.4  
.3  
.2  
.1  
.0  
H
H
TH1  
.5  
.4  
.3  
.2  
.1  
.0  
2)  
2)  
P1  
FF  
CLK-  
OUT  
T2EX INT2  
INT6  
INT5  
INT4  
INT3  
H
H
98  
99  
SCON  
SBUF  
P2  
00  
SM0  
.7  
SM1  
.6  
SM2  
.5  
REN  
.4  
TB8  
.3  
RB8  
.2  
TI  
RI  
.0  
H
H
H
XX  
.1  
H
H
2)  
2)  
A0  
A8  
A9  
FF  
00  
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
H
H
H
IEN0  
IP0  
EAL  
WDT  
ET2  
ES  
.4  
ET1  
.3  
EX1  
.2  
ET0  
.1  
EX0  
.0  
H
X000-  
0000  
WDTS .5  
B
2)  
B0  
B1  
P3  
FF  
RD  
_
WR  
_
T1  
T0  
_
INT1  
_
INT0  
_
TxD  
_
RxD  
_
H
H
SYSCON X1XX  
XXXX  
EALE  
H
B
B1  
SYSCON XXXX  
XXXX  
_
_
_
_
_
_
_
_
H
4)  
B
2)  
B8  
B9  
IEN1  
IP1  
00  
EXEN2 SWDT EX6  
.5  
EX5  
.4  
EX4  
.3  
EX3  
.2  
EX2  
.1  
EADC  
.0  
H
H
XX00-  
H
0000  
B
1) X means that the value is undefined and the location is reserved  
2) Bit-addressable special function registers  
3) For C515-LN/1RN only  
4) This register is available without function in C515-LN/1RN  
Semiconductor Group  
3-6  
Memory Organization  
C515  
Table 3-2  
Contents of the SFRs, SFRs in Numeric Order of their Addresses (cont’d)  
Addr Register Content Bit 7  
after  
Bit 6  
Bit 5  
Bit 4  
Bit 3  
Bit 2  
Bit 1  
Bit 0  
1)  
Reset  
2)  
C0  
C1  
IRCON  
CCEN  
00  
00  
EXF2 TF2  
IEX6  
IEX5  
IEX4  
IEX3  
IEX2  
IADC  
H
H
H
COCA COCAL COCA COCAL COCA COCAL COCA COCAL  
H
H3  
.7  
.7  
.7  
.7  
.7  
.7  
3
H2  
2
H1  
.3  
.3  
.3  
.3  
.3  
.3  
1
H0  
.1  
.1  
.1  
.1  
.1  
.1  
0
C2  
C3  
C4  
C5  
C6  
C7  
C8  
CCL1  
CCH1  
CCL2  
CCH2  
CCL3  
CCH3  
T2CON  
CRCL  
CRCH  
TL2  
00  
00  
00  
00  
00  
00  
00  
00  
00  
00  
00  
00  
.6  
.6  
.6  
.6  
.6  
.6  
.5  
.4  
.4  
.4  
.4  
.4  
.4  
.2  
.2  
.2  
.2  
.2  
.2  
.0  
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
.5  
.0  
.5  
.0  
.5  
.0  
.5  
.0  
.5  
.0  
2)  
T2PS I3FR  
I2FR  
.5  
T2R1 T2R0 T2CM T2I1  
T2I0  
.0  
CA  
.7  
.6  
.4  
.3  
.2  
.1  
H
CB  
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
H
CC  
CD  
D0  
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
H
TH2  
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
H
2)  
PSW  
CY  
BD  
AC  
CLK  
F0  
RS1  
BSY  
RS0  
ADM  
OV  
MX2  
F1  
MX1  
P
H
2)  
H
D8  
ADCON 00X0-  
0000  
MX0  
B
D9  
ADDAT  
DAPR  
P6  
00  
00  
.7  
.7  
.7  
.7  
.7  
.7  
.7  
.6  
.6  
.6  
.6  
.6  
.6  
.6  
.5  
.5  
.5  
.5  
.5  
.5  
.5  
.4  
.4  
.4  
.4  
.4  
.4  
.4  
.3  
.3  
.3  
.3  
.3  
.3  
.3  
.2  
.2  
.2  
.2  
.2  
.2  
.2  
.1  
.1  
.1  
.1  
.1  
.1  
.1  
.0  
.0  
.0  
.0  
.0  
.0  
.0  
H
H
H
DA  
DB  
E0  
H
H
2)  
ACC  
P4  
00  
H
H
2)  
E8  
F0  
FF  
H
H
2)  
2)  
B
00  
H
H
F8  
P5  
FF  
H
H
1) X means that the value is undefined and the location is reserved  
2) Bit-addressable special function registers  
Semiconductor Group  
3-7  
External Bus Interface  
C515  
4
External Bus Interface  
The C515 allows for external memory expansion. The functionality and implementation of the  
external bus interface is identical to the common interface for the 8051 architecture with one  
exception : if the C515 is used in systems with no external memory the generation of the ALE signal  
can be suppressed. Resetting bit EALE in SFR SYSCON register, the ALE signal will be gated off.  
This feature reduces RFI emissions of the system.  
4.1 Accessing External Memory  
It 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). 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.  
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).  
4.1.1 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 FF to the port 0 latch (the special function  
H
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 1s, and the contents of the port 2 SFR are not  
modified.  
If 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. It 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  
4-1  
External Bus Interface  
C515  
a)  
One Machine Cycle  
One Machine Cycle  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
ALE  
PSEN  
RD  
(A)  
without  
MOVX  
PCH  
OUT  
PCH  
OUT  
PCH  
OUT  
PCH  
OUT  
P2  
P0  
INST.  
IN  
PCL  
OUT  
INST.  
IN  
PCL  
OUT  
INST.  
IN  
PCL  
OUT  
INST.  
IN  
PCL  
OUT  
INST.  
IN  
PCL OUT  
valid  
PCL OUT  
valid  
PCL OUT  
valid  
PCL OUT  
valid  
b)  
One Machine Cycle  
One Machine Cycle  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
ALE  
PSEN  
(B)  
with  
MOVX  
RD  
P2  
PCH  
OUT  
DPH OUT OR  
P2 OUT  
PCH  
OUT  
INST.  
IN  
PCL  
OUT  
INST.  
IN  
DATA  
IN  
PCL  
OUT  
INST.  
IN  
P0  
MCT03220  
PCL OUT  
valid  
DPL or Ri  
valid  
PCL OUT  
valid  
Figure 4-1  
External Program Memory Execution  
Semiconductor Group  
4-2  
 
External Bus Interface  
C515  
4.1.2 Timing  
The timing of the external bus interface, in particular the relationship between the control signals  
ALE, PSEN, RD, WR and information on port 0 and port 2, is illustated in figure 4-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.  
4.1.3 External Program Memory Access  
The external program memory is accessed under two conditions:  
- whenever signal EA is active (low); or  
- whenever the program counter (PC) content is greater than 1FFF  
H
When the CPU is executing out of external program memory, all 8 bits of port 2 are dedicated to an  
output function and must not be used for general-purpose I/O. The content 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 C515-L 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 C515-L can never be used as general-purpose I/O. This also applies to the  
C515-1R when it operates with only an external program memory.  
4.2 PSEN, Program Store Enable  
The read strobe for external program memory fetches is PSEN. It is not activated for internal  
program memory fetches. When the CPU is accessing external program memory, PSEN is  
activated twice every instruction 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 6 oscillator periods. A complete PSEN cycle, including activation and deactivation of ALE and  
PSEN, takes 3 oscillator periods. The execution sequence for these two types of read cycles is  
shown in figure 4-1 a) and b).  
4.3 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 C515 the external program and data memory spaces can be combined  
by the logical-AND of PSEN and RD. A positive result from this AND operation produces a low  
active 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  
4-3  
External Bus Interface  
C515  
4.4 ALE, Address Latch Enable  
The C515 allows to switch off the ALE output signal. If the internal ROM is used (EA=1 and  
PC £ 1FFF ) and ALE is switched off by EALE=0, then, ALE will only go active during external data  
H
memory accesses (MOVX instructions). If EA=0, the ALE generation is always enabled and the bit  
EALE has no effect.  
After a hardware reset the ALE generation is enabled.  
Special Function Register SYSCON (Address B1 )  
H
Reset Value : XX1XXXXX  
B
Bit No. MSB  
LSB  
7
6
5
4
3
2
1
0
B1  
SYSCON  
EALE  
H
Bit  
Function  
EALE  
Enable ALE output  
EALE = 0 : ALE generation is disabled; disables ALE signal generation  
during internal code memory accesses (EA=1). With EA=1,  
ALE is automatically generated at MOVX instructions.  
EALE = 1 : ALE generation is enabled  
If EA=0, the ALE generation is always enabled and the bit EALE has no  
effect on the ALE generation.  
Reserved bits for future use, read by CPU returns undefined values.  
Note: The ALE swicth-off feature is available in C515-LM/1RM versions only. In case of the  
C515-LN/1RN versions, the SYSCON register is present without function.  
Semiconductor Group  
4-4  
External Bus Interface  
C515  
4.5 Enhanced Hooks Emulation Concept  
The Enhanced Hooks Emulation Concept of the C500 microcontroller family is a new, innovative  
way to control the execution of C500 MCUs and to gain extensive information on the internal  
operation of the controllers. Emulation of on-chip ROM based programs is possible, too.  
Each C500 production chip has built-in logic for the support of the Enhanced Hooks Emulation  
Concept. Therefore, no costly bond-out chips are necessary for emulation. This also ensure that  
emulation and production chips are identical.  
1)  
The Enhanced Hooks TechnologyTM , which requires embedded logic in the C500 allows the C500  
together with an EH-IC to function similar to a bond-out chip. This simplifies the design and reduces  
costs of an ICE-system. ICE-systems using an EH-IC and a compatible C500 are able to emulate  
all operating modes of the different versions of the C500 microcontrollers. This includes emulation  
of ROM, ROM with code rollover and ROMless modes of operation. It is also able to operate in  
single step mode and to read the SFRs after a break.  
ICE-System Interface  
to Emulation Hardware  
RESET  
SYSCON  
PCON  
RSYSCON  
RPCON  
EA  
ALE  
EH-IC  
TCON  
RTCON  
PSEN  
C500  
MCU  
Enhanced Hooks  
Interface Circuit  
Port 0  
Port 2  
Optional  
I/O Ports  
Port 3 Port 1  
RPort 2 RPort 0  
TEA TALE TPSEN  
MCS02647  
Target System Interface  
Figure 4-2  
Basic C500 MCU Enhanced Hooks Concept Configuration  
Port 0, port 2 and some of the control lines of the C500 based MCU are used by Enhanced Hooks  
Emulation Concept to control the operation of the device during emulation and to transfer  
informations about the program execution and data transfer between the external emulation  
hardware (ICE-system) and the C500 MCU.  
1 “Enhanced Hooks Technology“ is a trademark and patent of Metalink Corporation licensed to Siemens.  
Semiconductor Group  
4-5  
External Bus Interface  
C515  
4.6 ROM Protection for the C515  
The C515-1R allows to protect the contents of the internal ROM against unauthorized read out. The  
type of ROM protection (protected or unprotected) is fixed with the ROM mask. Therefore, the  
customer of a C515-1R version has to define whether ROM protection has to be selected or not.  
The C515-1R devices, which operate from internal ROM, are always checked for correct ROM  
contents during production test. Therefore, unprotected as well as protected ROMs must provide a  
procedure to verify the ROM contents. In ROM verification mode 1, which is used to verify  
unprotected ROMs, a ROM address is applied externally to the C515-1R and the ROM data byte is  
output at port 0. ROM verification mode 2, which is used to verify ROM protected devices, operates  
different : ROM addresses are generated internally and the expected data bytes must be applied  
externally to the device (by the manufacturer or by the customer) and are compared internally with  
the data bytes from the ROM. After 16 byte verify operations the state of the P3.5 pin shows whether  
the last 16 bytes have been verified correctly.  
This mechanism provides a very high security of ROM protection. Only the owner of the ROM code  
and the manufacturer who know the contents of the ROM can read out and verify it with less effort.  
The behaviour of the move code instruction, when the code is executed from the external ROM, is  
in such a way that accessing a code byte from a protected on-chip ROM address is not possible. In  
this case the state of the EA pin is always latched with the rising edge of RESET and the byte  
accessed will be invalid.  
4.6.1 Unprotected ROM Mode  
If the ROM is unprotected, the ROM verification mode 1 as shown in figure 4-3 is used to read out  
the contents of the ROM. The AC timing characteristics of the ROM verification mode is shown in  
the AC specifications (chapter 10).  
P1.0 - P1.7  
P2.0 - P2.4  
Address 1  
Address 2  
Port 0  
Data 1 Out  
Data 2 Out  
Inputs: PSEN = VSS  
ALE, EA = VIH /VIH2  
RESET = VIL2  
MCT03221  
Figure 4-3  
ROM Verification Mode 1  
ROM verification mode 1 is selected if the inputs PSEN, ALE, EA, and RESET are put to the  
specified logic level. Then the 14-bit address of the internal ROM byte to be read is applied to the  
port 1 and port 2 lines. After a delay time, port 0 outputs the content of the addressed ROM cell. In  
ROM verification mode 1, the C515 must be provided with a system clock at the XTAL pins and  
pullup resistors on the port 0 lines.  
Semiconductor Group  
4-6  
 
External Bus Interface  
C515  
4.6.2 Protected ROM Mode  
If the ROM is protected, the ROM verification mode 2 as shown in figure 4-4 is used to verify the  
contents of the ROM. The detailed timing characteristics of the ROM verification mode is shown in  
the AC specifications (chapter 10).  
RESET  
12 tCLCL  
6 tCLCL  
1. ALE Pulse  
after Reset  
ALE  
Latch  
Data for  
Latch  
Latch  
Data for  
Latch  
Data for  
Addr. 1  
Data for  
Data for  
Port 0  
P3.5  
Addr. 0  
Addr. X-16-1  
Addr. X-16  
Addr. x-16+1  
Low : Error  
High : OK  
Inputs : ALE =VSS  
PSEN, EA =VIH  
RESET =  
MCT03222  
Figure 4-4  
ROM Verification Mode 2  
ROM verification mode 2 is selected if the inputs PSEN, EA, and ALE are put to the specified logic  
levels. With RESET going inactive, the ROM verification mode 2 sequence is started. The C515  
outputs an ALE signal with a period of 3 CLP and expects data bytes at port 0. The data bytes at port  
0 are assigned to the ROM addresses in the following way :  
1. Data Byte = content of internal ROM address 0000  
H
2. Data Byte = content of internal ROM address 0001  
H
3. Data Byte = content of internal ROM address 0002  
H
:
16. Data Byte= content of internal ROM address 000F  
:
H
The C515-1R does not output any address information during the ROM verification mode 2. The  
first data byte to be verified is always the byte which is assigned to the internal ROM address 0000  
H
and is put onto the data bus with the first rising edge of ALE. With each following ALE pulse the  
ROM address pointer is internally incremented and the expected data byte for the next ROM  
address must be delivered externally.  
Between two ALE pulses the data at port 0 is latched (at 3 CLP after ALE rising edge) and compared  
internally with the ROM content of the actual address. If an verify error is detected, the error  
Semiconductor Group  
4-7  
 
External Bus Interface  
C515  
condition is stored internally. After each 16th data byte the cumulated verify result (pass or fail) of  
the last 16 verify operations is output at P3.5. This means that P3.5 stays at static level (low for fail  
and high for pass) during the 16 bytes are checked. In ROM verification mode 2, the C515 must be  
provided with a system clock at the XTAL pins.  
Figure 4-5 shows an application example of an external circuitry which allows to verify a protected  
ROM inside the C515-1R in ROM verification mode 2. With RESET going inactive, the C515-1R  
starts the ROM verify sequence. Its ALE is clocking a 13-bit address counter. This counter  
generates the addresses for an external EPROM which is programmed with the contents of the  
internal (protected) ROM. The verify detect logic typically displays the pass/fail information of the  
verify operation. P3.5 can be latched with the falling edge of ALE.  
When the last byte of the internal ROM has been handled, the C515-1R starts generating a PSEN  
signal. This signal or the CY signal of the address counter indicate to the verify detect logic the end  
of the internal ROM verification.  
P3.5  
Verify  
Detect  
Logic  
Carry  
CLK  
ALE  
13-Bit  
Address  
Counter  
2 k  
W
A0 - A12  
S
C515-1R  
&
RESET  
Compare  
Code  
ROM  
VCC  
&
Port 0  
EA  
D0 - D7  
VCC  
PSEN  
CS  
OE  
MCS03223  
Figure 4-5  
ROM Verification Mode 2 - External Circuitry Example  
Semiconductor Group  
4-8  
 
Reset / System Clock  
C515  
5
Reset and System Clock Operation  
5.1 Hardware Reset Operation  
The hardware reset function incorporated in the C515 allows for an easy automatic start-up 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 is to be terminated.  
Additional to the hardware reset, which is applied externally to the C515, there exists another  
internal reset source, the watchdog timer. This chapter deals only with the external hardware reset.  
The reset input is an active low input. 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 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 or driven  
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).  
At the reset pin, a pullup resistor is internally connected to VCC to allow a power-up reset with an  
external capacitor only. An automatic power-up reset can be obtained when VCC is applied by  
connecting the reset pin to VSS via a capacitor. After VCC has been turned on, the capacitor must hold  
the voltage level at the reset pin for a specific time to effect a complete reset.  
Semiconductor Group  
5-1  
Reset / System Clock  
C515  
The time required for a reset operation 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  
typically met using a capacitor of 4.7 to 10 mF. The same considerations apply if the reset signal is  
generated externally (figure 5-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.  
a)  
b)  
&
RESET  
RESET  
+
C515  
C515  
c)  
RESET  
+
C515  
MCS03203  
Figure 5-1  
Reset Circuitries  
A correct reset leaves the processor in a defined state. The program execution starts at location  
0000 . After reset is internally accomplished the port latches are set to FF . This leaves port 0  
H
H
floating, since it is an open drain port when not used as data/address bus. All other I/O port lines  
(ports 1 to 5) output a one (1). Port 6 is an input-only port. It has no internal latch and therefore the  
contents of the special function registers P6 depend on the levels applied to port 6.  
The content of the internal RAM of the C515 is not affected by a reset. After power-up the content  
is undefined, while it remains unchanged during a reset if the power supply is not turned off.  
Semiconductor Group  
5-2  
Reset / System Clock  
C515  
5.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) the internal reset procedure is started. It 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 also performed  
if there is no clock available at the device. (This is done by the oscillator watchdog, which provides  
an auxiliary clock for performing a perfect reset without clock at the XTAL1 and XTAL2 pins). The  
RESET signal must be active for at least one machine cycle; after this time the C515 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 5-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  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
S3  
S4  
S5  
S6  
S1  
S2  
P1 P2  
RESET  
P0  
PCL  
OUT  
Inst. PCL  
IN OUT  
PCH  
OUT  
PCH  
OUT  
P2  
ALE  
MCT01879  
Figure 5-2  
CPU Timing after Reset  
Semiconductor Group  
5-3  
 
Reset / System Clock  
C515  
5.3 Oscillator and Clock Circuit  
XTAL1 and XTAL2 are the output and input of a single-stage on-chip inverter which can be  
configured with off-chip components as a Pierce oscillator. The oscillator, in any case, drives the  
internal clock generator. The clock generator provides the internal clock signals to the chip. These  
signals define the internal phases, states and machine cycles.  
Figure 5-3 shows the recommended oscillator circuit.  
C
XTAL2  
1 - 24 MHz  
C
C515  
XTAL1  
C = 20 pF ± 10 pF for Crystal Operation  
MCS03225  
Figure 5-3  
Recommended Oscillator Circuitry  
In this application the on-chip oscillator is used as a crystal-controlled, positive-reactance oscillator  
(a more detailed schematic is given in figure 5-4). lt is operated in its fundamental response mode  
as an inductive reactor in parallel resonance with a capacitor external to the chip. The crystal  
specifications and capacitances are non-critical. In this circuit 20 pF can be used as single  
capacitance at any frequency together with a good quality crystal. A ceramic resonator can be used  
in place of the crystal in cost-critical applications. If a ceramic resonator is used, the two capacitors  
normally have different values depending on the oscillator frequency. We recommend consulting  
the manufacturer of the ceramic resonator for value specifications of these capacitors.  
Semiconductor Group  
5-4  
 
Reset / System Clock  
C515  
To Internal  
Timing Circuitry  
C515  
XTAL1  
XTAL2  
1)  
C1  
C2  
1)  
MCS03226  
Crystal or Ceramic Resonator  
Figure 5-4  
On-Chip Oscillator Circuitry  
To drive the C515 with an external clock source, the external clock signal has to be applied to  
XTAL2, as shown in figure 5-5. XTAL1 has to be left unconnected. A pullup resistor is suggested  
(to increase the noise margin), but is optional if VOH of the driving gate corresponds to the VIH2  
specification of XTAL2.  
VCC  
C515  
N.C.  
XTAL1  
External  
Clock Signal  
XTAL2  
MCS03227  
Figure 5-5  
External Clock Source  
Semiconductor Group  
5-5  
 
Reset / System Clock  
C515  
5.4 System Clock Output  
For peripheral devices requiring a system clock, the C515 provides a clock output signal derived  
from the oscillator frequency as an alternate output function on pin P1.6/CLKOUT. lf bit CLK is set  
(bit 6 of special function register ADCON), a clock signal with 1/12 of the oscillator frequency is  
gated to pin P1.6/CLKOUT. To use this function the port pin must be programmed to a one (1),  
which is also the default after reset.  
Special Function Register ADCON (Address D8 )  
H
Reset Value : 00X000000  
B
LSB  
D8  
MSB  
Bit No.  
D8  
DF  
DE  
DD  
DC  
DB  
DA  
D9  
H
H
H
H
H
H
H
H
BD  
CLK  
BSY  
ADM  
MX2  
MX1  
MX0  
ADCON  
H
The shaded bits are not used for clock output control.  
Bit  
Function  
CLK  
Clockout enable bit  
When set, pin P1.6/CLKOUT outputs the system clock which is 1/12 of the  
oscillator frequency.  
Reserved bit for future use. Read by CPU returns undefined value.  
The system clock is high during S3P1 and S3P2 of every machine cycle and low during all other  
states. Thus, the duty cycle of the clock signal is 1:6. Associated with a MOVX instruction the  
system clock coincides with the last state (S3) in which a RD or WR signal is active. A timing  
diagram of the system clock output is shown in figure 5-6.  
Note : During slow-down operation the frequency of the CLKOUT signal is divided by 8.  
Semiconductor Group  
5-6  
Reset / System Clock  
C515  
S6 S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 S1 S2  
ALE  
PSEN  
RD,WR  
CLKOUT  
MCT01858  
Figure 5-6  
Timing Diagram - System Clock Output  
Semiconductor Group  
5-7  
On-Chip Peripheral Components  
C515  
6
On-Chip Peripheral Components  
This chapter gives detailed information about all on-chip peripherals of the C515 except for the  
integrated interrupt controller, which is described separately in chapter 7.  
6.1  
Parallel I/O  
The C515 has six 8-bit I/O ports and one 8-bit input port for analog/digital input. Port 0 is an open-  
drain bidirectional I/O port, while ports 1 to 5 are quasi-bidirectional I/O ports with internal pullup  
resistors. That means, when configured as inputs, ports 1 to 5 will be pulled high and will source  
current when externally pulled low. Port 0 will float when configured as input.  
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, time  
multiplexed 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. In this function, port 0 is not an open-drain port, but uses a strong internal pullup FET .  
6.1.1  
Port Structures  
The C515 generally allows digital I/O on 48 lines grouped into 6 bidirectional C501 compatible 8-bit  
ports and one 8-bit analog/digital input port. Each port bit (except port 6) consists of a latch, an  
output driver and an input buffer. Read and write accesses to the I/O ports P0 to P5 are performed  
via their corresponding special function registers. Depending on the specific ports, multiple  
functions are assigned to the port pins. These alternate functions of the port pins are listed in  
table 6-1.  
When port 6 is used as analog input, an analog channel is switched to the A/D converter through a  
3-bit multiplexer, which is controlled by three bits in SFR ADCON (see chapter 6.4). Port 6 lines  
may also be used as digital inputs. In this case they are addressed as an input port via SFR P6.  
Since port 6 has no internal latch, the contents of SFR P6 only depends on the levels applied to the  
input lines. It makes no sense to output a value to these input-only port by writing to the SFR P6.  
This will have no effect.  
Semiconductor Group  
6-1  
On-Chip Peripheral Components  
C515  
Table 6-1  
Alternate Functions of Port 1 and 3  
Port  
Alternate  
Description  
Functions  
P1.0  
P1.1  
P1.2  
P1.3  
P1.4  
P1.5  
P1.6  
P1.7  
INT3 / CC0  
INT4 / CC1  
INT5 / CC2  
INT6 / CC3  
INT2  
T2EX  
CLKOUT  
T2  
External Interrupt 3 input / Capture/compare 0 input/output  
External Interrupt 4 input / Capture/compare 1 input/output  
External Interrupt 5 input / Capture/compare 2 input/output  
External Interrupt 6 input / Capture/compare 3 input/output  
External Interrupt 2 input  
Timer 2 external reload/trigger input  
System clock output  
Timer 2 external count input  
P3.0  
P3.1  
RxD  
TxD  
Serial port’s receiver data input (asynchronous) or  
data input/output (synchronous)  
Serial port’s transmitter data output (asynchronous)  
or data clock output (synchronous)  
P3.2  
P3.3  
P3.4  
P3.5  
P3.6  
P3.7  
INT0  
INT1  
T0  
T1  
WR  
RD  
External interrupt 0 input, timer 0 gate control  
External interrupt 1 input, timer 1 gate control  
Timer 0 external count input  
Timer 1 external count input  
External data memory write strobe  
External data memory read strobe  
Semiconductor Group  
6-2  
 
On-Chip Peripheral Components  
C515  
6.1.2 Standard I/O Port Circuitry  
Figure 6-1 shows a functional diagram of a typical bit latch and I/O buffer, which is the core of each  
of the six 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  
P4) activate the "read-latch" signal, while others activate the "read-pin" signal.  
Read  
Latch  
Q
Int. Bus  
D
Port  
Latch  
Port  
Driver  
Circuit  
Port  
Pin  
Write  
to  
Latch  
Q
CLK  
MCS01822  
Read  
Pin  
Figure 6-1  
Basic Structure of a Port Circuitry  
Semiconductor Group  
6-3  
 
On-Chip Peripheral Components  
C515  
The output drivers of port 1 to 5 have internal pullup FET’s (see figure 6-2). Each I/O line can be  
used independently as an input or output. To be used as an input, the port bit stored in the bit latch  
must contain a one (1) (that means for figure 6-2: Q=0), which turns off the output driver FET n1.  
Then, for ports 1 to 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 called "quasi-bidirectional".  
Read  
Latch  
VCC  
Internal  
Pull Up  
Arrangement  
Q
Q
Pin  
Int. Bus  
D
Bit  
Latch  
Write  
to  
Latch  
n1  
CLK  
MCS01823  
Read  
Pin  
Figure 6-2  
Basic Output Driver Circuit of Ports 1 to 5  
Semiconductor Group  
6-4  
 
On-Chip Peripheral Components  
C515  
6.1.2.1 Port 0 Circuitry  
Port 0, in contrast to ports 1 to 4, 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 6-3) 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. If port 0 is configured as  
general I/O port and has to emit logic high-level (1), external pullups are required.  
Addr./Data  
VCC  
Control  
Read  
Latch  
&
=1  
Port  
Pin  
Int. Bus  
D
Q
Q
Bit  
Latch  
Write to  
Latch  
MUX  
CLK  
Read  
Pin  
MCS02434  
Figure 6-3  
Port 0 Circuitry  
Semiconductor Group  
6-5  
 
On-Chip Peripheral Components  
C515  
6.1.2.2 Port 1, Port 3 to Port 5 Circuitry  
The pins of ports 1, 3, 4, and 5 are multifunctional. They are port pins and also serve to implement  
special features as listed in table 6-1.  
Figure 6-4 shows a functional diagram of a port latch with alternate function. To pass the alternate  
function to the output pin and vice versa, however, the gate between the latch and driver circuit must  
be open. Thus, to use the alternate input or output functions, the corresponding bit latch in the port  
SFR has to contain a one (1); otherwise the pulldown FET is on and the port pin is stuck at 0. After  
reset all port latches contain ones (1).  
Alternate  
Output  
Function  
VCC  
Read  
Latch  
Internal  
Pull Up  
Arrangement  
Pin  
Q
Q
&
Int. Bus  
D
Bit  
Latch  
Write  
to  
Latch  
CLK  
MCS01827  
Read  
Pin  
Alternate  
Input  
Function  
Figure 6-4  
Ports 1, 3, 4 and 5  
Semiconductor Group  
6-6  
 
On-Chip Peripheral Components  
C515  
6.1.2.3 Port 2 Circuitry  
As shown in figure 6-3 and below in figure 6-5, 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. If the ports are configured as an address/data bus, the port latches  
are disconnected from the driver circuit. During this time, the P0/P2 SFR remains unchanged. Being  
an address/data bus, port 0 uses a pullup FET as shown in figure 6-3. When a 16-bit address is  
used, port 2 uses the additional strong pullups p1 (figure 6-6) to emit 1’s for the entire external  
memory cycle instead of the weak ones (p2 and p3) used during normal port activity.  
Addr. Control  
VCC  
Read  
Latch  
Internal  
Pull Up  
Arrangement  
Port  
Pin  
Int. Bus  
D
Q
Q
Bit  
Latch  
MUX  
Write to  
Latch  
CLK  
=1  
Read  
Pin  
MCS03228  
Figure 6-5  
Port 2 Circuitry  
If no external bus cycles are generated using data or code memory accesses, port 0 can be used  
for I/O functions.  
Semiconductor Group  
6-7  
 
On-Chip Peripheral Components  
C515  
Addr.  
Control  
VCC  
Q
_
<
1
MUX  
_
<
1
p1  
p2  
p3  
Delay  
1 State  
Port  
Pin  
= 1  
n1  
VSS  
= 1  
= 1  
Input Data (Read Pin)  
MCS03229  
Figure 6-6  
Port 2 Pull-up Arrangement  
Port 2 in I/O function works similar to the standard port driver circuitry (section 6.1.2.4) whereas in  
address output function it works similar to Port 0 circuitry.  
Semiconductor Group  
6-8  
On-Chip Peripheral Components  
C515  
6.1.2.4 Detailed Output Driver Circuitry  
In fact, the pullups mentioned before and included in figure 6-2, 6-4 and 6-5 are pullup  
arrangements.  
Figure 6-7 shows the detailed output driver (pullup arrangement) circuit of the the port 1 and 3 to 5  
port lines. The basic circuitry of these ports is shown in figure 6-4. The pullup arrangement of these  
port lines has one n-channel pulldown FET and three pullup FETs:  
VCC  
Delay = 1 State  
=1  
_
<
1
p1  
p2  
p3  
Port  
Pin  
n1  
Q
VSS  
=1  
=1  
Input Data  
(Read Pin)  
MCS03230  
Figure 6-7  
Driver Circuit of Ports 1, 3 to 6  
– The pulldown FET n1 is of n-channel type. It 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. This also means that no “0“ must be programmed into the latch of a pin that is used  
as input.  
– The pullup FET p1 is of p-channel type. It 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. It 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.  
Semiconductor Group  
6-9  
 
On-Chip Peripheral Components  
C515  
– The pullup FET p3 is of p-channel type. It 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 shall 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 . If, 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 capability 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  
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  
output 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.  
Semiconductor Group  
6-10  
On-Chip Peripheral Components  
C515  
6.1.3 Port Timing  
When executing an instruction that changes the value of a port latch, the new value arrives at the  
latch during S6P2 of the final cycle of the instruction. However, port latches are only sampled by  
their output buffers during phase 1 of any clock period (during phase 2 the output buffer holds the  
value it noticed during the previous phase 1). Consequently, the new value in the port latch will not  
appear at the output pin until the next phase 1, which will be at S1P1 of the next machine cycle.  
When an instruction reads a value from a port pin (e.g. MOV A, P1) the port pin is actually sampled  
in state 5 phase 1 or phase 2 depending on port and alternate functions. Figure 6-8 illustrates this  
port timing. It must be noted that this mechanism of sampling once per machine cycle is also used  
if a port pin is to detect an "edge", e.g. when used as counter input. In this case an "edge" is  
detected when the sampled value differs from the value that was sampled the cycle before.  
Therefore, there must be met certain reqirements on the pulse length of signals in order to avoid  
signal "edges" not being detected. The minimum time period of high and low level is one machine  
cycle, which guarantees that this logic level is noticed by the port at least once.  
S4  
S5  
S6  
S1  
S2  
S3  
P1 P2  
P1 P2  
P1 P2  
P1 P2  
P1 P2  
P1 P2  
XTAL2  
Input sampled:  
e.g. MOV A, P1  
P1 active for 1 State  
(driver transistor)  
Old Data  
New Data  
Port  
MCT03231  
Figure 6-8  
Port Timing  
Semiconductor Group  
6-11  
 
On-Chip Peripheral Components  
C515  
6.1.4 Port Loading and Interfacing  
The output buffers of ports 1 to 5 can drive TTL inputs directly. The maximum port load which still  
guarantees correct logic output levels can be be looked up in the DC characteristics in the Data  
Sheet of the C515 or in chapter 10 of this User’s Manual. The corresponding parameters are VOL  
and VOH.  
The same applies to port 0 output buffers. They do, however, require external pullups to drive  
floating inputs, except when being used as the address/data bus.  
When used as inputs it must be noted that the ports 1 to 5 are not floating but have internal pullup  
transistors. The driving devices must be capable of sinking a sufficient current if a logic low level  
shall be applied to the port pin (the parameters ITL and IIL in the DC characteristics specify these  
currents). Port 0 as well as port 1 programmed to analog input function, however, have floating  
inputs when used for digital input.  
Semiconductor Group  
6-12  
On-Chip Peripheral Components  
C515  
6.1.5 Read-Modify-Write Feature of Ports 0 to 5  
Some port-reading instructions read the latch and others read the pin. The instructions reading the  
latch rather than the pin read a value, possibly change it, and then rewrite it to the latch. These are  
called "read-modify-write"- instructions, which are listed in table 6-2. If the destination is a port or a  
port pin, these instructions read the latch rather than the pin. Note that all other instructions which  
can be used to read a port, exclusively read the port pin. In any case, reading from latch or pin,  
resp., is performed by reading the SFR P0, P2 and P3; for example, "MOV A, P3" reads the value  
from port 3 pins, while "ANL P3, #0AAH" reads from the latch, modifies the value and writes it back  
to the latch.  
It is not obvious that the last three instructions in table 6-2 are read-modify-write instructions, but  
they are. The reason is that they read the port byte, all 8 bits, modify the addressed bit, then write  
the complete byte back to the latch.  
Table 6-2  
"Read-Modify-Write"-Instructions  
Instruction  
ANL  
Function  
Logic AND; e.g. ANL P1, A  
ORL  
Logic OR; e.g. ORL P2, A  
XRL  
Logic exclusive OR; e.g. XRL P3, A  
Jump if bit is set and clear bit; e.g. JBC P1.1, LABEL  
Complement bit; e.g. CPL P3.0  
Increment byte; e.g. INC P4  
Decrement byte; e.g. DEC P5  
Decrement and jump if not zero; e.g. DJNZ P3, LABEL  
Move carry bit to bit y of port x  
Clear bit y of port x  
JBC  
CPL  
INC  
DEC  
DJNZ  
MOV Px.y,C  
CLR Px.y  
SETB Px.y  
Set bit y of port x  
The reason why read-modify-write instructions are directed to the latch rather than the pin is to avoid  
a possible misinterpretation of the voltage level at the pin. For example, a port bit might be used to  
drive the base of a transistor. When a "1" is written to the bit, the transistor is turned on. If the CPU  
then reads the same port bit at the pin rather than the latch, it will read the base voltage of the  
transitor (approx. 0.7 V, i.e. a logic low level!) and interpret it as "0". For example, when modifying  
a port bit by a SETB or CLR instruction, another bit in this port with the above mentioned  
configuration might be changed if the value read from the pin were written back to th latch. However,  
reading the latch rater than the pin will return the correct value of "1".  
Semiconductor Group  
6-13  
 
On-Chip Peripheral Components  
C515  
6.2 Timers/Counters  
The C515 contains three general purpose 16-bit timers/counters, timer 0, 1, and 2, which are useful  
in many applications for timing and counting.  
In "timer" function, the timer register is incremented every machine cycle. Thus one can think of it  
as counting machine cycles. Since a machine cycle consists of 12 oscillator periods, the counter  
rate is 1/12 of the oscillator frequency.  
In "counter" function, the register is incremented in response to a 1-to-0 transition (falling edge) at  
its corresponding external input pin, T0 or T1 (alternate functions of P3.4 and P3.5, resp.). In this  
function the external input is sampled during S5P2 of every machine cycle. When the samples show  
a high in one cycle and a low in the next cycle, the count is incremented. The new count value  
appears in the register during S3P1 of the cycle following the one in which the transition was  
detected. Since it takes two machine cycles (24 oscillator periods) to recognize a 1-to-0 transition,  
the maximum count rate is 1/24 of the oscillator frequency. There are no restrictions on the duty  
cycle of the external input signal, but to ensure that a given level is sampled at least once before it  
changes, it must be held for at least one full machine cycle.  
6.2.1  
Timer/Counter 0 and 1  
Timer / counter 0 and 1 of the C515 are fully compatible with timer / counter 0 and 1 of the C501  
and can be used in the same four operating modes:  
Mode 0: 8-bit timer/counter with a divide-by-32 prescaler  
Mode 1: 16-bit timer/counter  
Mode 2: 8-bit timer/counter with 8-bit auto-reload  
Mode 3: Timer/counter 0 is configured as one 8-bit timer/counter and one 8-bit timer; Timer/  
counter 1 in this mode holds its count. The effect is the same as setting TR1 = 0.  
External inputs INT0 and INT1 can be programmed to function as a gate for timer/counters 0 and 1  
to facilitate pulse width measurements.  
Each timer consists of two 8-bit registers (TH0 and TL0 for timer/counter 0, TH1 and TL1 for timer/  
counter 1) which may be combined to one timer configuration depending on the mode that is  
established. The functions of the timers are controlled by two special function registers TCON and  
TMOD.  
In the following descriptions the symbols TH0 and TL0 are used to specify the high-byte and the  
low-byte of timer 0 (TH1 and TL1 for timer 1, respectively). The operating modes are described and  
shown for timer 0. If not explicity noted, this applies also to timer 1.  
Semiconductor Group  
6-14  
On-Chip Peripheral Components  
C515  
6.2.1.1 Timer/Counter 0 and 1 Registers  
Totally six special function registers control the timer/counter 0 and 1 operation :  
– TL0/TH0 and TL1/TH1 - counter registers, low and high part  
– TCON and TMOD - control and mode select registers  
Special Function Register TL0 (Address 8A )  
H
Reset Value : 00  
H
H
H
H
Special Function Register TH0 (Address 8C )  
H
Reset Value : 00  
Reset Value : 00  
Reset Value : 00  
Special Function Register TL1 (Address 8B )  
H
Special Function Register TH1 (Address 8D )  
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
8A  
H
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
TL0  
TH0  
8C  
H
.7  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
8B  
H
.7  
.7  
.6  
.6  
.5  
.5  
.4  
.4  
.3  
.3  
.2  
.2  
.1  
.1  
.0  
.0  
TL1  
TH1  
8D  
H
Bit  
Function  
TLx.7-0  
x=0-1  
Timer/counter 0/1 low register  
Operating Mode Description  
0
1
2
3
"TLx" holds the 5-bit prescaler value.  
"TLx" holds the lower 8-bit part of the 16-bit timer/counter value.  
"TLx" holds the 8-bit timer/counter value.  
TL0 holds the 8-bit timer/counter value; TL1 is not used.  
THx.7-0  
x=0-1  
Timer/counter 0/1 high register  
Operating Mode Description  
0
1
2
3
"THx" holds the 8-bit timer/counter value.  
"THx" holds the higher 8-bit part of the 16-bit timer/counter value  
"THx" holds the 8-bit reload value.  
TH0 holds the 8-bit timer value; TH1 is not used.  
Semiconductor Group  
6-15  
On-Chip Peripheral Components  
C515  
Special Function Register TCON (Address 88 )  
Reset Value : 00  
H
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
8F  
8E  
8D  
8C  
8B  
8A  
89  
88  
H
H
H
H
H
H
H
H
88  
H
TF1  
TR1  
TF0  
TR0  
IE1  
IT1  
IE0  
IT0  
TCON  
The shaded bits are not used in controlling timer/counter 0 and 1.  
Bit  
Function  
TR0  
Timer 0 run control bit  
Set/cleared by software to turn timer/counter 0 ON/OFF.  
TF0  
Timer 0 overflow flag  
Set by hardware on timer/counter overflow.  
Cleared by hardware when processor vectors to interrupt routine.  
TR1  
TF1  
Timer 1 run control bit  
Set/cleared by software to turn timer/counter 1 ON/OFF.  
Timer 1 overflow flag  
Set by hardware on timer/counter overflow.  
Cleared by hardware when processor vectors to interrupt routine.  
Semiconductor Group  
6-16  
On-Chip Peripheral Components  
C515  
Special Function Register TMOD (Address 89 )  
Reset Value : 00  
H
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
89  
H
Gate  
C/T  
M1  
M0  
Gate  
C/T  
M1  
M0  
TMOD  
Timer 1 Control  
Timer 0 Control  
Bit  
Function  
GATE  
Gating control  
When set, timer/counter "x" is enabled only while "INT x" pin is high and "TRx"  
control bit is set.  
When cleared timer "x" is enabled whenever "TRx" control bit is set.  
C/T  
Counter or timer select bit  
Set for counter operation (input from "Tx" input pin).  
Cleared for timer operation (input from internal system clock).  
M1  
M0  
Mode select bits  
M1  
M0  
Function  
0
0
8-bit timer/counter:  
"THx" operates as 8-bit timer/counter  
"TLx" serves as 5-bit prescaler  
0
1
1
0
16-bit timer/counter.  
"THx" and "TLx" are cascaded; there is no prescaler  
8-bit auto-reload timer/counter.  
"THx" holds a value which is to be reloaded into "TLx" each  
time it overflows  
1
1
Timer 0 :  
TL0 is an 8-bit timer/counter controlled by the standard  
timer 0 control bits. TH0 is an 8-bit timer only controlled by  
timer 1 control bits.  
Timer 1 :  
Timer/counter 1 stops  
Semiconductor Group  
6-17  
On-Chip Peripheral Components  
C515  
6.2.1.2 Mode 0  
Putting either timer/counter 0,1 into mode 0 configures it as an 8-bit timer/counter with a divide-by-  
32 prescaler. Figure 6-9 shows the mode 0 operation.  
In this mode, the timer register is configured as a 13-bit register. As the count rolls over from all 1’s  
to all 0’s, it sets the timer overflow flag TF0. The overflow flag TF0 then can be used to request an  
interrupt. The counted input is enabled to the timer when TR0 = 1 and either Gate = 0 or INT0 = 1  
(setting Gate = 1 allows the timer to be controlled by external input INT0, to facilitate pulse width  
measurements). TR0 is a control bit in the special function register TCON; Gate is in TMOD.  
The 13-bit register consists of all 8 bits of TH0 and the lower 5 bits of TL0. The upper 3 bits of TL0  
are indeterminate and should be ignored. Setting the run flag (TR0) does not clear the registers.  
Mode 0 operation is the same for timer 0 as for timer 1. Substitute TR0, TF0, TH0, TL0 and INT0 for  
the corresponding timer 1 signals in figure 6-9. There are two different gate bits, one for timer 1  
(TMOD.7) and one for timer 0 (TMOD.3).  
÷ 12  
OSC  
C/T = 0  
C/T = 1  
TL0  
(5 Bits)  
TH0  
(8 Bits)  
Interrupt  
TF0  
P3.4/T0  
Control  
&
TR0  
=1  
Gate  
_
<
1
P3.2/INTO  
MCS02583  
Figure 6-9  
Timer/Counter 0, Mode 0: 13-Bit Timer/Counter  
Semiconductor Group  
6-18  
 
On-Chip Peripheral Components  
C515  
6.2.1.3 Mode 1  
Mode 1 is the same as mode 0, except that the timer register is running with all 16 bits. Mode 1 is  
shown in figure 6-10.  
÷ 12  
OSC  
C/T = 0  
C/T = 1  
Interrupt  
TL0  
(8 Bits)  
TH0  
(8 Bits)  
TF0  
P3.4/T0  
Gate  
Control  
&
TR0  
=1  
_
<
1
P3.2/INTO  
MCS02095  
Figure 6-10  
Timer/Counter 0, Mode 1: 16-Bit Timer/Counter  
Semiconductor Group  
6-19  
 
On-Chip Peripheral Components  
C515  
6.2.1.4 Mode 2  
Mode 2 configures the timer register as an 8-bit counter (TL0) with automatic reload, as shown in  
figure 6-11. Overflow from TL0 not only sets TF0, but also reloads TL0 with the contents of TH0,  
which is preset by software. The reload leaves TH0 unchanged.  
Figure 6-11  
Timer/Counter 0,1, Mode 2: 8-Bit Timer/Counter with Auto-Reload  
Semiconductor Group  
6-20  
 
On-Chip Peripheral Components  
C515  
6.2.1.5 Mode 3  
Mode 3 has different effects on timer 0 and timer 1. Timer 1 in mode 3 simply holds its count. The  
effect is the same as setting TR1=0. Timer 0 in mode 3 establishes TL0 and TH0 as two seperate  
counters. The logic for mode 3 on timer 0 is shown in figure 6-12. TL0 uses the timer 0 control bits:  
C/T, Gate, TR0, INT0 and TF0. TH0 is locked into a timer function (counting machine cycles) and  
takes over the use of TR1 and TF1 from timer 1. Thus, TH0 now controls the "timer 1" interrupt.  
Mode 3 is provided for applications requiring an extra 8-bit timer or counter. When timer 0 is in mode  
3, timer 1 can be turned on and off by switching it out of and into its own mode 3, or can still be used  
by the serial channel as a baud rate generator, or in fact, in any application not requiring an interrupt  
from timer 1 itself.  
fOSC /12  
C/T = 0  
÷ 12  
OSC  
Interrupt  
TL0  
(8 Bits)  
TF0  
C/T = 1  
P3.4/T0  
Control  
&
TR1  
=1  
Gate  
_
<
1
P3.2/INT0  
Interrupt  
TH0  
(8 Bits)  
fOSC /12  
TR1  
TF1  
Control  
MCS02096  
Figure 6-12  
Timer/Counter 0, Mode 3: Two 8-Bit Timers/Counters  
Semiconductor Group  
6-21  
 
On-Chip Peripheral Components  
C515  
6.2.2 Timer/Counter 2 with Additional Compare/Capture/Reload  
The timer 2 with additional compare/capture/reload features is one of the most powerful peripheral  
units of the C515. lt can be used for all kinds of digital signal generation and event capturing like  
pulse generation, pulse width modulation, pulse width measuring etc.  
Timer 2 is designed to support various automotive control applications (ignition/injection-control,  
anti-lock-brake ... ) as well as industrial applications (DC-, three-phase AC- and stepper-motor  
control, frequency generation, digital-to-analog conversion, process control ...). Please note that  
this timer is not equivalent to timer 2 of the C501.  
The C515 timer 2 in combination with the compare/capture/reload registers allows the following  
operating modes:  
– Compare : up to 4 PWM signals with 65535 steps at maximum and 500 ns resolution  
– Capture  
– Reload  
: up to 4 high speed capture inputs with 500 ns resolution  
: modulation of timer 2 cycle time  
The block diagram in figure 6-13 shows the general configuration of timer 2 with the additional  
compare/capture/reload registers. The I/O pins which can used for timer 2 control are located as  
multifunctional port functions at port 1 (see table 6-3).  
Table 6-3  
Alternate Port Functions of Timer 2  
Pin Symbol  
Function  
P1.0 / INT3 / CC0  
P1.1 / INT4 / CC1  
P1.2 / INT5 / CC2  
P1.3 / INT6 / CC3  
P1.5 / T2EX  
Compare output / capture input for CRC register  
Compare output / capture input for CC register 1  
Compare output / capture input for CC register 2  
Compare output / capture input for CC register 3  
External reload trigger input  
P1.7 / T2  
External count or gate input to timer 2  
Semiconductor Group  
6-22  
 
On-Chip Peripheral Components  
C515  
P1.5/  
T2EX  
_
<
1
Sync.  
Sync.  
÷ 12  
EXF2  
Interrupt  
Request  
T2I0  
T2I1  
EXEN2  
Reload  
P1.7/  
T2  
&
Reload  
f OSC  
OSC  
÷ 24  
Timer 2  
TL2 TH2  
T2PS  
TF2  
Compare  
P1.0/  
INT3/  
CC0  
P1.1/  
INT4/  
CC1  
16 Bit  
Comparator  
16 Bit  
Comparator  
16 Bit  
Comparator  
16 Bit  
Comparator  
Input/  
Output  
Control  
P1.2/  
INT5/  
CC2  
Capture  
P1.2/  
INT6/  
CC3  
CCL3/CCH3  
CCL2/CCH2  
CCL1/CCH1  
CRCL/CRCH  
MCB03205  
Figure 6-13  
Timer 2 Block Diagram  
Semiconductor Group  
6-23  
On-Chip Peripheral Components  
C515  
6.2.2.1 Timer 2 Registers  
This chapter describes all timer 2 related special function registers of timer 2. The interrupt related  
SFRs are also included in this section. Table 6-4 summarizes all timer 2 SFRs.  
Table 6-4  
Special Function Registers of the Timer 2 Unit  
Symbol  
Description  
Address  
T2CON  
TL2  
TH2  
Timer 2 control register  
Timer 2, low byte  
Timer 2, high byte  
C8  
H
CC  
H
CD  
H
CCEN  
CRCL  
CRCH  
CCL1  
CCH1  
CCL2  
CCH2  
CCL3  
CCH3  
IEN0  
Compare / capture enable register  
Compare / reload / capture register, low byte  
Compare / reload / capture register, high byte  
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  
Interrupt enable register 0  
C1  
H
CA  
H
CB  
H
C2  
H
C3  
H
C4  
H
C5  
H
C6  
H
C7  
H
A8  
H
IEN1  
IRCON  
Interrupt enable register 1  
Interrupt control register  
B8  
H
C0  
H
Semiconductor Group  
6-24  
 
On-Chip Peripheral Components  
C515  
The T2CON timer 2 control register is a bitaddressable register which controls the timer 2 function  
and the compare mode of registers CRC, CC1 to CC3.  
Special Function Register T2CON (Address C8 )  
Reset Value : 00  
H
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
CF  
CE  
CD  
CC  
CB  
CA  
C9  
C8  
H
H
H
H
H
H
H
H
C8  
T2PS I3FR  
I2FR T2R1 T2R0 T2CM T2I1  
T2I0 T2CON  
H
The shaded bit is not used in controlling timer/counter 2.  
Bit  
Function  
Prescaler select bit  
T2PS  
When set, timer 2 is clocked in the “timer“ or “gated timer“ function with 1/24 of the  
oscillator frequency. When cleared, timer 2 is clocked with 1/12 of the oscillator  
frequency. T2PS must be 0 for the counter operation of timer 2.  
I3FR  
External interrupt 3 falling/rising edge flag  
Used for capture function in combination with register CRC. lf set, a capture to  
register CRC (if enabled) will occur on a positive transition at pin P1.0 / INT3 / CC0.  
lf I3FR is cleared, a capture will occur on a negative transition.  
T2R1  
T2R0  
Timer 2 reload mode selection  
T2R1  
T2R0  
Function  
0
1
1
X
0
1
Reload disabled  
Mode 0 : auto-reload upon timer 2 overflow (TF2)  
Mode 1 : reload on falling edge at pin P1.5 / T2EX.  
T2CM  
Compare mode bit for registers CRC, CC1 through CC3  
When set, compare mode 1 is selected. T2CM = 0 selects compare mode 0.  
T2I1  
T2I0  
Timer 2 input selection  
T2I1  
T2I0  
Function  
0
0
0
1
No input selected, timer 2 stops  
Timer function :  
input frequency = f /12 (T2PS = 0) or f /24 (T2PS = 1)  
osc  
osc  
1
1
0
1
Counter function : external input signal at pin P1.7 / T2  
Gated timer function : input controlled by pin P1.7 / T2  
Semiconductor Group  
6-25  
On-Chip Peripheral Components  
C515  
Special Function Register TL2 (Address CC )  
H
Reset Value : 00  
H
Special Function Register TH2 (Address CD )  
H
Reset Value : 00  
H
Special Function Register CRCL (Address CA )  
H
Special Function Register CRCH (Address CB )  
H
Reset Value : 00  
H
Reset Value : 00  
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
CC  
H
.7  
.6  
.5  
.4  
.3  
.2  
.1  
LSB  
TL2  
TH2  
CD  
H
MSB  
.6  
.5  
.4  
.3  
.2  
.1  
.0  
CA  
H
.7  
.6  
.6  
.5  
.5  
.4  
.4  
.3  
.3  
.2  
.2  
.1  
.1  
LSB  
.0  
CRCL  
CRCH  
CB  
H
MSB  
Bit  
Function  
TL2.7-0  
Timer 2 value low byte  
The TL2 register holds the 8-bit low part of the 16-bit timer 2 count value.  
TH2.7-0  
CRCL.7-0  
Timer 2 value high byte  
The TH2 register holds the 8-bit high part of the 16-bit timer 2 count value.  
Compare / reload / capture register low byte  
CRCL is the 8-bit low byte of the 16-bit reload register of timer 2. It is also used for  
compare/capture functions.  
CRCH.7-0  
Compare / reload / capture register high byte  
CRCH is the 8-bit high byte of the 16-bit reload register of timer 2. It is also used for  
compare/capture functions.  
Semiconductor Group  
6-26  
On-Chip Peripheral Components  
C515  
Special Function Register IEN0 (Address A8 )  
H
Reset Value : 00  
H
Special Function Register IEN1 (Address B8 )  
H
Reset Value : 00  
H
Special Function Register IRCON (Address C0 )  
H
Reset Value : 00  
H
LSB  
MSB  
Bit No.  
AF  
AE  
AD  
AC  
ES  
AB  
AA  
A9  
A8  
H
H
H
H
H
H
H
H
A8  
H
EAL  
WDT  
ET2  
ET1  
EX1  
ET0  
EX0  
IEN0  
Bit No.  
BF  
BE  
BD  
BC  
BB  
BA  
B9  
B8  
H
H
H
H
H
H
H
H
IEN1  
B8  
H
EXEN2 SWDT EX6  
EX5  
EX4  
EX3  
EX2 EADC  
Bit No.  
C7  
C6  
C5  
C4  
C3  
C2  
C1  
C0  
H
H
H
H
H
H
H
H
C0  
H
EXF2  
TF2  
IEX6  
IEX5  
IEX4  
IEX3  
IEX2 IADC  
IRCON  
The shaded bits are not used in timer/counter 2 interrupt control.  
Bit  
Function  
ET2  
Timer 2 overflow / external reload interrupt enable.  
If ET2 = 0, the timer 2 interrupt is disabled.  
If ET2 = 1, the timer 2 interrupt is enabled.  
EXEN2  
EXF2  
Timer 2 external reload interrupt enable  
If EXEN2 = 0, the timer 2 external reload interrupt is disabled.  
If EXEN2 = 1, the timer 2 external reload interrupt is enabled. The external reload  
function is not affected by EXEN2.  
Timer 2 external reload flag  
EXF2 is set when a reload is caused by a falling edge on pin T2EX while EXEN2 =  
1. If ET2 in IEN0 is set (timer 2 interrupt enabled), EXF2 = 1 will cause an interrupt.  
EXF2 can be used as an additional external interrupt when the reload function is  
not used. EXF2 must be cleared by software.  
TF2  
Timer 2 overflow flag  
Set by a timer 2 overflow and must be cleared by software. If the timer 2 interrupt  
is enabled, TF2 = 1 will cause an interrupt.  
Semiconductor Group  
6-27  
On-Chip Peripheral Components  
C515  
Special Function Register CCEN (Address C1 )  
Reset Value : 00  
H
H
Bit No.  
MSB  
7
LSB  
0
6
5
4
3
2
1
C1  
H
COCAH3 COCAL3 COCAH2 COCAL2 COCAH1 COCAL1 COCAH0 COCAL0  
CCEN  
Bit  
Function  
COCAH3  
COCAL3  
Compare/capture mode for CC register 3  
COCAH3 COCAL3  
Function  
0
0
1
1
0
1
0
1
Compare/capture disabled  
Capture on rising edge at pin P1.3 / INT6 / CC3  
Compare enabled  
Capture on write operation into register CCL3  
COCAH2  
COCAL2  
Compare/capture mode for CC register 2  
COCAH2 COCAL2  
Function  
0
0
1
1
0
1
0
1
Compare/capture disabled  
Capture on rising edge at pin P1.2 / INT5 / CC2  
Compare enabled  
Capture on write operation into register CCL2  
COCAH1  
COCAL1  
Compare/capture mode for CC register 1  
COCAH1 COCAL1  
Function  
0
0
1
1
0
1
0
1
Compare/capture disabled  
Capture on rising edge at pin P1.1 / INT4 / CC1  
Compare enabled  
Capture on write operation into register CCL1  
COCAH0  
COCAL0  
Compare/capture mode for CRC register  
COCAH0 COCAL0  
Function  
0
0
1
1
0
1
0
1
Compare/capture disabled  
Capture on falling/rising edge at pin P1.0 / INT3 / CC0  
Compare enabled  
Capture on write operation into register CRCL  
Semiconductor Group  
6-28  
On-Chip Peripheral Components  
C515  
6.2.2.2 Timer 2 Operation  
The timer 2, which is a 16-bit-wide register, can operate as timer, event counter, or gated timer. The  
detailed operation is described below.  
Timer Mode  
In timer function, the count rate is derived from the oscillator frequency. A prescaler offers the  
possibility of selecting a count rate of 1/12 or 1/24 of the oscillator frequency. Thus, the 16-bit timer  
register (consisting of TH2 and TL2) is either incremented in every machine cycle or in every second  
machine cycle. The prescaler is selected by bit T2PS in special function register T2CON. lf T2PS is  
cleared, the input frequency is 1/12 of the oscillator frequency. if T2PS is set, the 2:1 prescaler gates  
1/24 of the oscillator frequency to the timer.  
Gated Timer Mode  
In gated timer function, the external input pin P1.7 / T2 functions as a gate to the input of timer 2. lf  
T2 is high, the internal clock input is gated to the timer. T2 = 0 stops the counting procedure. This  
facilitates pulse width measurements. The external gate signal is sampled once every machine  
cycle.  
Event Counter Mode  
In the counter function, the timer 2 is incremented in response to a 1-to-0 transition at its  
corresponding external input pin P1.7 / T2 In this function, the external input is sampled every  
machine cycle. When the sampled inputs show a high in one cycle and a low in the next cycle, the  
count is incremented. The new count value appears in the timer register in the cycle following the  
one in which the transition was detected. Since it takes two machine cycles (24 oscillator periods)  
to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. There  
are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is  
sampled at least once before it changes, it must be held for at least one full machine cycle.  
Note: The prescaler must be off for proper counter operation of timer 2, i.e. T2PS must be 0.  
In either case, no matter whether timer 2 is configured as timer, event counter, or gated timer, a  
rolling-over of the count from all 1’s to all 0’s sets the timer overflow flag TF2 in SFR IRCON, which  
can generate an interrupt.  
lf TF2 is used to generate a timer overflow interrupt, the request flag must be cleared by the interrupt  
service routine as it could be necessary to check whether it was the TF2 flag or the external reload  
request flag EXF2 which requested the interrupt. Both request flags cause the program to branch to  
the same vector address.  
Semiconductor Group  
6-29  
On-Chip Peripheral Components  
C515  
Reload of Timer 2  
The reload mode for timer 2 is selected by bits T2R0 and T2R1 in SFR T2CON. Figure 6-14 shows  
the configuration of timer 2 in reload mode.  
Mode 0 : When timer 2 rolls over from all l’s to all 0’s, it not only sets TF2 but also causes the timer  
2 registers to be loaded with the 16-bit value in the CRC register, which is preset by  
software. The reload will happen in the same machine cycle in which TF2 is set, thus  
overwriting the count value 0000 .  
H
Mode 1 : When a 16-bit reload from the CRC register is caused by a negative transition at the  
corresponding input pin T2EX/P1.5. In addition, this transition will set flag EXF2, if bit  
EXEN2 in SFR IEN1 is set. lf the timer 2 interrupt is enabled, setting EXF2 will generate  
an interrupt. The external input pin T2EX is sampled in every machine cycle. When the  
sampling shows a high in one cycle and a low in the next cycle, a transition will be  
recognized. The reload of timer 2 registers will then take place in the cycle following the  
one in which the transition was detected.  
Input  
Clock  
TL2  
TH2  
T2EX  
P1.5  
Mode 1  
Mode 0  
Reload  
CRCL  
CRCH  
TF2  
_
<
Timer 2  
Interrupt  
Request  
1
EXF2  
MCS01903  
EXEN2  
Figure 6-14  
Timer 2 in Reload Mode  
Semiconductor Group  
6-30  
 
On-Chip Peripheral Components  
C515  
6.2.2.3 Compare Function of Registers CRC, CC1 to CC3  
The compare function of a timer/register combination can be described as follows. The 16-bit value  
stored in a compare/capture register is compared with the contents of the timer register. lf the count  
value in the timer register matches the stored value, an appropriate output signal is generated at a  
corresponding port pin, and an interrupt is requested.  
The contents of a compare register can be regarded as ’time stamp’ at which a dedicated output  
reacts in a predefined way (either with a positive or negative transition). Variation of this ’time stamp’  
somehow changes the wave of a rectangular output signal at a port pin. This may - as a variation  
of the duty cycle of a periodic signal - be used for pulse width modulation as well as for a continually  
controlled generation of any kind of square wave forms. Two compare modes are implemented to  
cover a wide range of possible applications.  
The compare modes 0 and 1 are selected by bit T2CM in special function register T2CON. In both  
compare modes, the new value arrives at the port pin 1 within the same machine cycle in which the  
internal compare signal is activated.  
The four registers CRC, CC1 to CC3 are multifunctional as they additionally provide a capture,  
compare or reload capability (the CRC register only). A general selection of the function is done in  
register CCEN. Please note that the compare interrupt CC0 can be programmed to be negative or  
positive transition activated. The internal compare signal (not the output signal at the port pin!) is  
active as long as the timer 2 contents is equal to the one of the appropriate compare registers, and  
it has a rising and a falling edge. Thus, when using the CRC register, it can be selected whether an  
interrupt should be caused when the compare signal goes active or inactive, depending on bit I3FR  
in T2CON. For the CC registers 1 to 3 an interrupt is always requested when the compare signal  
goes active (see figure 6-16).  
6.2.2.3.1 Compare Mode 0  
In mode 0, upon matching the timer and compare register contents, the output signal changes from  
low to high. lt goes back to a low level on timer overflow. As long as compare mode 0 is enabled,  
the appropriate output pin is controlled by the timer circuit only, and not by the user. Writing to the  
port will have no effect. Figure 6-15 shows a functional diagram of a port latch in compare mode 0.  
The port latch is directly controlled by the two signals timer overflow and compare. The input line  
from the internal bus and the write-to-latch line are disconnected when compare mode 0 is enabled.  
Compare mode 0 is ideal for generating pulse width modulated output signals, which in turn can be  
used for digital-to-analog conversion via a filter network or by the controlled device itself (e.g. the  
inductance of a DC or AC motor). Mode 0 may also be used for providing output clocks with initially  
defined period and duty cycle. This is the mode which needs the least CPU time. Once set up, the  
output goes on oscillating without any CPU intervention. Figure 6-16 and 6-17 illustrate the function  
of compare mode 0.  
Semiconductor Group  
6-31  
On-Chip Peripheral Components  
C515  
Port Circuit  
Read Latch  
VCC  
Compare Register  
Circuit  
Compare Reg.  
S
Q
Q
Port  
Pin  
Internal  
Bus  
16 Bit  
Comparator  
16 Bit  
D
Port  
Latch  
Write to  
Latch  
Compare  
Match  
CLK  
R
Timer Register  
Timer Circuit  
Timer  
Overflow  
Read Pin  
MCS02661  
Figure 6-15  
Port Latch in Compare Mode 0  
I3FR  
Interrupt  
IEXx  
Shaded Function  
for CRC only  
Compare Register CCx  
16-Bit  
Set Latch  
Comparator  
Compare Signal  
Reset Latch  
16-Bit  
Overflow  
TH2  
Timer 2  
TL2  
S
S
S
R
S
R
R
R
Q
Q
Q
Q
Interrupt  
P1.3/  
P1.2/  
P1.1/  
P1.0/  
INT6/  
CC3  
INT5/  
CC2  
INT4/  
CC1  
INT3/  
CC0  
MCS03233  
Figure 6-16  
Timer 2 with Registers CCx in Compare Mode 0  
Semiconductor Group  
6-32  
On-Chip Peripheral Components  
C515  
Timer Count = FFFF  
H
Timer Count =  
Compare Value  
Contents  
of  
~
~
Timer 2  
Timer Count = Reload Value  
Interrupt can be generated  
on overflow  
Compare  
Output  
(P1.x/CCx)  
MCT01906  
Interrupt can be generated  
on compare-match  
Figure 6-17  
Function of Compare Mode 0  
6.2.2.3.2 Modulation Range in Compare Mode 0  
Generally it can be said that for every PWM generation in compare mode 0 with n-bit wide compare  
n
registers there are 2 different settings for the duty cycle. Starting with a constant low level (0%duty  
cycle) as the first setting, the maximum possible duty cycle then would be :  
n
(1 - 1/2 ) x 100%  
This means that a variation of the duty cycle from 0% to real 100% can never be reached if the  
compare register and timer register have the same length. There is always a spike which is as long  
as the timer clock period.  
This “spike“ may either appear when the compare register is set to the reload value (limiting the  
lower end of the modulation range) or it may occur at the end of a timer period. In a timer 2/CCx  
register configuration in compare mode 0 this spike is divided into two halves: one at the beginning  
when the contents of the compare register is equal to the reload value of the timer; the other half  
when the compare register is equal to the maximum value of the timer register (here: FFFF ).  
H
Please refer to figure 6-18 where the maximum and minimum duty cycle of a compare output signal  
is illustrated. Timer 2 is incremented with the machine clock (fosc/12), thus at 24-MHz operational  
frequency, these spikes are both approx. 250 ns long.  
Semiconductor Group  
6-33  
On-Chip Peripheral Components  
C515  
a) CCHx/CCLx = 0000 or = CRCH/CRCL (maximum duty cycle)  
H
P1.x  
H
L
Appr. 1/2 Machine Cycle  
b) CCHx/CCLx = FFFF (minimum duty cycle)  
H
Appr. 1/2 Machine Cycle  
P1.x  
H
L
MCT01907  
Figure 6-18  
Modulation Range of a PWM Signal, generated with a Timer 2/CCx Register Combination in  
Compare Mode 0*  
The following example shows how to calculate the modulation range for a PWM signal. To calculate  
with reasonable numbers, a reduction of the resolution to 8-bit is used. Otherwise (for the maximum  
resolution of 16-bit) the modulation range would be so severely limited that it would be negligible.  
Example:  
Timer 2 in auto-reload mode; contents of reload register CRC = FF00  
H
Restriction of modulation range = 1 / 256 x 2 x 100% = 0.195%  
This leads to a variation of the duty cycle from 0.195% to 99.805% for a timer 2/CCx register  
configuration when 8 of 16 bits are used.  
Semiconductor Group  
6-34  
On-Chip Peripheral Components  
C515  
6.2.2.3.3 Compare Mode 1  
In compare mode 1, the software adaptively determines the transition of the output signal. lt is  
commonly used when output signals are not related to a constant signal perlod (as in a standard  
PWM Generation) but must be controlled very precisely with high resolution and without jitter. In  
compare mode 1, both transitions of a signal can be controlled. Compare outputs in this mode can  
be regarded as high speed outputs which are independent of the CPU activity.  
lf compare mode 1 is enabled and the software writes to the appropriate output latch at the port, the  
new value will not appear at the output pin until the next compare match occurs. Thus, one can  
choose whether the output signal is to make a new transition (1-to-0 or 0-to-1, depending on the  
actual pinlevel) or should keep its old value at the time the timer 2 count matches the stored  
compare value.  
Figure 6-19 and figure 6-20 show functional diagrams of the timer/compare register/port latch  
configuration in compare mode 1. In this function, the port latch consists of two separate latches.  
The upper latch (which acts as a “shadow latch“) can be written under software control, but its value  
will only be transferred to the output latch (and thus to the port pin) in response to a compare match.  
Note that the double latch structure is transparent as long as the internal compare signal is active.  
While the compare signal is active, a write operation to the port will then change both latches. This  
may become important when driving timer 2 with a slow external clock. In this case the compare  
signal could be active for many machine cycles in which the CPU could unintentionally change the  
contents of the port latch.  
A read-modify-write instruction will read the user-controlled „shadow latch“ and write the modified  
value back to this “shadow-latch“. A standard read instruction will - as usual - read the pin of the  
corresponding compare output.  
Semiconductor Group  
6-35  
On-Chip Peripheral Components  
C515  
Port Circuit  
Read Latch  
VCC  
Compare Register  
Circuit  
Compare Reg.  
Internal  
Bus  
D
Q
D
Q
Q
Port  
Pin  
16 Bit  
Comparator  
16 Bit  
Shadow  
Latch  
Port  
Latch  
Compare  
Match  
Write to  
Latch  
CLK  
CLK  
Timer Register  
Timer Circuit  
Read Pin  
MCS02662  
Figure 6-19  
Port Latch in Compare Mode 1  
I3FR  
Interrupt  
IEXx  
Shaded Function  
for CRC only  
Compare Register CCx  
16 Bit  
Port  
Latch  
Circuit  
Comparator  
Shadow Latch  
Compare Signal  
16 Bit  
Overflow  
Interrupt  
TH2  
TL2  
Timer 2  
Output Latch  
P1.7  
P1.3/  
P1.0/  
INT6/  
CC3  
INT3/  
CC0  
MCS02732  
Figure 6-20  
Timer 2 with Registers CCx in Compare Mode 1  
(CCx stands for CRC, CC1 to CC3, IEXx stands for IEX3 to IEX6)  
Semiconductor Group  
6-36  
On-Chip Peripheral Components  
C515  
6.2.2.4 Using Interrupts in Combination with the Compare Function  
The compare service of registers CRC, CC1, CC2 and CC3 is assigned to alternate output functions  
at port pins P1.0 to P1.3. Another option of these pins is that they can be used as external interrupt  
inputs. However, when using the port lines as compare outputs then the input line from the port pin  
to the interrupt system is disconnected (but the pin’s level can still be read under software control).  
Thus, a change of the pin’s level will not cause a setting of the corresponding interrupt flag. In this  
case, the interrupt input is directly connected to the (internal) compare signal thus providing a  
compare interrupt.  
The compare interrupt can be used very effectively to change the contents of the compare registers  
or to determine the level of the port outputs for the next “compare match“. The principle is, that the  
internal compare signal (generated at a match between timer count and register contents) not only  
manipulates the compare output but also sets the corresponding interrupt request flag. Thus, the  
current task of the CPU is interrupted - of course provided the priority of the compare interrupt is  
higher than the present task priority - and the corresponding interrupt service routine is called. This  
service routine then sets up all the necessary parameters for the next compare event.  
Advantages when using compare interrupts  
Firstly, there is no danger of unintentional overwriting a compare register before a match has been  
reached. This could happen when the CPU writes to the compare register without knowing about  
the actual timer 2 count.  
Secondly, and this is the most interesting advantage of the compare feature, the output pin is  
exclusively controlled by hardware therefore completely independent from any service delay which  
in real time applications could be disastrous. The compare interrupt in turn is not sensitive to such  
delays since it loads the parameters for the next event. This in turn is supposed to happen after a  
suff icient space of time.  
Please note two special cases where a program using compare interrupts could show a “surprising“  
behavior :  
The first configuration has already been mentioned in the description of compare mode 1. The fact  
that the compare interrupts are transition activated becomes important when driving timer 2 with a  
slow external clock. In this case it should be carefully considered that the compare signal is active  
as long as the timer 2 count is equal to the contents of the corresponding compare register, and that  
the compare signal has a rising and a falling edge. Furthermore, the “shadow latches“ used in  
compare mode 1 are transparent while the compare signal is active.  
Thus, with a slow input clock for timer 2, the comparator signal is active for a long time (= high  
number of machine cycles) and therefore a fast interrupt controlled reload of the compare register  
could not only change the “shadow latch“ - as probably intended - but also the output buffer.  
When using the CRC, you can select whether an interrupt should be generated when the compare  
signal goes active or inactive, depending on the status of bit I3FR in T2CON.  
Initializing the interrupt to be negative transition triggered is advisable in the above case. Then the  
compare signal is already inactive and any write access to the port latch just changes the contents  
of the “shadow-latch“.  
Please note that for CC registers 1 to 3 an interrupt is always requested when the compare signal  
goes active.  
Semiconductor Group  
6-37  
On-Chip Peripheral Components  
C515  
The second configuration which should be noted is when compare function is combined with  
negative transition activated interrupts. lf the port latch of port P1.0 contains a 1, the interrupt  
request flags IEX3 will immediately be set after enabling the compare mode for the CRC register.  
The reason is that first the external interrupt input is controlled by the pin’s level. When the compare  
option is enabled the interrupt logic input is switched to the internal compare signal, which carries  
a low level when no true comparison is detected. So the interrupt logic sees a 1-to-0 edge and sets  
the interrupt request flag.  
An unintentional generation of an interrupt during compare initialization can be prevented lf the  
request flag is cleared by software after the compare is activated and before the external interrupt  
is enabled.  
Semiconductor Group  
6-38  
On-Chip Peripheral Components  
C515  
6.2.2.5 Capture Function  
Each of the compare/capture registers CC1 to CC3 and the CRC register can be used to latch the  
current 16-bit value of the timer 2 registers TL2 and TH2. Two different modes are provided for this  
function. In mode 0, an external event latches the timer 2 contents to a dedicated capture register.  
In mode 1, a capture will occur upon writing to the low order byte of the dedicated 16-bit capture  
register. This mode is provided to allow the software to read the timer 2 contents “on-the-fly“.  
In mode 0, the external event causing a capture is :  
– for CC registers 1 to 3: a positive transition at pins CC1 to CC3 of port 1  
– for the CRC register:  
a positive or negative transition at the corresponding pin, depending  
on the status of the bit I3FR in SFR T2CON. lf the edge flag is  
cleared, a capture occurs in response to a negative transition; lf the  
edge flag is set a capture occurs in response to a positive transition  
at pin P1.0 / INT3 / CC0.  
In both cases the appropriate port 1 pin is used as input and the port latch must be programmed to  
contain a one (1). The external input is sampled in every machine cycle. When the sampled input  
shows a low (high) level in one cycle and a high (low) in the next cycle, a transition is recognized.  
The timer 2 contents is latched to the appropriate capture register in the cycle following the one in  
which the transition was identified.  
In mode 0 a transition at the external capture inputs of registers CC1 to CC3 will also set the  
corresponding external interrupt request flags IEX3 to IEX6. lf the interrupts are enabled, an  
external capture signal will cause the CPU to vector to the appropriate interrupt service routine.  
In mode 1 a capture occurs in response to a write instruction to the low order byte of a capture  
register. The write-to-register signal (e.g. write-to-CRCL) is used to initiate a capture. The value  
written to the dedicated capture register is irrelevant for this function. The timer 2 contents will be  
latched into the appropriate capture register in the cycle following the write instruction. In this mode  
no interrupt request will be generated.  
Figure 6-21 illustrates the operation of the CRC register, while figure 6-22 shows the operation of  
the compare/capture registers 1 to 3.  
The two capture modes can be established individually for each capture register by bits in SFR  
CCEN (compare/capture enable register). That means, in contrast to the compare modes, it is  
possible to simultaneously select mode 0 for one capture register and mode 1 for another register.  
Semiconductor Group  
6-39  
On-Chip Peripheral Components  
C515  
Timer 2  
Interrupt  
Request  
Input  
Clock  
TL2  
TH2  
TF2  
"Write to  
CRCL"  
Mode 1  
Mode 0  
Capture  
P1.0/INT 3/  
CC0  
T2  
CRCL  
CRCH  
CON.6  
External  
Interrupt 3  
Request  
IEX3  
MCS01909  
Figure 6-21  
Timer 2 - Capture with Register CRC  
Timer 2  
Interrupt  
Request  
Input  
Clock  
TL2  
TH2  
TF2  
"Write to  
CCL1"  
Mode 1  
Mode 0  
Capture  
CCL1  
CCH1  
External  
Interrupt 4  
Request  
P1.1/INT4/  
CC1  
IEX4  
MCS01910  
Figure 6-22  
Timer 2 - Capture with Registers CC1 to CC3  
Semiconductor Group  
6-40  
On-Chip Peripheral Components  
C515  
6.3 Serial Interface  
The serial port of the C515 is full duplex, meaning it can transmit and receive simultaneously. It is  
also receive-buffered, meaning it can commence reception of a second byte before a previously  
received byte has been read from the receive register (however, if the first byte still hasn’t been read  
by the time reception of the second byte is complete, one of the bytes will be lost). The serial port  
receive and transmit registers are both accessed at special function register SBUF. Writing to SBUF  
loads the transmit register, and reading SBUF accesses a physically separate receive register.  
The serial port can operate in 4 modes (one synchronous mode, three asynchronous modes). The  
baud rate clock for the serial port is derived from the oscillator frequency (mode 0, 2) or generated  
either by timer 1 or by a dedicated baud rate generator (mode 1, 3).  
Mode 0, Shift Register (Synchronous) Mode:  
Serial data enters and exits through RxD. TxD outputs the shift clock. 8 data bits are transmitted/  
received: (LSB first). The baud rate is fixed at 1/12 of the oscillator frequency. (See section 6.3.4 for  
more detailed information)  
Mode 1, 8-Bit UART, Variable Baud Rate:  
10 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits (LSB  
first), and a stop bit (1). On receive, the stop bit goes into RB8 in special function register SCON.  
The baud rate is variable. (See section 6.3.5 for more detailed information)  
Mode 2, 9-Bit UART, Fixed Baud Rate:  
11 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits (LSB  
first), a programmable 9th bit, and a stop bit (1). On transmit, the 9th data bit (TB8 in SCON) can be  
assigned to the value of 0 or 1. Or, for example, the parity bit (P, in the PSW) could be moved into  
TB8. On receive, the 9th data bit goes into RB8 in special function register SCON, while the stop bit  
is ignored. The baud rate is programmable to either 1/32 or 1/64 of the oscillator frequency. (See  
section 6.3.6 for more detailed information)  
Mode 3, 9-Bit UART, Variable Baud Rate:  
11 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits (LSB  
first), a programmable 9th data bit, and a stop bit (1). In fact, mode 3 is the same as mode 2 in all  
respects except the baud rate. The baud rate in mode 3 is variable. (See section 6.3.6 for more  
detailed information)  
In all four modes, transmission is initiated by any instruction that uses SBUF as a destination  
register. Reception is initiated in mode 0 by the condition RI = 0 and REN = 1. Reception is initiated  
in the other modes by the incoming start bit if REN = 1. The serial interfaces also provide interrupt  
requests when a transmission or a reception of a frame has completed. The corresponding interrupt  
request flags for serial interface 0 are TI or RI, resp. See chapter 7 of this user manual for more  
details about the interrupt structure. The interrupt request flags TI and RI can also be used for  
polling the serial interface 0 if the serial interrupt is not to be used (i.e. serial interrupt 0 not enabled).  
Semiconductor Group  
6-41  
On-Chip Peripheral Components  
C515  
6.3.1 Multiprocessor Communication  
Modes 2 and 3 have a special provision for multiprocessor communications. In these modes, 9 data  
bits are received. The 9th one goes into RB8. Then a stop bit follows. The port can be programmed  
such that when the stop bit is received, the serial port interrupt will be activated only if RB8 = 1. This  
feature is enabled by setting bit SM2 in SCON. A way to use this feature in multiprocessor systems  
is as follows.  
When the master processor wants to transmit a block of data to one of several slaves, it first sends  
out an address byte which identifies the target slave. An address byte differs from a data byte in  
that the 9th bit is 1 in an address byte and 0 in a data byte. With SM2 = 1, no slave will be interrupted  
by a data byte. An address byte, however, will interrupt all slaves, so that each slave can examine  
the received byte and see if it is beeing addressed. The addressed slave will clear its SM2 bit and  
prepare to receive the data bytes that will be coming. The slaves that weren't being addressed leave  
their SM2s set and go on about their business, ignoring the incoming data bytes.  
SM2 has no effect in mode 0. SM2 can be used in mode 1 to check the validity of the stop bit. In a  
mode 1 reception, if SM2 = 1, the receive interrupt will not be activated unless a valid stop bit is  
received.  
6.3.2 Serial Port Registers  
The serial port control and status register is the special function register SCON. This register  
contains not only the mode selection bits, but also the 9th data bit for transmit and receive (TB8 and  
RB8), and the serial port interrupt bits (TI and RI).  
SBUF is the receive and transmit buffer of serial interface 0. Writing to SBUF loads the transmit  
register and initiates transmission. Reading out SBUF accesses a physically separate receive  
register.  
Semiconductor Group  
6-42  
On-Chip Peripheral Components  
C515  
Special Function Register SCON (Address 98 )  
H
Special Function Register SBUF (Address 99 )  
H
Reset Value : 00  
H
Reset Value : XX  
H
Bit No.  
MSB  
9F  
LSB  
9E  
9D  
9C  
9B  
9A  
99  
98  
H
H
H
H
H
H
H
H
98  
H
SM0  
SM1  
SM2  
REN  
TB8  
RB8  
TI  
RI  
SCON  
SBUF  
7
6
5
4
3
2
1
0
99  
H
Serial Interface Buffer Register  
Bit  
Function  
Serial port 0 operating mode selection bits  
SM0  
SM1  
SM0  
SM1  
Selected operating mode  
0
0
1
1
0
1
0
1
Serial mode 0 : Shift register, fixed baud rate (fOSC/12)  
Serial mode 1 : 8-bit UART, variable baud rate  
Serial mode 2 : 9-bit UART, fixed baud rate (fOSC/32 or fOSC/64)  
Serial mode 3 : 9-bit UART, variable baud rate  
SM2  
Enable serial port multiprocessor communication in modes 2 and 3  
In mode 2 or 3, if SM2 is set to 1 then RI0 will not be activated if the received 9th  
data bit (RB8) is 0. In mode 1, if SM2 = 1 then RI will not be activated if a valid  
stop bit was not received. In mode 0, SM2 should be 0.  
REN  
TB8  
RB8  
TI  
Serial port receiver enable  
Enables serial reception. Set by software to enable serial reception. Cleared by  
software to disable serial reception.  
Serial port transmitter bit 9  
TB8 is the 9th data bit that will be transmitted in modes 2 and 3. Set or cleared by  
software as desired.  
Serial port receiver bit 9  
In modes 2 and 3, RB8 is the 9th data bit that was received. In mode 1, if SM2 = 0,  
RB8 is the stop bit that was received. In mode 0, RB8 is not used.  
Serial port transmitter interrupt flag  
TI is set by hardware at the end of the 8th bit time in mode 0, or at the beginning  
of the stop bit in the other modes, in any serial transmission. TI must be cleared  
by software.  
RI  
Serial port receiver interrupt flag  
RI is set by hardware at the end of the 8th bit time in mode 0, or halfway through  
the stop bit time in the other modes, in any serial reception (exception see SM2).  
RI must be cleared by software.  
Semiconductor Group  
6-43  
On-Chip Peripheral Components  
C515  
6.3.3 Baud Rate Generation  
There are several possibilities to generate the baud rate clock for the serial port depending on the  
mode in which it is operating.  
For clarification some terms regarding the difference between "baud rate clock" and "baud rate"  
should be mentioned. The serial interface requires a clock rate which is 16 times the baud rate for  
internal synchronization. Therefore, the baud rate generators have to provide a "baud rate clock" to  
the serial interface which - there divided by 16 - results in the actual "baud rate". However, all  
formulas given in the following section already include the factor and calculate the final baud rate.  
Further, the abrevation fOSC refers to the external clock frequency (oscillator or external input clock  
operation).  
The baud rate of the serial port is controlled by two bits which are located in the special function  
registers as shown below.  
Special Function Register ADCON (Address D8 )  
H
Special Function Register PCON (Address 87 )  
H
Reset Value : 00X00000  
Reset Value : 000X0000  
B
B
Bit No.  
MSB  
DF  
LSB  
D8  
DE  
DD  
DC  
DB  
DA  
D9  
H
H
H
H
H
H
H
H
D8  
H
BD  
CLK  
BSY  
ADM  
MX2  
MX1  
MX0  
ADCON  
PCON  
7
6
5
4
3
2
1
0
1)  
87  
H
SMOD PDS  
IDLS  
SD  
GF1  
GF0  
PDE  
IDLE  
The shaded bits are not used in controlling the serial port baud rate.  
1) This bit is available for C515-LM/1RM versions only.  
Bit  
Function  
BD  
Baud rate generator enable  
When set, the baud rate of serial interface 0 is derived from a dedicated prescaler.  
When cleared (default after reset), baud rate is derived from the timer 1 overflow  
rate.  
SMOD  
Double baud rate  
When set, the baud rate of the serial interface in modes 1, 2, and 3 is doubled.  
After reset this bit is cleared.  
Figure 6-23 shows the configuration for the baud rate generation of the serial port.  
Semiconductor Group  
6-44  
On-Chip Peripheral Components  
C515  
Timer 1  
Overflow  
SCON.7  
SCON.6  
(SM0/  
ADCON.7  
(BD)  
PCON.7  
Mode 1  
Mode 3  
(SMOD)  
SM1)  
0
÷ 2  
f OSC/2  
1
0
1
Baud  
Rate  
Clock  
÷ 39  
÷ 6  
Mode 2  
Mode 0  
Only one mode  
can be selected  
Note: The switch configuration shows the reset state.  
MCB03206  
Figure 6-23  
Baud Rate Generation for the Serial Port  
Depending on the programmed operating mode different paths are selected for the baud rate clock  
generation. Figure 6-23 shows the dependencies of the serial port 0 baud rate clock generation  
from the two control bits and from the mode which is selected in the special function register SCON.  
6.3.3.1 Baud Rate in Mode 0  
The baud rate in mode 0 is fixed to :  
oscillator frequency  
Mode 0 baud rate =  
12  
6.3.3.2 Baud Rate in Mode 2  
The baud rate in mode 2 depends on the value of bit SMOD in special function register PCON. If  
SMOD = 0 (which is the value after reset), the baud rate is 1/64 of the oscillator frequency. If SMOD  
= 1, the baud rate is 1/32 of the oscillator frequency.  
2SMOD  
Mode 2 baud rate =  
x oscillator frequency  
64  
Semiconductor Group  
6-45  
 
On-Chip Peripheral Components  
C515  
6.3.3.3 Baud Rate in Mode 1 and 3  
In these modes the baud rate is variable and can be generated alternatively by a baud rate  
generator with a fixed prescaler or by timer 1.  
6.3.3.3.1 Using the Baud Rate Generator  
In modes 1 and 3, the C515 can use the internal baud rate generator for the serial port. To enable  
this feature, bit BD (bit 7 of special function register ADCON) must be set. This baud rate generator  
divides the oscillator frequency by 2 x 39=78. Bit SMOD (PCON.7) also can be used to enable a  
divide by 2 prescaler. For baud rate calculation the baud rate clock must be further divided by 16.  
Therefore, at 12 MHz oscillator frequency, the commonly used baud rates 4800 baud (SMOD=0)  
and 9600 (SMOD=1) are available (with 0.16 % deviation). The baud rate is determined by SMOD  
and the oscillator frequency as follows :  
2SMOD  
x oscillator frequency  
Mode 1,3 baud rate =  
2496  
6.3.3.3.2 Using Timer 1 to Generate Baud Rates  
In mode 1 and 3 of the serial port also timer 1 can be used for generating baud rates. To enable this  
feature, bit BD (bit 7 of special function register ADCON) must be reset.Then the baud rate is  
determined by the timer 1 overflow rate and the value of SMOD as follows :  
2SMOD  
Mode 1, 3 baud rate =  
x (timer 1 overflow rate)  
32  
The timer 1 interrupt is usually disabled in this application. Timer 1 itself can be configured for either  
"timer" or "counter" operation, and in any of its operating modes. In most typical applications, it is  
configured for "timer" operation in the auto-reload mode (high nibble of TMOD = 0010 ). In this  
B
case the baud rate is given by the formula:  
2SMOD  
x oscillator frequency  
Mode 1, 3 baud rate =  
32 x 12 x (256 – (TH1))  
Very low baud rates can be achieved with timer 1 if leaving the timer 1 interrupt enabled,  
configuring the timer to run as 16-bit timer (high nibble of TMOD = 0001 ), and using the timer 1  
B
interrupt for a 16-bit software reload.  
Table 6-5 lists various commonly used baud rates of the different modes. It also shows how these  
baud rates can be obtained using timer 1 in mode 1 or 3.  
Semiconductor Group  
6-46  
On-Chip Peripheral Components  
C515  
Table 6-5  
Timer 1 generated Commonly used Baud Rates  
Baud Rate  
fOSC (MHz)  
SMOD  
BD  
Timer 1  
Mode  
Reload  
Value  
Mode 1, 3:  
62.5 Kbaud  
125 Kbaud  
19.5 Kbaud  
9.6 Kbaud  
4.8 Kbaud  
2.4 Kbaud  
1.2 Kbaud  
110 Baud  
110 Baud  
4.8 Kbaud  
9.6 Kbaud  
6.4 Kbaud  
12.8 Kbaud  
9.6 Kbaud  
19.2 Kbaud  
12.0  
24.0  
1
1
1
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
2
2
2
2
2
2
2
2
1
-
FF  
H
FF  
H
11.059  
11.059  
11.059  
11.059  
11.059  
6.0  
12.0  
12.0  
12.0  
16.0  
FD  
H
FD  
H
FA  
H
F4  
H
E8  
H
72  
H
FEEB  
H
-
-
-
-
-
-
-
-
-
-
16.0  
24.0  
24.0  
-
Mode 0 :  
Mode 2 :  
1 Mbaud  
1.33 Mbaud  
2 Mbaud  
12.0  
16.0  
24.0  
-
-
-
-
-
-
-
-
-
-
-
-
187.5 Kbaud  
375 Kbaud  
250 Kbaud  
500 Kbaud  
375 Kbaud  
750 Kbaud  
12.0  
12.0  
16.0  
16.0  
24.0  
24.0  
0
1
0
1
0
1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Semiconductor Group  
6-47  
On-Chip Peripheral Components  
C515  
6.3.4 Details about Mode 0  
Serial data enters and exists through RXD. TXD outputs the shift clock. 8 data bits are transmitted/  
received: (LSB first). The baud rate is fixed at fOSC/12.  
Figure 6-24 shows a simplified functional diagram of the serial port in mode 0. The associated  
timing is illustrated in figure 6-25.  
Transmission is initiated by any instruction that uses SBUF as a destination register. The "Write-to-  
SBUF" signal at S6P2 also loads a 1 into the 9th position of the transmit shift register and tells the  
TX control block to commence a transmission. The internal timing is such that one full machine  
cycle will elapse between "Write-to-SBUF", and activation of SEND.  
SEND enables the output of the shift register to the alternate output function line of P3.0, and also  
enables SHIFT CLOCK to the alternate output function line of P3.1. SHIFT CLOCK is low during  
S3, S4, and S5 of every machine cycle, and high during S6, S1 and S2. At S6P2 of every machine  
cycle in which SEND is active, the contents of the transmit shift register are shifted one position to  
the right.  
As data bits shift out to the right, zeroes come in from the left. When the MSB of the data byte is at  
the output position of the shift register, then the1 that was initially loaded into the 9th position, is just  
left of the MSB, and all positions to the left of that contain zeroes. This condition flags the TX control  
block to do one last shift and then deactivate SEND and set TI. Both of these actions occur at S1P1  
of the 10th machine cycle after "Write-to-SBUF".  
Reception is initiated by the condition REN = 1 and RI = 0. At S6P2 of the next machine cycle, the  
RX control unit writes the bits 1111 1110 to the receive shift register, and in the next clock phase  
activates RECEIVE.  
RECEIVE enables SHIFT CLOCK to the alternate output function line of P3.1. SHIFT CLOCK  
makes transitions at S3P1 and S6P1 of every machine cycle. At S6P2 of every machine cycle in  
which RECEIVE is active, the contents of the receive shift register are shifted one position to the  
left. The value that comes in from the right is the value that was sampled at the P3.0 pin at S5P2 of  
the same machine cycle.  
As data bit comes in from the right, 1’s shift out to the left. When the 0 that was initially loaded into  
the rightmost position arrives at the leftmost position in the shift register, it flags the RX control block  
to do one last shift and load SBUF. At S1P1 of the 10th machine cycle after the write to SCON that  
cleared RI, RECEIVE is cleared and RI is set.  
Semiconductor Group  
6-48  
On-Chip Peripheral Components  
C515  
Internal Bus  
1
Write  
to  
SBUF  
RXD  
P3.0 Alt.  
Output  
Q
&
S
SBUF  
Function  
D
CLK  
Zero Detector  
Start  
Shift  
TX Control  
Baud  
Rate S6  
Clock  
Baud Rate  
Clock  
_
<
1
Send  
TXD  
TX Clock  
TI  
&
P3.1 Alt.  
Output  
Function  
_
<
1
Serial  
Port  
Shift  
Clock  
Interrupt  
&
REN  
RI  
1
Start  
Receive  
RI  
RX Control  
RX Clock  
Shift  
1 0  
1
1
1
1
1
RXD  
P3.0 Alt.  
Input  
Input Shift Register  
Function  
Shift  
Load  
SBUF  
SBUF  
Read  
SBUF  
Internal Bus  
MCS02101  
Figure 6-24  
Serial Interface, Mode 0, Functional Diagram  
Semiconductor Group  
6-49  
On-Chip Peripheral Components  
C515  
Transmit  
Receive  
Figure 6-25  
Serial Interface, Mode 0, Timing Diagram  
Semiconductor Group  
6-50  
On-Chip Peripheral Components  
C515  
6.3.5 Details about Mode 1  
Ten bits are transmitted (through TXD), or received (through RXD): a start bit (0), 8 data bits (LSB  
first), and a stop bit (1). On receive, the stop bit goes into RB8 in SCON. The baud rate is  
determined either by the timer 1 overflow rate or by the internal baud rate generator.  
Figure 6-26 shows a simplified functional diagram of the serial port in mode 1. The associated  
timings for transmit/receive are illustrated in figure 6-27.  
Transmission is initiated by an instruction that uses SBUF as a destination register. The "Write-to-  
SBUF" signal also loads a 1 into the 9th bit position of the transmit shift register and flags the TX  
control unit that a transmission is requested. Transmission starts at the next rollover in the divide-  
by-16 counter. (Thus, the bit times are synchronized to the divide-by-16 counter, not to the "Write-  
to-SBUF" signal).  
The transmission begins with activation of SEND, which puts the start bit at TXD. One bit time later,  
DATA is activated, which enables the output bit of the transmit shift register to TXD. The first shift  
pulse occurs one bit time after that.  
As data bits shift out to the right, zeroes are clocked in from the left. When the MSB of the data byte  
is at the output position of the shift register, then the 1 that was initially loaded into the 9th position  
is just to the left of the MSB, and all positions to the left of that contain zeroes. This condition flags  
the TX control unit to do one last shift and then deactivate SEND and set TI. This occurs at the 10th  
divide-by-16 rollover after "Write-to-SBUF".  
Reception is initiated by a detected 1-to-0 transition at RXD. For this purpose RXD is sampled at a  
rate of 16 times whatever baud rate has been established. When a transition is detected, the divide-  
by-16 counter is immediately reset, and 1FF is written into the input shift register, and reception  
H
of the rest of the frame will proceed.  
The 16 states of the counter divide each bit time into 16ths. At the 7th, 8th and 9th counter states  
of each bit time, the bit detector samples the value of RXD. The value accepted is the value that  
was seen in at latest 2 of the 3 samples. This is done for the noise rejection. If the value accepted  
during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for  
another 1-to-0 transition. This is to provide rejection or false start bits. If the start bit proves valid, it  
is shifted into the input shift register, and reception of the rest of the frame will proceed.  
As data bits come in from the right, 1s shift out to the left. When the start bit arrives at the leftmost  
position in the shift register, (which in mode 1 is a 9-bit register), it flags the RX control block to do  
one last shift, load SBUF and RB8, and set RI. The signal to load SBUF and RB8, and to set RI, will  
be generated if, and only if, the following conditions are met at the time the final shift pulse is  
generated.  
1) RI = 0, and  
2) either SM2 = 0, or the received stop bit = 1  
If one of these two condtions is not met, the received frame is irretrievably lost. If both conditions  
are met, the stop bit goes into RB8, the 8 data bit goes into SBUF, and RI is activated. At this time,  
whether the above conditions are met or not, the unit goes back to looking for a 1-to-0 transition in  
RXD.  
Semiconductor Group  
6-51  
On-Chip Peripheral Components  
C515  
Internal Bus  
1
Write  
to  
SBUF  
Q
&
S
_
<
1
TXD  
SBUF  
D
CLK  
Zero Detector  
Shift  
TX Control  
Start  
Data  
Send  
÷ 16  
TX Clock  
TI  
_
<
1
Baud  
Rate  
Clock  
Serial  
Port  
Interrupt  
÷ 16  
Sample  
RX  
RI  
Load  
SBUF  
1-to-0  
Transition  
Detector  
Start  
RX Control  
1FF  
Shift  
H
Bit  
Detector  
Input Shift Register  
(9Bits)  
RXD  
Shift  
Load  
SBUF  
SBUF  
Read  
SBUF  
Internal Bus  
MCS02103  
Figure 6-26  
Serial Interface, Mode 1, Functional Diagram  
Semiconductor Group  
6-52  
On-Chip Peripheral Components  
C515  
Transmit  
Receive  
Figure 6-27  
Serial Interface, Mode 1, Timing Diagram  
Semiconductor Group  
6-53  
On-Chip Peripheral Components  
C515  
6.3.6 Details about Modes 2 and 3  
Eleven bits are transmitted (through TXD), or received (through RXD): a start bit (0), 8 data bits  
(LSB first), a programmable 9th data bit, and a stop bit (1). On transmit, the 9th data bit (TB8) can  
be assigned the value of 0 or 1. On receive, the 9th data bit goes into RB8 in SCON. The baud rate  
is generated by either using timer 1 or the internal baud rate generator.  
Figure 6-28 shows a functional diagram of the serial port in modes 2 and 3. The receive portion is  
exactly the same as in mode 1. The transmit portion differs from mode 1 only in the 9th bit of the  
transmit shift register. The associated timings for transmit/receive are illustrated in figure 6-29.  
Transmission is initiated by any instruction that uses SBUF as a destination register. The "Write-to-  
SBUF" signal also loads TB8 into the 9th bit position of the transmit shift register and flags the TX  
control unit that a transmission is requested. Transmission starts at the next rollover in the divide-  
by-16 counter. (Thus, the bit times are synchronized to the divide-by-16 counter, not to the "Write-  
to-SBUF" signal.)  
The transmission begins with activation of SEND, which puts the start bit at TXD. One bit time later,  
DATA is activated, which enables the output bit of the transmit shift register to TXD. The first shift  
pulse occurs one bit time after that. The first shift clocks a 1 (the stop bit) into the 9th bit position of  
the shift register. Thereafter, only zeroes are clocked in. Thus, as data bits shift out to the right,  
zeroes are clocked in from the left. When TB8 is at the output position of the shift register, then the  
stop bit is just to the left of TB8, and all positions to the left of that contain zeroes. This condition  
flags the TX control unit to do one last shift and then deactivate SEND and set TI. This occurs at  
the 11th divide-by-16 rollover after "Write-to-SBUF".  
Reception is initiated by a detected 1-to-0 transition at RXD. For this purpose RXD is sampled at a  
rate of 16 times whatever baud rate has been established. When a transition is detected, the divide-  
by-16 counter is immediately reset, and 1FF is written to the input shift register.  
H
At the 7th, 8th and 9th counter states of each bit time, the bit detector samples the value of RXD.  
The value accepted is the value that was seen in at least 2 of the 3 samples. If the value accepted  
during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for  
another 1-to-0 transition. If the start bit proves valid, it is shifted into the input shift register, and  
reception of the rest of the frame will proceed.  
As data bit come from the right, 1s shift out to the left. When the start bit arrives at the leftmost  
position in the shift register (which in modes 2 and 3 is a 9-bit register), it flags the RX control block  
to do one last shift, load SBUF and RB8, and to set RI. The signal to load SBUF and RB8, and to  
set RI, will be generated if, and only if, the following conditions are met at the time the final shift  
pulse is generated:  
1) RI = 0, and  
2) Either SM2 = 0 or the received 9th data bit = 1  
If either of these conditions is not met, the received frame is irretrievably lost, and RI is not set. If  
both conditions are met, the received 9th data bit goes into RB8, and the first 8 data bit goes into  
SBUF. One bit time later, whether the above conditions were met or not, the unit goes back to  
looking for a 1-to-0 transition at the RXD input.  
Note that the value of the received stop bit is irrelevant to SBUF, RB8 or RI.  
Semiconductor Group  
6-54  
On-Chip Peripheral Components  
C515  
Internal Bus  
TB8  
Write  
to  
SBUF  
Q
&
S
_
<
TXD  
1
SBUF  
D
CLK  
Zero Detector  
Stop Bit  
Generation  
Shift  
Start  
Data  
TX Control  
Send  
÷ 16  
TX Clock  
TI  
_
<
1
Baud  
Rate  
Clock  
Serial  
Port  
Interrupt  
÷ 16  
Sample  
RX Clock  
RI  
Load  
SBUF  
1-to-0  
Transition  
Detector  
Start  
RX Control  
Shift  
1FF  
Bit  
Detector  
Input Shift Register  
(9Bits)  
RXD  
Shift  
Load  
SBUF  
SBUF  
Read  
SBUF  
Internal Bus  
MCS02105  
Figure 6-28  
Serial Interface, Mode 2 and 3, Functional Diagram  
Semiconductor Group  
6-55  
On-Chip Peripheral Components  
C515  
Transmit  
Receive  
Figure 6-29  
Serial Interface, Mode 2 and 3, Timing Diagram  
Semiconductor Group  
6-56  
On-Chip Peripheral Components  
C515  
6.4 A/D Converter  
The C515 provides an A/D converter with the following features:  
– 8 multiplexed input channels  
– The possibility of using the analog inputs (port 6) also as digital inputs  
– Programmable internal reference voltages (16 steps each) via resistor array  
– 8-bit resolution within the selected reference voltage range  
– Internal start-of-conversion trigger  
– Interrupt request generation after each conversion  
For the conversion, the method of successive approximation via capacitor array is used. The  
externally applied reference voltage range has to be held on a fixed value within the specifications  
(see section "A/D Converter Characteristics" in chapter 10). The internal reference voltages can be  
varied to reduce the reference voltage range of the A/D converter and thus to achieve a higher  
resolution. Figure 6-30 shows a block diagram of the A/D converter.  
6.4.1 A/D Converter Operation  
An internal start of a single A/D conversion is triggered by a write-to-DAPR instruction. When single  
conversion mode is selected (bit ADM=0) only one A/D conversion is performed. In continuous  
mode (bit ADM=1), after completion of an A/D conversion a new A/D conversion is triggered  
automatically until bit ADM is reset.  
The busy flag BSY (ADCON.4) is automatically set when an A/D conversion is in progress. After  
completion of the conversion it is reset by hardware. This flag can be read only, a write has no  
effect. The interrupt request flag IADC (IRCON.0) is set when an A/D conversion is completed.  
The bits MX0 to MX2 in special function register ADCON are used for selection of the analog input  
channel.  
Port 6 is a dual purpose input port. lf the input voltage meets the specified logic levels, it can also  
be used as digital inputs regardless of whether the pin levels are sampled by the A/D converter at  
the same time.  
Semiconductor Group  
6-57  
On-Chip Peripheral Components  
C515  
Internal  
Bus  
IEN1 (B8  
)
H
EXEN2 SWDT EX6  
IRCON (C0  
EX5  
IEX5  
BSY  
EX4  
IEX4  
ADM  
EX3  
IEX3  
MX2  
ECAN EADC  
)
H
EXF2  
TF2  
IEX6  
0
IADC  
MX0  
ADCON (D8  
)
H
_
BD  
CLK  
MX1  
ADDAT  
(D9  
)
H
Single/  
Continuous  
Mode  
LBS  
.1  
.2  
.3  
.4  
Port 6  
MUX  
S & H  
.5  
A/D  
.6  
Converter  
MSB  
Conversion Clock fADC  
Input Clock fIN  
fOSC /2  
÷ 4  
Write to  
DAPR  
Start of  
Conversion  
VINTAREF VINTAGND  
VAREF  
VAGND  
Internal Reference Voltages  
DAPR (DA  
.7  
)
H
.6  
.5  
.4  
.3  
.2  
.1  
.0  
Internal  
Bus  
Programming of  
VINTAREF  
Programming of  
VINTAGND  
Shaded bit locations are not used in ADC-functions.  
MCB03207  
Figure 6-30  
A/D Converter Block Diagram  
Semiconductor Group  
6-58  
On-Chip Peripheral Components  
C515  
6.4.2 A/D Converter Registers  
This section describes the bits/functions of the registers which are used by the A/D converter.  
– ADCON (A/D converter control register)  
– ADDAT (A/D converter data register)  
– IEN1 and IRCON (A/D converter Interrupt control bits)  
– DAPR (D/A converter program register) for the programmable reference voltages.  
6.4.2.1 A/D Converter Control Register ADCON  
Special function register ADCON which is is used to set the operating modes, to check the status,  
and to select one of eight analog input channels.  
Special Function Register ADCON (Address D8 ) )  
H
Reset Value : 00X00000  
B
Bit No. MSB  
LSB  
0
7
6
5
4
3
2
1
D8  
BSY  
ADM  
MX2  
MX1  
MX0 ADCON  
BD  
CLK  
H
The shaded bits are not used for A/D converter control.  
Bit  
Function  
BSY  
Busy flag  
This flag indicates whether a conversion is in progress (BSY = 1). The flag is  
set by hardware during an A/D conversion and cleared by hardware when the  
conversion is completed.  
ADM  
A/D conversion mode  
When set, a continuous A/D conversion is selected. If cleared during a running  
A/D conversion, the conversion is stopped after current conversion process is  
completed.  
MX2 - MX0  
A/D converter input channel select bits  
Bits MX2-0 are used for selection of the analog input channels.The analog  
inputs are selected according to the following table :  
MX2  
MX1  
MX0  
Selected Analog Input  
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
P6.0 / AIN0  
P6.1 / AIN1  
P6.2 / AIN2  
P6.3 / AIN3  
P6.4 / AIN4  
P6.5 / AIN5  
P6.6 / AIN6  
P6.7 / AIN7  
Semiconductor Group  
6-59  
On-Chip Peripheral Components  
C515  
Note :Generally, before entering the power-down mode, an A/D conversion in progress must be  
stopped. If a single A/D conversion is running, it must be terminated by polling the BSY bit or  
waiting for the A/D conversion interrupt. In continuous conversion mode, bit ADM must be  
cleared and the last A/D conversion must be terminated before entering the power-down  
mode.  
A single A/D conversion is started by writing to SFR ADDAT with dummy data. A continuous  
conversion is started under the following conditions :  
– By setting bit ADM during a running single A/D conversion  
– By setting bit ADM when at least one A/D conversion has occured after the last reset  
operation.  
– By writing ADDAT with dummy data after bit ADM has been set before (if no A/D conversion  
has occured after the last reset operation).  
When bit ADM is reset by software in continuous conversion mode, the just running A/D conversion  
is stopped after its end.  
6.4.2.2 A/D Converter Data Register ADDAT  
This register holds the result of the 8-bit conversion. The most significant bit of the 8-bit conversion  
result is bit 7 and the least significant bit is bit 0 of the ADDAT register. The data remains in ADDAT  
until it is overwritten by the next converted data. ADDAT can be read or written under software  
control. If the A/D converter of the C515 is not used, register ADDAT can be used as an additional  
general purpose register.  
Special Function Register ADDAT (Address D9 )  
H
Reset Value : 00  
H
Bit No. MSB  
LSB  
0
7
6
5
4
3
2
1
.7  
D9  
.2  
.1  
.6  
.5  
.4  
.3  
.0  
ADDAT  
H
Semiconductor Group  
6-60  
On-Chip Peripheral Components  
C515  
6.4.2.3 A/D Converter Interrupt Control Bits in IEN1 and IRCON  
The A/D converter interrupt is controlled by bits which are located in the SFRs IEN1 and IRCON.  
Special Function Register IEN1 (Address B8 )  
H
Special Function Register IRCON (Address C0 )  
H
Reset Value : 00  
Reset Value : 00  
H
H
LSB  
B8  
MSB  
Bit No.  
BF  
BE  
BD  
BC  
BB  
BA  
B9  
H
H
H
H
H
H
H
H
B8  
H
EXEN2 SWDT EX6  
EX5  
EX4  
EX3 ECAN EADC  
IEN1  
C7  
C6  
C5  
C4  
H
C3  
C2  
C1  
C0  
H
H
H
H
H
H
H
IRCON  
IADC  
C0  
H
IEX6 IEX5  
IEX4  
IEX3  
IEX2  
EXF2  
TF2  
The shaded bits are not used for A/D converter control.  
Bit  
Function  
EADC  
Enable A/D converter interrupt  
If EADC = 0, the A/D converter interrupt is disabled.  
IADC  
A/D converter interrupt request flag  
Set by hardware at the end of an A/D conversion. Must be cleared by software.  
Semiconductor Group  
6-61  
On-Chip Peripheral Components  
C515  
6.4.2.4 Programmable Reference Voltages of the A/D Converter (DAPR Register)  
The C515 has two pins to which a reference voltage range for the on-chip A/D converter is applied  
(pin VAREF for the upper voltage and pin VAGND for the lower voltage). In contrast to conventional A/  
D converters it is now possible to use not only these externally applied reference voltages for the  
conversion but also internally generated reference voltages which are derived from the externally  
applied ones. For this purpose a resistor ladder provides 16 equidistant voltage levels between  
V
AREF and VAGND. These steps can individually be assigned as upper and lower reference voltage for  
the converter itself. These internally generated reference voltages are called VlntAREF and VlntAGND  
.
The internal reference voltage programming can be thought of as a programmable "D/A converter"  
which provides the voltages VIntARFF and VIntAGND for the A/D converter itself.  
Special Function Register DAPR (Address DA ) )  
H
Reset Value : 00  
H
Bit No. MSB  
LSB  
0
7
6
5
4
3
2
1
.5  
.0  
DA  
.4  
.3  
.2  
.1  
DAPR  
.7  
.6  
H
Bit  
Function  
DAPR.7-.4  
Programming of VIntAREF  
These bits are used for adjustment of the internal VIntAREF voltage.  
DAPR.3-.0  
Programming of VIntAGND  
These bits are used for adjustment of the internal VIntAGND voltage.  
Any write-access to DAPR starts conversion.  
The SFR DAPR is provided for programming the internal reference voltages VIntAREF and VlntAGND. For  
this purpose the internal reference voltages can be programmed in steps of 1/16 of the external  
reference voltages (VAREF VAGND) by four bits each in register DAPR. Bits 0 to 3 specify VlntAGND  
,
while bits 4 to 7 specify VIntAREF. A minimum of 1 V difference is required between the internal  
reference voltages VlntARF and VIntAGND for proper operation of the A/D converter. This means, for  
example, in the case where VAREF is 5 V and VAGND is 0 V, there must be at least four steps difference  
between the internal reference voltages VIntAREF and VIntAGND  
.
The values of VIntAGND and VIntAREF are given by the formulas:  
DAPR.3-.0  
V
IntAGND = VAGND  
+
(VAREF VAGND  
)
)
16  
with DAPR.3-.0 < C ;  
H
DAPR.7-.4  
16  
VIntAREF = VAGND  
+
(VAREF VAGND  
with DAPR.7-.4 > 3 ;  
H
Semiconductor Group  
6-62  
On-Chip Peripheral Components  
C515  
DAPR.3-.0 is the contents of the low-order nibble, and DAPR.7-.4 the contents of the high-order  
nibble of DAPR.  
If DAPR.3-.0 or DAPR.7-.4 = 0, the internal reference voltages correspond to the external reference  
voltages VAGND and VAREF, respectively.  
If VAINPUT > VIntAREF, the conversion result is FF , if VAINPUT < VIntAGDN , the conversion result is 00  
(VAINPUT is the analog input voltage). If the external reference voltages VAGND = 0 V and VAREF = +5 V  
(with respect to VSS and VCC) are applied, then the following internal reference voltages VIntAGND and  
H
H
VIntAREF shown in table 6-6 can be adjusted via the special function register DAPR.  
Table 6-6  
Adjustable Internal Reference Voltages  
Step  
DAPR (.3-.0)  
DAPR (.7-.4)  
VIntAGND  
VIntAREF  
0
0000  
0001  
0010  
0011  
0100  
0101  
0110  
0111  
1000  
1001  
1010  
1011  
1100  
1101  
1110  
1111  
0.0  
5.0  
1
0.3125  
0.625  
0.9375  
1.25  
1.5625  
1.875  
2.1875  
2.5  
2
3
4
1.25  
5
1.5625  
1.875  
2.1875  
2.5  
6
7
8
9
2.8125  
3.125  
3.4375  
3.75  
2.8125  
3.125  
3.4375  
3.75  
10  
11  
12  
13  
14  
15  
4.0625  
4.375  
4.68754  
The programmability of the internal reference voltages allows adjusting the internal voltage range  
to the range of the external analog input voltage or it may be used to increase the resolution of the  
converted analog input voltage by starting a second conversion with a compressed internal  
reference voltage range close to the previously measured analog value. Figures 7-30 and 7-31  
illustrate these applications.  
Semiconductor Group  
6-63  
 
On-Chip Peripheral Components  
C515  
AN0  
AN1  
AN..  
5.00 V  
VAREF  
4.375 V  
2.5 V  
3.125 V  
2.5 V VINTAREF  
1.25 V VINTAGND  
0.625 V  
0 V  
VAGND  
MCA01899  
Figure 6-31  
Adjusting the Internal Reference Voltages within Range of the External Analog Input  
Voltages  
First Conversion  
20 mV Resolution  
Second Conversion  
5 mV Resolution  
5.00 V  
VAREF  
3.125 V  
VINTAREF  
1.875 V  
VINTAGND  
0 V  
VAGND  
MCA01900  
Sample  
Time  
Sample  
Time  
Figure 6-32  
Increasing the Resolution by a Second Conversion  
Semiconductor Group  
6-64  
On-Chip Peripheral Components  
C515  
The external reference voltage supply need only be applied when the A/D converter is used,  
otherwise the pins VAREF and VAGND may be left unconnected. The reference voltage supply has to  
meet some requirements concerning the level of VAGND and VAREF and the output impedance of the  
supply voltage (see also "A/D Converter Characteristics" in the data sheet).  
– The voltage VAREF must meet the following specification :  
V
AREF = VCC + 0.25 V  
– The voltage VAGND must meet a similar specification :  
AGND = VSS + 0.2 V  
V
– The differential output impedance of the analog reference supply voltage should be less than  
1 kW.  
lf the above mentioned operating conditions are not met the accuracy of the converter may be  
decreased.  
Furthermore, the analog input voltage VAINPUT must not exceed the range from (VAGND – 0.2 V) to  
(VAREF + 0.2 V). Otherwise, a static input current might result at the corresponding analog input  
which will also affect the accuracy of the other input channels.  
Semiconductor Group  
6-65  
On-Chip Peripheral Components  
C515  
6.4.3 A/D Conversion Timing  
An A/D conversion is internally started by writing the SFR DAPR. A write to SFR DAPR will start a  
new conversion even if a conversion is currently in progress. The conversion begins with the next  
machine cycle, and the BSY flag in SFR ADCON will be set.  
The A/D conversion procedure is divided into three parts :  
– Sample phase (t ), used for sampling the analog input voltage.  
S
– Conversion phase (t ), used for the real A/D conversion.  
CO  
– Write result phase (t ), used for writing the conversion result into the ADDAT register.  
WR  
Sample Time t :  
S
During this time the internal capacitor array is connected to the selected analog input channel and  
is loaded with the analog voltage to be converted. The analog voltage is internally fed to a voltage  
comparator. With beginning of the sample phase the BSY bit in SFR ADCON is set.  
Conversion Time t  
:
CO  
During the conversion time the analog voltage is converted into a 8-bit digital value using the  
successive approximation technique with a binary weighted capacitor network.  
Write Result Time t  
:
WR  
At the result phase the conversion result is written into the ADDAT register.  
The total A/D conversion time is defined by t which is the sum of the two phase times t and  
ADCC  
S
t
. The duration of the three phases of an A/D conversion is specified as shown in figure 6-33.  
CO  
This figure also shows how an A/D conversion is embedded into the microcontroller cycle scheme  
using the relation 6 x t = 1 instruction cycle. It also shows the behaviour of the busy flag (BSY)  
IN  
and the interrupt flag (IADC) during an A/D conversion.  
Semiconductor Group  
6-66  
On-Chip Peripheral Components  
C515  
Start of an  
A/D Conversion  
Result is written  
into ADDAT  
BSY Bit  
Sample  
Phase  
t S  
Conversion Phase  
t CO  
Write  
Result  
Phase  
t WR  
tADCC  
A/D Conversion Time Cycle Time  
t WR = t IN  
tADCC = t S +t CO = 40t IN + 32t IN = 72t IN  
with t IN = 2xt CLCL  
Write Result Cycle  
MOV A, ADDAT  
MOV ADDAT,#0  
x-1  
1 Instruction Cycle  
x
1
2
3
4
5
11  
12  
13  
14  
15  
16  
Start of next conversion  
(in continuous mode)  
tADCC = 80tIN  
Write  
ADDAT  
Start of A/D  
conversion cycle  
A/D Conversion Cycle  
Cont. conv.  
Single conv.  
BSY Bit  
IADC Bit  
First instr. of an  
interrupt routine  
MCT03236  
Figure 6-33  
A/D Conversion Timing  
Semiconductor Group  
6-67  
 
On-Chip Peripheral Components  
C515  
An A/D conversion is always started with the beginning of a processor cycle when it has been  
initiated by writing SFR ADDAT. The ADDAT write operation may take one or two machine cycles.  
In figure 6-33, the instruction MOV ADDAT,#0 starts the A/D conversion (machine cycle X-1 and  
X). The total A/D conversion (sample and conversion phase) is finished with the beginning of the  
14th machine cycle after the A/D conversion start. In the next machine cycle the conversion result  
is written into the ADDAT register and can be read in the same cycle by an instruction (e.g. MOV  
A,ADDAT). If continuous conversion is selected (bit ADM set), the next conversion is started with  
the beginning of the machine cycle which follows the write result cycle.  
The BSY bit is set at the beginning of the first A/D conversion machine cycle and reset at the  
beginning of the write result cycle. If continuous conversion is selected, BSY is again set with the  
beginning of the machine cycle which follows the write result cycle. This means that in continuous  
conversion mode BSY is not set for a complete machine cycle. Therefore, in continuous conversion  
mode it is not recommended to poll the BSY bit using e.g. the JNB instruction.  
The interrupt flag IADC is set in the 12th instruction cycle of an A/D conversion. If the A/D converter  
interrupt is enabled and the A/D converter interrupt is priorized to be serviced immediately, the first  
instruction of the interrupt service routine will be executed in the next machine cycle which follows  
the write result cycle. IADC must be reset by software.  
Depending on the application, typically there are three methods to handle the A/D conversion in the  
C515 :  
– Software delay  
The machine cycles of the A/D conversion are counted and the program executes a software  
delay (e.g. NOPs) before reading the A/D conversion result in the write result cycle. This is  
the fastest method to get the result of an A/D conversion.  
– Polling BSY bit  
The BSY bit is polled and the program waits until BSY=0. Attention : a polling JB instruction  
which is two machine cycles long, possibly may not recognize the BSY=0 condition during the  
write result cycle in the continuous conversion mode.  
– A/D conversion interrupt  
After the start of an A/D conversion the A/D converter interrupt is enabled. The result of the  
A/D conversion is read in the interrupt service routine. If other C515 interrupts are enabled,  
the interrupt latency must be regarded. Therefore, this software method is the slowest method  
to get the result of an A/D conversion.  
Depending on the oscillator frequency of the C515 the total time of an A/D conversion is calculated  
according the formula given in figure 6-33. Table 6-7 shows some conversion times for typical clock  
rates.  
Table 6-7  
A/D Conversion Times  
f
[MHz]  
t [ns]  
Total Conversion Time  
[ms]  
IN  
OSC  
t
ADCC  
12 MHz  
16 MHz  
24 MHz  
166.7  
125  
12  
9
83.3  
6
Semiconductor Group  
6-68  
 
Interrupt System  
C515  
7
Interrupt System  
The C515 provides 12 interrupt sources with four priority levels. Five interrupts can be generated by  
the on-chip peripherals (timer 0, timer 1, timer 2, A/D converter, and serial interface) and seven  
interrupts may be triggered externally (P3.2/INT0, P3.3/INT1, P1.4/INT2, P1.0/INT3, P1.1/INT4,  
P1.2/INT5, P1.3/INT6).  
This chapter shows the interrupt structure, the interrupt vectors and the interrupt related special  
function registers. Figure 7-1 and 7-2 give a general overview of the interrupt sources and illustrate  
the request and the control flags which are described in the next sections.  
Semiconductor Group  
7-1  
Interrupt System  
C515  
Highest  
Priority Level  
P3.2/  
INT0  
IE0  
0003  
0043  
EX0  
IEN0.0  
H
H
TCON.1  
IT0  
TCON.0  
Lowest  
Priority Level  
A/D Converter  
IADC  
EADC  
IRCON.0  
IEN1.0  
IP1.0  
IP0.0  
Timer 0  
Overflow  
TF0  
000B  
004B  
ET0  
IEN0.1  
H
H
TCON.5  
P1.4/  
INT2  
IEX2  
EX2  
IEN1.1  
IRCON.1  
I2FR  
T2CON.5  
IP1.1  
IP0.1  
P3.3/  
INT1  
IE1  
0013  
0053  
EX1  
IEN0.2  
H
H
TCON.3  
IT1  
TCON.2  
P1.0/  
INT3  
CC0  
IEX3  
EX3  
IEN1.2  
IRCON.2  
I3FR  
T2CON.6  
EAL  
IEN0.7  
IP1.2  
IP0.2  
Bit addressable  
MCS03208  
Request Flag is  
cleared by hardware  
Figure 7-1  
Interrupt Structure, Overview Part 1  
Semiconductor Group  
7-2  
Interrupt System  
C515  
Highest  
Priority Level  
Timer 1  
Overflow  
TF1  
001B  
005B  
ET1  
IEN0.3  
H
H
TCON.7  
Lowest  
Priority Level  
P1.1/  
INT4  
CC1  
IEX4  
EX4  
IRCON.3  
IEN1.3  
IP1.3  
IP0.3  
RI  
_
<
1
SCON.0  
USART  
P1.2/  
0023  
0063  
ES  
IEN0.4  
H
H
TI  
SCON.1  
IEX5  
INT5  
CC2  
EX5  
IRCON.4  
IEN1.4  
IP1.4  
IP0.4  
Timer 2  
Overflow  
TF2  
IRCON.6  
_
<
1
P1.5/  
T2EX  
EXF2  
002B  
006B  
EXEN2  
IEN1.7  
ET2  
IEN0.5  
H
H
IRCON.7  
P1.3/  
INT6  
CC3  
IEX6  
IRCON.5  
EX6  
IEN1.5  
EAL  
IEN0.7  
IP1.5  
IP0.5  
Bit addressable  
Request Flag is  
MCS03209  
cleared by hardware  
Figure 7-2  
Interrupt Structure, Overview Part 2  
Semiconductor Group  
7-3  
Interrupt System  
C515  
7.1 Interrupt Registers  
7.1.1 Interrupt Enable Registers  
Each interrupt vector can be individually enabled or disabled by setting or clearing the  
corresponding bit in the interrupt enable registers IEN0 and IEN1. Register IEN0 also contains the  
global disable bit (EAL), which can be cleared to disable all interrupts at once. Generally, after reset  
all interrupt enable bits are set to 0. That means that the corresponding interrupts are disabled.  
The IEN0 register contains the general enable/disable flags of the external interrupts 0 and 1, the  
timer interrupts, and the USART interrupt.  
Special Function Register IEN0 (Address A8 )  
H
Reset Value : 00  
H
LSB  
A8  
MSB  
Bit No.  
AF  
AE  
AD  
AC  
ES  
AB  
AA  
A9  
H
H
H
H
H
H
H
H
A8  
H
EAL  
WDT  
ET2  
ET1  
EX1  
ET0  
EX0  
IEN0  
The shaded bit is not used for interrupt control.  
Bit  
Function  
EAL  
Enable/disable all interrupts.  
If EAL=0, no interrupt will be acknowledged.  
If EAL=1, each interrupt source is individually enabled or disabled by setting or  
clearing its enable bit.  
ET2  
ES  
Timer 2 overflow / external reload interrupt enable.  
If ET2 = 0, the timer 2 interrupt is disabled.  
If ET2 = 1, the timer 2 interrupt is enabled.  
Serial channel (USART) interrupt enable  
If ES = 0, the serial channel interrupt 0 is disabled.  
If ES = 1, the serial channel interrupt 0 is enabled.  
ET1  
EX1  
ET0  
EX0  
Timer 1 overflow interrupt enable.  
If ET1 = 0, the timer 1 interrupt is disabled.  
If ET1 = 1, the timer 1 interrupt is enabled.  
External interrupt 1 enable.  
If EX1 = 0, the external interrupt 1 is disabled.  
If EX1 = 1, the external interrupt 1 is enabled.  
Timer 0 overflow interrupt enable.  
If ET0 = 0, the timer 0 interrupt is disabled.  
If ET0 = 1, the timer 0 interrupt is enabled.  
External interrupt 0 enable.  
If EX0 = 0, the external interrupt 0 is disabled.  
If EX0 = 1, the external interrupt 0 is disabled.  
Semiconductor Group  
7-4  
Interrupt System  
C515  
The IEN1 register contains enable/disable flags of the timer 2 external timer reload interrupt, the  
external interrupts 2 to 6, and the A/D converter interrupt.  
Special Function Register IEN1 (Address B8 )  
H
Reset Value : 00  
H
LSB  
B8  
MSB  
Bit No.  
BF  
BE  
BD  
BC  
BB  
BA  
B9  
H
H
H
H
H
H
H
H
B8  
H
EXEN2 SWDT EX6  
EX5  
EX4  
EX3  
EX2 EADC  
IEN1  
The shaded bit is not used for interrupt control.  
Bit  
Function  
EXEN2  
Timer 2 external reload interrupt enable  
If EXEN2 = 0, the timer 2 external reload interrupt is disabled.  
If EXEN2 = 1, the timer 2 external reload interrupt is enabled. The external reload  
function is not affected by EXEN2.  
EX6  
EX5  
EX4  
EX3  
EX2  
EADC  
External interrupt 6 / capture/compare interrupt 3 enable  
If EX6 = 0, external interrupt 6 is disabled.  
If EX6 = 1, external interrupt 6 is enabled.  
External interrupt 5 / capture/compare interrupt 2 enable  
If EX5 = 0, external interrupt 5 is disabled.  
If EX5 = 1, external interrupt 5 is enabled.  
External interrupt 4 / capture/compare interrupt 1 enable  
If EX4 = 0, external interrupt 4 is disabled.  
If EX4 = 1, external interrupt 4 is enabled.  
External interrupt 3 / capture/compare interrupt 0 enable  
If EX3 = 0, external interrupt 3 is disabled.  
If EX3 = 1, external interrupt 3 is enabled.  
External interrupt 2 / capture/compare interrupt 4 enable  
If EX2 = 0, external interrupt 2 is disabled.  
If EX2 = 1, external interrupt 2 is enabled.  
A/D converter interrupt enable  
If EADC = 0, the A/D converter interrupt is disabled.  
If EADC = 1, the A/D converter interrupt is enabled.  
Semiconductor Group  
7-5  
Interrupt System  
C515  
7.1.2 Interrupt Request / Control Flags  
Special Function Register TCON (Address 88 )  
H
Reset Value : 00  
H
LSB  
88  
MSB  
Bit No.  
8F  
8E  
8D  
8C  
8B  
8A  
89  
H
H
H
H
H
H
H
H
88  
H
TF1  
TR1  
TF0  
TR0  
IE1  
IT1  
IE0  
IT0  
TCON  
The shaded bits are not used for interrupt control.  
Bit  
Function  
TF1  
Timer 1 overflow flag  
Set by hardware on timer/counter 1 overflow. Cleared by hardware when  
processor vectors to interrupt routine.  
TF0  
IE1  
IT1  
IE0  
IT0  
Timer 0 overflow flag  
Set by hardware on timer/counter 0 overflow. Cleared by hardware when  
processor vectors to interrupt routine.  
External interrupt 1 request flag  
Set by hardware when external interrupt 1 edge is detected. Cleared by hardware  
when processor vectors to interrupt routine.  
External interrupt 1 level/edge trigger control flag  
If IT1 = 0, low level triggered external interrupt 1 is selected.  
If IT1 = 1, falling edge triggered external interrupt 1 is selected.  
External interrupt 0 request flag  
Set by hardware when external interrupt 0 edge is detected. Cleared by hardware  
when processor vectors to interrupt routine.  
External interrupt 0 level/edge trigger control flag  
If IT0 = 0, low level triggered external interrupt 0 is selected.  
If IT0 = 1, falling edge triggered external interrupt 0 is selected.  
The external interrupts 0 and 1 (INT0 and INT1) can each be either level-activated or negative  
transition-activated, depending on bits IT0 and IT1 in register TCON. The flags that actually  
generate these interrupts are bits IE0 and lE1 in TCON. When an external interrupt is generated, the  
flag that generated this interrupt is cleared by the hardware when the service routine is vectored too,  
but only if the interrupt was transition-activated. lf the interrupt was level-activated, then the  
requesting external source directly controls the request flag, rather than the on-chip hardware.  
The timer 0 and timer 1 interrupts are generated by TF0 and TF1 in register TCON, which are set  
by a rollover in their respective timer/counter registers. When a timer interrupt is generated, the flag  
that generated it is cleared by the on-chip hardware when the service routine is vectored too.  
Semiconductor Group  
7-6  
Interrupt System  
C515  
Special Function Register T2CON (Address C8 )  
H
Reset Value : 00  
H
LSB  
MSB  
Bit No.  
CF  
CE  
CD  
CC  
CB  
CA  
C9  
H
C8  
H
H
H
H
H
H
H
C8  
H
T2PS I3FR  
I2FR T2R1 T2R0 T2CM T2I1  
T2I0  
T2CON  
The shaded bits are not used for interrupt control.  
Bit  
Function  
I3FR  
External interrupt 3 rising/falling edge control flag  
If I3FR = 0, the external interrupt 3 is activated by a falling edge at P1.0/INT3/CC0.  
If I3FR = 1, the external interrupt 3 is activated by a rising edge at P1.0/INT3/CC0.  
I2FR  
External interrupt 2 rising/falling edge control flag  
If I2FR = 0, the external interrupt 2 is activated by a falling edge at P1.4/INT2.  
If I2FR = 1, the external interrupt 2 is activated by a rising edge at P1.4/INT2.  
The external interrupt 2 (INT2) can be either positive or negative transition-activated depending on  
bit I2FR in register T2CON. The flag that actually generates this interrupt is bit IEX2 in register  
IRCON. lf an interrupt 2 is generated, flag IEX2 is cleared by hardware when the service routine is  
vectored to.  
The external interrupt 3 (INT3) can be either positive or negative transition-activated, depending  
on bit I3FR in register T2CON. The flag that actually generates this interrupt is bit IEX3 in register  
IRCON. In addition, this flag will be set if a compare event occurs at pin P1.0/INT3/CC0, regardless  
of the compare mode established and the transition at the respective pin. The flag IEX3 is cleared  
by hardware when the service routine is vectored to.  
Semiconductor Group  
7-7  
Interrupt System  
C515  
Special Function Register IRCON (Address C0 )  
H
Reset Value : 00  
H
LSB  
MSB  
Bit No.  
C7  
C6  
C5  
C4  
C3  
C2  
C1  
H
C0  
H
H
H
H
H
H
H
C0  
H
EXF2  
TF2  
IEX6  
IEX5  
IEX4  
IEX3  
IEX2 IADC  
IRCON  
Bit  
Function  
EXF2  
Timer 2 external reload flag  
EXF2 is set when a reload is caused by a falling edge on pin T2EX while EXEN2 =  
1. If ET2 in IEN0 is set (timer 2 interrupt enabled), EXF2 = 1 will cause an interrupt.  
EXF2 can be used as an additional external interrupt when the reload function is  
not used. EXF2 must be cleared by software.  
TF2  
Timer 2 overflow flag  
Set by a timer 2 overflow and must be cleared by software. If the timer 2 interrupt  
is enabled, TF2 = 1 will cause an interrupt.  
IEX6  
External interrupt 6 edge flag  
Set by hardware when external interrupt edge was detected or when a compare  
event occurred at pin P1.3/INT6/CC3. Cleared by hardware when processor  
vectors to interrupt routine.  
IEX5  
IEX4  
IEX3  
External interrupt 5 edge flag  
Set by hardware when external interrupt edge was detected or when a compare  
event occurred at pin P1.2/INT5/CC2. Cleared by hardware when processor  
vectors to interrupt routine.  
External interrupt 4 edge flag  
Set by hardware when external interrupt edge was detected or when a compare  
event occurred at pin P1.1/INT4/CC1. Cleared by hardware when processor  
vectors to interrupt routine.  
External interrupt 3 edge flag  
Set by hardware when external interrupt edge was detected or when a compare  
event occurred at pin P1.0/INT3/CC0. Cleared by hardware when processor  
vectors to interrupt routine.  
IEX2  
External interrupt 2 edge flag  
Set by hardware when external interrupt edge was detected at pin P1.4/INT2.  
Cleared by hardware when processor vectors to interrupt routine.  
IADC  
A/D converter interrupt request flag  
Set by hardware at the end of an A/D conversion. Must be cleared by software.  
Semiconductor Group  
7-8  
Interrupt System  
C515  
The timer 2 interrupt is generated by the logical OR of bit TF2 in register T2CON and bit EXF2 in  
register IRCON. Neither of these flags is cleared by hardware when the service routine is vectored  
to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the  
interrupt, and the bit will have to be cleared by software.  
The A/D converter interrupt is generated by IADC bit in register IRCON. If an interrupt is  
generated, in any case the converted result in ADDAT is valid on the first instruction of the interrupt  
service routine. lf continuous conversion is established, IADC is set once during each conversion.  
lf an A/D converter interrupt is generated, flag IADC will have to be cleared by software.  
The external interrupts 4 to 6 (INT4, INT5, INT6) are positive transition-activated. The flags that  
actually generate these interrupts are bits IEX4, IEX5, and IEX6 in register IRCON. In addition,  
these flags will be set if a compare event occurs at the corresponding output pin P1.1/ INT4/CC1,  
P1.2/INT5/CC2, and P1.3/INT6/CC3, regardless of the compare mode established and the  
transition at the respective pin. When an interrupt is generated, the flag that generated it is cleared  
by the on-chip hardware when the service routine is vectored too.  
All of these interrupt request bits that generate interrupts can be set or cleared by software, with the  
same result as if they had been set or cleared by hardware. That is, interrupts can be generated or  
pending interrupts can be cancelled by software. The only exceptions are the request flags IE0 and  
lE1. lf the external interrupts 0 and 1 are programmed to be level-activated, IE0 and lE1 are  
controlled by the external source via pin INT0 and INT1, respectively. Thus, writing a one to these  
bits will not set the request flag IE0 and/or lE1. In this mode, interrupts 0 and 1 can only be  
generated by software and by writing a 0 to the corresponding pins INT0 (P3.2) and INT1 (P3.3),  
provided that this will not affect any peripheral circuit connected to the pins.  
Semiconductor Group  
7-9  
Interrupt System  
C515  
Special Function Register SCON (Address. 98 )  
H
Reset Value : 00  
H
LSB  
MSB  
Bit No.  
9F  
9E  
9D  
9C  
9B  
9A  
99  
TI  
98  
H
H
H
H
H
H
H
H
98  
H
SM0  
SM1  
SM2  
REN  
TB8  
RB8  
RI  
SCON  
The shaded bits are not used for interrupt control.  
Bit  
Function  
TI  
Serial interface transmitter interrupt flag  
Set by hardware at the end of a serial data transmission. Must be cleared by  
software.  
RI  
Serial interface receiver interrupt flag  
Set by hardware if a serial data byte has been received. Must be cleared by  
software.  
The serial port interrupt is generated by a logical OR of flag RI and TI in SFR SCON. Neither of  
these flags is cleared by hardware when the service routine is vectored too. In fact, the service  
routine will normally have to determine whether it was the receive interrupt flag or the transmission  
interrupt flag that generated the interrupt, and the bit will have to be cleared by software.  
Semiconductor Group  
7-10  
Interrupt System  
C515  
7.1.3 Interrupt Priority Registers  
The lower six bits of these two registers are used to define the interrupt priority level of the interrupt  
groups as they are defined in table 7-1 in the next section.  
Special Function Register IP0 (Address A9 )  
H
Special Function Register IP1 (Address B9 )  
H
Reset Value : X0000000  
Reset Value : XX000000  
B
B
LSB  
MSB  
Bit No.  
7
6
5
4
3
2
1
0
A9  
H
WDTS IP0.5 IP0.4 IP0.3 IP0.2 IP0.1 IP0.0  
IP0  
IP1  
Bit No.  
7
6
5
4
3
2
1
0
B9  
H
IP1.5 IP1.4 IP1.3 IP1.2 IP1.1 IP1.0  
The shaded bits are not used for interrupt control.  
Bit  
Function  
IP1.x  
IP0.x  
Interrupt group priority level bits (x=1-6, see table 7-1)  
IP1.x  
IP0.x  
Function  
0
0
1
1
0
1
0
1
Interrupt group x is set to priority level 0 (lowest)  
Interrupt group x is set to priority level 1  
Interrupt group x is set to priority level 2  
Interrupt group x is set to priority level 3 (highest)  
Semiconductor Group  
7-11  
Interrupt System  
C515  
7.2 Interrupt Priority Level Structure  
The following table shows the interrupt grouping of the C515 interrupt sources.  
Table 7-1  
Interrupt Source Structure  
Interrupt Associated Interrupts  
Priority  
Group  
High Priority  
Low Priority  
1
2
3
4
5
6
External interrupt 0  
Timer 0 overflow  
External interrupt 1  
Timer 1 overflow  
Serial channel interrupt  
Timer 2 interrupt  
A/D converter interrupt  
External interrupt 2  
External interrupt 3  
External interrupt 4  
External interrupt 5  
External interrupt 6  
High  
Low  
Each pair of interrupt sources can be programmed individually to one of four priority levels by setting  
or clearing one bit in the special function register IP0 and one in IP1. A low-priority interrupt can be  
interrupted by a high-priority interrupt, but not by another interrupt of the same or a lower priority. An  
interrupt of the highest priority level cannot be interrupted by another interrupt source.  
lf two or more requests of different priority leveis are received simultaneously, the request of the  
highest priority is serviced first. lf requests of the same priority level are received simultaneously, an  
internal polling sequence determines which request is to be serviced first. Thus, within each priority  
level there is a second priority structure determined by the polling sequence, as follows.  
– Within one interrupt group the „left“ interrupt is serviced first  
– The interrupt groups are serviced from top to bottom of the table.  
Semiconductor Group  
7-12  
Interrupt System  
C515  
7.3 How Interrupts are Handled  
The interrupt flags are sampled at S5P2 in each machine cycle. The sampled flags are polled during  
the following machine cycle. If one of the flags was in a set condition at S5P2 of the preceeding  
cycle, the polling cycle will find it and the interrupt system will generate a LCALL to the appropriate  
service routine, provided this hardware-generated LCALL is not blocked by any of the following  
conditions:  
1. An interrupt of equal or higher priority is already in progress.  
2. The current (polling) cycle is not in the final cycle of the instruction in progress.  
3. The instruction in progress is RETI or any write access to registers IEN0 and IEN1 or IP0/IP1.  
Any of these three conditions will block the generation of the LCALL to the interrupt service routine.  
Condition 2 ensures that the instruction in progress is completed before vectoring to any service  
routine. Condition 3 ensures that if the instruction in progress is RETI or any write access to  
registers IEN0/IEN1 or IP0/IP1, then at least one more instruction will be executed before any  
interrupt is vectored too; this delay guarantees that changes of the interrupt status can be observed  
by the CPU.  
The polling cycle is repeated with each machine cycle, and the values polled are the values that  
were present at S5P2 of the previous machine cycle. Note that if any interrupt flag is active but not  
being responded to for one of the conditions already mentioned, or if the flag is no longer active  
when the blocking condition is removed, the denied interrupt will not be serviced. In other words, the  
fact that the interrupt flag was once active but not serviced is not remembered. Every polling cycle  
interrogates only the pending interrupt requests.  
The polling cycle/LCALL sequence is illustrated in figure 7-3.  
C1  
C2  
C3  
C4  
C5  
S5P2  
Interrupts  
are polled  
Long Call to Interrupt  
Vector Address  
Interrupt  
Routine  
Interrupt  
is latched  
MCT01859  
Figure 7-3  
Interrupt Response Timing Diagram  
Semiconductor Group  
7-13  
 
Interrupt System  
C515  
Note that if an interrupt of a higher priority level goes active prior to S5P2 in the machine cycle  
labeled C3 in figure 7-3 then, in accordance with the above rules, it will be vectored to during C5  
and C6 without any instruction for the lower priority routine to be executed.  
Thus, the processor acknowledges an interrupt request by executing a hardware-generated LCALL  
to the appropriate servicing routine. In some cases it also clears the flag that generated the  
interrupt, while in other cases it does not; then this has to be done by the user's software. The  
hardware clears the external interrupt flags IE0 and IE1 only if they were transition-activated. The  
hardware-generated LCALL pushes the contents of the program counter onto the stack (but it does  
not save the PSW) and reloads the program counter with an address that depends on the source of  
the interrupt being vectored too, as shown in the following table 7-2.  
Table 7-2  
Interrupt Source and Vectors  
Interrupt Source  
External Interrupt 0  
Timer 0 Overflow  
Interrupt Vector Address  
Interrupt Request Flags  
0003  
H
IE0  
000B  
H
TF0  
External Interrupt 1  
Timer 1 Overflow  
0013  
H
IE1  
001B  
H
TF1  
Serial Channel  
0023  
H
RI / TI  
TF2 / EXF2  
IADC  
IEX2  
IEX3  
IEX4  
IEX5  
IEX6  
Timer 2 Overflow / Ext. Reload  
A/D Converter  
002B  
H
0043  
H
External Interrupt 2  
External Interrupt 3  
External Interrupt 4  
External Interrupt 5  
External Interrupt 6  
004B  
H
0053  
H
005B  
H
0063  
H
006B  
H
Execution proceeds from that location until the RETI instruction is encountered. The RETI  
instruction informs the processor that the interrupt routine is no longer in progress, then pops the  
two top bytes from the stack and reloads the program counter. Execution of the interrupted program  
continues from the point where it was stopped. Note that the RETI instruction is very important  
because it informs the processor that the program left the current interrupt priority level. A simple  
RET instruction would also have returned execution to the interrupted program, but it would have  
left the interrupt control system thinking an interrupt was still in progress. In this case no interrupt of  
the same or lower priority level would be acknowledged.  
Semiconductor Group  
7-14  
 
Interrupt System  
C515  
7.4 External Interrupts  
The external interrupts 0 and 1 can be programmed to be level-activated or negative-transition  
activated by setting or clearing bit IT0, respectively in register TCON. If ITx = 0 (x = 0 or 1), external  
interrupt x is triggered by a detected low level at the INTx pin. If ITx = 1, external interrupt x is  
negative edge-triggered. In this mode, if successive samples of the INTx pin show a high in one  
cycle and a low in the next cycle, interrupt request flag IEx in TCON is set. Flag bit IEx=1 then  
requests the interrupt.  
If the external interrupt 0 or 1 is level-activated, the external source has to hold the request active  
until the requested interrupt is actually generated. Then it has to deactivate the request before the  
interrupt service routine is completed, or else another interrupt will be generated.  
The external interrupts 2 and 3 can be programmed to be negative or positive transition-activated  
by setting or clearing bit I2FR or I3FR in register T2CON. lf IxFR = 0 (x = 2 or 3), the external  
interrupt x is negative transition-activated. lf IxFR = 1, the external interrupt is triggered by a positive  
transition.  
The external interrupts 4, 5, and 6 are activated only by a positive transition. The external timer 2  
reload trigger interrupt request flag EXF2 will be activated by a negative transition at pin Pl.5/T2EX  
but only if bit EXEN2 is set.  
Since the external interrupt pins (INT2 to INT6) are sampled once in each machine cycle, an input  
high or low should be held for at least 6 oscillator periods to ensure sampling. lf the external interrupt  
is transition-activated, the external source has to hold the request pin low (high for INT2 and INT3,  
if it is programmed to be negative transition-active) for at least one cycle, and then hold it high (low)  
for at least one cycle to ensure that the transition is recognized so that the corresponding interrupt  
request flag will be set (see figure 7-4). The external interrupt request flags will automatically be  
cleared by the CPU when the service routine is called.  
Semiconductor Group  
7-15  
Interrupt System  
C515  
a) Level-Activated Interrupt  
P3.x/INTx  
Low-Level Threshold  
> 1 Machine Cycle  
b) Transition-Activated Interrupt  
High-Level Threshold  
e.g. P3.x/INTx  
Low-Level Threshold  
> 1 Machine Cycle  
> 1 Machine Cycle  
MCD01860  
Transition to  
be detected  
Figure 7-4  
External Interrupt Detection  
Semiconductor Group  
7-16  
Interrupt System  
C515  
7.5 Interrupt Response Time  
If an external interrupt is recognized, its corresponding request flag is set at S5P2 in every machine  
cycle. The value is not polled by the circuitry until the next machine cycle. If the request is active and  
conditions are right for it to be acknowledged, a hardware subroutine call to the requested service  
routine will be next instruction to be executed. The call itself takes two cycles. Thus a minimum of  
three complete machine cycles will elapse between activation and external interrupt request and the  
beginning of execution of the first instruction of the service routine.  
A longer response time would be obtained if the request was blocked by one of the three previously  
listed conditions. If an interrupt of equal or higer priority is already in progress, the additional wait  
time obviously depends on the nature of the other interrupt's service routine. If the instruction in  
progress is not in its final cycle, the additional wait time cannot be more than 3 cycles since the  
longest instructions (MUL and DIV) are only 4 cycles long; and, if the instruction in progress is RETI  
or a write access to registers IEN0, IEN1 or IP0, IP1 the additional wait time cannot be more than  
5 cycles (a maximum of one more cycle to complete the instruction in progress, plus 4 cycles to  
complete the next instruction, if the instruction is MUL or DIV).  
Thus a single interrupt system, the response time is always more than 3 cycles and less than  
9 cycles.  
Semiconductor Group  
7-17  
Fail Safe Mechanisms  
C515  
8
Fail Safe Mechanisms  
8.1 Watchdog Timer  
8.1.1 General Operation  
As a means of graceful recovery from software or hardware upset a watchdog timer is provided in  
the C515. lf the software fails to clear the watchdog timer at least every 65532 ms (at 12 MHz clock  
rate), an internal hardware reset will be initiated. The software can be designed such that the  
watchdog times out if the program does not progress properly. The watchdog will also time out if the  
software error was due to hardware-related problems. This prevents the controller from  
malfunctioning for longer than 65 ms if a 12-MHz oscillator is used.  
The watchdog timer is a 16-bit counter which is incremented once every machine cycle. After an  
external reset the watchdog timer is disabled and cleared to 0000 .  
H
8.1.2 Starting the Watchdog Timer  
There are two ways to start the watchdog timer depending on the level applied to pin PE/SWD. This  
pin serves two functions, because it is also used for blocking the power saving modes. (see also  
chapter 9).  
8.1.2.1 The First Possibility of Starting the Watchdog Timer  
The automatic start of the watchdog timer directly during an external HW reset is achieved by  
strapping pin PE/SWD to VCC. In this case the power saving modes (power down mode, idle mode  
and slow down mode) are also disabled and cannot be started by software. If pin PE/SWD is left  
unconnected, a weak pull-up transistor ensures the automatic start of the watchdog timer.  
The self-start of the watchdog timer by a pin option has been implemented to provide high system  
security in electrically very noisy environments.  
Note: The automatic start of the watchdog timer is only performed if PE/SWD (power-save  
enable/start watchdog timer) is held at high level while RESET is active. A positive transition  
at PE/SWD pin during normal program execution will not start the watchdog timer.  
8.1.2.2 The Second Possibility of Starting the Watchdog Timer  
The watchdog timer can also be started by software. Setting of bit SWDT in SFR IEN1 starts the  
watchdog timer. After having been started, the bit WDTS in SFR IP0 is set. Note that the watchdog  
timer cannot be stopped by software.  
See chapter 9 for entering the power saving modes by software.  
Semiconductor Group  
8-1  
Fail Safe Mechanisms  
C515  
8.1.3 Refreshing the Watchdog Timer  
Once started, the watchdog timer can only be cleared to 0000 by first setting bit WDT and with the  
H
next instruction setting bit SWDT. Bit WDT will automatically be cleared during the second machine  
cycle after having been set. For this reason, setting SWDT bit has to be a one cycle instruction (e.g.  
SETB SWDT). This double instruction clearing of the watchdog timer was implemented to minimize  
the chance of unintentionally clearing the watchdog. To prevent the watchdog from overflowing, it  
must be cleared periodically.  
Setting only bit SWDT does not reload the watchdog timer automatically to 0000 . A watchdog  
H
timer reset operation occurs only by using the double instruction refresh sequence SETB WDT /  
SETB SWDT.  
8.1.4 Watchdog Reset and Watchdog Status Flag  
lf the software fails to clear the watchdog in time, an internally generated watchdog reset is entered  
at the counter state FFFC and lasts four instruction cycles. This internal reset differs from an  
H
external reset only to the extent that the watchdog timer is not disabled. Bit WDTS allows the  
software to examine from which source the reset was initiated. lf it is set, the reset was caused by  
a watchdog timer overflow.  
Figure 8-1 shows a block diagram of the watchdog timer.  
f OSC  
÷ 12  
16-Bit Watchdog Timer  
Reset  
WDT Reset if WDT count is between  
FFFC - FFFF  
H
H
IP0 ( A9  
-
)
H
-
WDTS  
-
-
-
-
-
External HW Reset  
PE/SWD  
Control Logic  
-
-
WDT  
-
-
-
-
-
-
-
-
-
-
-
-
IEN0 ( A8  
IEN1 ( B8  
)
)
H
H
SWDT  
MCB03210  
Figure 8-1  
Block Diagram of the Watchdog Timer  
Semiconductor Group  
8-2  
 
Fail Safe Mechanisms  
C515  
8.1.5 WDT Control and Status Flags  
The watchdog timer is controlled by two control flags (located in SFR IEN0 and IEN1) and one  
status flags (located in SFR IP0).  
Special Function Register IEN0 (Address A8 )  
H
Reset Value : 00  
Reset Value : 00  
Reset Value : X0000000  
H
H
B
Special Function Register IEN1 (Address B8 )  
H
Special Function Register IP0 (Address A9 )  
H
LSB  
A8  
MSB  
AF  
AE  
AD  
AC  
ES  
AB  
AA  
A9  
H
H
H
H
H
H
H
H
A8  
B8  
EAL  
BF  
WDT  
BE  
ET2  
BD  
ET1  
EX1  
BA  
ET0  
EX0  
B8  
IEN0  
H
BC  
BB  
EX4  
3
B9  
H
H
H
H
H
H
H
H
EXEN2 SWDT EX6  
EX5  
4
EX3  
2
EX2 EADC  
IEN1  
IP0  
H
Bit No.  
7
6
5
1
0
A9  
H
WDTS IP0.5 IP0.4 IP0.3 IP0.2 IP0.1 IP0.0  
The shaded bits are not used for fail save control.  
Bit  
Function  
WDT  
Watchdog timer refresh flag.  
Set to initiate a refresh of the watchdog timer. Must be set directly  
before SWDT is set to prevent an unintentional refresh of the  
watchdog timer. WDT is reset by hardware two processor cycles  
after it has been set.  
SWDT  
WDTS  
Watchdog timer start/refresh flag.  
Set to activate the watchdog timer. When directly set after setting  
WDT, a watchdog timer refresh/reset is performed. Bit SDWT is reset  
by hardware two processor cycles after it has been set.  
Watchdog timer status flag.  
Set by hardware when a watchdog Timer reset occured. Can be  
cleared and set by software.  
Semiconductor Group  
8-3  
Power Saving Modes  
C515  
9
Power Saving Modes  
The C515 provides two basic power saving modes, the idle mode and the power down mode.  
Additionally, a slow down mode is available. This power saving mode reduces the internal clock rate  
in normal operating mode and it can be also used for further power reduction in idle mode. All the  
power saving modes are initiated by software.  
9.1 Hardware Enable for the Use of the Power Saving Modes  
To provide power saving modes together with effective protection against unintentional entering of  
these modes, the C515 has an extra pin disabling the use of the power saving modes. As this pin  
will most likely be used only in critical applications it is combined with an automatic start of the  
watchdog timer (see the description in chapter 8 “Fail Save Mechanisms”). This pin is called PE/  
SWD (power saving enable/start watchdog timer) and its function is as follows:  
PE/SWD = 1 (logic high level)  
– Use of the power saving modes is not possible. The instruction sequences used for entering  
these modes will not affect the normal operation of the device.  
– lf and only if PE/SWD is held at high level during reset, the watchdog timer is started  
immediately after reset is released.  
PE/SWD = 0 (logic low level)  
– All power saving modes can be activated as described in the following sections  
– The watchdog timer has to be started by software if system protection is desired.  
When left unconnected, the pin PE/SWD is pulled to high level by a weak internal pullup. This is  
done to provide system protection by default.  
The logic level applied to pin PE/SWD can be changed during program execution in order to allow  
or block the use of the power saving modes without any effect on the on-chip watchdog circuitry;  
(the watchdog timer is started only if PE/SWD is on high level up to the moment when reset is  
released; a change at PE/SWD during program execution has no effect on the watchdog timer; this  
only enables or disables the use of the power saving modes.). A change of the pin’s level is detected  
in state 3, phase 1. A Schmitt trigger is used at the input to reduce susceptibility to noise.  
In addition to the hardware enable/disable of the power saving modes, a double-instruction  
sequence which is described in the corresponding sections is necessary to enter power down and  
idle mode. The combination of all these safety precautions provide a maximum of system  
protection.  
Application Example for Switching Pin PE/SWD  
For most applications in noisy environments, components external to the chip are used to give  
warning of a power failure or a turn off of the power supply. These circuits could be used to control  
the PE/SWD pin. The possible steps to go into power down mode could then be as follows:  
– A power-fail signal forces the controller to go into a high priority interrupt routine. This interrupt  
routine saves the actual program status. At the same time pin PE/SWD is pulled low by the  
power-fail signal.  
– Finally the controller enters power down mode by executing the relevant double-instruction  
sequence.  
Semiconductor Group  
9-1  
Power Saving Modes  
C515  
9.2 Power Saving Mode Control Register  
The functions of the power saving modes are controlled by bits which are located in the special  
function register PCON. The bits PDE, PDS and IDLE, IDLS located in SFR PCON select the power  
down mode or the idle mode, respectively. If the power down mode and the idle mode are set at the  
same time, power down takes precedence. Furthermore, register PCON contains two general  
purpose flags. For example, the flag bits GF0 and GF1 can be used to give an indication if an  
interrupt occurred during normal operation or during an idle. For this, 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 examine the flag bits.  
Special Function Register PCON (Address 87  
Reset Value : 00  
H)  
H
LSB  
0
Bit No. MSB  
7
6
5
4
3
2
1
87  
PCON  
SMOD  
PDS  
IDLS  
SD  
GF1  
GF0  
PDE  
IDLE  
H
The function of the shaded bit is not described in this section.  
Symbol  
Function  
PDS  
Power down start bit  
The instruction that sets the PDS flag bit is the last instruction before entering  
the power down mode  
IDLS  
SD  
Idle start bit  
The instruction that sets the IDLS flag bit is the last instruction before entering  
the idle mode.  
Slow down mode bit  
When set, the slow down mode is enabled. This function is available in the  
C515-LM/1RM versions only.  
GF1  
GF0  
PDE  
General purpose flag  
General purpose flag  
Power down enable bit  
When set, starting of the power down is enabled  
IDLE  
Idle mode enable bit  
When set, starting of the idle mode is enabled  
Note: The PDS bit, which controls the software power down mode is forced to logic low whenever  
the external PE/SWD pin is held at logic high level. Changing the logic level of the PE/SWD  
pin from high to low will irregularly terminate the software power down mode and is not  
permitted.  
Semiconductor Group  
9-2  
Power Saving Modes  
C515  
9.3 Idle Mode  
In the idle mode the oscillator of the C515 continues to run, but the CPU is gated off from the clock  
signal. However, the interrupt system, the serial port, the A/D converter, and all timers with the  
exception of the watchdog timer are further provided with the clock. The CPU status is preserved in  
its entirety: the stack pointer, program counter, program status word, accumulator, and all other  
registers maintain their data during idle mode.  
The reduction of power consumption, which can be achieved by this feature depends on the number  
of peripherals running. If all timers are stopped and the A/D converter, and the serial interfaces are  
not running, the maximum power reduction can be achieved. This state is also the test condition for  
the idle mode ICC.  
Thus, the user has to take care which peripheral should continue to run and which has to be stopped  
during idle mode. Also the state of all port pins – either the pins controlled by their latches or  
controlled by their secondary functions – depends on the status of the controller when entering idle  
mode.  
Normally, the port pins hold the logical state they had at the time when the idle mode was activated.  
If some pins are programmed to serve as alternate functions they still continue to output during idle  
mode if the assigned function is on. This especially applies to the serial interface in case it cannot  
finish reception or transmission during normal operation. The control signals ALE and PSEN are  
held at logic high levels.  
As in normal operation mode, the ports can be used as inputs during idle mode. Thus a capture or  
reload operation can be triggered, the timers can be used to count external events, and external  
interrupts will be detected.  
The idle mode is a useful feature which makes it possible to "freeze" the processor's status - either  
for a predefined time, or until an external event reverts the controller to normal operation, as  
discussed below. The watchdog timer is the only peripheral which is automatically stopped during  
idle mode.  
Semiconductor Group  
9-3  
Power Saving Modes  
C515  
The idle mode is entered by two consecutive instructions. The first instruction sets the flag bit IDLE  
(PCON.0) and must not set bit IDLS (PCON.5), the following instruction sets the start bit IDLS  
(PCON.5) and must not set bit IDLE (PCON.0). The hardware ensures that a concurrent setting of  
both bits, IDLE and IDLS, does not initiate the idle mode. Bits IDLE and IDLS will automatically be  
cleared after being set. If one of these register bits is read the value that appears is 0. This double  
instruction is implemented to minimize the chance of an unintentional entering of the idle mode  
which would leave the watchdog timer's task of system protection without effect.  
Note:  
PCON is not a bit-addressable register, so the above mentioned sequence for entering the idle  
mode is obtained by byte-handling instructions, as shown in the following example:  
ORL  
ORL  
PCON,#00000001B  
PCON,#00100000B  
;Set bit IDLE, bit IDLS must not be set  
;Set bit IDLS, bit IDLE must not be set  
The instruction that sets bit IDLS is the last instruction executed before going into idle mode.  
There are two ways to terminate the idle mode:  
– The idle mode can be terminated by activating any enabled interrupt. The CPU operation is  
resumed, the interrupt will be serviced and the next intsruction to be executed after the RETI  
instruction will be the one following the instruction that had set the bit IDLS.  
– The other way to terminate the idle mode, is a hardware reset. Since the oscillator is still  
running, the hardware reset must be held active only for two machine cycles for a complete  
reset.  
Semiconductor Group  
9-4  
Power Saving Modes  
C515  
9.4 Slow Down Mode Operation (C515-LM/1RM only)  
In some applications, where power consumption and dissipation are critical, the controller might run  
for a certain time at reduced speed (e.g. if the controller is waiting for an input signal). Since in  
CMOS devices there is an almost linear dependence of the operating frequency and the power  
supply current, a reduction of the operating frequency results in reduced power consumption.  
In the slow down mode all signal frequencies that are derived from the oscillator clock are divided  
by 8.  
The slow down mode is activated by setting the bit SD in SFR PCON. If the slow down mode is  
enabled, the clock signals for the CPU and the peripheral units are reduced to 1/8 of the nominal  
system clock rate. The controller actually enters the slow down mode after a short synchronization  
period (max. two machine cycles). The slow down mode is terminated by clearing bit SD.  
The slow down mode can be combined with the idle mode by performing the following double  
instruction sequence:  
ORL PCON,#00000001B  
ORL PCON,#00110000B  
; preparing idle mode: set bit IDLE (IDLS not set)  
; entering idle mode combined with the slow down mode:  
; (IDLS and SD set)  
There are two ways to terminate the combined Idle and Slow Down Mode :  
– The idle mode can be terminated by activation of any enabled interrupt. The CPU operation  
is resumed, the interrupt will be serviced and the next instruction to be executed after the RETI  
instruction will be the one following the instruction that had set the bits IDLS and SD.  
Nevertheless the slow down mode keeps enabled and if required has to be terminated by  
clearing the bit SD in the corresponding interrupt service routine or at any point in the program  
where the user no longer requires the slow-down mode power saving.  
– The other possibility of terminating the combined idle and slow down mode is a hardware  
reset. Since the oscillator is still running, the hardware reset has to be held active for only two  
machine cycles for a complete reset.  
The slow down feature is not available for C515-LN/1RN versions.  
Semiconductor Group  
9-5  
Power Saving Modes  
C515  
9.5 Power Down Mode  
In the power down mode, the RC osciillator and the on-chip oscillator which operates with the XTAL  
pins is stopped. Therefore, all functions of the microcontroller are stopped and only the contents of  
the on-chip RAM and the SFR's are maintained. The port pins, which are controlled by their port  
latches, output the values that are held by their SFR's. The port pins which serve the alternate  
output functions show the values they had at the end of the last cycle of the instruction which  
initiated the power down mode. ALE and PSEN held at logic low level (see table 9-1).  
In the power down mode of operation, VCC can be reduced to minimize power consumption. It must  
be ensured, however, that is VCC not reduced before the power down mode is invoked, and that VCC  
is restored to its normal operating level before the power down mode is terminated.  
The power down mode can be left only by a hardware reset. Leaving the power down mode puts the  
microcontroller with its SFRs into the reset state, and it should not be done before VCC is restored  
to its nominal operating level.  
9.5.1 Invoking Power Down Mode  
The power down mode is entered by two consecutive instructions. The first instruction has to set the  
flag bit PDE (PCON.1) and must not set bit PDS (PCON.6), the following instruction has to set the  
start bit PDS (PCON.6) and must not set bit PDE (PCON.1). The hardware ensures that a  
concurrent setting of both bits, PDE and PDS, does not initiate the power down mode. Bits PDE and  
PDS will automatically be cleared after having been set and the value shown by reading one of  
these bits is always 0. This double instruction is implemented to minimize the chance of  
unintentionally entering the power down mode which could possibly ”freeze” the chip's activity in an  
undesired status.  
PCON is not a bit-addressable register, so the above mentioned sequence for entering the power  
down mode is obtained by byte-handling instructions, as shown in the following example:  
ORL  
ORL  
PCON,#00000010B  
PCON,#01000000B  
;set bit PDE, bit PDS must not be set  
;set bit PDS, bit PDE must not be set, enter power down  
The instruction that sets bit PDS is the last instruction executed before going into power down  
mode. When the double instruction sequence shown above is used, the power down mode can only  
be left by a reset operation.  
Note : Before entering the power down mode, an A/D conversion in progress must be stopped.  
9.5.2 Exit from Power Down Mode  
If power down mode is exit via a hardware reset, the microcontroller with its SFRs is put into the  
hardware reset state and the content of RAM is not changed. The reset signal that terminates the  
power down mode also restarts the RC oscillator and the on-chip oscillatror. The reset operation  
should not be activated before VCC is restored to its normal operating level and must be held active  
long enough to allow the oscillator to restart and stabilize (similar to power-on reset).  
Semiconductor Group  
9-6  
Power Saving Modes  
C515  
9.6 State of Pins in the Power Saving Modes  
In the idle mode and in the power down mode the port pins of the C515 have a well defined status  
which is listed in the following table 9-1. This state of some pins also depends on the location of the  
code memory (internal or external).  
Table 9-1  
Status of External Pins During Idle and Software Power Down Mode  
Outputs  
Last Instruction Executed from  
Internal Code Memory  
Last Instruction Executed from  
External Code Memory  
Idle  
Power Down  
Low  
Idle  
Power Down  
Low  
ALE  
High  
High  
Data  
Data  
Data /  
High  
PSEN  
Low  
High  
Low  
PORT 0  
PORT 2  
PORT 1, 3, 4  
Data  
Float  
Float  
Data  
Address  
Data /  
Data  
Data /  
Data /  
alternate outputs last output  
alternate outputs last output  
Semiconductor Group  
9-7  
 
Device Specifications  
C515  
10  
Device Specifications  
10.1  
Absolute Maximum Ratings  
Ambient temperature under bias (TA) .............................................................. 0 ˚C to + 110 ˚C  
Storage temperature (TST) ...............................................................................– 65 ˚C to + 150 ˚C  
Voltage on VCC pins with respect to ground (VSS) ............................................– 0.5 V to 6.5 V  
Voltage on any pin with respect to ground (VSS)..............................................– 0.5 V to VCC + 0.5 V  
Input current on any pin during overload condition..........................................– 10 mA to + 10 mA  
Absolute sum of all input currents during overload condition ..........................| 100 mA |  
Power dissipation.............................................................................................TBD  
Note: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent  
damage of the device. This is a stress rating only and functional operation of the device at  
these or any other conditions above those indicated in the operational sections of this  
specification is not implied. Exposure to absolute maximum rating conditions for longer  
periods may affect device reliability. During overload conditions (VIN > VCC or VIN < VSS) the  
Voltage on VCC pins with respect to ground (VSS) must not exceed the values defined by the  
absolute maximum ratings.  
Semiconductor Group  
10-1  
Device Specifications  
C515  
10.2  
DC Characteristics  
VCC = 5 V + 10%, – 15%; VSS = 0 V  
TA = 0 to 70 °C  
TA = – 40 to 85 °C  
TA = – 40 to 110 °C  
for the SAB-C515  
for the SAF-C515  
for the SAH-C515  
Parameter  
Symbol  
Limit Values  
Unit Test Condition  
min.  
max.  
Input low voltages  
all except EA  
EA pin  
VIL  
VIL1  
– 0.5  
– 0.5  
0.2 VCC - 0.1  
0.2 VCC - 0.3  
V
V
Input high voltages  
all except XTAL2 and RESET  
XTAL2 pin  
VIH  
VIH1  
VIH2  
0.2 VCC + 0.9 VCC + 0.5  
V
V
V
0.7 VCC  
0.6 VCC  
V
CC + 0.5  
RESET pin  
VCC + 0.5  
Output low voltages  
Ports 1, 2, 3, 4, 5  
Port 0, ALE, PSEN  
VOL  
VOL1  
0.45  
0.45  
V
V
IOL = 1.6 mA 1)  
IOL = 3.2 mA 1)  
Output high voltages  
Ports 1, 2, 3, 4, 5  
VOH  
2.4  
0.9 VCC  
2.4  
V
V
V
V
I
I
I
I
OH = – 80 mA  
OH = – 10 mA)  
OH = – 800 mA 2)  
OH = – 80 mA 2)  
Port 0 an 2 in external bus mode, VOH2  
ALE, PSEN  
0.9 VCC  
Logic 0 input current  
Ports 1, 2, 3, 4, 5  
IIL  
– 10  
– 65  
– 70  
mA  
mA  
VIN = 0.45 V  
VIN = 2 V  
Logical 0-to-1 transition current ITL  
– 650  
Ports 1, 2, 3, 4, 5  
Input leakage current  
Port 0, AIN0-7 (Port 6), EA  
ILI  
± 1  
mA  
0.45 < VIN < VCC  
Input low current  
to RESET for reset  
XTAL2  
ILI2  
ILI3  
ILI4  
–10  
– 100  
– 15  
– 20  
mA  
mA  
mA  
VIN = 0.45 V  
VIN = 0.45 V  
VIN = 0.45 V  
PE  
Pin capacitance  
Overload current  
Notes see next page  
CIO  
10  
pF  
fc = 1 MHz,  
TA = 25 °C  
7) 8)  
IOV  
± 5  
mA  
Semiconductor Group  
10-2  
Device Specifications  
C515  
Power Supply Current  
Parameter  
Symbol  
Limit Values  
Unit Test Condition  
typ. 9)  
max. 10)  
4)  
Active mode  
Idle mode  
12 MHz  
16 MHz  
24 MHz  
11.0  
13.7  
19.1  
14.8  
18.2  
25  
mA  
mA  
mA  
ICC  
ICC  
ICC  
5)  
12 MHz  
16 MHz  
24 MHz  
5.8  
6.9  
9.1  
8.1  
9.6  
12.8  
mA  
mA  
mA  
ICC  
ICC  
ICC  
6)  
Active mode with  
12 MHz  
16 MHz  
24 MHz  
4.2  
4.9  
6.3  
6.1  
7.0  
8.8  
mA  
mA  
mA  
ICC  
ICC  
ICC  
slow-down enabled  
3)  
Power-down mode  
IPD  
10  
30  
mA  
1) Capacitive loading on ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOL of ALE  
and ports1, 3, 4, and 5. The noise is due to external bus capacitance discharging into the port 0 and port 2 pins  
when these pins make 1-to-0 transitions during bus operation. In the worst case (capacitive loading > 100 pF),  
the noise pulse on ALE line may exceed 0.8 V. In such cases it may be desirable to qualify ALE with a schmitt-  
trigger, or use an address latch with a schmitt-trigger strobe input.  
2) Capacitive loading on ports 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall below the  
0.9 VCC specification when the address lines are stabilizing.  
3) IPD (power-down mode) is measured under following conditions:  
EA = Port 0 = Port 6 =VCC ; RESET = VCC; XTAL1 = N.C.; PE = XTAL2 = VSS ; VAGND = VSS ; VAREF = VCC ; all  
other pins are disconnected. The typical IPD current is measured at VCC = 5V.  
4) ICC (active mode) is measured with:  
XTAL2 driven with tCLCH , tCHCL = 5 ns , VIL = VSS + 0.5 V, VIH = VCC – 0.5 V; XTAL1 = N.C.;  
EA = Port 0 = Port 6 = VCC ; RESET = VSS ; all other pins are disconnected.  
5) ICC (idle mode) is measured with all output pins disconnected and with all peripherals disabled;  
XTAL2 driven with tCLCH , tCHCL = 5 ns, VIL = VSS + 0.5 V, VIH = VCC – 0.5 V; XTAL1 = N.C.;  
EA = Port 0 = Port 6 = VCC ; RESET = VCC ; all other pins are disconnected;  
6) ICC (active mode with slow-down mode) is measured with :  
XTAL2 driven with tCLCH , tCHCL = 5 ns , VIL = VSS + 0.5 V, VIH = VCC – 0.5 V; XTAL1 = N.C.;  
EA = Port 0 = Port 6 = VCC ; RESET = VCC ; all other pins are disconnected; the microcontroller is put into  
slow-down mode by software; all peripheral units are not activated.  
7) Overload conditions occur if the standard operating conditions are exceeded, ie. the voltage on any pin  
exceeds the specified range (i.e. VOV > VCC + 0.5 V or VOV < VSS - 0.5 V). The supply voltage VCC and VSS must  
remain within the specified limits. The absolute sum of input currents on all port pins may not exceed 50 mA.  
8) Not 100% tested, guaranteed by design characterization  
9) The typical ICC values are periodically measured at TA = +25 ˚C and VCC = 5 V but not 100% tested.  
10)The maximum ICC values are measured under worst case conditions (TA = 0 ˚C or -40 ˚C and VCC = 5.5 V)  
Semiconductor Group  
10-3  
Device Specifications  
C515  
30  
mA  
25  
I CC max  
I CC typ  
I CC  
Active Mode  
Active Mode  
20  
15  
10  
5
Idle Mode  
Idle Mode  
Active Mode with Slow Down  
0
0
4
8
12  
16  
20  
MHz  
24  
fOSC  
Active mode  
Idle mode  
: I CC typ = 0.68 x fOSC + 2.8  
: I CC max = 0.85 x fOSC + 4.6  
: I CC typ = 0.28 x fOSC + 2.4  
: I CC max = 0.39 x fOSC + 3.4  
Active mode with slow-down : I CC typ = 0.18 x fOSC + 2.0  
: I CC max = 0.23 x fOSC + 3.3  
f
OSC is the oscillator frequency in MHz. I CC values are given in mA.  
MCD03282  
ICC Diagram  
Semiconductor Group  
10-4  
Device Specifications  
C515  
10.3  
A/D Converter Characteristics  
VCC = 5 V + 10%, – 15%; VSS = 0 V  
TA = 0 to 70 °C  
TA = – 40 to 85 °C  
TA = – 40 to 110 °C  
for the SAB-C515  
for the SAF-C515  
for the SAH-C515  
VCC – 0.25 V £ VAREF £ VCC + 0.1 V; VSS – 0.1 V £ VAGND £ VSS + 0.2 V; VIntAREF - VIntAGND ³ 1 V;  
Parameter  
Symbol  
Limit Values  
Unit Test Condition  
min.  
max.  
1)  
Analog input voltage  
VAIN  
VAGND  
-
VAREF  
+
V
0.2  
0.2  
A/D converter input clock  
Sample time  
t IN  
2 x t CLCL  
40 x tIN  
72 x tIN  
± 1  
ns  
2)  
tS  
ns  
3)  
Conversion cycle time  
Total unadjusted error  
tADCC  
ns  
TUE  
LSB  
V
IntAREF = VAREF = VCC  
IntAGND = VAGND = VSS  
5) 6)  
4)  
V
tIN in [ns]  
Internal resistance of  
reference voltage source  
RAREF  
RASRC  
CAIN  
4 x tIN /500 kW  
- 1  
2) 6)  
tS in [ns]  
Internal resistance of  
analog source  
tS / 500 - 1 kW  
6)  
ADC input capacitance  
45  
pF  
Notes:  
1) V  
may exeed V  
or V  
up to the absolute maximum ratings. However, the conversion result in  
these cases will be 00 or FF , respectively.  
AIN  
AGND  
AREF  
H
H
2) During the sample time the input capacitance C  
can be charged/discharged by the external source. The  
AIN  
internal resistance of the analog source must allow the capacitance to reach their final voltage level within t .  
After the end of the sample time t , changes of the analog input voltage have no effect on the conversion  
S
result.  
S
3) This parameter includes the sample time t and the conversion time t . The values for the conversion clock  
S
CO  
t
is always 4 x t .  
ADC  
IN  
4) T  
is tested at V  
AREF  
= 5.0 V, V  
AGND  
= 0 V, V  
= 4.9 V. It is guaranteed by design characterization for all  
UE  
CC  
other voltages within the defined voltage range.  
If an overload condition occurs on maximum 2 not selected analog input pins and the absolute sum of input  
overload currents on all analog input pins does not exceed 10 mA, an additional conversion error of 1/2 LSB  
is permissible.  
5) During the conversion the ADC’s capacitance must be repeatedly charged or discharged. The internal  
resistance of the reference source must allow the capacitance to reach their final voltage level within the  
indicated time. The maximum internal resistance results from the programmed conversion timing.  
6) Not 100% tested, but guaranteed by design characterization.  
Semiconductor Group  
10-5  
Device Specifications  
C515  
10.4  
AC Characteristics (16 MHz)  
VCC = 5 V + 10%, – 15%; VSS = 0 V  
TA = 0 to 70 °C  
TA = – 40 to 85 °C  
TA = – 40 to 110 °C  
for the SAB-C515  
for the SAF-C515  
for the SAH-C515  
(CL for port 0, ALE and PSEN outputs = 100 pF; CL for all other outputs = 80 pF)  
Program Memory Characteristics  
Parameter  
Symbol  
Limit Values  
Variable Clock  
1/tCLCL = 1 MHz to 16 MHz  
Unit  
16 MHz  
Clock  
min. max. min.  
max.  
ALE pulse width  
tLHLL  
tAVLL  
tLLAX  
tLLIV  
85  
33  
28  
2tCLCL – 40  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
Address setup to ALE  
Address hold after ALE  
ALE low to valid instruction in  
ALE to PSEN  
t
CLCL – 30  
CLCL – 35  
t
150  
4tCLCL – 100  
tLLPL  
tPLPH  
tPLIV  
38  
153  
tCLCL – 25  
PSEN pulse width  
3tCLCL – 35  
PSEN to valid instruction in  
88  
0
3tCLCL – 100  
Input instruction hold after PSEN tPXIX  
0
*)  
Input instruction float after PSEN tPXIZ  
43  
tCLCL – 20  
*)  
Address valid after PSEN  
Address to valid instruction in  
Address float to PSEN  
tPXAV  
tAVIV  
tAZPL  
55  
tCLCL – 8  
198  
0
5tCLCL – 115  
0
*)  
Interfacing the C515 to devices with float times up to 55 ns is permissible. This limited bus contention will not  
cause any damage to port 0 drivers.  
CLKOUT Timing  
Parameter  
Symbol  
Limit Values  
Variable Clock  
1/tCLCL = 3.5 MHz to 16 MHz  
Unit  
16 MHz  
Clock  
min. max. min.  
max.  
ALE to CLKOUT  
tLLSH  
tSHSL  
tSLSH  
tSLLH  
398  
85  
7 tCLCL – 40  
2 tCLCL – 40  
10 tCLCL – 40  
ns  
ns  
ns  
ns  
CLKOUT high time  
CLKOUT low time  
CLKOUT low to ALE high  
585  
23  
103  
tCLCL – 40  
tCLCL + 40  
Semiconductor Group  
10-6  
Device Specifications  
C515  
AC Characteristics (16 MHz) (cont’d)  
External Data Memory Characteristics  
Parameter  
Symbol  
Limit Values  
Unit  
16 MHz  
Clock  
Variable Clock  
1/tCLCL = 1 MHz to 16 MHz  
min. max. min.  
max.  
RD pulse width  
tRLRH  
tWLWH  
tLLAX2  
tRLDV  
tRHDX  
tRHDZ  
tLLDV  
275  
275  
90  
6tCLCL – 100  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
WR pulse width  
6tCLCL – 100  
Address hold after ALE  
RD to valid data in  
2tCLCL – 35  
148  
5tCLCL – 165  
Data hold after RD  
0
0
Data float after RD  
55  
350  
398  
238  
2tCLCL – 70  
8tCLCL – 150  
9tCLCL – 165  
3tCLCL + 50  
ALE to valid data in  
Address to valid data in  
ALE to WR or RD  
tAVDV  
tLLWL  
tAVWL  
tWHLH  
tQVWX  
tQVWH  
tWHQX  
tRLAZ  
138  
120  
23  
13  
288  
13  
3tCLCL – 50  
4tCLCL – 130  
Address valid to WR or RD  
WR or RD high to ALE high  
Data valid to WR transition  
Data setup before WR  
Data hold after WR  
Address float after RD  
103  
t
CLCL – 40  
CLCL – 50  
tCLCL + 40  
t
0
7tCLCL – 150  
CLCL – 50  
t
0
External Clock Drive Characteristics  
Parameter  
Symbol  
Limit Values  
Variable Clock  
Unit  
Freq. = 1 MHz to 16 MHz  
min.  
62.5  
20  
20  
max.  
Oscillator period  
High time  
tCLCL  
tCHCX  
tCLCX  
tCLCH  
tCHCL  
1000  
ns  
ns  
ns  
ns  
ns  
t
CLCL tCLCX  
CLCL tCHCX  
Low time  
t
Rise time  
20  
20  
Fall time  
Semiconductor Group  
10-7  
Device Specifications  
C515  
10.5  
AC Characteristics (24 MHz)  
VCC = 5 V + 10%, – 15%; VSS = 0 V  
TA = 0 to 70 °C  
TA = – 40 to 85 °C  
TA = – 40 to 110 °C  
for the SAB-C515  
for the SAF-C515  
for the SAH-C515  
(CL for port 0, ALE and PSEN outputs = 100 pF; CL for all other outputs = 80 pF)  
Program Memory Characteristics  
Parameter  
Symbol  
Limit Values  
Variable Clock  
1/tCLCL = 1 MHz to 24 MHz  
Unit  
24 MHz  
Clock  
min. max. min.  
max.  
ALE pulse width  
tLHLL  
tAVLL  
tLLAX  
tLLIV  
43  
17  
17  
2tCLCL – 40  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
Address setup to ALE  
Address hold after ALE  
ALE low to valid instruction in  
ALE to PSEN  
t
CLCL – 25  
CLCL – 25  
t
80  
4tCLCL – 87  
tLLPL  
tPLPH  
tPLIV  
22  
95  
tCLCL – 20  
PSEN pulse width  
3tCLCL – 30  
PSEN to valid instruction in  
60  
0
3tCLCL – 65  
Input instruction hold after PSEN tPXIX  
0
*)  
Input instruction float after PSEN tPXIZ  
32  
tCLCL – 10  
*)  
Address valid after PSEN  
Address to valid instruction in  
Address float to PSEN  
tPXAV  
tAVIV  
tAZPL  
37  
tCLCL – 5  
148  
0
5tCLCL – 60  
0
*) Interfacing the C501 to devices with float times up to 37 ns is permissible. This limited bus contention will not  
cause any damage to port 0 Drivers.  
CLKOUT Timing  
Parameter  
Symbol  
Limit Values  
Variable Clock  
1/tCLCL = 3.5 MHz to 24 MHz  
Unit  
24 MHz  
Clock  
min. max. min.  
max.  
ALE to CLKOUT  
tLLSH  
tSHSL  
tSLSH  
tSLLH  
252  
43  
7 tCLCL – 40  
2 tCLCL – 40  
10 tCLCL – 40  
ns  
ns  
ns  
ns  
CLKOUT high time  
CLKOUT low time  
CLKOUT low to ALE high  
377  
2
82  
tCLCL – 40  
tCLCL + 40  
Semiconductor Group  
10-8  
Device Specifications  
C515  
AC Characteristics (24 MHz) (cont’d)  
External Data Memory Characteristics  
Parameter  
Symbol  
Limit Values  
Unit  
24 MHz  
Clock  
Variable Clock  
1/tCLCL = 1 MHz to 24 MHz  
min. max. min.  
max.  
RD pulse width  
tRLRH  
tWLWH  
tLLAX2  
tRLDV  
tRHDX  
tRHDZ  
tLLDV  
180  
180  
48  
6tCLCL – 70  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
ns  
WR pulse width  
6tCLCL – 70  
Address hold after ALE  
RD to valid data in  
2tCLCL – 35  
118  
5tCLCL – 90  
Data hold after RD  
0
0
Data float after RD  
63  
200  
220  
175  
2tCLCL – 20  
8tCLCL – 133  
9tCLCL – 155  
3tCLCL + 50  
ALE to valid data in  
Address to valid data in  
ALE to WR or RD  
tAVDV  
tLLWL  
tAVWL  
tWHLH  
tQVWX  
tQVWH  
tWHQX  
tRLAZ  
75  
67  
17  
5
3tCLCL – 50  
4tCLCL – 97  
Address valid to WR or RD  
WR or RD high to ALE high  
Data valid to WR transition  
Data setup before WR  
Data hold after WR  
Address float after RD  
67  
t
CLCL – 25  
CLCL – 37  
tCLCL + 25  
t
0
170  
15  
7tCLCL – 122  
CLCL – 27  
t
0
External Clock Drive Characteristics  
Parameter  
Symbol  
Limit Values  
Variable Clock  
Unit  
Freq. = 1 MHz to 24 MHz  
min.  
41.7  
12  
12  
max.  
Oscillator period  
High time  
tCLCL  
tCHCX  
tCLCX  
tCLCH  
tCHCL  
1000  
ns  
ns  
ns  
ns  
ns  
t
CLCL tCLCX  
CLCL tCHCX  
Low time  
t
Rise time  
12  
12  
Fall time  
Semiconductor Group  
10-9  
Device Specifications  
C515  
t LHLL  
ALE  
tAVLL  
t PLPH  
t LLPL  
t LLIV  
t PLIV  
PSEN  
t AZPL  
t LLAX  
t PXAV  
t PXIZ  
t PXIX  
Port 0  
A0 - A7  
Instr.IN  
A0 - A7  
t AVIV  
Port 2  
A8 - A15  
A8 - A15  
MCT00096  
Program Memory Read Cycle  
Semiconductor Group  
10-10  
Device Specifications  
C515  
tWHLH  
ALE  
PSEN  
RD  
t LLDV  
t LLWL  
t RLRH  
t RLDV  
t AVLL  
tRHDZ  
t LLAX2  
t RLAZ  
tRHDX  
A0 - A7 from  
Ri or DPL  
A0 - A7  
from PCL  
Instr.  
IN  
Port 0  
Data IN  
tAVWL  
t AVDV  
Port 2  
P2.0 - P2.7 or A8 - A15 from DPH  
A8 - A15 from PCH  
MCT00097  
Data Memory Read Cycle  
Semiconductor Group  
10-11  
Device Specifications  
C515  
tWHLH  
ALE  
PSEN  
WR  
t LLWL  
t WLWH  
tQVWX  
t AVLL  
tWHQX  
t LLAX2  
tQVWH  
A0 - A7 from  
Ri or DPL  
A0 - A7  
Instr.IN  
Port 0  
Port 2  
Data OUT  
from PCL  
tAVWL  
P2.0 - P2.7 or A8 - A15 from DPH  
A8 - A15 from PCH  
MCT00098  
Data Memory Write Cycle  
Semiconductor Group  
10-12  
Device Specifications  
C515  
t SLLH  
ALE  
t LLSH  
t SHSL  
t LLSH  
CLK OUT  
t SLSH  
PSEN  
RD,WR  
Program Memory Access  
Data Memory Access  
MCT00083  
CLKOUT Timing  
tCLCL  
V
CC- 0.5V  
0.45V  
0.7 VCC  
0.2 VCC- 0.1  
tCLCX  
tCHCX  
MCT00033  
tCHCL  
tCLCH  
External Clock Drive on XTAL2  
Semiconductor Group  
10-13  
Device Specifications  
C515  
10.6  
ROM Verification Characteristics for the C515-1R  
ROM Verification Mode 1  
Parameter  
Symbol  
Limit Values  
Unit  
min.  
max.  
tAVQV  
Address to valid data  
10 tCLCL  
ns  
P1.0 - P1.7  
P2.0 - P2.4  
Address  
New Address  
New Data Out  
tAVQV  
Port 0  
Data OUT  
Address : P1.0 - P1.7 = A0 - A7  
Inputs : PSEN =VSS  
ALE, EA =VIH  
P2.0 - P2.4 = A8 - A12  
Data :  
P0.0 - P0.7 = D0 - D7  
RESET =VIL2  
MCT03212  
ROM Verification Mode 1  
Semiconductor Group  
10-14  
Device Specifications  
C515  
ROM Verification Mode 2  
Parameter  
Symbol  
Limit Values  
Unit  
min.  
typ  
2 tCLCL  
12 tCLCL  
max.  
tAWD  
tACY  
ALE pulse width  
ns  
ALE period  
ns  
tDVA  
Data valid after ALE  
Data stable after ALE  
P3.5 setup to ALE low  
Oscillator frequency  
4 tCLCL  
ns  
tDSA  
8 tCLCL  
ns  
tAS  
1
tCLCL  
ns  
1/ tCLCL  
24  
MHz  
t ACY  
t AWD  
ALE  
t DSA  
t DVA  
Port 0  
P3.5  
Data Valid  
t AS  
MCT02613  
ROM Verification Mode 2  
Semiconductor Group  
10-15  
Device Specifications  
C515  
VCC -0.5 V  
0.2 VCC+0.9  
0.2 VCC -0.1  
Test Points  
0.45 V  
MCT00039  
AC Inputs during testing are driven at VCC - 0.5 V for a logic ’1’ and 0.45 V for a logic ’0’.  
Timing measurements are made at VIHmin for a logic ’1’ and VILmax for a logic ’0’.  
AC Testing: Input, Output Waveforms  
-0.1 V  
VOH  
V
Load +0.1 V  
Timing Reference  
Points  
VLoad  
-0.1 V  
VLoad  
VOL +0.1 V  
MCT00038  
For timing purposes a port pin is no longer floating when a 100 mV change from load voltage  
occurs and begins to float when a 100 mV change from the loaded VOH/VOL level occurs.  
IOL/IOH ³ ± 20 mA  
AC Testing: Float Waveforms  
Crystal Oscillator Mode  
Driving from External Source  
C
N.C.  
XTAL1  
XTAL2  
XTAL1  
XTAL2  
1-24 MHz  
C
External Oscillator  
Signal  
Crystal Mode : C = 20 pF±10 pF (incl. stray capacitance)  
MCS03204  
Recommended Oscillator Circuits for Crystal Oscillator  
Semiconductor Group  
10-16  
Device Specifications  
C515  
10.7  
Package Information (P-LCC-68)  
Plastic Package, P-LCC-68 (SMD)  
(Plastic Lead Chip-Carrier)  
1.2 x 45˚  
1.27  
0.81 max  
23.3 ±0.3  
24.21 ±0.071)  
25.28 -0.26  
0.38  
M
A-B D 34x  
0.43 ±0.1  
0.18  
M
D 68x  
0.1  
A-B  
20.32  
D
A
B
Index Marking  
68  
1
0.5 x 45˚  
3 x  
1.1 x 45˚  
24.21 ±0.071)  
25.28 -0.26  
GPL05099  
1) Does not include plastic or metal protrusions of 0.15 max per side  
Sorts of Packing  
Package outlines for tubes, trays etc. are contained in our  
Data Book “Package Information”  
Dimensions in mm  
SMD = Surface Mounted Device  
Semiconductor Group  
10-17  
Device Specifications  
C515  
10.8  
Package Information (P-MQFP-80)  
Plastic Package, P-MQFP-80-1 (SMD)  
(Plastic Metric Quad Flat Package)  
H
0.65  
±0.08  
0.88  
80x  
0.3  
C
0.1  
12.35  
17.2  
14 1)  
M
0.12  
A-B D C  
0.2 A-B D 80x  
0.2 A-B D 4x  
H
D
B
A
80  
1
Index Marking  
0.6x45˚  
1) Does not include plastic or metal protrusions of 0.25 max per side  
Sorts of Packing  
Package outlines for tubes, trays etc. are contained in our  
Data Book “Package Information”  
Dimensions in mm  
SMD = Surface Mounted Device  
Semiconductor Group  
10-18  
Index  
C515  
11  
Index  
COCAH0 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAH1 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAH2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAH3 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAL0 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAL1 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAL2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
COCAL3 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28  
CPU  
Accumulator . . . . . . . . . . . . . . . . . . . .2-2  
B register . . . . . . . . . . . . . . . . . . . . . . .2-3  
Basic timing . . . . . . . . . . . . . . . . . . . . .2-4  
Fetch/execute diagram . . . . . . . . . . . .2-5  
Functionality . . . . . . . . . . . . . . . . . . . .2-2  
Program status word . . . . . . . . . . . . . .2-2  
Stack pointer . . . . . . . . . . . . . . . . . . . .2-3  
CPU timing . . . . . . . . . . . . . . . . . . . . . . .2-5  
CRCH . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26  
CRCL . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26  
CY . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3, 3-7  
A
A/D converter . . . . . . . . . . . . . . .6-57–6-68  
Conversion timing . . . . . . . . . .6-66–6-68  
General operation . . . . . . . . . . . . . . 6-57  
Programmable reference voltages . 6-62–  
6-65  
Registers . . . . . . . . . . . . . . . . .6-59–6-61  
A/D converter characteristics . . . . . . . 10-5  
Absolute maximum ratings . . . . . . . . . 10-1  
AC . . . . . . . . . . . . . . . . . . . . . . . . . .2-3, 3-7  
AC characteristics . . . . . . . . . . .10-6–10-16  
16 MHz timing . . . . . . . . . . . . .10-6–10-7  
24 MHz timing . . . . . . . . . . . . .10-8–10-9  
CLKOUT timing . . . . . . . . . . . . . . . 10-13  
Data memory read cycle . . . . . . . . 10-11  
Data memory write cycle . . . . . . . . 10-12  
External clock timing . . . . . . . . . . . 10-13  
Program memory read cycle . . . . . 10-10  
ROM verification mode 1 . . . . . . . . 10-14  
ROM verification mode 2 . . . . . . . . 10-15  
AC Testing  
Float waveforms . . . . . . . . . . . . . . 10-16  
Input/output waveforms . . . . . . . . . 10-16  
ACC . . . . . . . . . . . . . . . . . . . . . . . . .3-4, 3-7  
ADCON . . . . . 3-4, 3-5, 3-7, 5-6, 6-44, 6-59  
ADDAT . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-60  
ADM . . . . . . . . . . . . . . . . . . . . . . .3-7, 6-59  
ALE signal . . . . . . . . . . . . . . . . . . . . . . . 4-4  
D
E
DAPR . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-62  
DC characteristics . . . . . . . . . . . . 10-2–10-4  
Device characteristics . . . . . . . . 10-1–10-18  
DPH . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6  
DPL . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6  
EADC . . . . . . . . . . . . . . . . . . 3-6, 6-61, 7-5  
EAL . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
EALE . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4  
Emulation concept . . . . . . . . . . . . . . . . .4-5  
ES . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
ET0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
ET1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
ET2 . . . . . . . . . . . . . . . . . . . . 3-6, 6-27, 7-4  
EX0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
EX1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4  
EX2 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5  
EX3 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5  
EX4 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5  
EX5 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5  
EX6 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5  
Execution of instructions . . . . . . . . . . . . .2-4  
EXEN2 . . . . . . . . . . . . . . . . . 3-6, 6-27, 7-5  
EXF2 . . . . . . . . . . . . . . . . . . . 3-7, 6-27, 7-8  
External bus interface . . . . . . . . . . . 4-1–4-4  
ALE signal . . . . . . . . . . . . . . . . . . . . . .4-4  
B
C
B . . . . . . . . . . . . . . . . . . . . . . . . . . .3-4, 3-7  
Basic CPU timing . . . . . . . . . . . . . . . . . 2-4  
BD . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 6-44  
Block diagram . . . . . . . . . . . . . . . . . . . . 2-1  
BSY . . . . . . . . . . . . . . . . . . . . . . . .3-7, 6-59  
C/T . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-17  
CCEN . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-28  
CCH1 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31  
CCH2 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31  
CCH3 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31  
CCL1 . . . . . . . . . . . . . . . . . . . . . . .3-4, 6-31  
CCL2 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31  
CCL3 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31  
CLK . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 5-6  
CLKOUT . . . . . . . . . . . . . . . . . . . . .3-6, 5-6  
Semiconductor Group  
11-1  
Index  
C515  
Overlapping of data/program memory 4-3  
Program memory access . . . . . . . . . . 4-3  
Program/data memory timing . . . . . . 4-2  
PSEN signal . . . . . . . . . . . . . . . . . . . . 4-3  
Role of P0 and P2 . . . . . . . . . . . . . . . 4-1  
External interrupts . . . . . . . . . . . . . . .7-15  
Handling procedure . . . . . . . . . . . . . .7-13  
Priority registers . . . . . . . . . . . . . . . .7-11  
Priority within level structure . . . . . . .7-12  
Request flags . . . . . . . . . . . . . . 7-6–7-10  
Response time . . . . . . . . . . . . . . . . .7-17  
Sources and vector addresses . . . . .7-14  
IP0 . . . . . . . . . . . . . . . . . 3-5, 3-6, 7-11, 8-4  
IP1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 7-11  
IRCON . . . . . . . . . 3-4, 3-7, 6-27, 6-61, 7-8  
IT0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6  
IT1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6  
F
F0 . . . . . . . . . . . . . . . . . . . . . . . . . .2-3, 3-7  
F1 . . . . . . . . . . . . . . . . . . . . . . . . . .2-3, 3-7  
Fail save mechanisms . . . . . . . . . . .8-1–8-4  
Features . . . . . . . . . . . . . . . . . . . . . . . . 1-2  
Functional units . . . . . . . . . . . . . . . . . . . 1-1  
Fundamental structure . . . . . . . . . . . . . 2-1  
L
G
Logic symbol . . . . . . . . . . . . . . . . . . . . . .1-3  
GATE . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-17  
GF0 . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 9-2  
GF1 . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 9-2  
M
M0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17  
M1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17  
Memory organization . . . . . . . . . . . 3-1–3-2  
Data memory . . . . . . . . . . . . . . . . . . . .3-2  
General purpose registers . . . . . . . . . .3-2  
Memory map . . . . . . . . . . . . . . . . . . . .3-1  
Program memory . . . . . . . . . . . . . . . .3-2  
MX0 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7  
MX1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7  
MX2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7  
MX2-0 . . . . . . . . . . . . . . . . . . . . . . . . . .6-59  
H
I
Hardware reset . . . . . . . . . . . . . . . . . . . 5-1  
I/O ports . . . . . . . . . . . . . . . . . . . . .6-1–6-13  
I2FR . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 7-7  
I3FR . . . . . . . . . . . . . . . . . . . . 3-7, 6-25, 7-7  
IADC . . . . . . . . . . . . . . . . . . . 3-7, 6-61, 7-8  
IDLE . . . . . . . . . . . . . . . . . . . . . . . .3-6, 9-2  
Idle mode . . . . . . . . . . . . . . . . . . . . .9-3–9-4  
IDLS . . . . . . . . . . . . . . . . . . . . . . . .3-6, 9-2  
IE0 . . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 7-6  
IE1 . . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 7-6  
IEN0 . . . . . . . . 3-4, 3-5, 3-6, 6-27, 7-4, 8-4  
IEN1 . . . .3-4, 3-5, 3-6, 6-27, 6-61, 7-5, 8-4  
IEX2 . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 7-8  
IEX3 . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 7-8  
IEX4 . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 7-8  
IEX5 . . . . . . . . . . . . . . . . . . . . . . . . .3-7, 7-8  
IEX6 . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8, 7-8  
INT0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
INT6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
Interrupt system . . . . . . . . . . . . . . .7-1–7-17  
Interrupts  
O
P
Oscillator operation . . . . . . . . . . . . . 5-4–5-5  
External clock source . . . . . . . . . . . . .5-5  
On-chip oscillator circuitry . . . . . . . . . .5-5  
Recommended oscillator circuit . . . . .5-4  
OV . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3, 3-7  
P . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3, 3-7  
P0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6  
P1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6  
P2 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6  
P3 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6  
P4 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7  
P5 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7  
P6 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7  
Package information (P-LCC-68) . . . .10-17  
Package information (P-MQFP-80) . .10-18  
Parallel I/O . . . . . . . . . . . . . . . . . . 6-1–6-13  
PCON . . . . . . . . . . . . . . . 3-5, 3-6, 6-44, 9-2  
PDE . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2  
Block diagram . . . . . . . . . . . . . . .7-2–7-3  
Enable registers . . . . . . . . . . . . . .7-4–7-5  
Semiconductor Group  
11-2  
Index  
C515  
PDS . . . . . . . . . . . . . . . . . . . . . . . . .3-6, 9-2  
Pin configuration . . . . . . . . . . . . . . . . . . 1-4  
P-MQFP-80 package . . . . . . . . . .1-4, 1-5  
Pin definitions and functions . . . . .1-6–1-10  
Ports . . . . . . . . . . . . . . . . . . . . . . .6-1–6-13  
Alternate functions . . . . . . . . . . . . . . . 6-2  
Loading and interfacing . . . . . . . . . . 6-12  
Output driver circuitry . . . . . . . . .6-9–6-10  
Output/input sample timing . . . . . . . 6-11  
Read-modify-write operation . . . . . . 6-13  
Types and structures . . . . . . . . . . . . . 6-1  
Port 0 circuitry . . . . . . . . . . . . . . . . 6-5  
Port 1/3/4/5 circuitry . . . . . . . . . . . . 6-6  
Port 2 circuitry . . . . . . . . . . . . . . . . 6-7  
Standard I/O port circuitry . . . .6-3–6-4  
Power down mode . . . . . . . . . . . . . . . . . 9-6  
Entry procedure . . . . . . . . . . . . . . . . . 9-6  
Exit procedure . . . . . . . . . . . . . . . . . . 9-6  
Power saving modes . . . . . . . . . . . .9-1–9-7  
Control register . . . . . . . . . . . . . . . . . 9-2  
Hardware enable . . . . . . . . . . . . . . . . 9-1  
Idle mode . . . . . . . . . . . . . . . . . . .9-3–9-4  
Power down mode . . . . . . . . . . . . . . . 9-6  
Slow down mode . . . . . . . . . . . . . . . . 9-5  
State of pins . . . . . . . . . . . . . . . . . . . . 9-7  
Power supply current . . . . . . . . . .10-3–10-4  
PSEN signal . . . . . . . . . . . . . . . . . . . . . 4-3  
PSW . . . . . . . . . . . . . . . . . . . . 2-3, 3-4, 3-7  
S
SBUF . . . . . . . . . . . . . . . . . . 3-5, 3-6, 6-43  
SCON . . . . . . . . . . 3-4, 3-5, 3-6, 6-43, 7-10  
SD . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2  
Serial interface (USART) . . . . . . 6-41–6-56  
Baudrate generation . . . . . . . . . . . . .6-44  
with internal baud rate generator . .6-46  
with timer 1 . . . . . . . . . . . . . . . . . .6-46  
Multiprocessor communication . . . . .6-42  
Operating mode 0 . . . . . . . . . . 6-48–6-50  
Operating mode 1 . . . . . . . . . . 6-51–6-53  
Operating mode 2 and 3 . . . . . 6-54–6-56  
Registers . . . . . . . . . . . . . . . . . 6-42–6-43  
Slow down mode . . . . . . . . . . . . . . . . . .9-5  
SM0 . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43  
SM1 . . . . . . . . . . . . . . . . . . 3-6, 6-43, 6-43  
SM2 . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43  
SMOD . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-44  
SP . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6  
Special Function Registers . . . . . . . . . . .3-3  
Table - address ordered . . . . . . . 3-6–3-7  
Table - functional order . . . . . . . . 3-4–3-5  
SWDT . . . . . . . . . . . . . . . . . . . . . . . 3-6, 8-4  
SYSCON . . . . . . . . . . . . . . . . . 3-4, 3-6, 4-4  
System clock output . . . . . . . . . . . . 5-6–5-7  
T
T0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6  
T1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6  
T2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6  
T2CM . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
T2CON . . . . . . . . . . 3-4, 3-5, 3-7, 6-25, 7-7  
T2EX . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6  
T2I0 . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
T2I1 . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
T2PS . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
T2R0 . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
T2R1 . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25  
TB8 . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43  
TCON . . . . . . . . . . . . . . . 3-4, 3-6, 6-16, 7-6  
TF0 . . . . . . . . . . . . . . . . . . . . 3-6, 6-16, 7-6  
TF1 . . . . . . . . . . . . . . . . . . . . 3-6, 6-16, 7-6  
TF2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-27, 7-8  
TH0 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15  
TH1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15  
TH2 . . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26  
TI . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43, 7-10  
Timer/counter . . . . . . . . . . . . . . . 6-14–6-40  
R
RB8 . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-43  
RD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
Recommended oscillator circuits . . . . 10-16  
REN . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-43  
Reset . . . . . . . . . . . . . . . . . . . . . . . .5-1–5-3  
Hardware reset timing . . . . . . . . . . . . 5-3  
Reset circuitries . . . . . . . . . . . . . . . . . 5-2  
RI . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43, 7-10  
ROM protection . . . . . . . . . . . . . . . .4-6–4-8  
Protected ROM mode . . . . . . . . . . . . 4-7  
Protected ROM verification example . 4-8  
Protected ROM verify timing . . . . . . . 4-7  
Unprotected ROM mode . . . . . . . . . . 4-6  
Unprotected ROM verify timing . . . . . 4-6  
RS0 . . . . . . . . . . . . . . . . . . . . . . . . .2-3, 3-7  
RS1 . . . . . . . . . . . . . . . . . . . . . . . . .2-3, 3-7  
RxD . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-41  
Semiconductor Group  
11-3  
Index  
C515  
Timer/counter 0 and 1 . . . . . . .6-14–6-21  
Mode 0, 13-bit timer/counter . . . . 6-18  
Mode 1, 16-bit timer/counter . . . . 6-19  
Mode 2, 8-bit rel. timer/counter . . 6-20  
Mode 3, two 8-bit timer/counter . . 6-21  
Registers . . . . . . . . . . . . . . .6-15–6-17  
Timer/counter 2 . . . . . . . . . . . .6-22–6-40  
Alternate port functions . . . . . . . . 6-22  
Block diagram . . . . . . . . . . . . . . . 6-23  
Capture function . . . . . . . . . .6-39–6-40  
Compare function . . . . . . . . .6-31–6-36  
Compare mode 0 . . . . . . . . .6-31–6-34  
Compare mode 1 . . . . . . . . .6-35–6-36  
Compare mode interrupts . . . . . . 6-37  
General operation . . . . . . . . . . . . 6-29  
Registers . . . . . . . . . . . . . . .6-24–6-28  
Reload mode . . . . . . . . . . . . . . . . 6-30  
Timings  
CLKOUT timing . . . . . . . . . . . . . . . 10-13  
Data memory read cycle . . . . . . . . 10-11  
Data memory write cycle . . . . . . . . 10-12  
External clock timing . . . . . . . . . . . 10-13  
Program memory read cycle . . . . . 10-10  
ROM verification mode 1 . . . . . . . . 10-14  
ROM verification mode 2 . . . . . . . . 10-15  
TL0 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15  
TL1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15  
TL2 . . . . . . . . . . . . . . . . . . . . 3-5, 3-7, 6-26  
TMOD . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-17  
TR0 . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-16  
TR1 . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-16  
TxD . . . . . . . . . . . . . . . . . . . . . . . .3-6, 6-41  
W
Watchdog timer . . . . . . . . . . . . . . . .8-1–8-4  
Block diagram . . . . . . . . . . . . . . . . . . 8-3  
Control and status flags . . . . . . . . . . . 8-4  
General operation . . . . . . . . . . . . . . . 8-1  
Refreshing of the WDT . . . . . . . . . . . 8-2  
Reset operation . . . . . . . . . . . . . . . . . 8-2  
Starting of the WDT . . . . . . . . . . . . . . 8-1  
WDT . . . . . . . . . . . . . . . . . . . . . . . .3-6, 8-4  
WDTS . . . . . . . . . . . . . . . . . . . . . . .3-6, 8-4  
WR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6  
Semiconductor Group  
11-4  

相关型号:

C515-LN/1RN

8-Bit CMOS Microcontroller
INFINEON

C5150

NPN TRIPLE DIFFUSED MESA TYPE (HORIZONTAL DEFLECTION OUTPUT FOR GIHG RESOLUTION DISPLAY, COLOR TV. HIGH SPEED SWITCHING APPLICATIONS)
TOSHIBA

C515A

8-Bit CMOS Microcontroller
INFINEON

C515A_9708

8-Bit CMOS Microcontroller
INFINEON

C515C

8-Bit CMOS Microcontroller
INFINEON

C515C-8E

8-Bit CMOS Microcontroller
INFINEON

C515C-8EM

8-Bit Single-Chip Microcontroller
INFINEON

C515C-8R

8-Bit CMOS Microcontroller
INFINEON

C515C-8RM

8-Bit Single-Chip Microcontroller
INFINEON

C515C-LM

8-Bit Single-Chip Microcontroller
INFINEON

C515C8EMCAFXUMA2

Microcontroller, 8-Bit, OTPROM, 10MHz, CMOS, PQFP80, PLASTIC, MQFP-80
INFINEON

C515C_9711

8-Bit CMOS Microcontroller
INFINEON