Part Number Hot Search : 
DL472 T32211 KGF1203 AA30A 3MN03S 10ER7M BM29F SH7083
Product Description
Full Text Search
 

To Download SPNU127A Datasheet File

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


  Datasheet File OCR Text:
 TMS370 Microcontroller Family User's Guide
Literature Number: SPNU127A Manufacturing Part Number: 1604927-9761 revision C February 1997
Printed on Recycled Paper
Chapter Title--Attribute Reference
-1
IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify, before placing orders, that the information being relied on is current. TI warrants performance of its semiconductor products and related software to the specifications applicable at the time of sale in accordance with TI's standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements. Certain applications using semiconductor products may involve potential risks of death, personal injury, or severe property or environmental damage ("Critical Applications"). TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. Inclusion of TI products in such applications is understood to be fully at the risk of the customer. Use of TI products in such applications requires the written approval of an appropriate TI officer. Questions concerning potential risk applications should be directed to TI through a local SC sales office. In order to minimize risks associated with the customer's applications, adequate design and operating safeguards should be provided by the customer to minimize inherent or procedural hazards. TI assumes no liability for applications assistance, customer product design, software performance, or infringement of patents or services described herein. Nor does TI warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used.
Copyright (c) 1997, Texas Instruments Incorporated
Preface
Read This First
About This Manual
This user's guide describes the TMS370 family of microcontroller devices. These devices have robust features that enhance performance and enable new application technologies. The specifications and descriptions included in this user's guide apply to the TMS370CxxxA devices; all differences for the TMS370Cxxx devices are described in Appendix A. The objective of this user's guide is to provide the information you need to implement a microcontroller design using a TMS370 device. The user's guide contains the following chapters: Chapter 1 Introduction to the TMS370 Family Devices. Discusses the key features and the major components of the TMS370 family devices. Also includes block diagrams for each device category. TMS370 Family Pinouts and Pin Descriptions. Provides pinouts and pin descriptions for the TMS370 family device categories.
Chapter 2
Chapters 3-15 Describe the operation and programming of each major function in the TMS370 architecture. Chapter 16 Assembly Language Instruction Set. Describes the TMS370 addressing modes and each of the 73 instructions, including samples and examples. Development Support. Describes the hardware and software development tools available for the TMS370 devices.
Chapter 17
Read This First
iii
About This Manual
Chapter 18
Electrical Specifications and Timings. Gives timing diagrams and electrical specifications for each of the device categories. Customer Information. Describes mask-ROM prototyping, TMS370 physical characteristics, and parts ordering. Differences Among the TMS370CxxxA, TMS370CxxxB, and TMS370Cxxx Devices (Contact Options). Points out the differences between the TMS370CxxxA and TMS370CxxxB devices as described in this manual and the TMS370Cxxx devices. Peripheral File Memory Map. Gives reference tables for the TMS370 control bits and registers. Block Diagrams. Gives reference block diagrams of the major circuits. ASCII Character Set. Lists the ASCII character set that the TMS370 assembler recognizes. Opcode/Instruction Cross-Reference. Gives an opcode-to-instruction cross-reference of all 73 mnemonics and 274 opcodes of the TMS370 instruction set. Instruction/Opcode Cross-Reference and Bus Activity Table. Gives an instruction-to-opcode cross-reference of all 73 mnemonics and 274 opcodes of the TMS370 instruction set and provides a cycle-by-cycle bus activity table. Device Pinouts. Provides pinouts for the individual device categories. PLCC-to-PGA Pinouts. Shows the pinouts for the standard PLCC-to-PGA sockets that are commonly used in prototype and production applications. You can use these pinouts when you wirewrap your breadboard with a socket. PACT.H. Gives PACT.H macros used with PACT example programs. Glossary. Defines acronyms and key terms used in this book.
Chapter 19
Appendix A
Appendix B
Appendix C Appendix D
Appendix E
Appendix F
Appendix G Appendix H
Appendix I Appendix J
iv
Style and Symbol Conventions
Style and Symbol Conventions
This document uses the following conventions.
Symbol or Term (xxxxxx.n) Example SPICTL.4 Description Bit location convention used in text and figures, where 'xxxxxx' is the name of the register (e.g., SPICTL) containing the bit and 'n' is the bit number (7 = MSB, 0 = LSB). Designates a number in the hexadecimal number system. Hexadecimal Peripheral File (PF) address used in instructions accessing the PF. (i.e., P012 = P18) Decimal Peripheral File (PF) address used in instructions accessing the PF. (i.e., P18 = P012). Hexadecimal Register File (RF) address used in instructions accessing the RF. (i.e., R010 = R16) Decimal Register File (RF) address used in instructions accessing the RF. (i.e., R16 = R010) When used in reference to bits, means to write a logic 1 to the bit. When used in reference to bits, means to write a logic 0 to the bit. Most significant byte Most significant bit Least significant byte Least significant bit bits per second
h P0n Pn R0n Rn set clear MSbyte MSB LSbyte LSB bps
1ABCh P012 P18 R010 R16
-
Program listings, program examples, interactive displays, filenames, and symbol names are shown in a special typeface similar to a typewriter's. Here is a sample program listing:
LABEL SUB R19,B ;(B) minus (R19) is ;stored in B ;(A) minus 076h is stored ;in A ;(R9) minus (R4) is stored ;in R9
SUB #076h,A
SUB R4,R9
Read This First
v
Style and Symbol Conventions / Information About Cautions and Warnings
-
In syntax descriptions, the instruction, command, or directive is in a bold typeface font, and parameters are in an italic typeface. Portions of a syntax that are in bold should be entered as shown; portions of a syntax that are in italics describe the type of information that should be entered. Here is an example of a directive syntax: MOV s,d MOV is the instruction. This instruction has two parameters, indicated by s and d.
-
Braces ( { and } ) indicate a list. The symbol | (read as or ) separates items within the list. Here's an example of a command that has a list: TST {A| B} This provides two choices: TST A or TST B. Unless the list is enclosed in square brackets, you must choose one item from the list.
Information About Cautions and Warnings
This book may contain cautions and warnings.
This is an example of a caution statement. A caution statement describes a situation that could potentially damage your software or equipment.
This is an example of a warning statement. A warning statement describes a situation that could potentially cause harm to you.
The information in a caution or a warning is provided for your protection; please read each carefully.
vi
Related Documentation From Texas Instruments
Related Documentation From Texas Instruments
The following books describe the TMS370 family devices and related support tools. To obtain a copy of any of these TI documents, call the Texas Instruments Literature Response Center at (800) 477-8924. When ordering, please identify the book by its title and literature number.
TMS370 Microcontroller Family Applications Book (literature number SPNA017) provides examples of hardware setups and accompanying software routines for various applications of the TMS370 microcontroller. TMS370Cxxx 8-Bit Microcontrollers Data Sheets describe the features of the device and provide pinouts, electrical specifications, and timings for the following microprocessors: - TMS370Cx0x (literature number SPNS029) - TMS370Cx1x (literature number SPNS012) - TMS370Cx2x (literature number SPNS018) - TMS370Cx32 (literature number SPNS015) - TMS370Cx36 (literature number SPNS039) - TMS370Cx4x (literature number SPNS016) - TMS370Cx5x (literature number SPNS010) - TMS370Cx6x (literature number SPNS033) - TMS370Cx7x (literature number SPNS034) - TMS370Cx8x (literature number SPNS035) - TMS370Cx9x (literature number SPNS036) - TMS370CxAx (literature number SPNS037) - TMS370CxBx (literature number SPNS038) - TMS370CxCx (literature number SPNS040) TMS370 8-Bit Microcontrollers Data Book (literature number SPND003) is a collection of the TMS370Cxxx microcontroller data sheets into a single book with additional chapters that discuss ordering information, an overview of development tools, a selection guide with a cross-reference of device functions, and quality and reliability. TMS370 and TMS370C8 8-Bit Microcontroller Family Assembly Language Tools User's Guide (literature number SPNU010) describes the assembly language tools (assembler, linker, and other tools used to develop assembly code), assembler directives, macros, common object file format, and symbolic debugging directives for the TMS370/C8 8-bit family of devices. TMS370 and TMS370C8 8-Bit Microcontroller Family Optimizing C Compiler User's Guide (literature number SPNU022) describes the TMS370/C8 8-bit C compiler. This C compiler accepts ANSI standard C source code and produces assembly language source code for the TMS370/C8 8-bit family of devices.
Read This First
vii
Related Documentation From Texas Instruments / Trademarks
TMS370 Family C Source Debugger User's Guide (literature number SPNU028) tells you how to invoke the '370 XDS/22 emulator and application board versions of the C source debugger interface. This book discusses various aspects of the debugger interface, including window management, command entry, code execution, data management, and breakpoints, and includes a tutorial that introduces basic debugger functionality. It also includes an advanced tutorial that introduces the breakpoint, trace, and timing features.
Trademarks
CROSSTALK is a trademark of Microstuf, Inc. HP700 is a trademark of Hewlett-Packard Company. Kermit is a registered trademark of Columbia University. MS-DOS is a registered trademark of Microsoft Corp. PC-DOS is a trademark of International Business Machines Corp. PROCOMM is a registered trademark of Datastorm Technologies Inc. UNIX is a registered trademark of Unix System Laboratories, Inc. VAX and VMS are trademarks of Digital Equipment Corp. XDS is a trademark of Texas Instruments Incorporated.
viii
If You Need Assistance
If You Need Assistance. . .
If you want to. . . Request more information about Texas Instruments microcontroller products Do this. . . Write to: Texas Instruments Incorporated Market Communications Manager, MS 736 P.O. Box 1443 Houston, Texas 77251-1443 Call the TI Literature Response Center: (800) 477-8924 Call the Microcontroller Hotline: (713) 274-2370 FAX: (713) 274-4203 Web address: http://www.ti.com/sc/micro Product Information Center: (214) 644-5580 Report mistakes in this document or any other TI documentation Send your comments to: Texas Instruments Incorporated Technical Publications Manager, MS 702 P.O. Box 1443 Houston, Texas 77251-1443
Order Texas Instruments documentation Ask questions about product operation or report suspected problems Product information
Read This First
ix
x
Contents
Contents
1 Introduction to the TMS370 Family Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Discusses the key features and the major components of the TMS370 family devices. Also includes block diagrams for each device category 1.1 1.2 1.3 1.4 1.5 1.6 1.7 2 Typical Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Available Development Support Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Device Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Key Features of the TMS370 Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Major Components of the TMS370 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Summary of Components by Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 Device Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21
TMS370 Family Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 Provides pinouts and pin descriptions for the TMS370 family device categories 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 TMS370Cx0x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 TMS370Cx1x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 TMS370Cx2x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 TMS370Cx32 Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 TMS370Cx36 Pinout and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 TMS370Cx4x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 TMS370Cx5x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 TMS370Cx6x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 TMS370Cx7x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 TMS370Cx8x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27 TMS370Cx9x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30 TMS370CxAx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33 TMS370CxBx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35 TMS370CxCx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38
3
CPU and Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 The TMS370 has a register-to-register architecture. This chapter describes the CPU registers and memory organization. 3.1 3.2 CPU/Register File Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Stack Pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Status Register (ST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Program Counter (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3-4 3-4 3-5 3-7
xi
Contents
3.3
3.4
Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 3.3.1 Register File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 3.3.2 Peripheral File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 3.3.3 Data EEPROM Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 3.3.4 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Memory Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16 3.4.1 Microcomputer Single-Chip Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17 3.4.2 Microcomputer Mode With External Expansion (All Devices With Memory Expansion and Internal Program Memory) . . . . . . . . . . . . . . . . . . 3-19 3.4.3 Microprocessor Mode Without Internal Memory (Memory Expansion Devices Only) 3-24 3.4.4 Microprocessor Mode With Internal Program Memory (Memory Expansion Devices Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 3.4.5 Memory Mode Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
4
System and Digital I/O Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 Discusses the system and I/O configuration. Features and options are described, as well as the registers that control the configuration 4.1 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4.1.1 Privilege Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4.1.2 Clock Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.1.3 Oscillator Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.1.4 Automatic Wait States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 Low-Power and Idle Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 4.2.1 Standby Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 4.2.2 Halt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 4.2.3 Using Interrupts to Exit From the Halt Mode . . . . . . . . . . . . . . . . . . . . . . . . 4-10 4.2.4 Oscillator Power Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12 System Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13 4.3.1 System Control and Configuration Register 0 (SCCR0) . . . . . . . . . . . . . . 4-13 4.3.2 System Control and Configuration Register 1 (SCCR1) . . . . . . . . . . . . . . 4-15 4.3.3 System Control and Configuration Register 2 (SCCR2) . . . . . . . . . . . . . . 4-16 Digital I/O Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18 4.4.1 Configuration Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27 4.4.2 Microprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29 4.4.3 Microcomputer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
4.2
4.3
4.4
5
Interrupts and System Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 Discusses the internal and external interrupts of the TMS370. The methods of device reset are also discussed. 5.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 5.1.1 Interrupt Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 5.1.2 External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
xii
Contents
5.2
5.3 5.4
Interrupt Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Interrupt 1 Control Register (INT1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Interrupt 2 Control Register (INT2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 Interrupt 3 Control Register (INT3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multiple Interrupt Servicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 Simple Reset Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 Reset Circuitry With Low-Voltage Detection . . . . . . . . . . . . . . . . . . . . . . . .
5-12 5-12 5-14 5-16 5-18 5-19 5-20 5-22
6
EPROM and EEPROM Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 Discusses the architecture and programming of the data EEPROM modules of the TMS370 family and the program EPROM module of the TMS370C6xx and TMS370C7xx devices 6.1 6.2 Data EEPROM Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Data EEPROM Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 6.2.1 Write Protection Register (WPR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 6.2.2 Data EEPROM Control Register (DEECTL) . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 Programming the Data EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 Program EPROM Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 6.4.1 Erasing the EPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 6.4.2 Program EPROM Control Register (EPCTLx) . . . . . . . . . . . . . . . . . . . . . . . 6-12 6.4.3 Programming the Program EPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 6.4.4 Write Protection of the Program EPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15
6.3 6.4
7
Timer 1 (T1) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 Discusses the architecture and programming of the timer 1 module 7.1 T1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7.1.2 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.1.3 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 General-Purpose Timer Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.2.1 16-Bit Resettable Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.2.2 Compare Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.2.3 Capture/Compare Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Operating Modes of the General-Purpose Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.3.1 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.3.2 Capture/Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 Edge-Detection Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 7.4.1 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 7.4.2 Capture/Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Clock Prescaler/External Clock Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16 7.5.1 Event Counter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18 7.5.2 Pulse Accumulator Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20
Contents
xiii
7.2
7.3
7.4
7.5
7.6
Contents
7.7
7.8
7.9
WD Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.1 Standard WD Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.2 Hard WD Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.3 Simple Counter Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.4 Summary of WD Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8.1 Halt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8.2 Standby Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.1 T1 Control Register 1 (T1CTL1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.2 T1 Control Register 2 (T1CTL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.3 T1 Control Register 3 (T1CTL3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.4 T1 Control Register 4 (T1CTL4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.5 T1 Port Control Registers (T1PC1 and T1PC2) . . . . . . . . . . . . . . . . . . . . . 7.9.6 T1 Interrupt Priority Control Register (T1PRI) . . . . . . . . . . . . . . . . . . . . . . .
7-21 7-23 7-25 7-27 7-28 7-29 7-29 7-29 7-30 7-32 7-34 7-36 7-38 7-40 7-43
8
Timer 2A (T2A) and Timer 2B (T2B) Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 Discusses the architecture and programming of the timer 2 module 8.1 T2n Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 8.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 8.1.2 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 8.1.3 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 T2n Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 8.2.1 16-Bit Resettable Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 8.2.2 Compare Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 8.2.3 Capture Register (Dual Capture Mode Only) . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 8.2.4 Capture/Compare Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 8.3.1 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 8.3.2 Dual Capture Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11 Edge-Detection Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 8.4.1 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 8.4.2 Dual Capture Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14 8.5.1 Event Counter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15 8.5.2 Pulse Accumulator Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-16 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 T2n Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 8.8.1 T2n Control Register 1 (T2nCTL1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19 8.8.2 T2n Control Register 2 (T2nCTL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20 8.8.3 T2n Control Register 3 (T2nCTL3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-23 8.8.4 T2n Port Control Registers (T2nPC1 and T2nPC2) . . . . . . . . . . . . . . . . . . 8-26 8.8.5 T2n Interrupt Priority Control Register (T2nPRI) . . . . . . . . . . . . . . . . . . . . . 8-29
8.2
8.3
8.4
8.5
8.6 8.7 8.8
xiv
Contents
9
Serial Communications Interface 1 (SCI1) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 Discusses the architecture and programming of serial communication interface SCI1 9.1 SCI1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 9.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 9.1.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 9.1.3 Communications Modes and Multiprocessing Modes . . . . . . . . . . . . . . . . . 9-5 9.1.4 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 SCI1 Programmable Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Multiprocessor Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8 9.3.1 Idle Line Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 9.3.2 Address Bit Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10 Communications Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 9.4.1 Asynchronous Communications Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 9.4.2 Isosynchronous Communications Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13 9.4.3 Receiver Signals in Communications Modes . . . . . . . . . . . . . . . . . . . . . . . 9-13 9.4.4 Transmitter Signals in Communications Modes . . . . . . . . . . . . . . . . . . . . . 9-14 Port Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16 Initialization Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18 9.7.1 RS-232-C Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18 9.7.2 RS-232-C Multiprocessor Mode Example . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19 SCI1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21 9.8.1 SCI Communication Control Register (SCICCR) . . . . . . . . . . . . . . . . . . . . 9-22 9.8.2 SCI Control Register (SCICTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24 9.8.3 Baud Select Registers (BAUD MSB and BAUD LSB) . . . . . . . . . . . . . . . . 9-27 9.8.4 SCI Transmitter Interrupt Control and Status Register (TXCTL) . . . . . . . 9-28 9.8.5 SCI Receiver Interrupt Control and Status Register (RXCTL) . . . . . . . . . 9-29 9.8.6 SCI Receiver Data Buffer Register (RXBUF) . . . . . . . . . . . . . . . . . . . . . . . 9-31 9.8.7 SCI Transmitter Data Buffer Register (TXBUF) . . . . . . . . . . . . . . . . . . . . . . 9-31 9.8.8 SCI Port Control Register 1 (SCIPC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-32 9.8.9 SCI Port Control Register 2 (SCIPC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33 9.8.10 SCI Priority Control Register (SCIPRI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-35
9.2 9.3
9.4
9.5 9.6 9.7
9.8
10 Serial Communications Interface 2 (SCI2) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 Discusses the architecture and programming of serial communication interface SCI2 10.1 SCI2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.3 Communications Modes and Multiprocessing Modes . . . . . . . . . . . . . . . . 10.1.4 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Programmable Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multiprocessor Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.3.1 Idle Line Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.3.2 Address Bit Multiprocessor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
10.2 10.3
10-2 10-2 10-3 10-4 10-4 10-6 10-7 10-8 10-9
xv
Contents
10.4
10.5 10.6 10.7
10.8
Asynchronous Communications Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4.1 Receiver Signals in the Communication Mode . . . . . . . . . . . . . . . . . . . . . 10.4.2 Transmitter Signals in the Communication Mode . . . . . . . . . . . . . . . . . . . Port Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clock Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initialization Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.7.1 RS-232-C Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.7.2 RS-232-C Multiprocessor Mode Example . . . . . . . . . . . . . . . . . . . . . . . . . SCI2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8.1 SCI Communication Control Register (SCICCR) . . . . . . . . . . . . . . . . . . . 10.8.2 SCI Control Register (SCICTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8.3 Baud Select Registers (BAUD MSB and BAUD LSB) . . . . . . . . . . . . . . . 10.8.4 SCI Transmitter Interrupt Control and Status Register (TXCTL) . . . . . . 10.8.5 SCI Receiver Interrupt Control and Status Register (RXCTL) . . . . . . . . 10.8.6 SCI Receiver Data Buffer Register (RXBUF) . . . . . . . . . . . . . . . . . . . . . . 10.8.7 SCI Transmitter Data Buffer Register (TXBUF) . . . . . . . . . . . . . . . . . . . . . 10.8.8 SCI Port Control Register 2 (SCIPC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.8.9 SCI Priority Control Register (SCIPRI) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-10 10-10 10-10 10-12 10-13 10-14 10-14 10-15 10-17 10-18 10-20 10-22 10-23 10-24 10-26 10-26 10-27 10-29
11 Serial Peripheral Interface (SPI) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1 Discusses the architecture and programming of the serial peripheral interface 11.1 SPI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 11.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 11.1.2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4 11.2 Communications Between the Master and the Slave . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5 11.3 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6 11.3.1 Master Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6 11.3.2 Slave Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6 11.4 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8 11.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9 11.6 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10 11.7 Initialization Upon Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11 11.8 SPI Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12 11.9 SPI Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13 11.9.1 SPI Configuration Control Register (SPICCR) . . . . . . . . . . . . . . . . . . . . . 11-14 11.9.2 SPI Operation Control Register (SPICTL) . . . . . . . . . . . . . . . . . . . . . . . . . 11-16 11.9.3 Serial Input Buffer (SPIBUF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-18 11.9.4 Serial Data Register (SPIDAT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-18 11.9.5 SPI Port Control Registers (SPIPC1 and SPIPC2) . . . . . . . . . . . . . . . . . . 11-19 11.9.6 SPI Interrupt Priority Control Register (SPIPRI) . . . . . . . . . . . . . . . . . . . . 11-22 12 Analog-To-Digital Converter 1 (ADC1) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discusses the architecture and programming of the ADC1 12.1 Analog-to-Digital Converter 1 (ADC1) Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xvi
12-1 12-2 12-2 12-4
Contents
12.2
12.3 12.4
ADC1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5 12.2.1 Input/Output Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5 12.2.2 Sampling Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6 12.2.3 ADC1 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6 12.2.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7 12.2.5 Programming Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8 ADC1 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9 ADC1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11 12.4.1 Analog Control Register (ADCTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12 12.4.2 Analog Status and Interrupt Register (ADSTAT) . . . . . . . . . . . . . . . . . . . . 12-14 12.4.3 Analog Conversion Data Register (ADDATA) . . . . . . . . . . . . . . . . . . . . . . 12-15 12.4.4 Analog Port E Data Input Register (ADIN) . . . . . . . . . . . . . . . . . . . . . . . . . 12-15 12.4.5 Analog Port E Input Enable Register (ADENA) . . . . . . . . . . . . . . . . . . . . . 12-16 12.4.6 Analog Interrupt Priority Register (ADPRI) . . . . . . . . . . . . . . . . . . . . . . . . . 12-17
13 Analog-To-Digital Converter 2 (ADC2) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1 Discusses the architecture and programming of the ADC2 13.1 Analog-to-Digital Converter 2 (ADC2) Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 13.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 13.1.2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4 13.2 ADC2 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.2.1 Input/Output Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.2.2 Sampling Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.2.3 ADC2 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.2.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6 13.2.5 Programming Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7 13.3 ADC2 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8 13.4 ADC2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10 13.4.1 Analog Control Register (ADCTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11 13.4.2 Analog Status and Interrupt Register (ADSTAT) . . . . . . . . . . . . . . . . . . . . 13-13 13.4.3 Analog Conversion Data Register (ADDATA) . . . . . . . . . . . . . . . . . . . . . . 13-13 13.4.4 Analog Port E Data Input Register (ADIN) . . . . . . . . . . . . . . . . . . . . . . . . . 13-14 13.4.5 Analog Port E Input Enable Register (ADENA) . . . . . . . . . . . . . . . . . . . . . 13-14 13.4.6 Analog Interrupt Priority Register (ADPRI) . . . . . . . . . . . . . . . . . . . . . . . . . 13-15 14 Analog-To-Digital Converter 3 (ADC3) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discusses the architecture and programming of the ADC3 14.1 Analog-to-Digital Converter 3 (ADC3) Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.1.2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2 ADC3 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2.1 Input/Output Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2.2 Sampling Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2.3 ADC3 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2.4 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2.5 Programming Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
14-1 14-2 14-2 14-4 14-5 14-5 14-5 14-6 14-7 14-8
xvii
Contents
14.3 14.4
ADC3 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9 ADC3 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11 14.4.1 Analog Control Register (ADCTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12 14.4.2 Analog Status and Interrupt Register (ADSTAT) . . . . . . . . . . . . . . . . . . . . 14-14 14.4.3 Analog Conversion Data Register (ADDATA) . . . . . . . . . . . . . . . . . . . . . . 14-15 14.4.4 Analog Port E Data Input Register (ADIN) . . . . . . . . . . . . . . . . . . . . . . . . . 14-15 14.4.5 Analog Port E Input Enable Register (ADENA) . . . . . . . . . . . . . . . . . . . . . 14-16 14.4.6 Analog Interrupt Priority Register (ADPRI) . . . . . . . . . . . . . . . . . . . . . . . . . 14-16
15 Programmable Acquisition and Control Timer (PACT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1 Discusses the architecture and programming of the programmable acquisition and control timer (PACT) module. Even if you have extensive experience with microcontroller timers, you should read this chapter to fully understand how to use the TMS370 PACT module. 15.1 PACT Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 15.1.1 Physical Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 15.1.2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4 PACT Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.2.1 Hardware Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.2.2 Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.2.3 Time Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7 15.2.4 Command/Definition File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7 15.2.5 Available Time Slots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7 Dual-Port RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9 Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 Control and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15 15.5.1 Standard Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-16 15.5.2 Virtual Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17 15.5.3 Double Event Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-18 15.5.4 Offset Timer Definition--Time From the Last Event . . . . . . . . . . . . . . . . . 15-19 15.5.5 Conditional Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-20 15.5.6 Baud Rate Timer Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-20 Command/Definition Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-21 15.6.1 Virtual Timer Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22 15.6.2 Offset Timer Definition--Time From Last Event . . . . . . . . . . . . . . . . . . . . 15-23 15.6.3 Baud Rate Timer Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-24 15.6.4 Standard Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-25 15.6.5 Double Event Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-26 15.6.6 Conditional Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-28 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-29 WD Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-31 Mini-Serial Communications Interface (SCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-32 PWM Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-33 15.10.1 Defining the Command/Definition Area . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-33 15.10.2 Copying the Command/Definition Area to Dual-Port RAM . . . . . . . . . . . 15-34 15.10.3 Initializing the PACT Peripheral Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-35
15.2
15.3 15.4 15.5
15.6
15.7 15.8 15.9 15.10
xviii
Contents
15.11
PACT Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.1 Setup Control Register (PACTSCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.2 Command/Definition Area Start Register (CDSTART) . . . . . . . . . . . . . . . 15.11.3 Command/Definition Area End Register (CDEND) . . . . . . . . . . . . . . . . . . 15.11.4 Buffer Pointer Register (BUFPTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.5 PACT-SCI Control Register (SCICTLP) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.6 PACT-SCI RX Data Register (RXBUFP) . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.7 PACT-SCI TX Data Register (TXBUFP) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.8 Output Pins 1-8 State Register (OPSTATE) . . . . . . . . . . . . . . . . . . . . . . . 15.11.9 Command/Definition Entry Flags Register (CDFLAGS) . . . . . . . . . . . . . 15.11.10 Setup CP Control Register 1 (CPCTL1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.11 Setup CP Control Register 2 (CPCTL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.12 Setup CP Control Register 3 (CPCTL3) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.13 CP Input Control Register (CPPRE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11.14 Global Function Control Register (PACTPRI) . . . . . . . . . . . . . . . . . . . . . .
15-36 15-38 15-40 15-42 15-44 15-46 15-48 15-48 15-49 15-50 15-51 15-53 15-55 15-57 15-59
16 Assembly Language Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1 Summarizes the TMS370 family assembly language instruction set and provides individual instruction descriptions 16.1 16.2 16.3 Instruction Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2 Symbol Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4 16.3.1 Data Manipulation Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-5 16.3.2 Program Flow Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-15 16.3.3 Additional Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-22 16.3.4 Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-22 Instruction Set Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-23 Instruction Set Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-32
16.4 16.5
17 Development Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1 Discusses the key features of the TMS370 development tools. These tools are currently available for PC-DOS or MS-DOS systems. 17.1 17.2 17.3 17.4 TMS370 Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2 The Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4 The Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5 Additional Software Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7 17.4.1 The Archiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7 17.4.2 The Hex Conversion Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7 The Optimizing C Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8 The C Source Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9 The XDS/22 System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12 17.7.1 Breakpoint, Trace, and Timing (BTT) Functions . . . . . . . . . . . . . . . . . . . . 17-13 17.7.2 XDS System Configuration Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 17-16 17.7.3 XDS System Operating Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-17 17.7.4 XDS Target Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-17
Contents
xix
17.5 17.6 17.7
Contents
17.8
17.9 17.10 17.11 17.12
The CDT370 (Compact Development Tool) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.8.1 The CDT370 PACT (Compact Development Tool PACT) . . . . . . . . . . . . 17.8.2 The CDT370 Timer (Compact Development Tool Timer) . . . . . . . . . . . . The Design Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Starter Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Microcontroller Programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reprogrammable EPROM and OTP Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17-18 17-19 17-19 17-20 17-24 17-25 17-26
18 Electrical Specifications and Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-1 Contains electrical and timing information for the TMS370 family devices 18.1 18.2 18.3 18.4 18.5 18.6 18.7 Timing Parameter Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 Parameter Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 Absolute Maximum Ratings for All TMS370 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3 External Crystal/Clock Connections and Typical Circuits for Loads and Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4 General-Purpose Output Signal Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6 EPROM/EEPROM Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7 TMS370Cx0xA and TMS370Cx0x Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8 18.7.1 TMS370Cx0xA and TMS370Cx0x Electrical Specifications . . . . . . . . . . . 18-8 18.7.2 TMS370Cx0xA and TMS370Cx0x Timings . . . . . . . . . . . . . . . . . . . . . . . . 18-10 TMS370Cx1xA and TMS370Cx1xB Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-12 18.8.1 TMS370Cx1xA and TMS370Cx1xB Electrical Specifications . . . . . . . . . 18-12 18.8.2 TMS370Cx1xA and TMS370Cx1xB Timings . . . . . . . . . . . . . . . . . . . . . . . 18-14 TMS370Cx2xA and TMS370Cx2x Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-16 18.9.1 TMS370Cx2xA and TMS370Cx2x Electrical Specifications . . . . . . . . . . 18-16 18.9.2 TMS370Cx2xA and TMS370Cx2x Timings . . . . . . . . . . . . . . . . . . . . . . . . 18-18 TMS370Cx32A Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-20 18.10.1 TMS370Cx32A Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 18-20 18.10.2 TMS370Cx32A Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-22 TMS370Cx36A Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-24 18.11.1 TMS370Cx36A Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 18-24 18.11.2 TMS370Cx36A Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-27 TMS370Cx4xA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-29 18.12.1 TMS370Cx4xA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-29 18.12.2 TMS370Cx4xA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-32 TMS370Cx5xA and TMS370Cx5xB Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-34 18.13.1 TMS370Cx5xA and TMS370Cx5xB Electrical Specifications . . . . . . . . . 18-34 18.13.2 TMS370Cx5xA and TMS370Cx5xB Timings . . . . . . . . . . . . . . . . . . . . . . . 18-38 TMS370Cx6xA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-43 18.14.1 TMS370Cx6xA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-43 18.14.2 TMS370Cx6xA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-46 TMS370Cx7xA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-51 18.15.1 TMS370Cx7xA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-51 18.15.2 TMS370Cx7xA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-54
18.8
18.9
18.10
18.11
18.12
18.13
18.14
18.15
xx
Contents
18.16
18.17
18.18
18.19
18.20
18.21 18.22 18.23 18.24 18.25
TMS370Cx8xA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.16.1 TMS370Cx8xA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.16.2 TMS370Cx8xA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS370Cx9xA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.17.1 TMS370Cx9xA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.17.2 TMS370Cx9xA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS370CxAxA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.18.1 TMS370CxAxA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 18.18.2 TMS370CxAxA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS370CxBxA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.19.1 TMS370CxBxA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 18.19.2 TMS370CxBxA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TMS370CxCxA Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.20.1 TMS370CxCxA Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 18.20.2 TMS370CxCxA Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SCI Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SPI Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analog-to-Digital Converter 1 (ADC1) Module Specifications . . . . . . . . . . . . . . . . . . Analog-to-Digital Converter 2 (ADC2) Module Specifications . . . . . . . . . . . . . . . . . . Analog-to-Digital Converter 3 (ADC3) Module Specifications . . . . . . . . . . . . . . . . . .
18-57 18-57 18-59 18-62 18-62 18-65 18-68 18-68 18-70 18-73 18-73 18-76 18-79 18-79 18-81 18-84 18-86 18-89 18-92 18-94
19 Customer Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-1 Describes mask-ROM prototyping, TMS370 physical characteristics, and parts ordering 19.1 Mask-ROM Prototype and Production Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 19.2 Mechanical Package Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6 19.3 TMS370 Family Numbering and Symbol Conventions . . . . . . . . . . . . . . . . . . . . . . . . 19-16 19.3.1 Production Device Prefix Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-16 19.3.2 Support Device Prefix Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-17 19.3.3 Device Numbering Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-17 19.3.4 Device Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-17 19.3.5 Symbolization by Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-20 19.4 Ordering Information for Development Support Tools . . . . . . . . . . . . . . . . . . . . . . . . . 19-25 19.4.1 TMS370 Macro Assembler, Linker, C Compiler, and Utilities . . . . . . . . . 19-25 19.4.2 TMS370 Design Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-25 19.4.3 TMS370 Starter Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-25 19.4.4 TMS370 Microcontroller Programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-26 19.4.5 TMS370 XDS Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-26 19.4.6 TMS370 Compact Development Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-26 19.4.7 TMS370 Converter Socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-27 19.4.8 XDS Target Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-27 A Differences Among the TMS370CxxxA, TMS370C7xxB, and TMS370Cxxx Devices (Contact Options) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1 Describes the differences found in comparing the different devices identified by the suffixes A, B, and no suffix. A.1 Watchdog (WD) Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 A.2 Clock Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3 A.3 Low-Power and Idle Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4 A.4 Timer 1 Control Register 2 (T1CTL2) Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-5
Contents
xxi
Contents
A.5 A.6 A.7 A.8 A.9
A.10 B
System Control and Configuration Register 2 (SCCR2) Bits . . . . . . . . . . . . . . . . . . . . . A-5 AP Bit in the DEECTL Register (DEECTL.2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-6 Program EPROM Control Register (EPCTLx) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7 VCC1 and VCC2 Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7 Electrical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8 A.9.1 Differences for TMS370Cx5x Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8 A.9.2 Differences in SCI1 and SPI Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . A-9 A.9.3 Differences in EPROM Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-10 Summary of Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-11
Peripheral File Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1 Summarizes the peripheral file and control bit information B.1 Read/Write Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 B.2 Peripheral File Frame 1: System Configuration Registers . . . . . . . . . . . . . . . . . . . . . . . B-3 B.3 Peripheral File Frame 2: Digital Port Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . B-4 B.4 Peripheral File Frame 3: SPI Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-5 B.5 Peripheral File Frame 4: Timer 1 (T1) Control Registers . . . . . . . . . . . . . . . . . . . . . . . . B-6 B.6 Peripheral File Frame 4: PACT Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-7 B.7 Peripheral File Frame 5: SCI1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-8 B.8 Peripheral File Frame 5: SCI2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-9 B.9 Peripheral File Frame 6: Timer 2A (T2A) Control Registers . . . . . . . . . . . . . . . . . . . . . B-10 B.10 Peripheral File Frame 7: ADC1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-11 B.11 Peripheral File Frame 7: ADC2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-12 B.12 Peripheral File Frame 7: ADC3 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-13 B.13 Peripheral File Frame 8: Timer 2B (T2B) Control Registers . . . . . . . . . . . . . . . . . . . . . B-14 Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1 Summarizes the block diagrams of the major circuits C.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2 C.2 Timer 1 (T1) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4 C.3 Timer 2n (T2n) Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-8 C.4 Serial Communications Interface 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-10 C.5 Serial Communications Interface 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-11 C.6 Serial Peripheral Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-12 C.7 Analog-to-Digital Converter 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-13 C.8 Analog-to-Digital Converter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-14 C.9 Analog-to-Digital Converter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-15 ASCII Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1 Lists the ASCII character set that the TMS370 assembler recognizes Opcode/Instruction Cross-Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1 Contains an opcode-to-instruction cross-reference Instruction/Opcode Cross-Reference and Bus Activity Table . . . . . . . . . . . . . . . . . . . . . . . . F-1 Contains both an instruction-to-opcode cross reference and an instruction bus activity table. The bus activity table specifies the cycle-by-cycle actions of a given instruction. F.1 Instruction/Opcode Cross-Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-2 F.2 Bus Activity Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-6
C
D E F
xxii
Contents
G
Device Pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-1 Provides pinouts for the individual device categories PLCC-to-PGA Socket Pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-1 Shows the pinouts for the standard PLCC to PGA sockets that are commonly used in prototype and production applications. You can use these pinouts when you wirewrap your breadboard with a socket. PACT.H MACROS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-1 Lists and describes the macros that are defined in the PACT.H file I.1 General Comments About Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.1.1 Addressing Commands and Definitions in Dual-Port RAM . . . . . . . . . . . . . . I.1.2 Defining Output Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.1.3 Defining Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comments About Specific Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.2.1 Standard Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.2.2 Conditional Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.2.3 Virtual Timer Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.2.4 Baud Timer Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PACT.H Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-2 I-2 I-3 I-3 I-4 I-4 I-4 I-4 I-4 I-5
H
I
I.2
I.3 J
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . J-1 Defines acronyms and key terms used in this book
Contents
xxiii
Figures
Figures
1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-9 1-10 1-11 1-12 1-13 1-14 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 2-9 2-10 2-11 2-12 2-13 2-14 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8
xxiv
TMS370Cx0x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21 TMS370Cx1x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22 TMS370Cx2x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23 TMS370Cx32 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24 TMS370Cx36 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25 TMS370Cx4x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26 TMS370Cx5x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-27 TMS370Cx6x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28 TMS370Cx7x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-29 TMS370Cx8x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-30 TMS370Cx9x Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-31 TMS370CxAx Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32 TMS370CxBx Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-33 TMS370CxCx Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-34 Pinouts for TMS370Cx0x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Pinouts for TMS370Cx1x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 Pinouts for TMS370Cx2x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Pinout for TMS370Cx32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Pinout for TMS370Cx36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Pinouts for TMS370Cx4x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 Pinouts for TMS370Cx5x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Pinouts for TMS370Cx6x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 Pinouts for TMS370Cx7x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Pinouts for TMS370Cx8x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27 Pinouts for TMS370Cx9x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30 Pinouts for TMS370CxAx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33 Pinouts for TMS370CxBx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35 Pinouts for TMS370CxCx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38 Programmer's Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Stack Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Program Counter After Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 TMS370 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 Register File Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10 Microcomputer Single-Chip Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 Microcomputer Mode With Function A Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22 Microcomputer Mode With Function B Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23
Figures
3-9 3-10 4-1 4-2 4-3 4-4 4-5 4-6 5-1 5-2 5-3 5-4 5-5 5-6 6-1 6-2 6-3 7-1 7-2 7-3 7-4 7-5 7-6 7-7 7-8 7-9 7-10 8-1 8-2 8-3 8-4 8-5 9-1 9-2 9-3 9-4 9-5 9-6 9-7 9-8 9-9 9-10 10-1 10-2
Microprocessor Mode Without Internal Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25 Microprocessor Mode With Internal Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28 Peripheral File Frame 1: System Configuration and Control Registers . . . . . . . . . . . . . . . . 4-2 Correct Method to Enter Halt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11 Improper Method to Enter Halt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11 Peripheral File Frames 2 and 3: Digital Port Control Registers . . . . . . . . . . . . . . . . . . . . . 4-21 Typical Control-Register Operation Using Port D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22 System Interface Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30 Interrupt Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Peripheral File Frame 1: External Interrupt Control Registers . . . . . . . . . . . . . . . . . . . . . . . 5-9 Interrupt 1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10 Interrupts 2 and 3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11 Simple Reset Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21 Typical Reset Circuit Using a Supply Voltage Supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . 5-22 Write Protection Bits in an EEPROM Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 EEPROM Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 EPROM Programming Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 T1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 Capture/Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 T1 System Clock Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16 Pulse Accumulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19 WD Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22 Standard WD Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23 Hard WD Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-25 Simple Counter Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-27 Peripheral File Frame 4: T1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-31 T2n Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 Dual Compare Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11 Dual Capture Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12 T2n Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14 Peripheral File Frames 6 (T2A) and 8 (T2B): T2n Control Registers . . . . . . . . . . . . . . . . . 8-18 SCI1 Block Diagram - Three Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4 SCI1 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Idle Line Multiprocessor Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 Double-Buffered WUT and TXSHF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 Address Bit Multiprocessor Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11 Asynchronous Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 Isosynchronous Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13 SCI1 RX Signals in Communications Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14 SCI1 TX Signals in Communications Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14 Peripheral File Frame 5: SCI1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21 SCI2 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 SCI2 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6
Contents
xxv
Figures
10-3 10-4 10-5 10-6 10-7 11-1 11-2 11-3 12-1 12-2 12-3 13-1 13-2 13-3 14-1 14-2 14-3 15-1 15-2 15-3 15-4 15-5 15-6 15-7 15-8 15-9 15-10 16-1 16-2 16-3 16-4 16-5 16-6 16-7 16-8 16-9 16-10 16-11 16-12 16-13 16-14 16-15 16-16 16-17
xxvi
Idle Line Multiprocessor Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8 Double-Buffered WUT and TXSHF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8 Address Bit Multiprocessor Communication Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9 SCI2 RX Signals in Communications Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10 SCI2 TX Signals in the Communication Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11 SPI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3 SPI Master/Slave Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5 Peripheral File Frame 3: SPI Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13 Analog-to-Digital Converter1 (ADC1) Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3 Ratiometric Conversion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7 Peripheral File Frame 7: ADC1 Converter Control Registers . . . . . . . . . . . . . . . . . . . . . . 12-11 Analog-to-Digital Converter 2 (ADC2) Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3 Ratiometric Conversion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6 Peripheral File Frame 7: ADC2 Converter Control Registers . . . . . . . . . . . . . . . . . . . . . . 13-10 Analog-to-Digital Converter 3 (ADC3) Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3 Ratiometric Conversion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7 Peripheral File Frame 7: ADC3 Converter Control Registers . . . . . . . . . . . . . . . . . . . . . . 14-11 PACT Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3 TMS370 Memory Map Highlighting PACT Areas of the 'Cx36 and 'Cx32 . . . . . . . . . . . . . 15-6 Prescaler Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7 Dual-Port RAM Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10 Input Capture Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13 Output Control Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15 Standard Compare Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-16 Virtual Timer Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17 Interrupt Vector Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-29 Peripheral File Frame 4: PACT Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-37 Implied Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-6 Register Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7 Peripheral Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-8 Immediate Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-9 Stack Pointer Relative Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-10 Direct Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-11 Indexed Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-12 Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-13 Offset Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-14 Program Counter Relative Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-16 Absolute Direct Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-17 Relative Direct Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-17 Absolute Indexed Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-18 Relative Indexed Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-19 Absolute Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-20 Relative Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-20 Absolute Offset Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-21
Figures
16-18 16-19 17-1 17-2 17-3 17-4 17-5 17-6 17-7 17-8 17-9 17-10 17-11 18-1 18-2 18-3 18-4 18-5 18-6 18-7 18-8 18-9 18-10 18-11 18-12 18-13 18-14 18-15 18-16 18-17 18-18 18-19 18-20 18-21 18-22 18-23 18-24 18-25 18-26 18-27 18-28 18-29 18-30 18-31
Relative Offset Indirect Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-22 Status Register (ST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-22 Software Development Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3 Linker Output Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6 The Basic Debugger Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9 Debugger Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-10 BTT Setup Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-13 Dialog Box for Defining Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-14 Example of the Inspect Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-14 Typical XDS System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16 CDT370 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19 Application Board (Design Kit Board) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-21 Starter Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-24 Measurement Points for Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 Recommended Crystal/Clock Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4 Typical Output Load Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4 Typical Buffer Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5 Switching Time Measurement Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11 SYSCLK TIming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-14 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-15 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-15 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-18 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-19 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-19 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-22 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-23 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-23 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-27 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-28 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-28 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-32 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-33 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-33 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-38 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-39 External Read Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-41 External Write Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-42 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-46 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-47 External Read Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-49 External Write Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-50
Contents
xxvii
Figures
18-32 18-33 18-34 18-35 18-36 18-37 18-38 18-39 18-40 18-41 18-42 18-43 18-44 18-45 18-46 18-47 18-48 18-49 18-50 18-51 18-52 18-53 18-54 18-55 18-56 19-1 19-2 19-3 19-4 19-5 19-6 19-7 19-8 19-9 19-10 19-11 19-12 19-13 19-14 19-15 19-16 19-17 19-18 19-19
xxviii
External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-54 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-55 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-56 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-59 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-60 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-61 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-65 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-66 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-67 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-70 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-71 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-72 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-76 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-77 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-78 External Clock Timing for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-81 External Clock Timing for Divide-by-1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-82 SYSCLK Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-83 SCI Isosynchronous Mode Timing for Internal Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-84 SCI Isosynchronous Mode Timing for External Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-85 SPI Master Mode External Clock Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-87 SPI Mode Slave External Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-88 Analog Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-91 Analog Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-93 Analog Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-96 Prototype and Production Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-4 Plastic Dual-In-Line Package (N Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8 40-Pin Plastic Shrink Dual-In-Line Package (NJ Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9 64-Pin Plastic Shrink Dual-In-Line Package, 70-mil Pin Spacing (NM Suffix) . . . . . . . . 19-10 Plastic-Leaded Chip Carrier Package (FN Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-11 Ceramic (Side-Braze) Dual-In-Line Package (JD Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . . 19-12 40-Pin Ceramic Shrink (Side-Braze) Dual-In-Line Package (JC Suffix) . . . . . . . . . . . . . 19-13 64-Pin Ceramic Shrink Dual-In-Line Package (JN Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . 19-14 Ceramic-J-Leaded Chip Carrier Package (FZ Suffix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-15 Development Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-16 TMS370 Family Number and Symbol Nomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-18 Typical Symbolization for 28-pin PLCC Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . . 19-20 Typical Symbolization for 44-pin PLCC Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . . 19-20 Typical Symbolization for 68-pin PLCC Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . . 19-20 Typical Symbolization for 28-pin PDIP Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . . 19-21 Typical Symbolization for 40-pin PDIP Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . . 19-21 Typical Symbolization for 40-pin PSDIP Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . 19-21 Typical Symbolization for 64-pin PSDIP Mask-ROM Devices . . . . . . . . . . . . . . . . . . . . . 19-21 Typical Symbolization for 28-pin PLCC Program EPROM Devices (OTP) . . . . . . . . . . . 19-22
Figures
19-20 19-21 19-22 19-23 19-24 19-25 19-26 19-27 19-28 19-29 19-30 C-1 C-2 C-3 C-4 C-5 C-6 C-7 C-8 C-9 C-10 C-11 C-12 C-13 C-14 G-1 G-2 G-3 G-4 G-5 G-6 G-7 G-8 G-9 G-10 G-11 G-12 G-13 G-14 H-1
Typical Symbolization for 44-pin PLCC Program EPROM Devices (OTP) . . . . . . . . . . . 19-22 Typical Symbolization for 68-pin PLCC Program EPROM Devices (OTP) . . . . . . . . . . . 19-22 Typical Symbolization for 28-pin PDIP Program EPROM Devices (OTP) . . . . . . . . . . . 19-22 Typical Symbolization for 40-pin PDIP Program EPROM Devices (OTP) . . . . . . . . . . . 19-22 Typical Symbolization for 40-pin PSDIP EPROM Devices (OTP) . . . . . . . . . . . . . . . . . . 19-22 Typical Symbolization for 64-pin PSDIP Reprogrammable EPROM . . . . . . . . . . . . . . . . . . . . . Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-23 Typical Symbolization for 28-pin and 40-pin CDIP Reprogrammable . . . . . . . . . . . . . . . . . . . . EPROM Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-23 Typical Symbolization for 40-pin CSDIP Reprogrammable EPROM . . . . . . . . . . . . . . . . . . . . Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-23 Typical Symbolization for 64-pin CSDIP Reprogrammable EPROM . . . . . . . . . . . . . . . . . . . . . Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-23 Typical Symbolization for 44-pin and 68-pin CLCC Reprogrammable . . . . . . . . . . . . . . . . . . . . EPROM Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-24 Typical Symbolization for 28-pin CLCC Reprogrammable EPROM Devices . . . . . . . . . 19-24 Interrupt 1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2 Interrupts 2 and 3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-3 T1 System Clock Prescaler Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4 WD Timer Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-5 T1: Dual Compare Mode Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-6 T1: Capture/Compare Mode Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-7 T2n: Dual Compare Mode Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-8 T2n: Dual Capture Mode Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-9 SCI1 Block Diagram - Three Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-10 SCI2 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-11 SPI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-12 ADC1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-13 ADC2 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-14 ADC3 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-15 Pinouts for TMS370Cx0x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2 Pinouts for TMS370Cx1x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-2 Pinouts for TMS370Cx2x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-3 Pinouts for TMS370Cx32 Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-4 Pinouts for TMS370Cx36 Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-5 Pinouts for TMS370Cx4x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-6 Pinouts for TMS370Cx5x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-7 Pinouts for TMS370Cx6x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-8 Pinouts for TMS370Cx7x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-9 Pinouts for TMS370Cx8x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-10 Pinouts for TMS370Cx9x Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-10 Pinouts for TMS370CxAx Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-11 Pinouts for TMS370CxBx Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-12 Pinouts for TMS370CxCx Devices (Top View) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G-13 28-Pin PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-2
Contents
xxix
Figures
H-2 H-3 H-4 H-5 H-6 H-7 H-8 H-9 H-10 H-11 H-12 H-13 H-14 H-15 H-16
TMS370Cx0x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-3 TMS370Cx1x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-4 TMS370CxCx Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-5 44-Pin PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-6 TMS370Cx2x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-7 TMS370Cx32 Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-8 TMS370Cx36 Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-9 TMS370Cx4x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-10 TMS370Cx8x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-11 TMS370Cx9x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-12 68-Pin PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-13 TMS370Cx5x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-14 TMS370Cx6x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-15 TMS370Cx7x Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-16 TMS370CxBx Device PGA Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H-17
xxx
Tables
Tables
1-1 1-2 1-3 1-4 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 2-9 2-10 2-11 2-12 2-13 2-14 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 4-1 4-2 4-3 4-4 4-5 4-6 4-7 4-8 5-1 5-2 Typical Applications for TMS370 Family Microcontroller Devices . . . . . . . . . . . . . . . . . . . . 1-2 TMS370 Families and Their Corresponding Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Bits Per Port for TMS370 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 TMS370 Family Architecture, Memory, and Module Summary . . . . . . . . . . . . . . . . . . . . . 1-13 TMS370Cx0x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 TMS370Cx1x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 TMS370Cx2x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 TMS370x32 Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 TMS370Cx36 Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 TMS370Cx4x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 TMS370Cx5x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 TMS370Cx6x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21 TMS370Cx7x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25 TMS370Cx8x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28 TMS370Cx9x Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31 TMS370CxAx Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34 TMS370CxBx Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36 TMS370CxC Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39 Peripheral File Address Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 Vector Address Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Memory Modes Available Per Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16 Memory-Enabled Pins Activated when Memory Accessed . . . . . . . . . . . . . . . . . . . . . . . . . 3-20 Microcomputer Mode with Function A Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21 Microcomputer with Function B Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24 Microprocessor Mode with Internal Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27 Operating Mode Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29 Privilege-Mode Configuration Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Wait-State Control Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Powerdown/Idle Control Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Digital I/O Pins by Device Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20 Port Configuration Registers Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23 Function A and B Signal Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24 TMS370 Family and Internal Program Memory (64- and 68-pin packages) . . . . . . . . . . . 4-25 TMS370 Family EDS External Memory Accesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26 Interrupts and Reset Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Module Interrupt Priority in Lowest-to-Highest Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Contents
xxxi
Tables
5-3 5-4 5-5 6-1 7-1 7-2 7-3 7-4 7-5 7-6 7-7 7-8 8-1 8-2 8-3 8-4 8-5 8-6 9-1 9-2 9-3 9-4 9-5 10-1 10-2 10-3 10-4 10-5 10-6 11-1 11-2 12-1 13-1 14-1 14-2 15-1 15-2 15-3 15-4 15-5 15-6 15-7 15-8 15-9
xxxii
Interrupt Vector Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Reset Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19 Control-Bit States Following a Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21 EPROM Memory Map Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Timer-System Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 T1 I/O Pin Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 T1 and WD Timer Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 T1 Compare Values: (5 MHz SYSCLK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Counter Overflow Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18 WD Option Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28 Counter Clock Sources for the WD Input Select 0-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-33 Clock Sources for the T1 General Purpose Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-33 System-Requirement Solutions Using T2n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 T2n I/O Pin Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 T2n Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 T2n Compare Values: (5-MHz SYSCLK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 T2n Capture Register MSbyte and LSbyte Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8 T2n Capture/Compare Register MSbyte and LSbyte Addresses . . . . . . . . . . . . . . . . . . . . . 8-8 SCI1 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 Programming the Data Format Using SCICCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Asynchronous Baud Register Values for Common SCI1 Bit Rates . . . . . . . . . . . . . . . . . . 9-17 Character Bit Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23 Flags Affected by SCI SW RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24 SCI2 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 Programming the Data Format Using SCICCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6 Asynchronous Baud Register Values for Common SCI2 Bit Rates . . . . . . . . . . . . . . . . . 10-13 Peripheral File Frame 5: SCI2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17 Character Bit Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 Flags Affected by SCI SW RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20 SPI Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4 Common SPI Bit Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10 ADC1 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4 ADC2 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4 ADC3 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4 Conversion Rate Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-17 PACT Peripheral Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4 Number of Time Slots Available for Each Prescale Setting . . . . . . . . . . . . . . . . . . . . . . . . . 15-8 Bits That Control Functions on the Input Capture Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 Interrupt Vector Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-30 Bits Determining PACT-Module Time Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-39 Bits Defining the Command/Definition Area Start Addresses . . . . . . . . . . . . . . . . . . . . . . 15-41 Bits Defining the Command/Definition Area End Addresses . . . . . . . . . . . . . . . . . . . . . . . 15-43 Buffer Pointer Address Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-45 Rising/Falling Edge Capture Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-51
Tables
15-10 15-11 16-1 16-2 16-3 16-4 16-5 16-6 17-1 18-1 18-2 18-3 18-4 18-5 18-6 18-7 18-8 18-9 18-10 18-11 18-12 18-13 18-14 18-15 18-16 18-17 18-18 18-19 18-20 18-21 18-22 18-23 18-24 18-25 18-26 18-27 18-28 18-29 18-30 18-31
Rising/Falling Edge Capture Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-53 Rising/Falling Edge Capture Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-55 TMS370 Symbols Defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3 Overview of Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4 TMS370 Family Instruction Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-23 TMS370 Family Opcode/Instruction Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-30 Compare Instruction Examples--Status Bit Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-44 Conditional-Jump Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-62 OTP and Reprogrammable EPROM Support of ROM Devices . . . . . . . . . . . . . . . . . . . . 17-27 Absolute Maximum Ratings Over Operating Free-Air Temperature Range . . . . . . . . . . . 18-3 General-Purpose Output Signal Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6 EEPROM Timing Requirements for Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7 Recommended EPROM Operating Conditions for Programming . . . . . . . . . . . . . . . . . . . 18-7 EPROM Timing Requirements for Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-11 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-12 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-13 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-14 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-15 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-15 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-16 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-17 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-18 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-19 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-19 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-20 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-21 External Clocking Requirements For Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . 18-22 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-23 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-23 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-25 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-26 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-27 External Clocking Requirements For Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . 18-28 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-28 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-30
Contents
xxxiii
Tables
18-32 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-33 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-34 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-35 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-36 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-37 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-38 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-39 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-40 Switching Characteristics and Timing Requirements for External Read and Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-41 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-42 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-43 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-44 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . . 18-45 Switching Characteristics and Timing Requirements for External Read and Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-46 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-47 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-48 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-49 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . . 18-50 Switching Characteristics and TIming Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-51 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-52 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-53 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-54 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-55 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-56 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-57 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-58 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-59 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-60 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-61 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-62 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-63 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-64 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-65 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-66 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-67 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xxxiv
18-31 18-32 18-33 18-33 18-35 18-36 18-38 18-39 18-40 18-44 18-45 18-46 18-47 18-48 18-52 18-53 18-54 18-55 18-56 18-57 18-58 18-59 18-60 18-61 18-63 18-64 18-65 18-66 18-67 18-68 18-69 18-70 18-71 18-72 18-74 18-75
Tables
18-68 18-69 18-70 18-71 18-72 18-73 18-74 18-75 18-76 18-77 18-78 18-79 18-80 18-81 18-82 18-83 18-84 18-85 18-86 18-87 18-88 19-1 19-2 A-1 A-2 A-3 A-4 A-5 A-6 A-7 A-8 A-9 A-10 A-11 E-1 F-1 F-2 F-3 F-4
External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-76 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-77 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-78 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-79 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-80 External Clocking Requirements for Divide-by-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-81 External Clocking Requirements for Divide-by-1 Clock (PLL) . . . . . . . . . . . . . . . . . . . . . 18-82 Switching Characteristics and Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-83 SCI Isosynchronous Mode Timing Characteristics and Requirements for Internal Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-84 SCI Isosynchronous Mode Timing Characteristics and Requirements for External Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-85 SPI Master Mode External Timing Characteristics and Requirements . . . . . . . . . . . . . . 18-86 SPI Slave Mode External Timing Characteristics and Requirements . . . . . . . . . . . . . . . 18-88 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-89 ADC1 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-90 Analog Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-91 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-92 ADC2 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-92 Analog Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-93 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-94 ADC3 Electrical Characteristics Over Recommended Operating Free-Air Temperature Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-95 Analog Timing Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-96 Package Types and Associated Family Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7 Symbolization Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-19 WD Option Summary for TMS370CxxxA Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 Clock Option Summary for TMS370CxxxA Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3 Summary for TMS370CxxxA, TMS370C7xxB, and TMS370Cxxx Devices . . . . . . . . . . . . A-4 EPROM Memory Map for TMS370C758 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7 Switching Characteristics and Timing Requirements for External Read and Write . . . . . . A-8 IOL (Low-Level Output Current) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9 SCI1 Isosynchronous Mode Timing Characteristics for Internal Clock . . . . . . . . . . . . . . . . A-9 SPI External Timing Characteristics and Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9 Recommended EPROM Operating Conditions for Programming . . . . . . . . . . . . . . . . . . . A-10 Recommended EPROM Timing Requirements for Programming . . . . . . . . . . . . . . . . . . . A-10 Summary of Differences Among the TMS370Cxxx, TMS370CxxxA, and TMS370C7xxB Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-11 TMS370 Family Opcode/Instruction Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 TMS370 Family Instruction/Opcode Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FF-3 Possible Bus Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-7 Internal Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F-7 Bus Activity Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FF-8
Contents
xxxv
Examples
Examples
4-1 6-1 6-2 7-1 11-1 15-1 15-2 15-3 19-1 I-1 Digital Port Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28 Write Protection Register Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 Data EEPROM Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 Standard WD Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24 Register Values in an SPI Character-Write Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8 Routine to Perform a PWM FOR 'X32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-34 Example 1, if OP SET/CLR SELECT = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-49 Example 2, if OP SET/CLR SELECT = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-49 New Code Release Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5 Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-5
xxxvi
Chapter 1
Introduction to the TMS370 Family Devices
The TMS370 family consists of VLSI, 8-bit, CMOS microcontrollers with onchip EEPROM storage and peripheral support functions. These devices offer superior performance in complex, realtime control applications in demanding environments. They are available with mask-programmable ROM and OTP/ EPROM. This chapter covers the following topics:
Topic
1.1 1.2 1.3 1.4 1.5 1.6 1.7
Page
Typical Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Available Development Support Products . . . . . . . . . . . . . . . . . . . . . . . 1-3 Device Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Key Features of the TMS370 Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Major Components of the TMS370 Architecture . . . . . . . . . . . . . . . . . . 1-7 Summary of Components by Device . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 Device Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21
Texas Instruments has added new, more robust features to the TMS370 family of devices. These features are designed to enhance performance and enable new application technologies. The improved features include new watchdog modes, low-power modes, clock module, ROM security, standby RAM, Analog-to-Digital Converters, Serial Communication Interface 2, Timer 2B, and I/O ports. All family members are software compatible, so you can run many existing applications on the improved devices without having to modify your software. (Refer to Appendix A for more information about compatibility.) There are 14 device families (see Table 1-2 on page 1-4 for a full listing). This chapter describes the key features and major components of each of the TMS370 microcontroller families, and includes block diagrams to illustrate controllers from each device family.
Introduction to the TMS370 Family Devices
1-1
Typical Applications
1.1 Typical Applications
In expanding its powerful TMS370 family of microcontrollers, TI offers many new configurable devices for specific applications. As microcontrollers have evolved, TI has added multiple peripheral functions to chips that originally had only a CPU, memory, and I/O blocks. Now, with the high-performance, software-compatible TMS370 microcontrollers, you can choose from over 78 standard products. Alternatively, you can use as many as 27 function modules to configure your new device quickly, easily, and cost effectively for your application. The TMS370 family of devices is the ideal choice for the applications shown in Table 1-1.
Table 1-1. Typical Applications for TMS370 Family Microcontroller Devices
Application Area Automotive Applications Climate control systems Cruise control Entertainment systems Instrumentation Keyboards Peripheral interface control Disk controllers Motor control Temperature controllers Process control Modems Intelligent phones Intelligent line card control Navigational systems Engine control Antilock braking Body controllers Terminals Tape Drives Meter control Medical instrumentation Security systems Telecopiers Debit cards
Computer
Industrial
Telecommunications
1-2
Available Development Support Products
1.2 Available Development Support Products
The TMS370 family is fully supported by development tools that facilitate simplified software development for bringing new products to market more quickly. These tools include an assembler, a linker, an optimizing C compiler, a C source debugger, a design kit, a starter kit (with simulator), an in-circuit emulator, and an OTP/EPROM programmer. All of these tools work together using an IBM-compatible personal computer (PC) as the host and central control element. This allows you to select the host computer method of text management, and editing tools according to your system requirements. The TMS370 in-circuit emulator (XDS --eXtended Development Support and the CDT370 Compact Development Tool) allows you to immediately begin designing, testing, and debugging your system. This is because the emulator is modular and configurable, eliminating the need to produce a complete new emulator for each TMS370 configuration. More detailed information on development support products is provided in Chapter17, Development Support.
Introduction to the TMS370 Family Devices
1-3
Device Families
1.3 Device Families
TMS370 devices are divided into 14 families as shown Table 1-2. All the families are supported by a full complement of development tools.
Table 1-2. TMS370 Families and Their Corresponding Devices
Family TMS370Cx0x TMS370Cx1x TMS370C002A SE370C702 TMS370C010A TMS370C311A TMS370C712B TMS370C020A TMS370C322A TMS370C032A SE370C732{ TMS370C036A TMS370C040A TMS370C042A TMS370C050A TMS370C058A TMS370C156A TMS370C350A TMS370C356A TMS370C456A TMS370C758B SE370C758A{ TMS370C067A TMS370C768A SE370C769A{ TMS370C077A TMS370C080 SE370C686A TMS370C090A TMS370C3A7A TMS370C0B6A TMS370C3C0A TMS370C6C2A SE370C6C2A Devices Included TMS370C302A TMS370C012A TMS370C312A SE370C712A TMS370C022A TMS370C722 TMS370C332A TMS370C736A TMS370C340A TMS370C342A TMS370C052A TMS370C059A TMS370C250A TMS370C352A TMS370C358A TMS370C756A TMS370C759A SE370C758B{ TMS370C068A TMS370C769A TMS370C777A TMS370C380A TMS370C792 TMS370C702 TMS370C310A TMS370C712A SE370C712B TMS370C320A SE370C722{ TMS370C732A SE370C736A{ TMS370C742A SE370C742A{ TMS370C056A TMS370C150A TMS370C256A TMS370C353A TMS370C452A TMS370C758A SE370C756A{ SE370C759A{ TMS370C069A SE370C768A SE370C777A TMS370C686A SE370C792
TMS370Cx2x TMS370Cx32 TMS370Cx36 TMS370Cx4x TMS370Cx5x
TMS370Cx6x
TMS370Cx7x TMS370Cx8x TMS370Cx9x TMS370CxAx TMS370CxBx TMS370CxCx
These devices are system evaluators and are used only in a prototype environment. Their reliability has not been characterized. These devices use the recommended TMS370C758 (with converter socket) for prototyping. This device uses the recommended TMS370C758 for prototyping. Refer to the TMS370CxBx Data Sheet (SPNS038) for pin-to-pin compatibility.
1-4
Key Features of the TMS370 Family
1.4 Key Features of the TMS370 Family
Each TMS370 device family has the following key features (not all features are available for all devices):
-
Compatibility for supporting software migration between current and future microcontrollers CMOS EPROM technology for providing reprogrammable EPROM and OTP (one-time programmable) program memory for prototypes and for small-volume or quick-turn production CMOS EEPROM technology for providing EEPROM programming with a single 5-V supply ADC technology for converting analog signals to digital values Static RAM/registers for offering numerous memory options Standby RAM that offers data protection during a power-off condition Flexible operating features:
J J
H H H J H H J H H
J J J J J J J
Power-reduction standby and halt modes Operating temperature options: 0C to 70C (L range) - 40C to 85C (A range) - 40C to 105C (T range) Temperature range by device: ROM devices: A, L, and T EPROM and ROMless: T only Input clock frequency options: Divide by 4 (0.5 to 5 MHz SYSCLK) standard oscillator Divide by 1 (2 to 5 MHz SYSCLK) phase-locked loop Operating voltage range: 5 V 10%
Flexible interrupt handling for design flexibility: Two programmable interrupt levels Programmable rising- or falling-edge detect
System integrity features that increase flexibility during the software development phase: Oscillator fault detection Privileged mode lockout Watchdog timer Memory security (ROM)
Introduction to the TMS370 Family Devices
1-5
Key Features of the TMS370 Family
-
Memory-mapped ports for easy addressing An optimizing C compiler that translates ANSI C programs into TMS370 assembly language source A high-level language debugger that lets you refine and correct code A modular library for quickly changing the device configuration. 18 addressing modes that use eight formats, including the following:
-
J J J J J
Implied Register-to-register arithmetic Indirect addressing Indexed and indirect branches and calls PC relative
250-mA typical latch-up immunity at 25C ESD (electrostatic discharge) protection that exceeds 2000 V per MILSTD-883C method 3015
1-6
Major Components of the TMS370 Architecture
1.5 Major Components of the TMS370 Architecture
In addition to the features listed in Section 1.4, the TMS370 families have the following architectural features. Table 1-4 on page 1-13 summarizes the features described below.
CPU
The TMS370 8-bit CPU has a status register, a program counter register, and a stack pointer. The CPU uses another feature, the register file, as working registers, accessed on the internal bus in one bus cycle. The 8-bit internal bus also allows access to memory and to the peripheral interfaces. The TMS370Cx5x, TMS370Cx6x, TMS370Cx7x, and TMS370CxBx devices allow external memory expansion through ports A, B, C, and D. Refer to Chapter 3, CPU and Memory Organization, for more complete information about the CPU.
Register File
The register file is located at the beginning of the TMS370 memory map. Register-access instructions in the TMS370 instruction set allow access to any of the first 256 registers (if available) in one bus cycle. The register file is used as general-purpose RAM and contains the stack. Chapter 3, CPU and Memory Organization, provides additional information about the register file.
RAM
RAM modules other than those contained in the register file are mapped after the register file. The TMS370 accesses this RAM in two cycles. Memory is described in full in Chapter 3, CPU and Memory Organization.
Data EEPROM
With the exception of the TMS370CxAx and TMS370CxCx families, all the devices in each product family use EEPROM. The data EEPROM modules provide in-circuit programmability and data retention in power-off mode. The modules contain 256 or 512 bytes of EEPROM. This memory is useful for constants and infrequently changed variables required by the application program. The EEPROM can be
Introduction to the TMS370 Family Devices
1-7
Major Components of the TMS370 Architecture
programmed and erased by using available EEPROM programmers or by the TMS370 itself under program control. The data EEPROM modules are described in Chapter 6, EPROM and EEPROM Modules.
Program Memory
The program memory provides alternatives to meet the needs of your application. The program memory modules presently contain 2K, 4K, 8K, 16K, 24K, 32K, or 48K bytes of memory. The program memory in TMS370C6xx, TMS370C7xx, SE370C6xx, and SE370C7xx devices is EPROM. EPROM, in a windowed ceramic package, can be programmed, erased, and reprogrammed for prototyping. EPROM devices in a non-windowed plastic package are one-time programmable (OTP) devices, used for small production runs. In TMS370C0xx, TMS370C3xx, and TMS370C4xx devices, the program memory is mask ROM that is programmed at the factory. ROM devices are appropriate for larger volume production. Program memory is discussed in Chapter 6, EPROM and EEPROM Modules.
Input/Output Ports
The TMS370 family of devices have varying numbers of I/O ports, and of various port widths. Table 1-3 lists the widths, in the number of bits, for each of the ports of the different TMS370 families. I/O ports are described in greater detail in Chapter 4, System and Digital I/O Configuration.
1-8
Major Components of the TMS370 Architecture
Table 1-3. Bits Per Port for TMS370 Devices
Bits for Ports A - H Families{ TMS370Cx0x, TMS370Cx1x TMS370Cx2x TMS370Cx32 TMS370Cx36 TMS370Cx4x TMS370Cx5x, (64 pin) TMS370Cx5x, (68 pin) TMS370Cx6x TMS370Cx7x (64 pin) TMS370Cx7x (68 pin) TMS370Cx8x (40 pin) TMS370Cx8x (44 pin) TMS370Cx9x TMS370CxAx TMS370CxBx (64 pin) TMS370CxBx (68 pin) TMS370CxCx A 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 1 8 8 3 8 8 8 8 8 8 8 8 8 8 8 8 6 8 8 1 B C D 5 5 4 5 5 6 8
5
G
H
6 8 5 5 5 5 6 8 4
6 6
8 8
1 1
For all families, the ports for these microcontrollers can be programmed, bit by bit, to function as either digital input or digital output. These ports can be configured by the software as the data bus, control bus, and address bus for external memory. Any bits not needed for external memory can be programmed to be either digital input or digital output.
Timer 1
Timer 1 is a 16-bit timer that can be configured in the following ways:
-
A programmable 8-bit prescaler (providing a 24-bit realtime timer) that determines the independent clock sources for the general-purpose timer and the watchdog timer A 16-bit event timer to keep a cumulative total of the transitions A 16-bit pulse accumulator to measure the pulse input width A 16-bit input-capture function that latches the counter value on the occurrence of an external input
Introduction to the TMS370 Family Devices
1-9
Major Components of the TMS370 Architecture
-
Two 16-bit compare registers that trigger when the counter matches the contents of a compare register A self-contained PWM (pulse-width modulated) output control function
The operation of the timer can generate an interrupt to the CPU, set flag bits, reset the timer counter, toggle an I/O line, or generate PWM outputs. The timer can provide as much as 200 ns of resolution with a system clock (SYSCLK) speed of 5 MHz. Timer 1 is described fully in Chapter 7.
Timer 2n
Timers 2A and 2B are 16-bit timers that can be configured in the following ways:
-
Four independent clock sources for the general-purpose timer A 16-bit event timer to keep a cumulative total of the transitions A 16-bit pulse accumulator to measure the input pulse duration Two 16-bit input-capture devices which change a counter value to match the contents of a compare register Two 16-bit compare registers which trigger when a counter matches the contents of a compare register A self-contained PWM (pulse-width modulated) output controller
The operation of timers 2A and 2B can generate an interrupt to the CPU, set flag bits, reset the timer counter, toggle an I/O line, or generate PWM outputs. These timers provide as many as 200ns of resolution with a SYSCLK speed of 5 MHz. Timers 2A and 2B are described fully in Chapter 8.
Watchdog Timer
The watchdog timer helps ensure system integrity. It can be programmed to generate a hardware reset when it times out. This function provides a hardware monitor over the software to avoid losing a program. If it is not needed as a watchdog, this timer can be used as a general-purpose timer. For more information about the watchdog timer, refer to Section 7.7, page 7-21.
1-10
Major Components of the TMS370 Architecture
PACT (Programmable Acquisition and Control Timer)
The PACT module in the TMS370Cx3x family is a programmable timing module that uses some of the on-chip RAM to store its commands as well as the timer values. Only the TMS370Cx36 device offers 256-bytes of standby RAM, which protects data stored there against power failures. The PACT module offers the following:
-
Input capture on as many as six pins, four of which can have a programmable prescaler One input capture pin that can drive an 8-bit event counter As many as eight timer-driven outputs A timer capability of as many as 20 bits Interaction between event counter and timer activity 18 independent interrupt vectors to allow the better servicing of events A watchdog timer with a selectable time-out period A mini-SCI (serial communications interface), which works as a fullduplex UART (universal asynchronous receiver transmitter)
Once set up, the PACT requires no CPU overhead except to service interrupts. The PACT module is described fully in Chapter 15, Programmable Acquisition and Control Timer (PACT).
SCI (Serial Communications Interfaces)
The SCI1 and SCI2 modules are built-in serial interfaces. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The SCI1 model is programmable to be isosynchronous up to 2.5 Mbps, and both SCIs share the following features:
-
Programmable to be asynchronous (up to 156 kbps) Full-duplex, double-buffered receive (Rx) and transmit (Tx) Programmable format with error-checking capabilities
The SCI1 and SCI2 modules are described fully in Chapter 9, Serial Communications Interface (SCI1) Module, and Chapter 10, Serial Communications Interface (SCI2) Module.
Introduction to the TMS370 Family Devices
1-11
Major Components of the TMS370 Architecture / Summary of Components by Device
SPI (Serial Peripheral Interface)
The SPI module is a built-in serial interface that facilitates communication between the network master, slave CPUs, and external peripheral devices. This module provides synchronous data transmission up to 2.5 Mbps. Like SCI1 and SCI2, the SPI is set up by software. After that, the CPU takes no part in timing, data format, or protocol. Also, like the SCI, the CPU reads and writes to memory-mapped registers to receive and transmit data. A SPI interrupt alerts the CPU when received data is ready. The SPI module is described fully in Chapter 11, Serial Peripheral Interface (SPI) Module.
ADC (Analog-to-Digital Converter) Modules
The 8-bit ADC converter modules perform successive approximated conversion. The term ADC is a general term used for ADC1, ADC2, and ADC3 modules. The ADCs have the following input channels for each of the microcontroller families shown.
-
ADC1 has the following: Four channels in the 40-pin TMS370Cx4x family Eight channels in the 44-pin TMS370Cx4x, TMS370Cx32, and TMS370Cx36 families Eight channels in the 64- and 68-pin TMS370Cx5x, TMS370Cx6x, TMS370Cx7x, and TMS370CxBx families
J J J
-
ADC2 has four channels in the 28-pin TMS370CxCx family ADC3 has 15 channels in the 40- and 44-pin TMS370Cx9x families
The reference source and the input channels are selectable. You can program the conversion result to be the ratio of the input voltage to the reference voltage or the ratio of one analog input to another. Input lines that are not required for analog to digital conversion can be programmed as digital input lines. The ADC converter modules are described in Chapters 12, 13, and 14.
1.6 Summary of Components by Device
The major components of the TMS370 device family (described in Section 1.5) are summarized by device in Table 1-4 beginning on page 1-13.
1-12
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary
Program Memory (bytes) Di Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. E (bytes) Serial Interface Modules Ti Timer Modules ADC Channels I/O Pins Cl k Clock Generator No. No of Pins/ Package@
'Cx0x
TMS370C002A TMS370C302A TMS370C702# SE370C702
8K 8K -- -- 4K 8K 4K 2K 8K -- -- -- --
-- -- 8K 8K -- -- -- -- -- 8K 8K 8K 8K
256 -- 256 256 256 256 -- -- -- 256 256 256 256
256 256 256 256 128 256 128 128 128 256 256 256 256
-- -- -- -- -- -- -- -- -- -- -- -- --
SCI1 SCI1 SCI1 SCI1 SPI SPI SPI SPI SPI SPI SPI SPI SPI
T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1 T1
-- -- -- -- -- -- -- -- -- -- -- -- --
22 22 22 22 22 22 22 22 22 22 22 22 22
'Cx1x
TMS370C010A TMS370C012A TMS370C310A TMS370C311A TMS370C312A TMS370C712A# TMS370C712B# SE370C712A SE370C712B
4 or 1 4 or 1 4 4 4 or 1 4 or 1 4 or 1 4 or 1 4 or 1 4 1 4 1
28PLCC 28PLCC 28PLCC 28CLCC 28PDIP/PLCC 28PDIP/PLCC 28PDIP/PLCC 28PDIP/PLCC 28PDIP/PLCC 28PDIP/PLCC 28PDIP/PLCC 28CDIP/CLCC 28CDIP/CLCC
Introduction to TMS370 Family of Devices
1-13
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Summary of Components by Device
1-14
Summary of Components by Device
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx2x
TMS370C020A TMS370C022A TMS370C320A TMS370C322A TMS370C722# SE370C722
4K 8K 4K 8K -- -- 8K 8K -- --
-- -- -- -- 8K 8K -- -- 8K 8K
256 256 -- -- 256 256 256 -- 256 256
256 256 256 256 256 256 256 256 256 256
-- -- -- -- -- -- -- -- -- --
SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI PACT- SCI PACT- SCI PACT- SCI PACT- SCI
T1 T1 T1 T1 T1 T1 PACT PACT PACT PACT
-- -- -- -- -- -- ADC1/8 ADC1/8 ADC1/8 ADC1/8
34 34 34 34 34 34 23 23 23 23
'Cx32
TMS370C032A TMS370C332A TMS370C732A# SE370C732A
4 or 1 4 or 1 4 or 1 4 or 1 4 1 4 or 1 4 or 1 4 4
40PDIP/PSDIP/44PLCC 40PDIP/PSDIP/44PLCC 40PDIP/PSDIP/44PLCC 40PDIP/PSDIP/44PLCC 40PDIP/PSDIP/44PLCC 40CDIP/CSDIP/44CLCC 44PLCC 44PLCC 44PLCC 44CLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx36
TMS370C036A
16K
--
256
512
--
SPI/ PACT- SCI SPI/ PACT- SCI SPI/ PACT- SCI SCI1 SCI1 SCI1 SCI1 SCI1 SCI1
PACT
ADC1/8
25
4 or 1 4 4 4 or 1 4 or 1 4 or 1 4 or 1 4 4
44PLCC
TMS370C736A#
--
16K
256
512
--
PACT
ADC1/8
25
44PLCC
SE370C736
--
16K
256
512
--
PACT
ADC1/8
25
44CLCC
'Cx4x
TMS370C040A TMS370C042A TMS370C340A TMS370C342A
4K 8K 4K 8K -- --
-- -- -- -- 8K 8K
256 256 -- -- 256 256
256 256 256 256 256 256
-- -- -- -- -- --
T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A
ADC1/4, 8 ADC1/4, 8 ADC1/4, 8 ADC1/4, 8 ADC1/4, 8 ADC1/4, 8
32/36 32/36 32/36 32/36 32/36 32/36
40PDIP/PSDIP 44PLCC 40PDIP/PSDIP 44PLCC 40PDIP/PSDIP 44PLCC 40PDIP/PSDIP 44PLCC 40PDIP/PSDIP 44PLCC 40CDIP/CSDIP 44CLCC
Introduction to TMS370 Family of Devices
1-15
TMS370C742A# SE370C742A
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Summary of Components by Device
1-16
Summary of Components by Device
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx5x
TMS370C050A TMS370C052A TMS370C056A TMS370C058A TMS370C059Ak TMS370C150A TMS370C156A TMS370C250A TMS370C256A TMS370C350A TMS370C352A TMS370C353A TMS370C356A TMS370C358A
4K 8K 16K 32K 48K -- -- -- -- 4K 8K 12K 16K 32K
-- -- -- -- -- -- -- -- -- -- -- -- -- --
256 256 512 256 256 -- -- 256 512 -- -- -- -- --
256 256 512 1024 3584 256 512 256 512 256 256 1536 512 1024
112K 112K 112K 64K 20K 56K 56K 56K 56K 112K 112K 112K 112K 64K
SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI
T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A
ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8
53/55 53/55 53/55 53/55 55 55 55 55 55 53/55 53/55 55 53/55 53/55
4 or 1 4 or 1 4 or 1 4 or 1 4 or 1 4 4 4 4 4 or 1 4 or 1 4 or 1 4 or 1 4 or 1
64PSDIP 68PLCC 64PSDIP 68PLCC 64PSDIP 68PLCC 64PSDIP 68PLCC 68PLCC 68PLCC 68PLCC 68PLCC 68PLCC 64PSDIP/ 68PLCC 64PSDIP/ 68PLCC 68PLCC 64PSDIP/ 68PLCC 64PSDIP/ 68PLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx5x (Cont.)
TMS370C452A TMS370C456A TMS370C756A# TMS370C758A# TMS370C758B# TMS370C759Ak# SE370C756A SE370C758A SE370C758B SE370C759Ak
8Kh 16Kh -- -- -- -- -- -- -- --
-- -- 16K 32K 32K 48K 16K 32K 32K 48K
256 512 512 256 256 256 512 256 256 256
256 512 512 1024 1024 3584 512 1024 1024 3584
112K 112K 112K 64K 64K 20K 112K 64K 64K 20K
SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI SCI1/SPI
T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A T1/T2A
ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8 ADC1/8
55 55 53/55 53/55 53/55 55 53/55 53/55 53/55 55
4 or 1 4 or 1 4 4 1 4 4 4 1 4
68PLCC 68PLCC 64PSDIP/ 68PLCC 64PSDIP/ 68PLCC 64PSDIP/ 68PLCC 68PLCC 64CSDIP/ 68CLCC 64CSDIP/ 68CLCC 64CSDIP/ 68CLCC 68CLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Introduction to TMS370 Family of Devices
1-17
Summary of Components by Device
1-18
Summary of Components by Device
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx6x
TMS370C067A
24K
--
256
1024
24K
SCI1/SPI
T1/T2A/ T2B T1/T2A/ T2B T1/T2A/ T2B T1/T2A/ T2B T1/T2A/ T2B T1/T2A/ T2B T1/T2A/ T2B T1/T2A T1/T2A T1/T2A
ADC1/8
55
4 or 1 4 or 1 4 or 1 4 4 4 4 4 or 1 4 4
68PLCC
TMS370C068A TMS370C069Ak TMS370C768A# TMS370C769A#k SE370C768A SE370C769Ak
32K
--
256
1024
24K
SCI1/SPI
ADC1/8
55
68PLCC
48K
--
256
3584
8K
SCI1/SPI
ADC1/8
55
68PLCC
--
32K
256
1024
24K
SCI1/SPI
ADC1/8
55
68PLCC
--
48K
256
3584
8K
SCI1/SPI
ADC1/8
55
68PLCC
--
32K
256
1024
24K
SCI1/SPI
ADC1/8
55
68CLCC
--
48K
256
3584
8K
SCI1/SPI
ADC1/8
55
68CLCC
'Cx7x
TMS370C077A TMS370C777A# SE370C777A
24K -- --
-- 24K 24K
256 256 256
512 512 512
-- -- --
-- -- --
ADC1/8 ADC1/8 ADC1/8
53/55 53/55 53/55
64PSDIP/ 68PLCC 64PSDIP/ 68PLCC 64CSDIP/ 68CLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'Cx8x
TMS370C080 TMS370C380A TMS370C686A# SE370C686A
4K 4K -- -- 4K -- -- 24K 16K
-- -- 16K 16K -- 8K 8K -- --
256 -- -- -- 256 256 256 -- 256
128 128 256 256 128 128 128 512 384
-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- SCI1 --
T1 T1 T1 T1 T1 T1 T1 T1/T2A T1
-- -- -- -- ADC3/15 ADC3/15 ADC3/15 -- ADC3/8
33 35 35 35 25 25 25 34 53/55
'Cx9x
TMS370C090A TMS370C792# SE370C792
'CxAx 'CxBx
TMS370C3A7A TMS370C0B6A
4 4 or 1 4 4 4 or 1 4 4 4 or 1 4 or 1
40PLCC 44PLCC 44PLCC 44CLCC 40PSDIP/ 44PLCC 40PSDIP/ 44PLCC 40CSDIP/ 44CLCC 40PDIP 64PSDIP/ 68PLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Introduction to TMS370 Family of Devices
1-19
Summary of Components by Device
1-20
Summary of Components by Device
Table 1-4. TMS370 Family Architecture, Memory, and Module Summary (Continued)
Program Memory (bytes) Device Family Device ROM EPROM Data Memory (bytes) EEPROM RAM Off-Chip Mem. Exp. (bytes) Serial Interface Modules Timer Modules ADC Channels I/O Pins Clock Generator No. of Pins/ Package@
'CxCx
TMS370C3C0A TMS370C6C2A# SE370C6C2A
4K -- --
-- 8K 8K
-- -- --
128 128 128
-- -- --
SCI2 SCI2 SCI2
T1 T1 T1
ADC2/4 ADC2/4 ADC2/4
22 22 22
4 or 1 4 4
28PLCC 28PLCC 28CLCC
The PACT module has a mini-SCI. SCI1 has a 3-pin configuration and SCI2 has a 2-pin configuration. The timer 1 module includes a watchdog timer that you can program to serve as a general-purpose 16-bit timer. The PACT module includes a watchdog timer. 8 channels for the ADC1 module in the 44-pin package, and 4 channels for the ADC1 module in the 40-pin package In ROMless (microprocessor) mode, all address, data, and control lines are fixed as to their functions. # For OTP (PLCC) availability information, contact your local TI sales office or distributor System evaluator (reprogrammable EPROM) for use in a prototype environment only. k TMS370Cx59 and TMS370Cx69 can only operate up to 3 MHz SYSCLK. h TMS370C45x has ROM security, which inhibits the reading of data using any programmer. 256-byte standby RAM is general-purpose memory and is powered separately by the VCCSTBY pin. The data stored in this memory is protected against power failure on the main VCC1 pins. @Refer to Table 19-1 on page 19-7 for package type acronyms. Uses the recommended TMS370C758 EPROM devices (requiring converter socket) for prototyping. Uses the recommended TMS370C758 EPROM devices for prototyping. Refer to the TMS370CxBx Data Sheet (P/N SPNS038) for pin-to-pin compatibility, which requires software modification. Note: Temperature ranges: ROM: A (-40 C to 85 C), L (0 C to 70 C), and T (-40 C to 105 C); EPROM and ROMless: T only.
Device Block Diagrams
1.7 Device Block Diagrams
This section contains functional block diagrams for each of the microcontroller device families. Each of these diagrams show the basic internal connections among the major architectural features summarized in Table 1-4. Refer to Chapter 2, TMS370 Family Pinouts and Pin Descriptions, for descriptions of the external connection names.
Figure 1-1. TMS370Cx0x Block Diagram
INT1 INT2 INT3 XTAL1 XTAL2/ CLKIN MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
CPU
RAM 256 bytes (usable as registers) Data EEPROM 0 or 256 bytes
SCI1
SCIRXD SCITXD SCICLK
Program memory ROM: 8K bytes EPROM: 8K bytes
Timer 1
T1IC/CR T1EVT T1PWM
Watchdog
VCC Port A 8 Port D VSS
II
Introduction to the TMS370 Family Devices
1-21
5
Device Block Diagrams
Figure 1-2. TMS370Cx1x Block Diagram
INT1 INT2 INT3 XTAL1 XTAL2/ CLKIN MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
SPI CPU RAM 128 or 256 bytes (usable as registers) Data EEPROM 0 or 256 bytes Timer 1
SPISOMI SPISIMO SPICLK
Program memory ROM: 2K, 4K, or 8K bytes EPROM: 8K bytes
T1IC/CR T1EVT T1PWM
Watchdog
VCC Port A Port D VSS
8
1-22
I I
5
I I
Device Block Diagrams
Figure 1-3. TMS370Cx2x Block Diagram
INT1 INT2 INT3 XTAL1 XTAL2/ CLKIN MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
CPU
RAM 256 bytes (usable as registers) SCI1
SCIRXD SCITXD SCICLK SPISOMI SPISIMO SPICLK T1IC/CR T1EVT T1PWM
Program memory ROM: 4K bytes or 8K bytes EPROM: 8K bytes
0 or 256 bytes data EEPROM
SPI
Timer 1
Watchdog VCC VSS Port A Port B Port C Port D
8
8
1
5
Introduction to the TMS370 Family Devices
1-23
Device Block Diagrams
Figure 1-4. TMS370Cx32 Block Diagram
INT1 INT2 INT3 XTAL1 XTAL2 / CLKIN MC RESET AN0-AN7
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
ADC1
VCC3 VSS3
CP1
CP6 CPU RAM 256 bytes (usable as registers) PACT OP1 OP8 Program memory ROM: 8K bytes EPROM: 8K bytes Data EEPROM 0 or 256 bytes Mini SCI SCITXD SCIRXD
Watchdog
VCC1 VSS1 Port A Port D
8
4
NOTE: Three of port D's four I / O buffers (D4, D6, and D7) are internally connected to three of the PACT module's inputs (CP3, CP4, and CP5). The actual pins are D4 / CP3, D6 / CP4, and D7 / CP5.
1-24
Device Block Diagrams
Figure 1-5. TMS370Cx36 Block Diagram
INT1 XTAL2/ XTAL1 CLKIN MC RESET E0-E7 or AN0-AN7
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
VCC3 ADC1 VSS3 SPISOMI SPISIMO SPICLK
SPI VCCSTBY Standby RAM 256 bytes Program memory ROM: 16K bytes EPROM: 16K bytes RAM 256 bytes (usable as registers) CPU
Port A 8 Note:
Four of port D's five I/O buffers (D4, D5, D6, and D7) are respectively connected internally to four of the PACT module's inputs (CP4, CP1, CP6, and CP5). The actual pins are D4/CP4, D5/CP1, D6/CP6, and D7/CP5.
AAAA A AAA AAAA IIIII IIIII
Data EEPROM 256 bytes 128 bytes dual port RAM Port D 5
. .
PACT
CP1 CP6
. .
Mini SCI Watchdog
OP1 OP8 SCITXD SCIRXD VCC1 V SS1
Introduction to the TMS370 Family Devices
1-25
Device Block Diagrams
Figure 1-6. TMS370Cx4x Block Diagram
INT1 INT2 INT3 XTAL2/ XTAL1 CLKIN MC RESET AN0-AN7
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
VCC3 ADC1 (40-Pin: 4 CH 44-Pin: 8 CH) VSS3
CPU
RAM 256 bytes (usable as registers) SCI1
SCIRXD SCITXD SCICLK T2AIC1/CR T2AEVT T2AIC2/PWM T1IC/CR T1EVT T1PWM
Program memory ROM: 4K bytes or 8K bytes EPROM: 8K bytes
Data EEPROM 0 or 256 bytes
Timer 2A
Timer 1
Watchdog VCC VSS Port A 8 Port B 3 Port D 5
1-26
Device Block Diagrams
Figure 1-7. TMS370Cx5x Block Diagram
INT1 INT2 INT3 XTAL2/ XTAL1 CLKIN MC RESET E0 - E7 or AN0 - AN7
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
VCC3 System control ADC1 VSS3 SPISOMI SPISIMO SPICLK SCIRXD SCITXD SCICLK T2AIC1 / CR T2AEVT T2AIC2 / PWM T1IC / CR T1EVT T1PWM
CPU Program memory ROM: 4K, 8K, 12K, 16K, 32K, or 48K bytes EPROM: 16K, 32K, or 48K bytes
RAM 256, 512, 1K, 1.5K, or 3.5K bytes Data EEPROM 0, 256, or 512 bytes
SPI
SCI1
Timer 2A
Timer 1 Memory Expansion Address MSbyte Address LSbyte Watchdog Control Port D 8/6 VSS2 For the 64-pin devices, there are only six pins for port D. VCC2
Data
Port A 8
Port B 8
Port C 8
VCC1 VSS1
Introduction to the TMS370 Family Devices
1-27
Device Block Diagrams
Figure 1-8. TMS370Cx6x Block Diagram
INT1 INT2 XTAL2/ INT3 XTAL1 CLKIN MC RESET E0 - E7 or AN0 - AN7
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
VCC3 System control ADC1 VSS3 SPISOMI SPISIMO SPICLK SCIRXD SCITXD SCICLK T2BIC1 / CR T2BEVT T2BIC2 / PWM T2AIC1 / CR T2AEVT T2AIC2 / PWM T1IC / CR T1EVT T1PWM
SPI CPU Program memory ROM: 24K, 32K, or 48K bytes EPROM: 32K or 48K bytes RAM 1K or 3.5K bytes SCI1 Data EEPROM 256 bytes Timer 2B
Timer 2A Memory Expansion Address MSbyte Address LSbyte Timer 1 Control
Data
Watchdog
Port A 8
Port B 8
Port C 8
Port D 5 VSS2 VCC2
VCC1 VSS1
1-28
Device Block Diagrams
Figure 1-9. TMS370Cx7x Block Diagram
XTAL2/ INT3 XTAL1 CLKIN E0 - E7 or AN0 - AN7
INT1
INT2
MC
RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
VCC3 System control ADC1 VSS3 T2AIC1 / CR T2AEVT T2AIC2 / PWM T1IC / CR T1EVT T1PWM
Timer 2A CPU RAM 512 bytes Timer 1 Program memory ROM: 24K bytes EPROM: 24K bytes Data EEPROM 256 bytes Watchdog
Port A 8
Port B 8
Port C 8
Port D 8/6
Port G 6 VSS2 VCC2
VCC1 VSS1
For the 64-pin devices, there are only six pins for port D.
Introduction to the TMS370 Family Devices
1-29
Device Block Diagrams
Figure 1-10. TMS370Cx8x Block Diagram
INT1 INT2 INT3 XTAL1 XTAL2/ CLKIN MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
CPU Program memory ROM: 4K bytes EPROM: 16K bytes
RAM 128 or 256 bytes (usable as registers) Data EEPROM 0 or 256 bytes Timer 1 T1IC/CR T1EVT T1PWM
Watchdog
VCC Port A Port B 8 Port C 8/6 Port D 5 VSS
For the 40-pin devices, there are only six pins for port C.
1-30
II
8
Device Block Diagrams
Figure 1-11.TMS370Cx9x Block Diagram
XTAL2/ XTAL1 CLKIN E0 - E7 or AN0 - AN7 AN8 - AN14
INT1
MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
VCC3 System control ADC3 VSS3
CPU
RAM 128 bytes (usable as registers) Data EEPROM 256 bytes Timer 1
Program memory ROM: 4K bytes EPROM: 8K bytes
T1IC / CR T1EVT T1PWM
Watchdog
Port A 8
Port D 5
VCC VSS
Introduction to the TMS370 Family Devices
1-31
Device Block Diagrams
Figure 1-12. TMS370CxAx Block Diagram
INT1 INT2 XTAL2/ INT3 XTAL1 CLKIN MC RESET
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control SCIRXD SCITXD SCICLK T2AIC1 / CR T2AEVT T2AIC2 / PWM T1IC / CR T1EVT T1PWM
SCI1 RAM 512 bytes
CPU
Timer 2A
Program memory ROM: 24K bytes
Timer 1
Watchdog
Port A 8
Port B 8
Port C 1
Port D 5
1-32
Device Block Diagrams
Figure 1-13. TMS370CxBx Block Diagram
INT1 INT2 XTAL2/ INT3 XTAL1 CLKIN MC RESET E0 - E7 or AN0 - AN7
Interrupts
Clock options: System control divide-by-4 or divide-by-1(PLL)
VCC3 ADC1 VSS3
CPU
RAM 384 bytes Data EEPROM 256 bytes Timer 1 T1IC / CR T1EVT T1PWM
Program memory ROM: 16K bytes
Watchdog
VCC1 VSS1
Port A 8
Port B 8
Port C 8
Port D 8/6
Port G 8
Port H 1 VSS2 VCC2
For the 64-pin devices, there are only six pins for port D.
Introduction to the TMS370 Family Devices
1-33
Device Block Diagrams
Figure 1-14. TMS370CxCx Block Diagram
INT1 XTAL1 XTAL2/ CLKIN MC RESET E0 - E3 or AN0 - AN3
Interrupts
Clock options: divide-by-4 or divide-by-1 (PLL)
System control
ADC2
CPU
RAM 128 bytes (usable as registers)
SCI2
SCIRXD SCITXD
Program memory ROM: 4K bytes EPROM: 8K bytes Timer 1
T1IC/CR T1EVT T1PWM
Watchdog
VCC Port A 8 Port D 4 VSS
1-34
Running Title--Attribute Reference
Chapter 2
TMS370 Family Pinouts and Pin Descriptions
This chapter provides pinouts and pin descriptions for the individual device categories.
Topic
2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9
Page
TMS370Cx0x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . 2-2 TMS370Cx1x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . 2-4 TMS370Cx2x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . 2-6 TMS370Cx32 Pinout and Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . 2-8 TMS370Cx36 Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-11 TMS370Cx4x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-14 TMS370Cx5x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-16 TMS370Cx6x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-20 TMS370Cx7x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-24
2.10 TMS370Cx8x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-27 2.11 TMS370Cx9x Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-30 2.12 TMS370CxAx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-33 2.13 TMS370CxBx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-35 2.14 TMS370CxCx Pinouts and Pin Descriptions . . . . . . . . . . . . . . . . . . . . 2-38
Chapter Title--Attribute Reference
2-1
TMS370Cx0x Pinouts and Pin Descriptions
2.1 TMS370Cx0x Pinouts and Pin Descriptions
The pinouts and pin descriptions for the TMS370Cx0x devices are shown in Figure 2-1 and in Table 2-1, respectively.
Figure 2-1. Pinouts for TMS370Cx0x
XTAL2 / CLKIN XTAL1 A6 A5 A4 A3 A2
5 6 7 8 9 10 11
V CC A7 D7 D6 D3 RESET D4 4 3 2 1 28 27 26 25 24 23 22 21 20 19 12 13 14 15 16 1718 V SS A1 A0 D5 INT1 INT2 INT3 SCITXD SCICLK SCIRXD T1IC / CR T1PWM T1EVT MC
A. 28-Pin PLCC (FN) B. 28-Pin CLCC (FZ)
2-2
TMS370Cx0x Pinouts and Pin Descriptions
Table 2-1. TMS370Cx0x Pin Descriptions
AAAAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A A AA A AAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A A AA A AAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A A AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A
28-Pin LCC Name A0 A1 A2 A3 A4 A5 A6 A7 No. 14 13 11 10 9 8 7 3 28 26 15 1 2 16 17 18 22 21 20 25 23 24 27 I / O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Port A is a general-purpose bidirectional I / O port. D3 D4 D5 D6 D7 Port D is a general-purpose bidirectional I / O port. D3 is also configurable as SYSCLK. INT1 INT2 INT3 I I/O I/O External (non-maskable or maskable) interrupt/general-purpose input pin. External maskable interrupt input / general-purpose bidirectional pin. External maskable interrupt input / general-purpose bidirectional pin. T1IC / CR T1PWM T1EVT SCITXD SCIRXD SCICLK RESET I/O I/O I/O I/O I/O I/O I/O Timer1 input capture / counter reset input pin / general-purpose bidirectional pin. Timer1 PWM output pin / general-purpose bidirectional pin. Timer1 external event input pin / general-purpose bidirectional pin. SCI transmit data output pin, general-purpose bidirectional pin (see Note). SCI receive data input pin / general-purpose bidirectional pin. SCI bidirectional serial clock pin / general-purpose bidirectional pin. System reset bidirectional pin; as input pin, RESET initializes the microcontroller; as open-drain output, RESET indicates that an internal failure was detected by watchdog or oscillator fault circuit. Mode control input pin; enables EEPROM write protection override (WPO) mode, also supplies EPROM VPP . Internal oscillator crystal input / External clock source input. Internal oscillator output for crystal. Positive supply voltage MC 19 5 6 4 I XTAL2 / CLKIN XTAL1 VCC I O VSS 12 Ground reference I = input, O = output Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-3
TMS370Cx1x Pinouts and Pin Descriptions
2.2 TMS370Cx1x Pinouts and Pin Descriptions
The pinouts and pin descriptions for the TMS370Cx1x devices are shown in Figure 2-2 and in Table 2-2, respectively.
Figure 2-2. Pinouts for TMS370Cx1x
RESET D4 SPISOM SPICLK SPISIM T1IC/C T1PWM T1EVT MC 24 23 22 21 INT2 INT3
D6 D7 A7 V CC XTAL2/CLKIN XTAL1 A6 A5 A4 A3 A2 VSS A1 A0
D7 A0
D6 D5
2 3 4 5 6 7 8 9 10 11 12 13 14
27 26 25 24 23 22 21 20 19 18 17 16 15
RESET D4 SPISOMI SPICLK SPISIMO T1IC/CR T1PWM T1EVT MC INT3 INT2 INT1 D5 XTAL2/CLKIN XTAL1 A6 A5 A4 5 6 7 8 9
4
3
2 1 28 27 26 25
20 A3 10 19 11 A2 12 13 14 15 16 17 18 V SS INT1 A1
A. 28-Pin PDIP (N) B. 28-Pin CDIP (JD)
C. 28-Pin PLCC (FN) D. 28-Pin CLCC (FZ)
2-4
D3
A7
1
28
D3
V CC
TMS370Cx1x Pinouts and Pin Descriptions
Table 2-2. TMS370Cx1x Pin Descriptions
28-Pin DIP/LCC Name A0 A1 A2 A3 A4 A5 A6 A7 D3 D4 D5 D6 D7 INT1 INT2 INT3 T1IC/CR T1PWM T1EVT SPISOMI SPISIMO SPICLK RESET No. 14 13 11 10 9 8 7 3 28 26 15 1 2 16 17 18 22 21 20 25 23 24 27 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Port A is a general-purpose bidirectional I/O port
Port D is a general-purpose bidirectional I/O port; D3 is also configurable as SYSCLK
External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin Timer 1 input capture/counter reset input pin/general-purpose bidirectional pin Timer 1 PWM output pin/general-purpose bidirectional pin Timer 1 external event input pin/general-purpose bidirectional pin SPI slave output pin, master input pin/general-purpose bidirectional pin SPI slave input pin, master output pin/general-purpose bidirectional pin SPI bidirectional serial clock pin/general-purpose bidirectional pin System reset bidirectional pin; as an input, RESET initializes the microcontroller; as an open-drain output, RESET indicates that an internal failure was detected by the watchdog or oscillator fault circuit Mode control input pin; enables EEPROM write protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator crystal input/external clock source input Internal oscillator output for crystal Positive supply voltage Ground reference
MC XTAL2/CLKIN XTAL1 VCC VSS
19 5 6 4 12
I I O
I = input, O = output
TMS370 Family Pinouts and Pin Descriptions
2-5
TMS370Cx2x Pinouts and Pin Descriptions
2.3 TMS370Cx2x Pinouts and Pin Descriptions
The pinouts and pin descriptions for the TMS370Cx2x devices are shown in Figure 2-3 and Table 2-3, respectively.
Figure 2-3. Pinouts for TMS370Cx2x
B2 B3 B4 C0 RESET INT1 INT2 INT3 VCC A7 A6 VSS A5 A4 A3 A2 A1 A0 D7 D4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 B1 B0 SCITXD SCIRXD SCICLK D5 MC XTAL2/CLKIN XTAL1 T1IC/CR T1PWM T1EVT SPISOMI SPISIMO SPICLK B7 B6 B5 D6 D3 RESET C0 B4 B3 B2 B1 B0 SCITXD SCIRXD SCICLK D5 6 5 4 3 2 1 44 43 42 41 40 39 7 38 8 37 9 36 10 35 11 34 12 33 13 32 14 31 15 30 16 29 17 18 19 20 21 22 23 24 25 26 27 28 A2 A1 A0 D7 D4 D3 D6 NC B5 B6 B7
INT1 INT2 INT3 VCC NC A7 A6 VSS A5 A4 A3
MC XTAL2/CLKIN XTAL1 T1IC/CR T1PWM T1EVT NC SPISOMI SPISIMO SPICLK NC
A. 40-Pin PDIP (N) B. 40-Pin CDIP (JD) C. 40-Pin PSDIP (NJ) D. 40-Pin CSDIP (JC)
E. 44-Pin PLCC (FN) F. 44-Pin CLCC (FZ)
The NJ designator for the 40-pin plastic shrink DIP package was formerly known as N2.
The mechanical drawing of the NJ is identical to the N2 package and did not need to be requalified.
2-6
TMS370Cx2x Pinouts and Pin Descriptions
Table 2-3. TMS370Cx2x Pin Descriptions
Pin Pin No. DIP / LCC 40 44 18 17 16 15 14 13 11 10 39 40 1 2 3 23 24 25 4 21 20 35 22 19 38 37 36 6 7 8 31 30 29 28 27 26 5 20 19 18 17 16 15 13 12 44 1 2 3 4 26 27 28 5 23 22 40 24 21 43 42 41 7 8 9 36 35 34 32 31 30 6
Name A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 D3 D4 D5 D6 D7 SCITXD SCIRXD SCICLK INT1 INT2 INT3 T1IC/CR T1PWM T1EVT SPISOMI SPISIMO SPICLK RESET
I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I/O I/O I/O I/O I/O I/O I/O I/O I/O
Description Port A is a general-purpose bidirectional I/O port
Port B is a general-purpose bidirectional I/O port
Port C is a general-purpose bidirectional I/O port Port D is a general-purpose bidirectional I/O port; D3 is also configurable as a SYSCLK
SCI transmit data output pin/general-purpose bidirectional pin (see Note) SCI receive data input pin/general-purpose bidirectional pin SCI bidirectional serial clock pin/general-purpose bidirectional pin External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin Timer 1 input capture/counter reset input pin/general-purpose bidirectional pin Timer 1 PWM output pin/general-purpose bidirectional pin Timer 1 external event input pin/general-purpose bidirectional pin SPI slave output pin, master input pin/general-purpose bidirectional pin SPI slave input pin, master output pin/general-purpose bidirectional pin SPI bidirectional serial clock pin/general-purpose bidirectional pin System reset bidirectional pin; as an input, RESET initializes the microcontroller; as an open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit Mode control input pin; enables the EEPROM write-protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator output for crystal Internal oscillator crystal input/external clock source input No connections
MC XTAL1 XTAL2/CLKIN NC
34 32 33 - - - - 9 12
39 37 38 11 25 29 33 10 14
I O I
VCC VSS
Positive supply voltage Ground reference
I = input, O = output Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-7
TMS370Cx32 Pinouts and Pin Descriptions
2.4 TMS370Cx32 Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx32 devices are shown in Figure 2-4 and Table 2-4, respectively.
Figure 2-4. Pinout for TMS370Cx32
RESET OP8 OP7 OP6 OP5 OP4 OP3 OP2 OP1 SCITXD CP1 7 8 9 10 11 12 6 5 4 3 2 1 44 43 42 41 40
INT1 INT2 INT3 VCC1 VCC3 A7 A6 VSS1 A5 A4 A3
13 14
15 16 17 18 19 20 21 22 23 24 25 26 27 28
39 38 37 36 35 34 33 32 31 30 29
MC XTAL2/CLKIN XTAL1 CP2 SCIRXD CP6 AN7 AN6 AN5 AN4 VSS3
2-8
A2 A1 A0 D7/CP5 D4/CP3 D3 D6/CP4 AN0 AN1 AN2 AN3
A. 44-Pin PLCC (FN) B. 44-Pin CLCC (FZ)
TMS370Cx32 Pinouts and Pin Descriptions
Table 2-4. TMS370x32 Pin Descriptions
44-Pin LCC Name A0 A1 A2 A3 A4 A5 A6 A7 D3 D4/CP3 D6/CP4 D7/CP5 INT1 INT2 INT3 CP1 CP2 CP6 SCITXD SCIRXD OP1 OP2 OP3 OP4 OP5 OP6 OP7 OP8 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 RESET No. 20 19 18 17 16 15 13 12 23 22 24 21 7 8 9 40 36 34 41 35 42 43 44 1 2 3 4 5 25 26 27 28 30 31 32 33 6 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I/O I/O I I I O I O O O O O O O O I I I I I I I I I/O Description Port A is a general-purpose bidirectional port
Port D is a general-purpose bidirectional port I/O pin: Also configurable as SYSCLK I/O pin: PACT input capture 3. I/O pin: PACT input capture 4. I/O pin: PACT input capture 5. External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin PACT input capture pin 1 PACT input capture pin 2 PACT input capture pin 6; external event input pin (for event counter) PACT mini SCI transmit output pin PACT mini SCI receive input pin PACT output pin 1 PACT output pin 2 PACT output pin 3 PACT output pin 4 PACT output pin 5 PACT output pin 6 PACT output pin 7 PACT output pin 8 ADC1 analog input (AN0-AN7) or positive reference pins (AN1-AN7)
The analog port can be individually programmed as general-purpose input pins if it is not used as ADC1 converter analog input or positive reference input
System reset bidirectional pin; as input, RESET initializes the microcontroller; as an open-drain output, RESET indicates that an internal failure was detected by the watchdog or oscillator fault circuit Mode control input pin; enables EEPROM write-protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator crystal input/external clock source input y Internal oscillator output for crystal
MC XTAL2/CLKIN XTAL1
39 38 37
I I O
Some of port D's digital I/O buffers are internally connected to some of the PACT module's input capture pins. This allows the microcontroller to read the level on the input capture pin or, if the port D pin is configured as an output, to generate a capture. Be careful to leave the port D pin configured as an input if the corresponding input capture pin is being driven by external circuitry. I = input, O = output
TMS370 Family Pinouts and Pin Descriptions
2-9
TMS370Cx32 Pinouts and Pin Descriptions
Table 2-4. TMS370x32 Pin Descriptions (Continued)
44-Pin LCC Name No. I/O Description VCC1 10 Positive supply voltage for digital logic and digital I/O pins VSS1 14 Ground reference for digital logic and digital I/O pins VCC3 11 ADC1 converter positive supply voltage and optional positive reference input VSS3 29 ADC1 converter ground supply and low reference input pin Some of port D's digital I/O buffers are internally connected to some of the PACT module's input capture pins. This allows the microcontroller to read the level on the input capture pin or, if the port D pin is configured as an output, to generate a capture. Be careful to leave the port D pin configured as an input if the corresponding input capture pin is being driven by external circuitry. I = input, O = output
2-10
TMS370Cx36 Pinouts and Pin Descriptions
2.5 TMS370Cx36 Pinout and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx36 device family are shown in Figure 2-5 and Table 2-5, respectively.
Figure 2-5. Pinout for TMS370Cx36
AN3 AN4 AN5 AN6 AN7 D6/CP6 D7/CP5 D4/CP4 D5/CP1 OP1/CP3 OP2/CP2
AN2 AN1 AN0 VSS3 VCC3 VCC1 XTAL1 XTAL2/CLKIN V CCSTBY A7 A6
6543 2
7 8 9 10 111 21 31 41 51 61 7
1 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30
29 18 19 20 21 22 23 24 25 26 27 28
A5 A4 A3 A2 A1 A0 MC RESET SPICLK SPISOMI SPISIMO
V SS1 SCIRXD SCITXD OP3 OP4 OP5 OP6 OP7 OP8 D3 INT1
A. 44-Pin PLCC (FN) B. 44-Pin CLCC (FZ)
TMS370 Family Pinouts and Pin Descriptions
2-11
TMS370Cx36 Pinouts and Pin Descriptions
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A AA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Table 2-5. TMS370Cx36 Pin Descriptions
44-Pin LCC Name A0 A1 A2 A3 A4 A5 A6 A7 No. 34 35 36 37 38 39 40 41 27 14 15 12 13 I / O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I I I I I I I I Description Port A is a general-purpose bidirectional I / O port. D3 D4/CP4 D5/CP1 D6/CP6 D7/CP5 AN0/E0 AN1/E1 AN2/E2 AN3/E3 AN4/E4 AN5/E5 AN6/E6 AN7/E7 INT1 Port D is a general-purpose bidirectional port. Also configurable as SYSCLK (Note 1). PACT input capture 4 (Note 2). PACT input capture 1 (Note 2). PACT input capture 6 (Note 2). PACT input capture 5 (Note 2). ADC1 analog input pins (AN0 - AN7) / port E digital input pins (E0 - E7). 4 5 6 7 8 9 10 11 Port E can be programmed individually as a general-purpose digital input pin if it is not used as ADC1 analog input or positive reference input. 28 16 17 21 22 23 24 25 26 19 20 30 29 31 External (non-maskable or maskable) interrupt/general-purpose input pin PACT PWM output 1/input capture 3 (Note 3). PACT output pin 2/input capture 2 (Note 3). PACT PWM output 3 PACT PWM output 4 PACT PWM output 5 PACT PWM output 6 PACT PWM output 7 PACT PWM output 8 PACT mini SCI data receive input pin PACT mini SCI data transmit output pin OP1/CP3 OP2/CP2 OP3 OP4 OP5 OP6 OP7 OP8 SCIRXD SCITXD O O O O O O O O I O SPISOMI SPISIMO SPICLK I/O SPI slave output pin, master input pin / general-purpose bidirectional pin SPI slave input pin, master output pin / general-purpose bidirectional pin SPI bidirectional serial clock pin / general-purpose bidirectional pin I = input, O = output NOTES: 1. D3 can be configured as SYSCLK by appropriately programming the DPORT1 and DPORT2 registers. 2. These digital I/O buffers are connected internally to some of the PACT module's input capture pins. This allows the microcontroller to read the level on the input capture pin, or if the port D pin is configured as an output, to generate a capture. Be careful to leave the port D pin configured as an input if the corresponding input capture pin is being driven by external circuitry. 3. CP2 and CP3 are connected internally to OP2 and OP1. CP2 and CP3 can be used only to capture, respectively, OP2 and OP1, and not as external capture inputs.
2-12
TMS370Cx36 Pinouts and Pin Descriptions
Table 2-5 TMS370Cx36 Pin Descriptions (Continued)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AAA AA A AAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AAA A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAA A AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAA AAAAAA
44-Pin LCC Name No. 32 I / O I/O Description RESET System reset bidirectional pin; as input pin, RESET initializes the microcontroller; as open-drain output, RESET indicates that an internal failure was detected by the watchdog or oscillator fault circuit. MC 33 43 44 I Mode control input pin; enables EEPROM write protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator crystal output/external clock source input Internal oscillator output for crystal XTAL2/CLKIN XTAL1 VCC1 VSS1 VCC3 VSS3 VCCSTBY I O 1 18 2 3 42 Positive supply voltage for digital logic and digital I/O pins Ground reference for digital logic and digital I/O pins ADC1 positive supply voltage and optional positive reference input ADC1 ground supply and low reference input pin Positive supply voltage pin for standby RAM I = input, O = output NOTES: 4. D3 can be configured as SYSCLK by appropriately programming the DPORT1 and DPORT2 registers. 5. These digital I/O buffers are connected internally to some of the PACT module's input capture pins. This allows the microcontroller to read the level on the input capture pin, or if the port D pin is configured as an output, to generate a capture. Be careful to leave the port D pin configured as an input if the corresponding input capture pin is being driven by external circuitry. 6. CP2 and CP3 are connected internally to OP2 and OP1. CP2 and CP3 can be used only to capture, respectively, OP2 and OP1, and not as external capture inputs.
TMS370 Family Pinouts and Pin Descriptions
2-13
TMS370Cx4x Pinouts and Pin Descriptions
2.6 TMS370Cx4x Pinouts and Pin Descriptions
The pinouts and pin descriptions for the TMS370Cx4x devices are shown in Figure 2-6 and Table 2-6, respectively.
Figure 2-6. Pinouts for TMS370Cx4x
RESET T2AIC1/CR T2AIC2/PWM T2AEVT B2 B1 B0 SCITXD SCIRXD SCICLK D5 6 5 4 3 2 1 44 43 42 41 40 39 7 38 8 37 9 36 10 35 11 34 12 33 13 32 14 31 15 30 16 29 17 18 19 20 21 22 23 24 25 26 27 28 A2 A1 A0 D7 D4 D3 D6 AN0 AN1 AN2 AN3
B2 T2AEVT T2AIC2/PWM T2AIC1/CR RESET INT1 INT2 INT3 VCC A7 A6 VSS A5 A4 A3 A2 A1 A0 D7 D4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
B1 B0 SCITXD SCIRXD SCICLK D5 MC XTAL2/CLKIN XTAL1 T1IC/CR T1PWM T1EVT AN7 AN6 VCC3 VSS3 AN3 AN2 D6 D3
INT1 INT2 INT3 VCC VCC3 A7 A6 VSS A5 A4 A3
MC XTAL2/CLKIN XTAL1 T1IC/CR T1PWM T1EVT AN7 AN6 AN5 AN4 VSS3
A. 40-Pin PDIP (N) B. 40-Pin CDIP (JD) C. 40-Pin PSDIP (NJ) D. 40-Pin CSDIP (JC)
E. 44-Pin PLCC (FN) F. 44-Pin CLCC (FZ)
The NJ designator for the 40-pin plastic shrink DIP package was formerly known as N2. The
mechanical drawing of the NJ is identical to the N2 package and did not need to be requalified.
2-14
TMS370Cx4x Pinouts and Pin Descriptions
Table 2-6. TMS370Cx4x Pin Descriptions
Pin Name A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 D3 D4 D5 D6 D7 AN0/E0 AN1/E1 AN2/E2 AN3/E3 AN4/E4 AN5/E5 AN6/E6 AN7/E7 VCC3 VSS3 INT1 INT2 INT3 T1IC/CR T1PWM T1EVT T2AIC1/CR T2AIC2/PWM T2AEVT SCITXD SCIRXD SCICLK RESET DIP (40) 18 17 16 15 14 13 11 10 39 40 1 21 20 35 22 19 -- -- 23 24 -- -- 27 28 26 25 6 7 8 31 30 29 4 3 2 38 37 36 5 LCC (44) 20 19 18 17 16 15 13 12 44 1 2 23 22 40 24 21 25 26 27 28 30 31 32 33 11 29 7 8 9 36 35 34 5 4 3 43 42 41 6 I I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I I I I I I I Description Port A is a general-purpose bidirectional I/O port
Port B is a general-purpose bidirectional I/O port
Port D is a general-purpose bidirectional I/O port; D3 is also configurable as a SYSCLK
ADC1 analog input channels or positive reference pins; any ADC1 channel can be programmed as general-purpose input pins (E port) if not used as an analog input or reference channel
ADC1 converter positive supply voltage and optional positive reference input pin ADC1 converter ground supply and low reference input pin External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin Timer 1 input capture/counter reset input pin/general-purpose bidirectional pin Timer 1 PWM output pin/general-purpose bidirectional pin Timer 1 external event input pin/general-purpose bidirectional pin Timer 2A input capture/counter reset input pin/general-purpose bidirectional pin Timer 2A input capture 2/PWM output pin/general-purpose bidirectional pin Timer 2A external event Input pin/general-purpose bidirectional pin SCI transmit data output pin/general-purpose bidirectional pin (see Note) SCI receive data input pin/general-purpose bidirectional pin SCI bidirectional serial clock pin/general-purpose bidirectional pin System reset bidirectional pin; as input, RESET initializes the microcontroller; as an open-drain output, RESET indicates that an internal failure was detected by the watchdog or oscillator fault circuit Mode control input pin; enables the EEPROM write protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator output for crystal Internal oscillator crystal input/external clock source input Positive supply voltage Ground reference
MC XTAL1 XTAL2/CLKIN VCC VSS
34 32 33 9 12
39 37 38 10 14
I I O
I = input, O = output Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-15
TMS370Cx5x Pinouts and Pin Descriptions
2.7 TMS370Cx5x Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx5x devices are shown in Figure 2-7 and Table 2-7, respectively.
Figure 2-7. Pinouts for TMS370Cx5x
B5 B6 B7 C0 MC C1 C2 VSS1 D1/CSH3 D2/CSH2 D3/SYSCLK D4/R/W D5/CSPF D6/CSH1/EDS D7/CSE1/WAIT RESET INT1 INT2 INT3 SPISOMI SPISIMO SPICLK T1IC/CR T1PWM T1EVT C3 C4 C5 C6 C7 AN0 A0 A1 A2 A3 A4 A5 A6 A7 T2AEVT T2AIC2/PWM T2AIC1/CR SCICLK SCIRXD SCITXD XTAL2/CLKIN XTAL1 VCC1 VCC3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
D0/CSE2/OCF V CC2 V SS2 V CC1
B4 B3 B2 B1 B0 D0/CSE2/OCF VSS1 VCC1 D1/CSH3 D3/SYSCLK D4/R/W D6/CSH1/EDS D7/CSE1/WAIT RESET INT1 INT2 INT3 SPISOMI SPISIMO SPICLK T1IC/CR T1PWM AN7 T1EVT VSS1 AN6 AN5 AN4 AN3 AN2 AN1 VSS3
V SS1
C2 C1 MC C0
B7 B6 B5 B4
4 3 2
9
8
7
6
5
1 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45
C3 C4 C5 C6 C7 VCC2 VSS2 A0 A1 A2 A3 A4 A5 A6 A7 T2AEVT T2AIC2/PWM
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
44 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
XTAL1 V CC1 V CC3 V SS3
AN0 AN1 AN2 AN3
B3 B2 B1 B0
SCICLK SCIRXD SCITXD XTAL2/CLKIN
T2AIC1/CR
A. 68-Pin PLCC (FN) B. 68-Pin CLCC (FZ)
AN4 AN5 AN6 AN7
C. 64-Pin PSDIP (NM) D. 64-Pin CSDIP (JN)
2-16
TMS370Cx5x Pinouts and Pin Descriptions
Table 2-7. TMS370Cx5x Pin Descriptions
Pin Name A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 INT1 INT2 INT3 I = input, O = output Alternate Function DATA0 (LSB) DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 (MSB) ADDR0 ADDR1 ADDR2 ADDR3 ADDR4 ADDR5 ADDR6 ADDR7 ADDR8 ADDR9 ADDR10 ADDR11 ADDR12 ADDR13 ADDR14 ADDR15 NMI - - DIP (64) 15 16 17 18 19 20 21 22 60 61 62 63 64 1 2 3 4 6 7 9 10 11 12 13 50 49 48 LCC (68) 17 18 19 20 21 22 23 24 65 66 67 68 1 2 3 4 5 7 8 10 11 12 13 14 52 51 50 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I/O I/O Description Single-chip mode: port A is a general-purpose bidirectional port Expansion mode: port A can be individually programmed as the external bidirectional data bus (DATA0-DATA7)
Single-chip mode: port B is a general-purpose bidirectional I/O port Expansion modes: port B can be individually programmed as the low-order address output bus (ADDR0-ADDR7)
Single-chip mode: port C is a general-purpose bidirectional I/O port Expansion mode: port C can be individually programmed as the high-order address output bus (ADDR8-ADDR15)
External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin
TMS370 Family Pinouts and Pin Descriptions
2-17
TMS370Cx5x Pinouts and Pin Descriptions
Table 2-7. TMS370Cx5x Pin Descriptions (Continued)
Pin Name Alternate Function DIP (64) LCC (68) I/O Description Single-chip mode: port D is a general-purpose bidirectional I/O port. Each of the port D pins can be individually configured as a general-purpose I/O pin, primary memory control signal (function A), or secondary memory control signal ( (function ( ) y y g B). All chip selects are independent and can be used for memory bank switching. 59 56 -- 55 54 -- 53 64 60 59 58 57 56 55 I/O I/O I/O I/O I/O I/O I/O I/O pin/A: chip-select eighth output 2 goes low during memory accesses. I/O pin/B: Opcode fetch goes low during the opcode fetch memory cycle I/O pin/A: chip-select half output 3 goes low during memory accesses. I/O pin/B: reserved. I/O pin/A: chip-select half output 2 goes low during memory accesses. I/O pin/B: reserved. I/O pin/A, B: internal clock signal is 1/1 (PLL) or 1/4 XTAL2/CLKIN frequency. I/O pin/A, B: read/write output pin I/O pin/A: chip-select peripheral output for peripheral file goes low during memory accesses. I/O pin/B: reserved. I/O pin/A: chip-select half output 1 goes low during memory accesses. I/O pin/B: external data strobe output goes low during memory accesses from external memory and has the same timings as the five chip selects. I/O pin/A: chip-select eighth output goes low during memory accesses. I/O pin/B: wait input pin extends bus signals Timer 1 input capture/counter reset input pin/general-purpose bidirectional pin Timer 1 PWM output pin/general-purpose bidirectional pin Timer 1 external event input pin/general-purpose bidirectional pin Timer 2A input capture 1/counter reset input pin/generalpurpose bidirectional pin Timer 2A input capture 2/PWM output pin/general-purpose bidirectional pin Timer 2A external event input pin/general-purpose bidirectional pin SPI slave output pin, master input pin/general-purpose bidirectional pin SPI slave input pin, master output pin/general-purpose bidirectional pin SPI bidirectional serial clock pin/general-purpose bidirectional pin
Function
A D0 D1 D2 D3 D4 D5 D6 CSE2 CSH3 CSH2 SYSCLK R/W CSPF CSH1
B OCF -- -- SYSCLK R/W -- EDS
D7
CSE1
WAIT
52
54
I/O
T1IC/CR T1PWM T1EVT T2AIC1/CR T2AIC2/PWM T2AEVT SPISOMI SPISIMO SPICLK
T1IO1 T1IO2 T1IO3 T2IO1 T2IO2 T2IO3 SPIIO1 SPIIO2 SPIIO3
44 43 41 25 24 23 47 46 45
46 45 44 27 26 25 49 48 47
I/O I/O I/O I/O I/O I/O I/O I/O I/O
I = input, O = output Port D3 can be configured as SYSCLK
2-18
TMS370Cx5x Pinouts and Pin Descriptions
Table 2-7. TMS370Cx5x Pin Descriptions (Continued)
Pin Name SCITXD SCIRXD SCICLK AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 VCC3 VSS3 RESET Alternate Function SCIIO1 SCIIO2 SCIIO3 E0 E1 E2 E3 E4 E5 E6 E7 DIP (64)6 28 27 26 14 34 35 36 37 38 39 42 32 33 51 LCC (68) 30 29 28 36 37 38 39 40 41 42 43 34 35 53 I/O I/O I/O I/O I/O I I I I I I I I Description SCI transmit data output pin/general-purpose bidirectional pin (see Note) SCI receive data input pin/general-purpose bidirectional pin SCI bidirectional serial clock pin/general-purpose bidirectional pin ADC1 analog input (AN0-AN7) or positive reference pins (AN1-AN7) Port E can be individually programmed as generalpurpose input pins if not used as ADC1 analog input or positive reference input
ADC1 positive supply voltage and optional positive reference input pin ADC1 ground supply and low reference input pin System reset bidirectional pin; as an input, RESET initializes microcontroller; as open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit Mode control pin; enables EEPROM write protection override (WPO) mode, and also supplies EPROM Vpp. Internal oscillator crystal input/external clock source in ut input Internal oscillator output for crystal Positive supply voltage Positive supply voltage for digital I/O logic Ground reference for digital logic Ground reference for digital I/O pins
MC XTAL2/CLKIN XTAL1 VCC1 VCC2 VSS1 VSS2
5 29 30 31, 57 -- 8, 58 --
6 31 32 33, 61 15, 63 9 16, 62
I I O
I = input, O = output Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-19
TMS370Cx6x Pinouts and Pin Descriptions
2.8 TMS370Cx6x Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx6x devices are shown in Figure 2-8 and Table 2-8, respectively.
Figure 2-8. Pinouts for TMS370Cx6x
T2BIC1/CR
V CC2
9 C3 C4 C5 C6 C7 VCC2 VSS2 A0 A1 A2 A3 A4 A5 A6 A7 T2AEVT T2AIC2/PWM 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
8
7
6
5
4
B6
3
2
1
68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 T2BIC2 / PWM T2BEVT D3 / SYSCLK D4 / R / W D5 / CSPF D6/CSH1/EDS D7/CSE1/WAIT RESET INT1 INT2 INT3 SPISOMI SPISIMO SPICLK T1IC/CR T1PWM T1EVT
44 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 V CC1 XTAL2/CLKIN T2AIC1/CR SCICLK XTAL1 V CC3 V SS3 AN0 AN1 AN2 AN3 AN4 AN5 AN6 SCIRXD SCITXD AN7
A. 68-Pin PLCC (FN) B. 68-Pin CLCC (FZ)
2-20
V CC1
V SS1
V SS2
MC
C2
C1
C0
B7
B5 B4
B3
B2
B1
B0
TMS370Cx6x Pinouts and Pin Descriptions
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAA AAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAA A AA A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA
Table 2-8. TMS370Cx6x Pin Descriptions
Pin Name A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 Alternate Function DATA0 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 LCC (68) 17 18 19 20 21 22 23 24 65 66 67 68 1 2 3 4 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Single-chip mode: Port A is a general-purpose bidirectional I/O port. Expansion mode: Port A can be individually programmed as the external bidirectional data bus (DATA0 - DATA7). ADDR0 ADDR1 ADDR2 ADDR3 ADDR4 ADDR5 ADDR6 ADDR7 Single-chip mode: Port B is a general-purpose bidirectional I/O port. Expansion mode: Port B can be individually programmed as the low-order address output bus (ADDR0 - ADDR7). C0 C1 C2 C3 C4 C5 C6 C7 ADDR8 ADDR9 ADDR10 ADDR11 ADDR12 ADDR13 ADDR14 ADDR15 NMI -- -- E0 E1 E2 E3 E4 E5 E6 E7 5 7 8 10 11 12 13 14 Single-chip mode: Port C is a general-purpose bidirectional I/O port. Expansion mode: Port C can be individually programmed as the high-order address output bus (ADDR8 - ADDR15). INT1 INT2 INT3 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 52 51 50 36 37 38 39 40 41 42 43 34 35 53 I I/O I/O I I I I I I I I External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin A DC1 analog input (AN0 - AN7) or positive reference pins (AN1 - AN7) Port E can be individually programmed as general-purpose input pins if not used as A DC1 converter analog input or positive reference input. VCC3 VSS3 A DC1 positive-supply voltage and optional positive-reference input pin A DC1 ground reference pin RESET I/O System reset bidirectional pin. RESET, as an input, initializes the microcontroller; as open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit. I = input, O = output Ports A, B, C, and D can be configured only as general-purpose I/O pins. Also, port D3 can be configured as SYSCLK. Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-21
TMS370Cx6x Pinouts and Pin Descriptions
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAA AAAAA A AAA A AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A AAA AA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAA A A A A A AAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAA A AAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A A AAAA A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAAA A A AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A A AAAA A AAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAA A AAA AAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Table 2-8. TMS370Cx6x Pin Descriptions (Continued)
Pin Name Alternate Function LCC (68) 31 32 6 I/O I O I Description XTAL2/CLKIN XTAL1 MC Internal oscillator crystal input / external clock source input Internal oscillator output for crystal Mode control (MC) pin. MC enables EEPROM write-protection override (WPO) mode, and also supplies EPROM VPP. Positive supply voltage VCC1 VCC2 VSS1 VSS2 33,61 15,63 9 Positive supply voltage for digital I/O logic Ground reference for digital logic 16,62 Ground reference for digital I / O logic Function A B Single-chip mode: Port D is a general-purpose bidirectional I / O port. Each of the port D pins can be individually configured as a generalpin A) purpose I / O pin, primary memory control signal (function A), or secondary memory control signal (function B). All chip selects are independent and can be used for memory bank switching. I / O pin/A, B: Internal clock signal is 1 / 1 (PLL) or 1 / 4 XTAL2 / CLKIN frequency. I / O pin/A, B: Read / write output pin. D3 D4 D5 SYSCLK SYSCLK R/W R/W -- 58 57 56 I/O I/O I/O CSPF I / O pin/A: Chip select peripheral output for peripheral file goes low during memory accesses. I / O pin/B: Reserved. D6 CSH1 EDSAAA I/O I / O pin/A: Chip select half output 1 goes low during memory 55AAA accesses. I / O pin/B: External data strobe output goes low during memory accesses from external memory and has the same timings as the five chip selects. 54 I/O I / O pin/A: Chip select eighth output goes low during memory accesses. I / O pin/B: Wait input pin extends bus signals. D7 CSE1 WAIT SCITXD SCIIO1 SCIIO2 SCIIO3 T1IO1 T1IO2 T1IO3 30 29 28 46 45 44 I/O I/O I/O I/O I/O I/O SCIRXD SCICLK SCI transmit data output pin / general-purpose bidirectional pin (see Note) SCI receive data input pin / general-purpose bidirectional pin SCI bidirectional serial clock pin / general-purpose bidirectional pin T1IC / CR T1PWM T1EVT Timer 1 input capture / counter reset input pin / general-purpose bidirectional pin Timer 1 pulse width modulation (PWM) output pin / general-purpose bidirectional pin Timer 1 external event input pin / general-purpose bidirectional pin I = input, O = output Ports A, B, C, and D can be configured only as general-purpose I/O pins. Also, port D3 can be configured as SYSCLK. Note: The three-pin SCI configuration is referred to as SCI1.
2-22
TMS370Cx6x Pinouts and Pin Descriptions
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA
Table 2-8. TMS370Cx6x Pin Descriptions (Continued)
Pin Name Alternate Function T2AIO1 T2AIO2 T2AIO3 T2BIO1 T2BIO2 T2BIO3 SPIIO1 SPIIO2 SPIIO3 LCC (68) 27 26 25 64 60 59 49 48 47 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O Description T2AIC1 / CR T2AIC2 / PWM T2AEVT Timer 2A input capture 1 / counter-reset input pin / general-purpose bidirectional pin Timer 2A input capture 2 / PWM output pin / general-purpose bidirectional pin Timer 2A external event input pin / general-purpose bidirectional pin Timer 2B input capture 1/counter reset input pin/general-purpose bidirectional pin Timer 2B input capture 2/PWM output pin/general-purpose bidirectional pin Timer 2B external event input pin/general-purpose bidirectional pin T2BIC1/CR T2BIC2/PWM T2BEVT SPISOMI SPISIMO SPICLK SPI slave output pin, master input pin / general-purpose bidirectional pin SPI slave input pin, master output pin / general-purpose bidirectional pin SPI bidirectional serial clock pin / general-purpose bidirectional pin I = input, O = output Ports A, B, C, and D can be configured only as general-purpose I/O pins. Also, port D3 can be configured as SYSCLK. Note: The three-pin SCI configuration is referred to as SCI1.
TMS370 Family Pinouts and Pin Descriptions
2-23
TMS370Cx7x Pinouts and Pin Descriptions
2.9 TMS370Cx7x Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx7x devices are shown in Figure 2-9 and Table 2-9, respectively.
Figure 2-9. Pinouts for TMS370Cx7x
B5 B6 B7 C0 MC C1 C2 VSS1 C3 C4 C5 C6 C7 AN0 A0 A1 A2 A3 A4 A5 A6 A7 T2AEVT T2AIC2 / PWM T2AIC1 / CR G0 G1 G2 XTAL2 / CLKIN XTAL1 VCC1 VCC3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
B4 B3 B2 B1 B0 D0 / CSE2 / OCF VSS1 VCC1 D1 / CSH3 D3 / SYSCLK D4 / R / W D6 / CSH1 / EDS D7 / CSE1 / WAIT RESET INT1 INT2 INT3 G5 G4 G3 T1IC / CR T1PWM AN7 T1EVT VSS1 AN6 AN5 AN4 AN3 AN2 AN1 VSS3
C3 C4 C5 C6 C7 VCC2 VSS2 A0 A1 A2 A3 A4 A5 A6 A7 T2AEVT T2AIC2/PWM
10 11 12 13 14 15 16
VSS1 C2 C1 MC C0 B7 B6 B5 B4 B3 B2 B1 B0 D0 / CSE2 / OCF VCC2 VSS2 VCC1 9 8 7 6 5 4 3 2 1 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 17 52 18 51 19 50 20 49 21 48 22 47 23 46 24 45 25 44 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 T2AIC1/CR G0 G1 G2 XTAL2/CLKIN XTAL1 V CC1 V CC3 V SS3 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 D1 / CSH3 D2 / CSH2 D3 / SYSCLK D4 / R / W D5 / CSPF D6/CSH1/EDS D7/CSE1/WAIT RESET INT1 INT2 INT3 G5 G4 G3 T1IC/CR T1PWM T1EVT
A. 64-Pin PSDIP (NM) B. 64-Pin CSDIP (FZ)
C. 68-Pin PLCC (FN) D. 68-Pin CLCC (FZ)
2-24
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA AA AAAAAAAAAAAAAA AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA A AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A AAAA A AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A AAAA A AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAA A A AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAA
I = input, O = output VSS3 VCC3 AN0/E0 AN1/E1 AN2/E2 AN3/E3 AN4/E4 AN5/E5 AN6/E6 AN7/E7 INT3 INT2 INT1/NMI C0 C1 C2 C3 C4 C5 C6 C7 B0 B1 B2 B3 B4 B5 B6 B7 A0 A1 A2 A3 A4 A5 A6 A7 Name
Table 2-9. TMS370Cx7x Pin Descriptions
Pin
DIP (64)
33
32
14 34 35 36 37 38 39 42
48
49
50
60 61 62 63 64 1 2 3
15 16 17 18 19 20 21 22
4 6 7 9 10 11 12 13
LCC (68)
35
34
36 37 38 39 40 41 42 43
50
51
52
65 66 67 68 1 2 3 4
17 18 19 20 21 22 23 24
5 7 8 10 11 12 13 14
I/O
I/O
I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I I I I I I I I
I
TMS370 Family Pinouts and Pin Descriptions
Port C is a general-purpose bidirectional I/O port. Port B is a general-purpose bidirectional I/O port. Port A is a general-purpose bidirectional I/O port. Description
ADC1 positive-supply voltage and optional positive-reference input pin ADC1 ground reference pin
Port E can be individually programmed as general-purpose input pins if not used as ADC1 analog input or positive reference input.
A DC1 analog input (AN0 - AN7) or positive reference pins (AN1 - AN7)
External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin
TMS370Cx7x Pinouts and Pin Descriptions
2-25
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA A A A AAAA AAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA A A A AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2-26
G0 G1 G2 G3 G4 G5 D0 D1 D2 D3 D4 D5 D6 D7 MC
TMS370Cx7x Pinouts and Pin Descriptions
I = input, O = output T2AEVT T1EVT T1PWM VSS2 VSS1 VCC2 VCC1 XTAL1 RESET Name T2AIC2 / PWM T2AIC1 / CR T1IC / CR XTAL2/CLKIN
Table 2-9. TMS370Cx7x Pin Descriptions (Continued)
8, 40, 58
Pin
31, 57
DIP (64)
23 24 25 41 43 44 26 27 28 45 46 47 59 56 - 55 54 - 53 52 30 29 51 -- 5
33, 61
16,62
15,63
LCC (68)
25 26 27 44 45 46 28 29 30 47 48 49 64 60 59 58 57 56 55 54 32 31 53 9 6
I/O
I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O O I I
Description
Timer 2A input capture 1 / counter reset input pin / general-purpose bidirectional pin Timer 2A input capture 2 / PWM output pin / general-purpose bidirectional pin Timer 2A external event input pin / general-purpose bidirectional pin Timer 1 input capture / counter reset input pin / general-purpose bidirectional pin Timer 1 pulse-width-modulation (PWM) output pin / general-purpose bidirectional pin Timer 1 external event input pin / general-purpose bidirectional pin Port G is a general-purpose bidirectional port. Ground reference for digital I/O logic Ground reference for digital logic Positive supply voltage Positive supply voltage for digital I/O logic Internal oscillator crystal input / external clock source input Internal oscillator output for crystal
Port D is a general-purpose bidirectional I / O port that can be individually configured. D3 is also configurable as SYSCLK. Mode control (MC) pin. MC enables EEPROM write-protection override (WPO) mode, also supplies EPROM VPP. System reset bidirectional pin. RESET, as an input, initializes the microcontroller; as open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit.
TMS370Cx8x Pinouts and Pin Descriptions
2.10 TMS370Cx8x Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx8x devices are shown in Figure 2-10 and Table 2-10, respectively.
Figure 2-10. Pinouts for TMS370Cx8x
C2 C3 C4 C5 RESET INT1 INT2 INT3 NC VCC A7 A6 A5 A4 A3 A2 A1 A0 D7 D4
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
INT1 INT2 INT3 VCC NC A7 A6 VSS A5 A4 A3
RESET C5 C4 C3 C2 C1 C0 B0 B1 B2 B3
7 8 9 10 11 12 13 14 15 16 654 3 2 1 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 17 18 19 20 21 22 23 24 25 26 27 28 29
1
40
C1 C0 B0 B1 B2 B3 MC XTAL2/CLKIN XTAL1 B7 B6 B5 B4 VSS T1IC/CR T1PWM T1EVT D5 D6 D3
MC XTAL2/CLKIN XTAL1 B7 B6 B5 NC B4 C7 C6 NC
A. 40-pin PDIP (N)
TMS370 Family Pinouts and Pin Descriptions
A2 A1 A0 D7 D4 D3 D6 D5 T1EVT T1PWM T1IC/CR
B. 44-Pin PLCC (FN) C. 44-Pin CLCC (FZ)
2-27
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAA A A A A A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAA A A A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAA A A A A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A AAAAAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA
2-28
MC D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 B0 B1 B2 B3 B4 B5 B6 B7 A0 A1 A2 A3 A4 A5 A6 A7
TMS370Cx8x Pinouts and Pin Descriptions
I = input, O = output XTAL2 / CLKIN XTAL1 RESET T1PWM T1EVT T1IC / CR INT1 INT2 INT3 Name Pins
Table 2-10. TMS370Cx8x Pin Descriptions
PDIP (40)
33 32 34 25 24 26 21 20 23 22 19 39 40 1 2 3 4 -- -- 38 37 36 35 28 29 30 31 18 17 16 15 14 13 12 11 5 6 7 8
LCC (44)
38 37 39 27 26 28 23 22 25 24 21 44 1 2 3 4 5 30 31 43 42 41 40 32 34 35 36 20 19 18 17 16 15 13 12 6 7 8 9
I/O
I/O
I/O I/O
I/O
I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I I/O I/O
I O I
System reset bidirectional pin: as input pin, RESET initializes the microcontroller; as open-drain output, RESET indicates that an internal failure was detected by the watchdog or oscillator fault circuit.
Internal oscillator crystal input / external clock source input Internal oscillator output for crystal Port C is a general-purpose bidirectional I / O port. Port B is a general-purpose bidirectional I / O port. Port A is a general-purpose bidirectional I / O port. Description
Mode control pin; enables EEPROM write-protection override (WPO) mode, and also supplies EPROM VPP Timer 1 input capture / counter reset input pin / general-purpose bidirectional pin Timer 1 PWM output pin / general-purpose bidirectional pin Timer 1 external event input pin / general-purpose bidirectional pin External (non-maskable or maskable) interrupt / general-purpose input pin External maskable interrupt input / general-purpose bidirectional pin External maskable interrupt input / general-purpose bidirectional pin
Port D is a general-purpose bidirectional I / O port. D3 is also configurable as SYSCLK.
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA AAAAAAAAAAAAAAAAAA A A AAAAA A AAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AA AA A AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAA AA AA A
Table 2-10. TMS370Cx8x Pin Descriptions (Continued)
I = input, O = output NC VSS VCC Name Pins PDIP (40) 27 10 9 11, 29, 33 LCC (44) 14 10 I/O These pins have no connection to the internal die. Ground reference for digital logic Positive supply voltage Description
TMS370 Family Pinouts and Pin Descriptions
TMS370Cx8x Pinouts and Pin Descriptions
2-29
TMS370Cx9x Pinouts and Pin Descriptions
2.11 TMS370Cx9x Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370Cx9x devices are shown in Figure 2-11 and Table 2-11, respectively.
Figure 2-11.Pinouts for TMS370Cx9x
A3 A4 A5 A6 A7 RESET INT1 VCC VCC3 VSS3 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 AN8 AN9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
A2 A1 A0 T1EVT T1PWM MC T1IC/CR XTAL2/CLKIN XTAL1 VSS D7 D5 D4 D6 D3 AN14 AN13 AN12 AN11 AN10
RESET INT1 VCC VCC3 VSS3 AN0 AN1 AN2 AN3 AN4 NC
7 8 9
654
3 2 1 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30
T1PWM
T1EVT
NC
A7 A6
A5
A4
A3
A2 A1
A0
10 11 12 13 14 15 16
29 17 18 19 20 21 22 23 24 25 26 27 28 AN10 AN11 AN5 AN6 AN7 AN8 AN9 NC AN12 AN13 AN14
MC T1IC/CR XTAL2/CLKIN NC XTAL1 VSS D7 D5 D4 D6 D3
A. 40-Pin PSDIP (NJ) B. 40-Pin CSDIP (JC)
C. 44-Pin PLCC (FN) D. 44-Pin CLCC (FZ)
The NJ designator for the 40-pin plastic shrink DIP package was formerly known as N2. The
mechanical drawing of the NJ is identical to the N2 package and did not need to be requalified.
2-30
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A AA A A AAA AA A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA A A AA A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A AA A A AA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAA A A AA A A AA A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAA A A AA A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA AA A A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA A A AA A A AA A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA AA A A AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAA A A A AA AAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAA
VSS 31 I = input, O = output VCC XTAL2/CLKIN XTAL1 MC RESET T1IC/CR T1PWM T1EVT INT1 AN8 AN9 AN10 AN11 AN12 AN13 AN14 AN0/E0 AN1/E1 AN2/E2 AN3/E3 AN4/E4 AN5/E5 AN6/E6 AN7/E7 D3/SYSCLK D4 D5 D6 D7 A0 A1 A2 A3 A4 A5 A6 A7 Name
Table 2-11. TMS370Cx9x Pin Descriptions
Pin
SDIP (40)
33 32
35
34 36 37
19 20 21 22 23 24 25
26 28 29 27 30
38 39 40 1 2 3 4 5
11 12 13 14 15 16 17 18
8
6
7
LCC (44)
34
37 35
39
38 40 41
21 22 24 25 26 27 28
12 13 14 15 16 18 19 20
29 31 32 30 33
42 43 44 2 3 4 5 6
9
7
8
I/O
I/O
I/O I/O I/O
I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I O
I
I
I I I I I I I
I I I I I I I I
System-reset bidirectional pin. RESET, as an input, initializes the microcontroller; as open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit.
Ground reference for digital logic.
Positive supply voltage for digital logic.
Internal oscillator crystal input / external clock source input Internal oscillator output for crystal
Mode control (MC) pin. MC enables EEPROM write-protection override (WPO) mode, and also supplies EPROM VPP.
Timer 1 input capture/counter reset input pin/general-purpose bidirectional pin. Timer 1 PWM output pin/general-purpose bidirectional pin. Timer 1 external event input pin/general-purpose bidirectional pin.
External (nonmaskable or maskable) interrupt/general-purpose input pin
ADC3 analog input pins.
ADC3 analog input (AN0 - AN7) or positive reference pins (AN6 - AN7). Port E can be individually programmed as general-purpose input pins if not used as ADC3 analog input. Only AN6 and AN7 can be software-configured as positive reference input.
Port D is a general-purpose bidirectional I/O port. D3 is also configurable as SYSCLK.
Port A is a general-purpose bidirectional I/O port.
Description
TMS370 Family Pinouts and Pin Descriptions
TMS370Cx9x Pinouts and Pin Descriptions
2-31
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAA A A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TMS370Cx9x Pinouts and Pin Descriptions
I = input, O = output NC
2-32 VSS3 VCC3
Name
Table 2-11. TMS370Cx9x Pin Descriptions (Continued)
Pin
SDIP (40)
10 9
--
1, 17, 23, 36 LCC (44) 10 11
I/O
These pins have no connection to the internal die. Ground reference for ADC3 Description Positive supply voltage for ADC3
TMS370CxAx Pinouts and Pin Descriptions
2.12 TMS370CxAx Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370CxAx devices are shown in Figure 2-12 and Table 2-12, respectively.
Figure 2-12. Pinouts for TMS370CxAx
B2 T2AEVT T2AIC2 / PWM T2AIC1 / CR RESET INT1 INT2 INT3 VCC A7 A6 VSS A5 A4 A3 A2 A1 A0 D7 D4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
B1 B0 SCITXD SCIRXD SCICLK D5 MC XTAL2 / CLKIN XTAL1 T1IC / CR T1PWM T1EVT C0 B7 B6 B5 B4 B3 D6 D3
A. 40-Pin PDIP (N)
TMS370 Family Pinouts and Pin Descriptions
2-33
TMS370CxAx Pinouts and Pin Descriptions
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAA A A A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AA A AAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA A A AA A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Table 2-12. TMS370CxAx Pin Descriptions
40-Pin PDIP Name A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 No. 18 17 16 15 14 13 11 10 39 40 1 23 24 25 26 27 28 21 20 35 22 19 6 7 8 I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Port A is a general-purpose bidirectional I / O port. Port B is a general-purpose bidirectional I / O port. C0 D3 D4 D5 D6 D7 Port C is a general-purpose bidirectional I / O port. Port D is a general-purpose bidirectional I / O port. D3 is also configurable as SYSCLK. INT1 INT2 INT3 I I/O I/O External (non-maskable or maskable) interrupt/ general-purpose input pin. External maskable interrupt input / general-purpose bidirectional pin. External maskable interrupt input / general-purpose bidirectional pin. T1IC / CR T1PWM T1EVT SCITXD SCIRXD SCICLK RESET 31 30 29 38 37 36 5 I/O Timer 1 input capture / counter reset input pin / general-purpose bidirectional pin. Timer 1 PWM output pin / general-purpose bidirectional pin. Timer 1 external event input pin / general-purpose bidirectional pin. SCI transmit data output pin, general-purpose bidirectional pin (see Note). SCI receive data input pin / general-purpose bidirectional pin. SCI bidirectional serial clock pin / general-purpose bidirectional pin. I/O I/O System reset bidirectional pin; as input pin, RESET initializes the microcontroller; as open-drain output, RESET indicates that an internal failure was detected by watchdog or oscillator fault circuit. Timer 2A input capture 1/counter reset input pin/general-purpose bidirectional pin. Timer 2A input capture 2/PWM output pin/general-purpose bidirectional pin. Timer 2A external event input pin/general-purpose bidirectional pin. Mode control input pin . T2AIC1/CR T2AIC2/PWM T2AEVT MC 4 3 2 I/O I 34 33 32 9 XTAL2 / CLKIN XTAL1 VCC I O Internal oscillator crystal input / external clock source input. Internal oscillator output for crystal. Positive supply voltage VSS 12 Ground reference I = input, O = output Note: The two SCI configuration pins are referred to as SCI2.The three-pin SCI configuration is referred to as SCI1.
2-34
TMS370CxBx Pinouts and Pin Descriptions
2.13 TMS370CxBx Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370CxBx devices are shown in Figure 2-13 and Table 2-13, respectively.
Figure 2-13. Pinouts for TMS370CxBx
B5 B6 B7 C0 MC C1 C2 VSS1 C3 C4 C5 C6 C7 AN0 A0 A1 A2 A3 A4 A5 A6 A7 G0 G1 G2 G3 G4 G5 XTAL2 / CLKIN XTAL1 VCC1 VCC3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
B4 B3 B2 B1 B0 D0 / CSE2 / OCF VSS1 VCC1 D1 / CSH3 D3 / SYSCLK D4 / R / W D6 / CSH1 / EDS D7 / CSE1 / WAIT RESET INT1 INT2 INT3 H0 G7 G6 T1IC / CR T1PWM AN7 T1EVT VSS1 AN6 AN5 AN4 AN3 AN2 AN1 VSS3
C3 C4 C5 C6 C7 VCC2 VSS2 A0 A1 A2 A3 A4 A5 A6 A7 G0 G1
10 11 12 13 14 15 16
VSS1 C2 C1 MC C0 B7 B6 B5 B4 B3 B2 B1 B0 D0 / CSE2 / OCF VCC2 VSS2 VCC1 9 8 7 6 5 4 3 2 1 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 17 52 18 51 19 50 20 49 21 48 22 47 23 46 24 45 25 44 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 G2 G3 G4 G5 XTAL2/CLKIN XTAL1 V CC1 V CC3 V SS3 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 D1 / CSH3 D2 / CSH2 D3 / SYSCLK D4 / R / W D5 / CSPF D6/CSH1/EDS D7/CSE1/WAIT RESET INT1 INT2 INT3 H0 G7 G6 T1IC/CR T1PWM T1EVT
A. 64-Pin PSDIP (NM)
B. 68-Pin PLCC (FN)
TMS370 Family Pinouts and Pin Descriptions
2-35
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A A AAAAAAAAAAAAAAAAA A A A AA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A AA A A AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A A AA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA A A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2-36
C0 C1 C2 C3 C4 C5 C6 C7 B0 B1 B2 B3 B4 B5 B6 B7 A0 A1 A2 A3 A4 A5 A6 A7
TMS370CxBx Pinouts and Pin Descriptions
I = input, O = output RESET VSS3 INT3 INT2 VCC3 Name AN0/E0 AN1/E1 AN2/E2 AN3/E3 AN4/E4 AN5/E5 AN6/E6 AN7/E7 INT1/NMI
Table 2-13. TMS370CxBx Pin Descriptions
Pin
PSDIP (64)
51 33 32 14 34 35 36 37 38 39 42 48 49 50 60 61 62 63 64 1 2 3 15 16 17 18 19 20 21 22
4 6 7 9 10 11 12 13
LCC (68)
53 35 34 36 37 38 39 40 41 42 43 50 51 52 65 66 67 68 1 2 3 4 17 18 19 20 21 22 23 24
5 7 8 10 11 12 13 14
I/O
I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I I I I I I I I
System reset bidirectional pin. RESET, as an input, initializes the microcontroller; as open-drain output, RESET indicates an internal failure was detected by the watchdog or oscillator fault circuit. ADC1 positive-supply voltage and optional positivereference input pin ADC1 ground reference pin Port C is a general-purpose bidirectional I/O port. Port B is a general-purpose bidirectional I/O port. Port A is a general-purpose bidirectional I/O port. Description External (nonmaskable or maskable) interrupt/general-purpose input pin External maskable interrupt input/general-purpose bidirectional pin External maskable interrupt input/general-purpose bidirectional pin
Port E can be individually programmed as general-purpose input pins if not used as ADC1 analog input or positive reference input.
ADC1 analog input (AN0 - AN7) or positive reference pins (AN1 - AN7)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A AAAAAAAAAAAAA AA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA AA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAA AA AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A AA A A AA A AA AAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A A AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA A A AA A A A AA AA A A AAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA A A A AA AA AAAAAA AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A A AAAAAAAAAAAAAAAAAA A A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA A AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA
I = input, O = output T1EVT T1PWM T1IC / CR H0 G0 G1 G2 G3 G4 G5 G6 G7 D0 D1 D2 D3 D4 D5 D6 D7 VSS2 VSS1 VCC2 VCC1 XTAL2/CLKIN XTAL1 MC Name
Table 2-13. TMS370CxBx Pin Descriptions (Continued)
Pin
PSDIP (64)
8, 58, 40
31, 57
41
43
44
47
23 24 25 26 27 28 45 46
59 56 - 55 54 - 53 52
29 30
--
--
5
16,62
15,63
33,61
LCC (68)
44
45
46
49
25 26 27 28 29 30 47 48
64 60 59 58 57 56 55 54
31 32
9
6
I/O
I/O
I/O
I/O
I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I/O I/O I/O I/O I/O I/O I/O I/O
I O
I
Description
I/O timer 1 input capture / counter reset input pin / general-purpose bidirectional pin I/O timer 1 pulse-width-modulation (PWM) output pin / general-purpose bidirectional pin I/O timer 1 external event input pin / general-purpose bidirectional pin
Port H is a general-purpose bidirectional port.
Port G is a general-purpose bidirectional port.
Port D is a general-purpose bidirectional I / O port. D3 is also configurable as SYSCLK.
Ground reference for digital I/O logic
Ground reference for digital logic
Positive supply voltage for digital I/O logic
Positive supply voltage
Internal oscillator crystal input / external clock source input Internal oscillator output for crystal
Mode control (MC) pin. MC enables EEPROM write-protection override (WPO) mode.
TMS370 Family Pinouts and Pin Descriptions
TMS370CxBx Pinouts and Pin Descriptions
2-37
TMS370CxCx Pinouts and Pin Descriptions
2.14 TMS370CxCx Pinouts and Pin Descriptions
The pinout and pin descriptions for the TMS370CxCx devices are shown in Figure 2-14 and Table 2-14, respectively.
Figure 2-14. Pinouts for TMS370CxCx
A7 D6 D3 V CC V SS RESET D4 4 3 2 1 28 27 26 XTAL2 / CLKIN XTAL1 A6 A5 A4 A3 A2 5 6 7 8 9 10 11 25 24 23 22 21 20 19 12 13 14 15 16 1718 D7 A1 A0 INT1 T1EVT T1PWM T1IC / CR AN3 AN2 AN1 AN0 SCITXD SCIRXD MC
VCC D3 D6 A7 XTAL2 / CLKIN XTAL1 A6 A5 A4 A3 A2 D7 A1 A0
1 2 3 4 5 6 7 8 9 10 11 12 13 14
28 27 26 25 24 23 22 21 20 19 18 17 16 15
VSS RESET D4 AN3 AN2 AN1 AN0 SCITXD SCIRXD MC T1IC / CR T1PWM T1EVT INT1
A. 28-Pin PDIP (N) B. 28-Pin CDIP (JD)
C. 28-Pin PLCC (FN) D. 28-Pin CLCC (FZ)
2-38
TMS370CxCx Pinouts and Pin Descriptions
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAA A A AAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AAA AAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AA A AAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAA A AAA A AAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA A AAA AA AA AAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA A A AAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA A AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAA A AAAAAAAAAAAAAAAAAAAAAAA A AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA AA AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAA
Table 2-14. TMS370CxC Pin Descriptions
28-Pin DIP/LCC Name No. 14 13 11 10 9 8 7 4 I / O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I I I I I Description A0 A1 A2 A3 A4 A5 A6 A7 Port A is a general-purpose bidirectional I / O port. D3 D4 D6 D7 2 26 3 12 Port D is a general-purpose bidirectional I / O port. D3 is also configurable as SYSCLK. INT1 15 22 23 24 25 18 17 16 21 20 27 External (non-maskable or maskable) interrupt/general-purpose input pin. AN0 /E0 AN1 / E1 AN2 / E2 AN3 / E3 ADC2 module analog input (AN0 - AN3) or positive reference pins (AN1 - AN3). Port E can be individually programmed as general-purpose input pins if not used as ADC2 analog input. Timer 1 input capture / counter reset input pin / general-purpose bidirectional pin. Timer 1 PWM output pin / general-purpose bidirectional pin. Timer 1 external event input pin / general-purpose bidirectional pin. SCI module transmit data output / general-purpose bidirectional pin. (See Note) SCI module receive data input pin / general-purpose bidirectional pin. T1IC / CR T1PWM T1EVT SCITXD SCIRXD RESET I/O I/O I/O I/O I/O I/OAAAAAAAAAAAAAAAAAAAAA System reset bidirectional pin; as input pin, RESET initializes the microcontroller; as open-drain output, RESET indicates that an internal failure was detected by watchdog or oscillator fault circuit. I Mode control input pin; and also supplies EPROM VPP. MC 19 5 6 1 XTAL2 / CLKIN XTAL1 VCC I O Internal oscillator crystal input / External clock source input. Internal oscillator output for crystal. Positive supply voltage VSS 28 Ground reference I = input, O = output Note: The two SCI configuration pins are referred to as SCI2.
TMS370 Family Pinouts and Pin Descriptions
2-39
2-40
Running Title--Attribute Reference
Chapter 3
CPU and Memory Organization
This chapter describes the CPU registers and memory organization. In the TMS370 register-to-register architecture, the CPU and up to the first 256 bytes of RAM act as a single unit with the program counter, stack pointer, and status register. This chapter covers the following topics:
Topic
3.1 3.2 3.3 3.4
Page
CPU/Register File Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 CPU Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Memory Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Chapter Title--Attribute Reference
3-1
CPU / Register File Interaction
3.1 CPU/Register File Interaction
The TMS370 architecture provides the following components:
-
CPU registers
J J J
A stack pointer, which points to the last entry in the memory stack A status register, which monitors the operation of the instructions and contains the global interrupt bits A program counter, which points to the memory location of the next instruction to be executed
-
Memory map
J J J J
A register file that can be accessed as general-purpose registers, data memory storage, program instructions, or part of the stack A peripheral file that provides access to all internal peripheral modules, system-wide control functions, and EEPROM/EPROM programming control Data EEPROM modules, which provide in-circuit programmability and data retention in power-off mode Program memory that provides alternatives to meet the needs of your application
Figure 3-1 illustrates the CPU registers and memory blocks. Note: Device Block Diagrams
Section 1.7 on page 1-21 contains a collection of block diagrams of each device family. These diagrams show each element of the TMS370 architecture (for example, TMS370Cx4x in Figure 1-6 on page 1-26.)
3-2
CPU / Register File Interaction
Figure 3-1. Programmer's Model
15 Program Counter (PC) 0
7 C 7 N
Status Register (ST) Z V IE2 IE1 --
0 -- 0
Stack Pointer (SP)
Legend: C= N= Z= V= IE2 = IE1 =
Carry Negative Zero Overflow Level 2 interrupt enable Level 1 interrupt enable
Register File (RAM) R0 (A) R1 (B) R2 R3
0000h 0001h 0002h 0003h 0100h
RAM expansion, peripheral file, and data EEPROM expansion
1FFFh 2000h
. . .
R127
007Fh
Program ROM/EPROM
7F9Bh 7F9Ch
PACT vectors
. . .
R255
00FFh
7FBFh 7FC0h
Traps 0-15
7FDFh 7FE0h 7FEBh 7FECh 7FFFh 8000h
Reserved Interrupt/reset vectors
Program ROM/EPROM
DFFFh E000h
Program memory expansion
FFFFh
CPU and Memory Organization
3-3
CPU Registers
3.2 CPU Registers
The CPU contains three registers to control the status and direction of the program. These are the stack pointer, status register, and program counter. These registers and their use are described in the following subsections.
3.2.1
Stack Pointer (SP)
The stack operates as a last-in, first-out, read/write memory. The stack is typically used to store the return address on subroutine calls and the status register contents during interrupts. The stack pointer (SP) is an 8-bit CPU register that points to the last entry or top of the stack. The SP is automatically incremented before data is pushed onto the stack and decremented after data is popped from the stack. The stack can be placed anywhere in the register file. During reset, the SP is loaded with a value of 01h. To control the area occupied by the stack, the application program must set the stack pointer and include code to monitor the stack size. The SP is loaded from register B (R1) by the assembly language instruction LDSP (load stack pointer). The LDSP instruction allows the stack to be located anywhere in the register file space. The SP can be read into register B by the STSP (store stack pointer) command. Figure 3-2 illustrates an example SP initialization and stack operation.
INIT MOV #60h,B LDSP ;Load register B with the value ;60h. ;Load the stack pointer with the ;contents of register B.
Figure 3-2. Stack Example
0000h Top of stack on reset = 0001h
* * *
Initial top of stack = 0060h 0061h
* * * * * *
PUSH
Increment then store
* *
POP
Fetch then decrement
Upper stack limit = 007Fh or 00FFh
3-4
CPU Registers
For devices with 256 (or more) bytes of RAM, if the stack is pushed beyond its limit of 00FFh, the SP register wraps around from 00FFh to 0000h without an error indication. For devices with only 128 bytes of RAM, the stack is not implemented beyond 007Fh; data pushed beyond this limit is lost. Your application program must guard against a stack overflow.
3.2.2
Status Register (ST)
The status register (ST) monitors the operation of the instructions and contains the global interrupt enable bits. The ST includes four status bits (condition flags - C, N, Z, and V), two interrupt enable bits (IE2 and IE1), and two reserved bits. The four status bits indicate the outcome of the previous instruction; conditional instructions (for example, the conditional jump instructions) use these status bits to determine the program flow.
Status Register (ST)
Bit #
7
C RW-0
6
N RW-0
5
Z RW-0
4
V RW-0
3
IE2 RW-0
2
IE1 RW-0
1
--
0
--
R = Read, W = Write, -n = Value of the bit after the register is reset
The ST, status bit notation, and status bit definitions are as follows: Bit 7 C. Carry. This status bit is set by arithmetic instructions as a carry bit or as a no-borrow bit. It is also affected by the rotate instructions. See each instruction in Chapter 16 for a detailed description of how the carry bit is used. Bit 6 N. Negative. The CPU sets this bit to the value of the most significant bit (sign bit) of the result of the previous operation. Bit 5 Z. Zero. This bit is set by the CPU if the result of the previous operation was 0; cleared otherwise.
CPU and Memory Organization
3-5
CPU Registers
Bit 4
V. Overflow. This bit is set by the CPU if a signed arithmetic overflow condition is detected during the previous instruction. The value of this flag is significant at the completion of the following instructions: ADC, ADD, INC, INCW, CMP, DEC, SUB, SBB, and DIV.
Instruction ADC, ADD, INC, INCW CMP, DEC, SUB, SBB DIV (Rs, A) V (Bit 4) Equals a 1 If (C XOR N) AND (bit 7{s} XNOR bit 7{d}) (C XOR N) AND (bit 7{s} XOR bit 7{d}) Rs A, which means quotient > 255
Bit 3
IE2. Level 2 Interrupt Enable, (daisy-chain order). This bit controls interrupt level 2 (lowest priority). 0 = Disables interrupt requests from priority level 2. 1 = Enables interrupt requests from priority level 2.
Bit 2
IE1. Level 1 Interrupt Enable. This bit controls interrupt level 1 (highest priority). 0 = Disables interrupt requests from priority level 1. 1 = Enables interrupt requests from priority level 1.
Bits 1-0
Reserved. Read data is indeterminate. When the CPU acknowledges an interrupt, the contents of the ST are automatically pushed onto the stack; then the ST is cleared (for more information about interrupt effects on the ST, see subsection 5.1.1, page 5-3). The RTI instruction implements a normal exit from an interrupt service routine. When the CPU executes the RTI instruction, it automatically restores the contents of the ST with a stack-pop operation. The four condition flags (C, N, Z, and V) are updated every time an instruction is executed that manipulates or moves data. As a result, conditional branches should be performed immediately after data is manipulated. The instructions that do not affect the contents of these flags are as follows: TRAP 0 to TRAP 15 CALL CALLR BR DJNZ JMP Jcnd (jump on condition instructions) IDLE NOP PUSH ST RTS STSP JMPL LDSP
The LDST instruction allows a program to change all bits in the status register. The byte following this instruction is loaded directly into the status register. The
3-6
CPU Registers
assembly language instructions DINT, EINT, EINTH, and EINTL enable specific interrupts. These instructions are converted to an LDST #iop8 opcode by the assembler so that #iop8 is the appropriate value to set or clear the specific interrupt (see Chapter 16 for more information on the LDST instruction). The carry (C) bit can be set with the SETC opcode and cleared with the CLRC opcode.
3.2.3
Program Counter (PC)
The contents of the program counter (PC) point to the memory location of the next instruction to be executed. The PC consists of two 8-bit registers in the CPU: the program counter high (PCH) and program counter low (PCL). These registers contain the MSbyte and LSbyte of a 16-bit address. During reset, the PCH (PC's MSbyte) is loaded with the contents of memory location 7FFEh, and the PCL (PC's LSbyte) is loaded with the contents of memory location 7FFFh. Figure 3-3 illustrates this operation using an example value of 7000h as the contents of memory locations 7FFEh and 7FFFh (reset vector).
Figure 3-3. Program Counter After Reset
Memory (8-bits) 0000h Program Counter (PC) PCH PCL 70 00
(16-bits)
7FFEh 7FFFh
70 00
CPU and Memory Organization
3-7
Memory Map
3.3 Memory Map
Figure 3-4 shows the memory map of the TMS370 family members. The partitioning of memory and physical location of memory (that is, the on- or off-chip) depends on the device used and the memory mode (C or P -- microcontroller or microprocessor, discussed in Section 3.4, page 3-16). Each device that has memory expansion can be programmed up to sixteen address bits. This allows access to up to 56K bytes of memory. In addition, memory expansion features allow using up to 112K bytes of external memory. (The expansion features are described further in subsection 3.4.2 page 3-19.)
3.3.1
Register File
The register file (RF) is located in on-chip RAM at memory addresses 0000h-00FFh.
-
In devices with 128 bytes of RAM, the RF has 128 memory locations treated as registers R0 through R127. In devices with 256 bytes of RAM, the RF has 256 memory locations treated as registers R0 through R255. If the device incorporates the PACT module:
J
128 bytes of dual-port RAM are mapped into memory locations 0080h-00FFh for 'x32 devices or 0180-01FFh for 'x36 devices. For the 'x32 device, any of this RAM not used by the PACT module can be used as registers or stack. For the 'x36 device, any of this RAM not used by the PACT can be used only as data memory storage. 256 bytes of standby RAM (only available in 'x36 devices) are mapped into memory locations 0200h-02FFh. The standby RAM is used as general-purpose memory, and cannot be used as RF or stack. The standby RAM is powered by pin VCCSTBY; therefore, data is saved if the main VCC1 power fails.
J
The memory addresses of the registers in the RF are shown in Figure 3-5 on page 3-10.
3-8
Memory Map
Figure 3-4. TMS370 Memory Map
0000h 128 bytes RAM (0000h - 007Fh) 256 bytes RAM (0000h - 00FFh) 512 bytes RAM (0000h - 01FFh 0200h 1K bytes RAM (0000h - 03FFh) 0400h 1.5K bytes RAM (0000h - 05FFh) 0600h 3.5K bytes RAM (0000h - 0DFFh) 0E00h Reserved 1000h Peripheral file 10C0h Peripheral expansion Reserved 512 bytes (1E00h - 1FFFh) data EEPROM 256 bytes (1F00h - 1FFFh) data EEPROM 24K bytes ROM/EPROM (2000h - 7FFFh) or uP mode memory expansion 16K bytes ROM/EPROM (4000h - 7FFFh) or uP mode memory expansion 12K bytes ROM (5000h - 7FFFh) or uP mode memory expansion 8K bytes ROM (6000h - 7FFFh) or uP mode memory expansion 4K bytes ROM (7000h - 7FFFh) or uP mode memory expansion 2K bytes ROM (7800h - 7FFFh) interrupts and RESET vectors; TRAP vectors 32K bytes ROM/EPROM (2000h - 9FFFh) or uP memory expansion A000h 48K bytes ROM/EPROM (2000h - DFFFh) or uP memory expansion E000h Memory expansion/external memory FFFFh In devices with more than 256 bytes of RAM, only the first 256-byte block can be used as registers or stack. 1100h 1E00h 1F00h 2000h 4000h 5000h 6000h 7000h 7800h 7FC0h 8000h 0080h 0100h
CPU and Memory Organization
3-9
Memory Map
Figure 3-5. Register File Addresses
1 byte R0 (A) R1 (B) R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 0000h 0001h 0002h 0003h 0004h 0005h 0006h 0007h 0008h 0009h 000Ah 000Bh 000Ch 000Dh 000Eh 000Fh
D D D D
General-purpose registers Data memory storage Program execution Stack
R255
00FFh
The first two registers, R0 and R1, are also called registers A and B, respectively. Some instructions imply the use of register A or B. For example, the LDSP instruction assumes that the value to be loaded into the stack pointer is contained in register B. The partitioning of the RF is determined by the value loaded into the stack pointer and by the program's use of the RF. Locations within the RF address space can serve as either the CPU register file or general-purpose read/write memory. Program instructions can reside in and be executed from any location in the address space without restriction. The stack also occupies a portion of the RF. The multiple uses of the RF give you the flexibility to use the RF however you wish.
3-10
Memory Map
Any location in the RF can be accessed in one of three ways:
-
Register access using the register number as shown in the following example code:
MOV MOV A,R6 R12,R200 ;Move the ;Register ;Move the ;Register contents of Register A to R6. contents of Register 12 to R200.
-
Stack access using the stack pointer as shown in the following example code:
MOV LDSP PUSH #5,B A ;Move the value 5 into Register B. ;Move the contents of Register B to ;the stack pointer. ;Increment stack pointer to 6. ;Move contents of Register A to 0006h.
-
Normal memory access using 16-bit addresses as shown in the following example code:
MOV A,&0006 ;Move the contents of Register A to ;memory location 0006h.
When working with the RF, you must keep the following in mind:
3.3.2 Peripheral File
Access time. When the RF is used as a general-purpose register, the access time is a single-system clock cycle. Access to the RF for any other purpose takes two clock cycles. Reset operations. A reset operation has no effect on the contents of any memory location within the RF except for locations 0000h (register A) and 0001h (register B). Registers A and B are cleared in the beginning of the reset process. Halt, idle, and standby states. The halt, idle, and standby states have no effect on the contents of the RF or RAM. RAM outside of the RF. RAM that is not within the first 256 bytes (0000h-00FFh) is general-purpose RAM and is not considered part of the RF. Access to this RAM takes two clock cycles.
The peripheral file (PF) is a set of memory-mapped registers that provide access to all internal peripheral modules, system-wide control functions, and EEPROM/EPROM programming control. The PF includes 256 addresses in the memory map from 1000h-10FFh. The PF is divided into sixteen frames of 16 bytes each. Each peripheral frame is
CPU and Memory Organization
3-11
Memory Map
allocated its own set of control registers. In addition, some frames are dedicated to specific functions. The instruction set includes some instructions which access the peripheral file directly. These instructions designate the register by the number of the file register relative to 1000h, preceded by P0 for a hexadecimal designator or P for a decimal designator. For example, the system configuration control register 0 is located at address 1010h; its peripheral file hexadecimal designator is P010, and its decimal designator is P16. Table 3-1 shows the address map of the peripheral file for the different device families. The following describe frames 0 - 15 of the file:
-
Frame 0 of the peripheral file (memory addresses 1000h-100Fh) is reserved for factory testing. The results of access to this frame are unpredictable. Frame 1 (1010h-101Fh) contains system configuration and control functions. It also contains registers for controlling EEPROM/EPROM programming. EEPROM/EPROM module control registers are described in Chapter 6, EPROM and EEPROM Modules. Frame 2 (1020h-102Fh) contains the digital I/O pin configuration and control registers. The individual functions controlled by these registers are described in Section 4.4, page 4-18. Frames 3 through 8 are used by the internal peripherals. These peripherals and their control registers are described in the following chapters:
-
J J J J J J J J J J
Timer 1 registers -- Chapter 7 Timer 2A registers -- Chapter 8 Timer 2B registers -- Chapter 8 SCI1 registers -- Chapter 9 SCI2 registers -- Chapter 10 SPI registers -- Chapter 11 ADC1 registers -- Chapter 12 ADC2 registers -- Chapter 13 ADC3 registers -- Chapter 14 PACT registers -- Chapter 15
Frames 9 through 11 are reserved. Frames 12 through 15 are available for the external expansion of the peripheral file on devices that have a memory expansion capability. These frames are located in external memory and accessed by the external address and data buses.
3-12
Memory Map
Table 3-1. Peripheral File Address Map
Frame
No. Address Description Reserved for Factory Test System and EEPROM/EPROM Control Registers Digital I/O Port Control Registers SPI Registers Timer 1 Registers PACT Registers
TMS370 Device Families x0x x1x x2x -- Yes Yes NA Yes NA Yes NA NA NA NA NA NA NA NA NA NA -- Yes Yes Yes Yes NA NA NA NA NA NA NA NA NA NA NA NA -- Yes Yes Yes Yes NA Yes NA NA NA NA NA NA NA NA NA NA x32 -- Yes Yes NA NA Yes NA NA Yes NA NA NA NA NA NA NA NA x36 -- Yes Yes Yes NA Yes NA NA Yes NA NA NA NA NA NA NA NA x4x x5x x6x x7x x8x x9x -- Yes Yes NA Yes NA Yes Yes Yes NA NA NA NA NA NA NA NA -- Yes Yes Yes Yes NA Yes Yes Yes NA NA NA NA Yes Yes Yes Yes -- Yes Yes Yes Yes NA Yes Yes Yes Yes NA NA NA Yes Yes Yes Yes -- Yes Yes NA Yes NA NA Yes Yes NA NA NA NA NA NA NA NA -- Yes Yes NA Yes NA NA NA NA NA NA NA NA NA NA NA NA -- Yes Yes NA Yes NA NA NA Yes NA NA NA NA NA NA NA NA xAx -- NA Yes NA Yes NA Yes Yes NA NA NA NA NA NA NA NA NA xBx -- Yes Yes NA Yes NA NA NA Yes NA NA NA NA NA NA NA NA xCx -- Yes Yes NA Yes NA Yes NA Yes NA NA NA NA NA NA NA NA
0 1 2 3 4
1000h 1010h 1020h 1030h 1040h
5 6 7 8 9 10 11 12 13 14 15
1050h 1060h 1070h 1080h 1090h 10A0h 10B0h 10C0h 10D0h 10E0h 10F0h
SCI Registers Timer 2A Registers ADC Registers Timer 2B registers Reserved Reserved Reserved External Peripheral Control External Peripheral Control External Peripheral Control External Peripheral Control
NA = Not Available SCI refers to SCI1 and SCI2 ADC refers to ADC1, ADC2, and ADC3
3.3.3
Data EEPROM Modules
Data EEPROM modules are provided on all TMS370 family devices, except TMS370CxAx and TMS370CxCx device families. The data EEPROM modules are 256- and 512-byte arrays. The 256-byte array is located at memory addresses 1F00h through 1FFFh, with the WPR (write protection register) at 1F00h. The 512-byte array is located at memory addresses 1E00h through 1FFFh, with WPRs at 1E00h and 1F00h. Larger arrays will continue to grow toward the smaller memory addresses with WPRs located in the first byte of every 256-byte boundary. Each set of 256 bytes is configured into eight blocks of 32 bytes and has an associated WPR. Each block can be individually write protected by setting the
CPU and Memory Organization
3-13
Memory Map
appropriate bit in the WPR. This module can be programmed on the basis of an entire array, a byte, or a single bit. The read-access time for the EEPROM module is two system clock cycles. Programming of the data EEPROM array is controlled by the data EEPROM control register (DEECTL) at memory address 101Ah (P01A) and the corresponding WPRs. See subsections 6.2.1 (page 6-3) and 6.2.2 (page 6-4) for more details on the WPR and DEECTL registers.
3.3.4
Program Memory
The program memory options available for the TMS370 family allow a wide selection of memory types: ROM or EPROM, ranging in size from 2K to 48K bytes. The program memory is arranged as individually addressable bytes in the memory map. Data can be read or code can be executed directly from these locations. Memory addresses 7F9Ch through 7FBFh and 7FECh through 7FFFh are reserved for interrupt and reset vectors. Trap vectors, used with TRAP0 through TRAP15 instructions, are at addresses 7FC0h through 7FDFh. Table 3-2 gives the memory map for the reserved vector locations and describes the differences among the TMS370 family members.
Table 3-2. Vector Address Map
Available on TMS370 Family Members
Memory Address
Description PACT INT 1-18 Timer 2B Trap 0-15 Reserved ADC Timer 2A SCI TX SCI RX Timer 1 SPI Interrupt 3 Interrupt 2 Interrupt 1 Reset
x0x x1x x2x NA NA Yes Yes NA NA Yes Yes Yes NA Yes Yes Yes Yes NA NA Yes Yes NA NA NA NA Yes Yes Yes Yes Yes Yes NA NA Yes Yes NA NA Yes Yes Yes Yes Yes Yes Yes Yes
x32 Yes NA Yes Yes Yes NA NA NA NA NA Yes Yes Yes Yes
x36 Yes NA Yes Yes Yes NA NA NA NA Yes NA NA Yes Yes
x4x x5x x6x x7x x8x x9x NA NA Yes Yes Yes Yes Yes Yes Yes NA Yes Yes Yes Yes NA NA Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes NA Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes NA NA Yes Yes Yes Yes NA NA Yes NA Yes Yes Yes Yes NA NA Yes Yes NA NA NA NA Yes NA Yes Yes Yes Yes NA NA Yes Yes Yes NA NA NA Yes NA NA NA Yes Yes
xAx NA NA Yes Yes NA Yes Yes Yes Yes NA Yes Yes Yes Yes
xBx NA NA Yes Yes Yes NA NA NA Yes NA Yes Yes Yes Yes
xCx NA NA Yes Yes Yes NA Yes Yes Yes NA NA NA Yes Yes
No. No Bytes
7F9Ch 7FBEh 7FC0h 7FE0h 7FECh 7FEEh 7FF0h 7FF2h 7FF4h 7FF6h 7FF8h 7FFAh 7FFCh 7FFEh
36 2 32 12 2 2 2 2 2 2 2 2 2 2
NA = Not Available ADC refers to ADC1, ADC2, or ADC3. SCI refers to SCI1 or SCI2.
3-14
Memory Map
3.3.4.1
Program ROM Module (TMS370C0xx, TMS370C3xx, and TMS370C4xx Devices Only)
The program ROM module consists of read-only memory, which is programmed at the time of device fabrication. The present ROM module sizes are 2K, 4K, 8K, 12K, 16K, 24K, 32K, and 48K. All accesses to the ROM module require two system clock cycles. ROM security is a feature of the TMS370C45x devices which inhibits the reading of data using any programmer (secured memory feature). Note: All TMS370 family devices contain mask-ROM space reserved for TI use only. This space includes locations 7FE0h through 7FEBh. This reserved area should not be used in your software algorithm, nor should it be used during mask-ROM or firmware development. The contents of the reserved locations are changed by TI only.
3.3.4.2
ROM-less Devices (TMS370C1xx and TMS370C2xx Devices Only)
Program memory for ROM-less devices must be off-chip. The TMS370 must be in the microprocessor mode to operate.
3.3.4.3
Program EPROM Modules (TMS370C6xx and TMS370C7xx Devices Only)
The program EPROM modules replace the program ROM for systems in prototype or small production runs. The modules presently consist of 8K, 16K, 24K, 32K, and 48K bytes of EPROM and the necessary programming control logic. Read access to the program EPROM is performed as normal memory read cycles. Write cycles require a special sequence of events. See subsection 6.4.3, page 6-13, for a detailed discussion of programming the EPROM modules. The EPROM can be written to only when VPP is applied to the MC pin and the VPPS bit (EPCTLx.6) is set. When VPP is applied to the MC pin, all on-chip EEPROM is in write protect override (WPO) mode, regardless of the state of the VPPS bit. This allows the EPROM to be protected while the EEPROM is in WPO.
CPU and Memory Organization
3-15
Memory Operating Modes
3.4 Memory Operating Modes
Devices that have the memory expansion can operate in one of two major memory modes.
-
Microcomputer (C) modes
J J
Microcomputer single-chip mode Microcomputer with external expansion
Microprocessor (P) modes
J J
Microprocessor without internal program memory Microprocessor with internal program memory
Devices that do not have the memory expansion can operate only in the microcomputer single-chip mode. Table 3-3 shows the devices and the modes that they can operate in.
Table 3-3. Memory Modes Available Per Device
Member of TMS370C Family x0x, x1x, x2x, x32, x36, x4x, x32 x36 x4x x7x, x8x, x9x, xAx, xBx, xCx Yes No No No Described in 15x, 25x No No Yes No 05x, 35x, 45x, 75x, x6x Yes Yes Yes Yes Subsection 3.4.1 3.4.2 3.4.3 3.4.4 Page 3-17 3-19 3-24 3-26
Mode Microcomputer Single Chip Microcomputer External Expansion Microprocessor Without Internal Program Memory Microprocessor With Internal Program Memory
For devices that have the memory expansion, the basic microcomputer and microprocessor operating modes are selected by the voltage level applied to the dedicated MC pin when the RESET pin goes inactive (high).
-
If the MC pin is low when the RESET signal goes high, then the processor enters the microcomputer mode. If the MC pin is high when the RESET signal goes high, then the processor enters the microprocessor mode.
Changing the MC pin alone does not change the memory mode. To change the memory operating mode, change the MC pin and then reset the device. Applying 12 volts to the MC pin after the RESET signal goes inactive high forces the device to enter the WPO mode.
3-16
Memory Operating Modes
Note:
Consideration for MC-Pin Voltage Application
If 12 V is applied to the MC pin during the low-to-high transition of the RESET pin, the results are unpredictable.
If the processor resets into a microcomputer mode, the software can change the internal system configuration registers to select the desired memory expansion configuration. Part of this configuration setup involves digital I/O port D. Each pin of port D can be programmed to serve one of three purposes: digital I/O, function A signal, or function B signal. Function A includes chip-select signals, which can be used in the microcomputer mode with external memory expansion. Function B includes signals used in either the microcomputer or the microprocessor modes to access external memory chips.
3.4.1
Microcomputer Single-Chip Mode
In the microcomputer single-chip mode, a TMS370 device functions as a selfcontained microcomputer with all memory and peripherals on the chip. This mode has no external address or data memory and allows more pins (used for the external buses in other modes) to be programmed as input/output pins. The single-chip mode maximizes the general-purpose I/O capability for realtime control applications. Figure 3-6 on page 3-18 shows a memory map for the microcomputer single-chip mode. During reset, the MC pin must remain at a low level to successfully enter the microcomputer mode. While the device is operating in the single-chip mode, external circuitry can place 12 volts on the MC pin to enter the WPO mode to alter protected EEPROM. Use the following steps to set a TMS370 device to the microcomputer singlechip mode: 1) Place a low logic level on the MC pin. 2) Bring the RESET pin to active low, then return RESET to its inactive high state. Note: The preceding procedure must be followed for devices that do not have the memory expansion, even though they operate only in the microcomputer single-chip mode.
CPU and Memory Organization
3-17
Memory Operating Modes
Figure 3-6. Microcomputer Single-Chip Mode
0000h 128 bytes RAM (0000h - 007Fh) Register file/stack 256 bytes RAM (0000h - 00FFh) 512 bytes RAM (0000h - 01FFh) 1K bytes RAM (0000h - 03FFh) RAM expansion 1.5K bytes RAM (0000h - 05FFh 3.5K bytes RAM (0000h - 0DFFh) Reserved Peripheral file Peripheral file Not available Reserved Data EEPROM expansion 512 bytes (1E00h - 1FFFh) data EEPROM Data EEPROM 256 bytes (1F00h - 1FFFh) data EEPROM 24K bytes ROM/EPROM (2000h - 7FFFh) 16K bytes ROM/EPROM (4000h - 7FFFh) 12K bytes ROM (5000h - 7FFFh) 8K bytes ROM (6000h - 7FFFh) Program memory (ROM/EPROM) 4K bytes ROM (7000h - 7FFFh) 2K bytes ROM (7800h - 7FFFh) interrupts and RESET vectors; TRAP vectors 1000h 10C0h 1100h 1E00h 1F00h 2000h 4000h 5000h 6000h 7000h 7800h 7FC0h 8000h 32K bytes ROM/EPROM (2000h - 9FFFh) A000h 48K bytes ROM/EPROM (2000h - DFFFh) E000h FFFFh In devices with more than 256 bytes of RAM, only the first 256-byte block can be used as registers or stacks. 0080h 0100h 0200h 0400h 0600h 0E00h
Not available
3-18
Memory Operating Modes
3.4.2
Microcomputer Mode With External Expansion (All Devices With Memory Expansion and Internal Program Memory)
The microcomputer mode also supports memory expansion to external memory or peripherals, while all on-chip memory (register file, ROM, and EPROM) remains active. Digital I/O ports, under the control of their associated port control registers, become external memory as follows:
-
Port A: 8-bit data memory Ports B and C: 16-bit address memory Port D: 8-bit control memory
Each pin that is not used for address, data, or control memory can be individually programmed as a general-purpose input/output pin. These bits are programmed by setting the digital I/O control registers in the peripheral file (see Section 4.4, page 4-18, for further information on programming I/O pins). The address memory and data memory are nonmultiplexed, eliminating the requirement for an external address/data latch and thereby lowering system cost. External interface decode logic can be reduced further by using the precoded chip-select outputs. The port D outputs can be programmed on a pin-by-pin basis to provide direct memory/peripheral chip-select or chip-enable functions. Each port D pin can be individually set to function A, function B, or general-purpose I/O. Function A When port D is set up to drive the chip-selection signals (function A), memory accesses to certain ranges of memory activate pins (refer to Table 3-4 on page 3-20, and Figure 3-7 on page 3-22): Applications that use more than one chip-select signal for the same address should set the unused chip selects (i.e., chip selects not currently used to select memory banks) to general-purpose high-level outputs. For example, an application that uses both CSE1 and CSE2 can set one of these signals as the active chip-select function and set the other as a general-purpose high-level output. The CSH1, CSH2, and CSH3 signals can be used as memory bank select signals under software control. The CSPF signal can be used as a chip select for the external expansion of the peripheral file. These chip-select control lines allow access to more than 112K bytes of external memory.
CPU and Memory Organization
3-19
Memory Operating Modes
Table 3-4. Memory-Enabled Pins Activated when Memory Accessed
Amount of Internal Memory in Device 4K, 8K, 12K, or 16K bytes Memory Areas Accessed 10C0h - 10FFh 2000h - 3FFFh 8000h - FFFFh Pins Activated Pin CSPF for 68-pin x50, x52, x53, and x56 devices if the pin is enabled Pins CSE1 and CSE2 for 64- and 68-pin x50, x52, x53, and x56 devices Pins CSH1, CSH2, and CSE3 for 68-pin x50, x52, x53, and x56 devices Pins CSH1 and CSE3 for 64-pin x50, x52, and x56 devices 24K or 32K bytes 10C0h - 10FFh A000h - BFFFh Pin CSPF for 68-pin x58, x67, and x68 devices if the pin is enabled Pins CSE1 and CSE2 for 64- and 68-pin x58 devices Pin CSE1 for 68-pin x67 and x68 devices C000h - FFFFh Pins CSH1 and CSH3 for 64-pin x58 devices Pins CSH1, CSH2, and CSH3 for 68-pin x58 devices Pin CSH1 for 68-pin x67 and x68 devices 48K bytes 10C0h - 10FFh E000h - EFFFh Pin CSPF for 68-pin x59 and x69 devices if the pin is enabled Pins CSE1 and CSE2 for 68-pin x59 devices Pin CSE1 for 68-pin x69 devices F000h - FFFFh Pins CSH1, CSH2, and CSH3 for 68-pin x59 devices Pin CSH1 for 68-pin x69 devices
These pins are activated providing that the pins are enabled by the appropriate port control register(s).
See Section 4.4 (page 4-18) for a description of the digital I/O port control registers and how the chip-select signals are enabled. Table 3-5 on page 3-21 shows a memory map for the microcomputer mode with function A expansion. Note: Areas Not Available for External Access
The RAM, data EEPROM, and internal memory expansion areas are not available for external access.
3-20
Memory Operating Modes
Table 3-5. Microcomputer Mode with Function A Expansion
Internal Program g Memory (R=ROM E=EPROM) 4KB R ('x50) Function A: Chip-Select Signals (Showing Memory Areas) Maximum External Memory 112KB CSE1 64/68 pin 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) A000h- BFFFh (8KB) A000h- BFFFh (8KB) E000h- EFFFh (4KB) CSE2 64/68 pin 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) 2000h- 3FFFh (8KB) A000h- BFFFh (8KB) A000h- BFFFh (8KB) E000h- EFFFh (4KB) CSH1 64/68 pin 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) C000h- FFFFh (16KB) C000h- FFFFh (16KB) F000h- FFFFh (4KB) CSH2 68 pin 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) C000h- FFFFh (16KB) C000h- FFFFh (16KB) F000h- FFFFh (4KB) CSH3 64/68 pin 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) 8000h- FFFFh (32KB) C000h- FFFFh (16KB) C000h- FFFFh (16KB) F000h- FFFFh (4KB) CSPF 68 pin 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B) 10C0h- 10FFh (64 B)
8KB R ('x52)
112KB
12KB R ('x53)
112KB
16KB R/E ('x56)
24KB R/E
112KB
('x67)
32KB R/E ('x58, 'x68)
24KB/'x67 64KB/'x77
64KB/'x58 24KB/'x68
48KB R/E ('x59, 'x69)
20KB/'x59 8KB/'x69
Chip-select pins CSE2, CSH2, and CSH3 are not available for the 'x6x device family. Devices '150, '250, '156, and '256 are ROMless. These devices cannot operate in microcomputer mode function A. KB = kilobytes, where 1KB = 102410.
CPU and Memory Organization
3-21
Memory Operating Modes
Figure 3-7. Microcomputer Mode With Function A Expansion
Chip Select Signals Function A Off Chip 'x50, 'x52, 'x53, & 'x56 Address 0000h 00FFh 0100h On-Chip Register file/stack RAM expansion 0FFFh 1000h CSPF 10BFh 10C0h 10FFh 1100h Peripheral file 0FFFh 1000h 10BFh 10C0h 10FFh 1100h Address 0000h 00FFh 0100h 'x58, 'x67, & 'x68 On-Chip Register file/stack RAM expansion Peripheral file 0FFFh 1000h 10BFh 10C0h 10FFh Data EEPROM expansion Data EEPROM 1100h Data EEPROM expansion Data EEPROM Address 0000h 00FFh 0100h 'x59 & 'x69 On-Chip Register file/stack RAM expansion Peripheral file
Peripheral expansion
Data EEPROM expansion Data EEPROM
1EFFh 1F00h CSE1 CSE2 Memory expansion 3FFFh 4000h 1FFFh 2000h
1EFFh 1F00h 1FFFh 2000h
1EFFh 1F00h 1FFFh 2000h
CSH1 CSH2 7FFFh CSH3
Program memory (ROM/EPROM) 4K bytes or 8K bytes or 12K bytes or 16K bytes 9FFFh A000h BFFFh C000h
Program memory (ROM/EPROM)
Program memory (ROM/EPROM)
24K bytes or 32K bytes
48K bytes
Memory expansion
DFFFh E000h EFFFh F000h
FFFFh
FFFFh
FFFFh
1) Chip select signals CSH2 and CSPF are not available in 64-pin devices. 2) Chip select signals CSE1, CSH2, and CSH3 are not available for x6x devices. '150, '250, '156, and '256 are ROMless devices. These devices cannot operate in Microcomputer Mode Function A.
3-22
Memory Operating Modes
Figure 3-8. Microcomputer Mode With Function B Expansion
Chip Select Signals Function B Off Chip 'x50, 'x52, 'x53, & 'x56 Address 0000h 00FFh 0100h EDS 0FFFh 1000h 10BFh 10C0h 10FFh 1100h On-Chip Register file/stack RAM expansion Peripheral file 0FFFh 1000h 10BFh 10C0h 10FFh 1100h Address 0000h 00FFh 0100h 'x58, 'x67, & 'x68 On-Chip Register file/Stack RAM expansion Peripheral file 0FFFh 1000h 10BFh 10C0h 10FFh 1100h Address 0000h 00FFh 0100h 'x59 & 'x69 On-Chip Register file/stack RAM expansion Peripheral file
Peripheral expansion
Data EEPROM expansion Data EEPROM
Data EEPROM expansion Data EEPROM
Data EEPROM expansion Data EEPROM
1EFFh 1F00h 1FFFh 2000h Memory expansion 3FFFh 4000h
1EFFh 1F00h 1FFFh 2000h
1EFFh 1F00h 1FFFh 2000h
7FFFh
Program memory (ROM/EPROM) 4K bytes or 8K bytes or 12K bytes or 16K bytes 9FFFh A000h
Program memory (ROM/EPROM)
Program memory (ROM/EPROM)
24K bytes or 32K bytes 48K bytes
Memory expansion
DFFFh E000h
FFFFh
FFFFh
FFFFh
Function B All predecoded chip selects have the same timing as the external data strobe (EDS) signal (see Chapter 18, Electrical Specifications). EDS is a function B (microprocessor mode) signal that goes low whenever an access to external memory is made. Figure 3-8 shows a memory map for the microcomputer mode with function B expansion.
CPU and Memory Organization
3-23
Memory Operating Modes
Table 3-6. Microcomputer with Function B Expansion
Internal Program Memory (R=ROM, E=EPROM) 4K bytes R ('x50) 8K bytes R ('x52) 12K bytes R ('x53) 16K bytes R/E ('x56) 24K bytes R/E ('x67) 32K bytes R/E ('x58, 'x68) 48K bytes R/E ('x59, 'x69) Function B: Chip-Select Signal EDS 64/68 Pins 10C0h to 10FFh (64 bytes) 2000h to 3FFFh (8K bytes) 8000h to FFFFh (32K bytes) 10C0h to 10FFh (64 bytes) 2000h to 3FFFh (8K bytes) 8000h to FFFFh (32K bytes) 10C0h to 10FFh (64 bytes) 2000h to 3FFFh (8K bytes) 8000h to FFFFh (32K bytes) 10C0h to 10FFh (64 bytess) 2000h to 3FFFh (8K bytes) 8000h to FFFFh (32K bytes) 10C0h to 10FFh (64 bytes) A000h to FFFFh (24K bytes) 10C0h to 10FFh (64 bytes) A000h to FFFFh (24K bytes) 10C0h to 10FFh (64 bytes) E000h to EFFFh (4K bytes) Maximum External Memory 40K bytes
40K bytes
40K bytes
40K bytes
24K bytes 24K bytes 4K bytes
Table 3-6 shows the memory addresses for the function B chip-select signal. See Section 4.4 on page 4-18 for a description of the digital I/O port control registers and how the chip-select signals are enabled. To place a device in to the microcomputer mode with external expansion (the device must have bus expansion), execute the following steps: 1) Place a low logic level on the MC pin. 2) Pull the RESET pin active low, then return RESET to its inactive high state. 3) Program the digital I/O registers to select the chip-select or control signals needed (function A or function B).
3.4.3
Microprocessor Mode Without Internal Memory (Memory Expansion Devices Only)
When a device is activated in the microprocessor mode, the register file and data EEPROM remain active, but the on-chip program ROM or EPROM is disabled. The EDS signal goes low when a memory access is made to addresses 1020h-102Fh, 10C0h-10FFh, and 2000h-FFFFh. The program area, the re-
3-24
Memory Operating Modes
set vector, interrupt vectors, and trap vectors must be located in off-chip memory locations. When a device is reset into the microprocessor mode, the digital I/O port D registers are set to function B expansion memory control signals. The chip-select signals are not available in function B. Ports B and C are set up as the external address bus, and port A is set up to be the external data bus. Software cannot change the digital I/O configuration. Figure 3-9 shows a memory map for the microprocessor mode without internal memory.
Figure 3-9. Microprocessor Mode Without Internal Memory
Microprocessor chip-select signals Address 0000h Register file/stack
EDS
On-chip
00FFh 0100h RAM expansion Off-chip Peripheral expansion 0FFFh 1000h Peripheral file 101Fh 1020h 102Fh 1030h 10BFh 10C0h 10FFh 1100h
Peripheral expansion
1EFFh 1F00h 1FFFh 2000h
Data EEPROM expansion Data EEPROM
Memory expansion
FFFFh
CPU and Memory Organization
3-25
Memory Operating Modes
To place a device in the microprocessor mode without internal memory, do the following: 1) Place a high logic level on the MC pin. 2) Pull the RESET pin to active low, then return RESET to its inactive high state.
3.4.4
Microprocessor Mode With Internal Program Memory (Memory Expansion Devices Only)
Once the device is in microprocessor mode, the internal program memory can be re-enabled by clearing the MEMORY DISABLE bit (SCCR1.2). This mode is exactly the same as the microprocessor mode without internal memory except that when the internal memory is enabled, the EDS signal is no longer active during memory accesses to addresses 1020h-102Fh, and addresses that internal memory occupies. For example, when the MEMORY DISABLE bit (SCCR1.2) is cleared, memory accesses to addresses 1020h-102Fh and 5000h-7FFFh (x53 device) addresses access internal program memory; while EDS maintains the ability to access external memory locations 2000h-4FFFh and 8000h-FFFFh. This is shown in Table 3-7 and in Figure 3-10 (page 3-28), together with other TMS370 memory expansion devices. The actual amount of program memory available depends on the device. In this mode, accesses to memory addresses 1020h through 102Fh are not valid for external memory or for the internal port control registers. This peripheral frame should not be used in this mode. To use this mode, external memory must be implemented at memory addresses 7FFEh and 7FFFh to contain the reset vector. This memory can be switched in and out with the internal memory by clearing and setting the memory disable bit. Figure 3-10 (page 3-28) shows a memory map for the microprocessor mode with internal program memory.
3-26
Memory Operating Modes
Table 3-7. Microprocessor Mode with Internal Program Memory
Internal Memory Disabled (SCCR1.2=1) Device TMS370Cx50 Active Internal Memory -- Active External Memory 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh 10C0h - 10FFh 2000h - FFFFh Internal Memory Enabled (SCCR1.2=0) Active Internal Memory 1020h - 102Fh 7000h - 7FFFh 1020h - 102Fh 6000h - 7FFFh 1020h - 102Fh 5000h - 7FFFh 1020h - 102Fh 4000h - 7FFFh 1020h - 102Fh 2000h - 7FFFh 1020h - 102Fh 2000h - 9FFFh 1020h - 102Fh 2000h - DFFFh Active External Memory 10C0h - 10FFh 2000h - 6FFFh 8000h - FFFFh 10C0h - 10FFh 2000h - 5FFFh 8000h - FFFFh 10C0h - 10FFh 2000h - 4FFFh 8000h - FFFFh 10C0h - 10FFh 2000h - 3FFFh 8000h - FFFFh 10C0h - 10FFh 2000h - 1FFFh 8000h - FFFFh 10C0h - 10FFh 2000h - 1FFFh A000h - FFFFh 10C0h - 10FFh 2000h - 1FFFh E000h - FFFFh
TMS370Cx52
--
TMS370Cx53
--
TMS370Cx56
--
TMS370Cx67
--
TMS370Cx58, TMS370Cx68 TMS370Cx59, TMS370Cx69
--
--
To place a device in the microprocessor mode with internal program memory, use the following steps: 1) Place a high logic level on the MC pin. 2) Take the RESET pin active low, then return RESET to its inactive high state. 3) The CPU reads the reset vectors from external memory (7FFEh/7FFFh). The program pointed to by the vectors must include code to clear the MEMORY DISABLE bit (SCCR1.2) to enable the internal memory. The internal program memory becomes available. (The SCCR1 register is described in subsection 4.3.2 on page 4-15).
CPU and Memory Organization
3-27
Memory Operating Modes
Figure 3-10. Microprocessor Mode With Internal Program Memory
Chip select signals 'x50 On-chip 0000h Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 2000h 'x52 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 'x53 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 'x56 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 'x67 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 'x58 & 'x68 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM 'x59 & 'x69 On-chip Register file/stack RAM expansion Peripheral file Data EEPROM expansion Data EEPROM Address 0000h 0100h
EDS Off-chip
1000h 10C0h 1100h 1F00h 2000h
4000h 5000h ROM/ EPROM 16K bytes ROM/ EPROM 24K bytes ROM/ EPROM 32K bytes
4000h 5000h ROM/ EPROM 48K bytes 6000h 7000h 8000h A000h
SCCR1.2
set to 0 ROM 4K bytes 8000h ROM 8K bytes
ROM 12K bytes
E000h FFFFh x59 & x69 x58 & x68 x67 x56 x53 x52 x50 FFFFh
After the P is reset, the CPU reads the reset vectors from external memory (7FFEh/7FFFh) until the MEMORY DISABLE bit (SCCR1.2) is cleared by software, then the internal memory is enabled.
3.4.5
Memory Mode Summary
Table 3-8 summarizes the features of each memory mode and outlines the procedure for putting the TMS370 device into each mode.
3-28
Memory Operating Modes
Table 3-8. Operating Mode Summary
Computer
Feature Devices Single-Chip Mode All TMS370s with internal program memory Internal Digital I/O Computer With Expanded Memory Mode Devices with memory expansion and internal program memory Internal Digital I/O Function A Function B Optional 1) Place logic 0 on the MC pin. 2) Set the RESET pin to active low, then release RESET. 3) Set digital I/O registers to function A/B. Processor with Internal Memory Mode Devices with memory expansion and internal program memory Internal and external Function B
Processor Mode Devices with memory expansion External Function B
Program Memory Ports A, B,C,D
Predecoded CS (chip selects) Procedure to enter the mode
No 1) Place logic 0 on the MC pin. 2) Set the RESET pin to active low, then release RESET.
No 1) Place logic 1 on the MC pin. 2) Take the RESET pin active low, then release RESET. 3) Enable internal memory (clear SCCR1.2).
No 1) Place logic 1 on the MC pin. 2) Take the RESET pin active low, then release RESET.
Function A: Port D= Chip-select signals for 68-pin CSE1, CSE2, CSH1, CSH2, CSH3, and CSPF (see Section 4.4, pp. 4-18). = Chip-select signals for 64 pin CSE1, CSE2, CSH1, and CSH3 (see Section 4.4). Function B: Port D = Expansion memory control signals OCF, EDS, and WAIT (see Section 4.4).
CPU and Memory Organization
3-29
3-30
Running Title--Attribute Reference
Chapter 4
System and Digital I/O Configuration
This chapter discusses the system and I/O configuration. Features and options are described, as well as the registers that control the configuration. Examples of how to set specific configurations are also given. This chapter covers the following topics:
Topic
4.1 4.2 4.3 4.4
Page
System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Low-Power and Idle Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 System Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13 Digital I/O Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
Chapter Title--Attribute Reference
4-1
System Configuration
4.1 System Configuration
The system configuration is controlled and monitored by the first three registers of peripheral file frame 1. These registers' names, designations, addresses, and peripheral file (PF) register numbers are shown below and in Figure 4-1. The PF numbers are used by peripheral file instructions; for example, MOV #00h,P010 clears PF P010 at address 1010h. Name System control and configuration register 0 System control and configuration register 1 System control and configuration register 2 Designation Address PF SCCR0 SCCR1 SCCR2 1010h 1011h 1012h P010 P011 P012
Figure 4-1. Peripheral File Frame 1: System Configuration and Control Registers
Bit Names/Functions Register Name
SCCR0
Addr
1010h
PF
P010
Bit 7
COLD START (RW-*)
Bit 6
OSC POWER (RP-0)
Bit 5
PF AUTOWAIT (RP-0)
Bit 4
OSC FLT FLAG (RW-0) AUTOWAIT DISABLE (RP-0) BUS STEST (RP-0)
Bit 3
MC PIN WPO (R-0)
Bit 2
MC PINDATA (R-*) MEMORY DISABLE (RP-*)
Bit 1
--
Bit 0
P/C MODE (R-*)
SCCR1
1011h
P011
-- HALT/ STANDBY (RP-0)
-- PWRDWN/ IDLE (RP-0)
--
--
--
-- PRIVILEGE DISABLE (RS-0)
SCCR2
1012h
P012
--
CPU STEST (RP-1)
--
INT1 NMI (RP-0)
Note:
Shaded boxes denote privileged mode bits that can be written to only in the privileged mode.
4.1.1
Privilege Mode
The TMS370 architecture allows you to configure the system and peripherals by software to meet the requirements of a variety of applications. The privilege mode of operation ensures the integrity of the system configuration, once it is defined for an application. The shaded boxes in Figure 4-1 denote privilege mode bits; that is, you can write to these bits only in the privilege mode. Following a hardware reset, the processor operates in the privilege mode. In this mode, peripheral file registers have unrestricted read/write access. The application program can configure the system during the initialization sequence following a reset. As the last step of a system initialization, set the PRIVILEGE DISABLE bit (SCCR2.0) to enter the nonprivilege mode and prevent changes to specific control bits within the peripheral file.
4-2
System Configuration
Table 4-1 shows the system configuration bits that are write-protected during the nonprivilege mode. These bits should be configured by software before exiting the privilege mode.
Table 4-1. Privilege-Mode Configuration Bits
Register SCCR0 SCCR1 SCCR2 Bit PF AUTOWAIT OSC POWER MEMORY DISABLE AUTOWAIT DISABLE PRIVILEGE DISABLE INT NMI CPU STEST BUS STEST PWRDWN/IDLE HALT/STANDBY SPI STEST SPI PRIORITY SPI ESPEN SCI STEST SCITX PRIORITY SCIRX PRIORITY SCI ESPEN T1 STEST T1 PRIORITY T2A STEST T2A PRIORITY T2B STEST T2B PRIORITY AD STEST AD PRIORITY AD ESPEN PACT WD PRESCALE SELECT 0 PACT WD PRESCALE SELECT 1 PACT MODE SELECT PACT GROUP 3 PRIORITY PACT GROUP 2 PRIORITY PACT GROUP 1 PRIORITY PACT STEST PACT PRESCALE SELECT 0 PACT PRESCALE SELECT 1 PACT PRESCALE SELECT 2 PACT PRESCALE SELECT 3 FAST MODE SELECT Bit Name Peripheral File Automatic Wait Cycle y Oscillator Power Memory Disable Automatic Wait-State Disable Privilege Mode Disable Interrupt 1, Nonmaskable Interrupt CPU Factory Test BUS Factory Test Powerdown/Idle Halt/Standby SPI Factory Test SPI Interrupt Priority Select SPI emulator suspend enable SCI Factory Test SCI Transmitter Interrupt Priority Select SCI Receiver Interrupt Priority Select SCI emulator suspend enable Timer 1 Factory Test Timer 1 Interrupt Priority Select Timer 2A Factory Test Timer 2A Interrupt Priority Select Timer 2B Factory Test Timer 2B Interrupt Priority Select AD Factory Test AD Interrupt Priority Select AD emulator suspend enable PACT Watchdog Prescale Select 0 PACT Watchdog Prescale Select 1 PACT Mode Select PACT Group 3 Priority Select PACT Group 2 Priority Select PACT Group 1 Priority Select PACT Stest PACT Prescale Select 0 PACT Prescale Select 1 PACT Prescale Select 2 PACT Prescale Select 3 Fast Mode Select
SPIPRI
SCIPRI
T1PRI T2APRI T2BPRI ADPRI
PACTPRI
PACTSCR
The only way to change the privilege bits after leaving the privilege mode is to reset the processor and program the control registers. The write protection override (WPO) used for the EEPROM has no effect on the privilege bits. Note that privilege mode has no effect on timer 1 (T1) watchdog (WD) bits. These bits are protected in a separate manner.
System and Digital I/O Configuration
4-3
System Configuration
4.1.2
Clock Options
The TMS370 family provides two clock options which are referred to as divideby-1 (phase-locked loop) and divide-by-4 (standard oscillator). Both, the divide-by-1 and divide-by-4 options are configurable during the manufacturing process of a TMS370 microcontroller. The ROM-masked devices offer both options to meet system engineering requirements. Only one of the two clock options is allowed on each ROM device. The divide-by-1 clock module option provides the capability for reduced electromagnetic interference (EMI) with no added cost. The divide-by-1 option provides a one-to-one match of the external resonator frequency (CLKIN) to the internal system clock (SYSCLK) frequency, whereas the divide-by-4 option produces a SYSCLK which is one-fourth the frequency of the external resonator. Inside the divide-by-1 module, the frequency of the external resonator is multiplied by four, and the clock module then divides the resulting signal by four to provide the four internal system clock signals. The resulting SYSCLK is equal to the resonator frequency. These are formulated as follows:
Divide-by-4 option: Divide-by-1 option: SYSCLK = SYSCLK = external resonator frequency 4 = CLKIN 4
external resonator frequency x 4 = CLKIN 4
The main advantage of choosing a divide-by-1 oscillator is the improved EMI performance. The harmonics of low-speed resonators extend through less of the emissions spectrum than the harmonics of faster resonators. The divideby-1 option also reduces the resonator speed by 4x, resulting in a steeper decay of emissions produced by the oscillator.
4.1.3
Oscillator Fault
The processor contains a system of circuits to monitor the oscillator operation and to detect and contain major oscillator problems. This enhances processor and system reliability and aids in system recovery from a crash that is caused by a temporary fault. The circuit stops the processor whenever circuitry detects an out-of-range oscillator operation. The oscillator fault detection circuitry consists of:
4-4
An amplitude detector to detect whether the oscillator signal has a proper voltage level. A frequency detector to sense when the oscillator frequency goes too low. The oscillator fault detection circuit will always trigger below 20 kHz and never above 500 kHz.
System Configuration
The oscillator circuitry is designed to delay operation of the device until a stable clock signal is received. This protects against slow crystal startup times coming out of a halt mode or after an oscillator fault when the input clock cannot be operating at the correct voltage range. Device operation remains suspended until the input clock signal is within the required voltage range. Whenever the oscillator fault detection circuitry detects a major oscillator problem, the processor generates a reset by pulling the RESET pin low for at least eight cycles; this causes external devices to reset with the processor. After a reset, the program checks the oscillator fault flag (OSC FLT FLAG, SCCR0.4), the cold start flag (COLD START, SCCR0.7), and the watchdog reset key (WDRST) to determine the source of the reset. A reset does not clear these flags.
4.1.4
Automatic Wait States
If an application system uses peripherals or expansion memory with access times slower than those of the TMS370 processor, wait states are required. Other microprocessors require complex additional circuitry, but the TMS370 series provides for the automatic addition of wait states that can slow the processor's access time to a compatible period. The TMS370 series has a WAIT pin that can hold the processor in a wait state indefinitely. The following two bits control the insertion of the automatic wait state:
-
The PF AUTOWAIT bit (SCCR0.5) that controls the external frames of the peripheral file so that these frames can access off-chip peripherals. The AUTOWAIT DISABLE bit (SCCR1.4) that controls all other external memory.
When the AUTOWAIT DISABLE bit equals 1, any access to external memory (excluding the PF file) takes two system clock cycles to complete. When AUTOWAIT DISABLE bit equals 0, the access takes three system clock (SYSCLK) cycles. The reset value of this bit selects the slower 3-cycle access.
When the PF AUTOWAIT bit equals 1, memory access to the external peripheral files takes four SYSCLK cycles. This bit does not affect the accesses to the internal registers. When the PF AUTOWAIT bit equals 0, the memory is treated like any external memory, and the AUTOWAIT DISABLE bit selects the number of SYSCLK cycles per access as either two or three cycles. Table 4-2 summarizes the effects of the wait-state control bits.
System and Digital I/O Configuration
4-5
System Configuration
Table 4-2. Wait-State Control Bits
Wait State Control Bits PF AUTOWAIT Bit (SCCR0.5) 0 0 1 1 AUTOWAIT DISABLE Bit (SCCR1.4) 0 1 0 1 No. of Clock Cycles per Access
PF File 3 2 4 4
External Memory 3 2 3 2
An external device can pull the WAIT input pin low and cause the processor to wait an indefinite number of clock cycles for its data. When the wait line is released, the processor resynchronizes with the rising edge of the SYSCLK signal and continues with the program. The WAIT pin is sampled only during external memory cycles. Note: Tie Un-needed WAIT Line to VCC
When constructing an application circuit with expansion memory, do not forget to connect any unneeded WAIT line to VCC.
4-6
Low-Power and Idle Modes
4.2 Low-Power and Idle Modes
The OTP, mask-ROM, and reprogrammable EPROM devices have two lowpower (powerdown) modes and an idle mode. For mask-ROM devices, lowpower modes can be disabled permanently through a programmable contact at the time when the mask is manufactured (refer to Chapter 19, Customer Information, for order information about mask-ROM devices). Note: Low-Power Mode Difference
Low-power modes operate differently for TMS370Cxxx, TMS370CxxxA, and TMS370CxxxB devices. Refer to Section A.3, page A-4. The low-power modes reduce the operating power by reducing or stopping the activity of various modules. The processor has the following two types of lowpower modes: the halt mode and the standby mode (see Table 4-3). Bits 6 and 7 of register SCCR2 select the halt, standby, or idle modes.
-
The standby mode stops the internal clock in every module except the T1 module. The T1 module continues to run and can bring the processor out of the standby mode. In devices with the PACT module, only the default timer and the first command are active in standby mode. The halt mode stops the internal clock. This stops processing in all of the modules, resulting in the lowest amount of power consumption. The idle mode (which is not a low-power mode) is a state that waits for the next interrupt.
Executing an IDLE instruction causes the processor to enter one of the two low-power modes or the simple idle mode, depending on SCCR2.6 and SCCR2.7. The low-power and idle-mode selection bits are summarized in Table 4-3.
Table 4-3. Powerdown/Idle Control Bits
Powerdown Control Bits PWRDWN/IDLE (SCCR2.6) 1 1 0 HALT/STANDBY (SCCR2.7) 0 1 Don't care Mode Selected Standby Halt Idle
When low-power modes are disabled through a programmable contact in the mask-ROM devices, writing to the SCCR2.6-7 bits is ignored. In addition, if you execute an IDLE instruction when low-power modes are disabled through a programmable contact, the device always enters the idle mode.
System and Digital I/O Configuration
4-7
Low-Power and Idle Modes
To provide a method of exiting low-power modes for mask-ROM devices, INT1 is automatically enabled as a nonmaskable interrupt (NMI) during low-power modes when the hard WD mode is selected. This means that the NMI is always generated, regardless of the status of the interrupt enable flags and the values of the status bits (INT1 PRIORITY bit [INT1.1], INT1 ENABLE bit [INT1.0], INT1 NMI bit [SCCR2.1]), and global interrupt enable flags of the status register (IE1 and IE2). See subsection 7.7.2.1, page 7-26, for more information. The low-power modes and the methods of exiting these modes are discussed further in subsections 4.2.1 and 4.2.2 on page 4-9. In the standby and halt modes, the digital output ports remain active. In addition, the following information is retained:
-
The CPU registers: Program counter (PC) Status (ST) Stack pointer (SP)
J J J
The contents of the RAM The digital output data registers Control and status registers of all the modules, including the timer contents and the WD counter
If the serial peripheral interface (SPI) or serial communications interface (SCI--SCI1 or SCI2) is in the process of receiving or transmitting data when a low-power mode is entered, the data received or transmitted can be lost. The results of an analog-to-digital (AD) conversion (ADC1, ADC2, or ADC3) or an EEPROM write process is invalid when a low-power mode is entered. Use caution when using low-power modes in conjunction with the WD mode; the WD stops counting in both low-power modes. In the standard WD option, if the program executes an IDLE instruction without the interrupts enabled (described in subsections 4.2.1 and 4.2.2, page 4-9), then only a reset can start the processor running again. For additional information regarding WD operation during low-power modes, see subsection 7.7.2.1 (page 7-26) and Section 7.8 (page 7-29).
4.2.1
Standby Mode
The standby mode uses less power than the normal operating mode but more than the halt mode. The standby mode stops the clocks to every module except the T1 module or the PACT module. These modules can bring the processor out of this low-power mode if the interrupts are enabled. To enter the standby mode, use the following steps:
4-8
Low-Power and Idle Modes
-
Set the PWRDWN/IDLE bit (SCCR2.6) Clear the HALT/STANDBY bit (SCCR2.7). The next execution of an IDLE instruction causes the processor to enter the standby mode.
You can cause the processor to exit the standby mode by any one of the following methods: A reset An external interrupt 1, 2, or 3 (if enabled) A low level on the SCIRXD pin if the SCI RX interrupt and receiver are enabled (described in Chapter 9, Serial Communications Interface 1 (SCI1) Module -- subsections 9.8.2 (page 9-24) and 9.8.5 (page 9-29), and Chapter 10, Serial Communications Interface 2 (SCI2) Module -- subsections 10.8.2 (page 10-20) and 10.8.5 (page 10-24)).
Note: When using the SCIRXD pin as a method of exiting the standby mode, the first character received will wake-up the device; therefore, the first character will be misinterrupted and not be treated as valid data. Subsequent data transmissions are valid.
-
A T1 or PACT's first command/definition entry interrupt, if enabled
For additional standby mode power savings, see subsection 4.2.3 on page 4-10.
4.2.2
Halt Mode
The halt mode stops all internal operations and clocks (including T1 and the PACT counter) and uses the least power of the low-power modes. T1 cannot bring the processor out of this low-power mode. To select the halt mode, use the following steps:
-
Set the PWRDWN/IDLE bit (SCCR2.6) Set HALT/STANDBY bit (SCCR2.7) Execute an IDLE instruction.
Note: The OSC power bit (SCCR0.6) must be cleared before entering the HALT mode in order to exit the HALT mode properly.
System and Digital I/O Configuration
4-9
Low-Power and Idle Modes
You can cause the processor to exit the halt mode by any one of the following methods:
-
A reset An external Interrupt 1, 2, or 3 if enabled A low level on the SCIRXD pin if the SCI RX interrupt and receiver are enabled (described in Chapter 9, Serial Communications Interface 1 (SCI1) Module, and Chapter 10, Serial Communications Interface 2 (SCI2) Module.
Note: When using the SCIRXD pin as a method of exiting the halt mode, the first character received will wake-up the device; therefore, the first character will be misinterrupted and not be treated as valid data. Subsequent data transmissions are valid.
4.2.3
Using Interrupts to Exit From the Halt Mode
You must be aware of the following items when using an interrupt to exit the halt mode:
-
Interrupts enabled during the halt mode are level-sensitive and not edgesensitive. The interrupt must be at the inactive level when the device enters the halt mode. The processor exits the halt mode when the interrupt goes from the inactive level to the active level. Bit 2 in the interrupt control register determines the active and inactive levels.
J J
When the INT2 POLARITY bit (INT2.2) is selected to be triggered on the rising edge, the active level is high. When the INT2 POLARITY bit is selected to be triggered on the falling edge, the active level is low.
-
The interrupt should be at an active level until the oscillator is stable enough to generate an interrupt.
4-10
Low-Power and Idle Modes
-
If the halt mode is entered with the interrupt at an active level, the following actions occur:
J J
For devices with a divide-by-4 clock, the processor exits the halt mode and enters the idle mode. For devices with a PLL clock, an oscillator fault flag (SCCR0.4) is set causing a system reset to occur.
-
When the selected interrupt edge is detected, the program continues.
Refer to Figure 4-2 and Figure 4-3 for the differences between the correct and incorrect methods for entering the halt mode.
Figure 4-2. Correct Method to Enter Halt Mode
Exits halt mode INTx pin (Polarity = 0 active low)
Execute IDLE instruction
SYSCLK
Figure 4-3. Improper Method to Enter Halt Mode
Exits idle mode INTx pin (Polarity = 0 active low)
Execute IDLE instruction Enters idle mode instead of halt mode
SYSCLK
System and Digital I/O Configuration
4-11
Low-Power and Idle Modes
If this halt-mode condition exists and the device uses the WD, then the WD can reset while the program is waiting and unable to service the WD in the normal power idle mode. The same considerations apply when you use the SCIRXD pin to exit the halt mode. The processor exits halt mode anytime an enabled SCI receiver and pin detect a low level on SCIRXD.
4.2.4
Oscillator Power Bit
The OSC POWER bit (SCCR0.6) allows additional standby mode power savings. When in effect, this feature reduces the oscillator drive current and disables the oscillator fault detection circuitry. The OSC POWER bit can be used effectively with a frequency of up to 3-MHz SYSCLK. If the SYSCLK frequency is greater than 3 MHz, this bit must be cleared. For power reduction specifications, see Chapter 18, Electrical Specifications.
4-12
System Control Registers
4.3 System Control Registers
Each system control register is summarized in the following charts with definitions of each control bit.
4.3.1
System Control and Configuration Register 0 (SCCR0)
System Control and Configuration Register 0 (SCCR0) [Memory Address 1010h]
Bit #
P010
7
COLD START RW-*
6
OSC POWER RP-0
5
PF AUTOWAIT RP-0
4
OSC FLT FLAG RW-0
3
MC PIN WPO R-0
2
MC PIN DATA R-*
1
--
0
P/C MODE R-*
R = Read, W = Write, P= Privilege write only, C = Clear only, -n = Value of the bit after the register is reset, -* = See bit description Bit 7 COLD START. Cold Start Flag. This bit indicates whether the microcontroller is coming out of a powerup reset. This bit does not change during a reset under normal power. 0 = No full-power cycle occurred since last writing a 0 to this bit. This setting is used to determine the source of a reset. 1 = A full-power cycle has occurred since last writing a 0 to this bit. If the application does not zero this bit, the bit has no meaning. Only writing a 0 to this bit can clear the COLD START flag. This bit is set to 1 only after the VCC is off for several hundred milliseconds. As a result, you cannot use this bit to detect short VCC glitches or brownout conditions. Note: COLD START Bit Considerations The COLD START bit is not designed to detect short VCC glitches or brownout conditions. Bit 6 OSC POWER. Oscillator Power. This bit controls an oscillator power reduction feature. When this feature is in effect, the oscillator drive current is reduced, and the oscillator fault detection circuitry is powered down. Current reduction is most useful in the standby mode. However, when this bit is set during normal operation, the operating mode power consumption can be slightly reduced. Before entering the HALT mode, the OSC POWER bit (SCCR0.6) must be cleared in order to exit the HALT mode properly. This feature is effective up to a 3-MHz maximum SYSCLK frequency. If the SYSCLK frequency is greater than 3 MHz, this bit must be cleared. For power reduction specifications, see Chapter 18, Electrical Specifications.
System and Digital I/O Configuration
4-13
System Control Registers
0 = No oscillator drive current reduction. 1 = Oscillator drive current reduction. Bit 5 PF AUTOWAIT. Peripheral File Automatic Wait Cycle. 0 = Any access to the peripheral file will take two system clock cycles with no system auto wait (bit 4 of SCCR1=1), or three system clock cycles with the system autowait on (bit 4 of SCCR1=0). (See subsection 4.1.4, page 4-5.) 1 = Any access to the upper four frames of the peripheral file (address 10C0h to 10FFh) will take four system clock cycles to complete. This eases interface requirements for peripheral devices slower than the TMS370 processor. Normal full-speed operation consists of two system clock cycles per access. Bit 4 OSC FLT FLAG. Oscillator Fault Flag. This flag is reset upon an initial power-up reset. A reset under power does not affect this flag. Therefore, this bit can be polled to determine the source of a reset. 0 = No oscillator fault found. 1 = Oscillator fault found. Oscillator period is now or was out of the correct operating range. The oscillator fault detect circuit always triggers below 20 KHz and never above 500 kHz. Bit 3 MC PIN WPO. Mode Control Pin Write Protect Override Status. This bit indicates whether the voltage on the MC pin is adequate for WPO functions. (If this bit is set, then bit 2 is also set.) 0 = Voltage on the MC pin is not enough to override write protection. 1 = Voltage on the MC pin is enough for write-protect override. Protected bits in data EEPROM and program EPROM can now be written to. Override voltage is nominally 12 volts. Bit 2 MC PIN DATA. Mode Control Pin Data. This bit shows the current status of the MC pin. 0 = Voltage on the MC pin is a logic 0 level. 1 = Voltage on the MC pin is a logic 1 level. Bit 1 Bit 0 Reserved. Read data is indeterminate. P/C MODE. Microprocessor/Microcomputer Mode. This bit indicates the current operating mode (as described in subsection 3.4, page 3-16). 0 = Currently operating in microcomputer mode. 1 = Currently operating in microprocessor mode.
4-14
System Control Registers
4.3.2
System Control and Configuration Register 1 (SCCR1)
System Control and Configuration Register 1 (SCCR1) [Memory Address 1011h]
Bit #
P011
7
--
6
--
5
--
4
AUTOWAIT DISABLE RP-0
3
--
2
MEMORY DISABLE RP-*
1
--
0
--
R = Read, P= Privilege write only, -n = Value of the bit after the register is reset, -* = See bit description Bits 7-5 Bit 4 Reserved. Read data is indeterminate. AUTOWAIT DISABLE. Automatic Wait State Disable. This bit is cleared after a reset, and causes an extra cycle to be added to all external bus accesses to accommodate slower memory. 0 = Enables the autowait feature and makes the external bus access three system clock cycles long. 1 = Disables the autowait feature and makes the external bus access two system clock cycles long. Changes to this bit can occur only in the privilege mode. If the PF AUTOWAIT bit in SCCR0 is set, external peripheral file access takes four SYSCLK cycles, regardless of the AUTOWAIT DISABLE bit. Bit 3 Bit 2 Reserved. Read data is indeterminate. MEMORY DISABLE. This bit enables or disables the internal program memory (memory addresses affected are device dependent -- refer to Table 3-6 on page 3-24). This bit does not affect data EEPROM or internal RAM. A reset initializes this bit to the state of the MC pin. Changes to this bit can occur only in the privilege mode. 0 = Enables internal program memory and accesses internal memory locations. The EDS memory signal will not appear during accesses to internal ROM/EPROM programming memory and 1020h-102Fh. These ranges are accessed as on-chip memory. 1 = Disables internal program memory and accesses external memory (see Table 3-6 on page 3-24 for the external memory locations). An operation on these locations generates an external memory bus cycle with the EDS memory signal validating the access. This bit disables the program EPROM control register, EPCTL (described in Section 6.4, on page 6-10), if applicable, and disables 1020h-102Fh. These ranges are accessed as off-chip memory. Bits 1-0 Reserved. Read data is indeterminate.
System and Digital I/O Configuration
4-15
System Control Registers
4.3.3
System Control and Configuration Register 2 (SCCR2)
System Control and Configuration Register 2 (SCCR2) [Memory Address 1012h]
Bit #
P012
7
HALT/ STANDBY RP-0
6
PWRDWN/ IDLE RP-0
5
--
4
BUS STEST RP-0
3
CPU STEST RP-1
2
--
1
INT1 NMI RP-0
0
PRIVILEGE DISABLE RS-0
R = Read, P= Privilege write only, S = Set only, -n = Value of the bit after the register is reset Bit 7 HALT/STANDBY. The following descriptions apply only if the PWRDWN/IDLE bit is set; otherwise, the HALT/STANDBY bit has no effect. See subsection 4.2, on page 4-7 for a description of the halt and standby modes. Changes to this bit can occur only in the privilege mode. 0 = When an IDLE instruction executes, the processor enters the standby mode, which stops the program's execution and disables the SYSCLK to all nonessential peripherals. The SYSCLK to the T1 continues to run, and the timer generates an interrupt to bring the processor out of the standby mode. 1 = When an IDLE instruction executes, the processor enters the halt mode, which stops the internal oscillator and suspends the system and peripheral operations. This mode provides the lowest power consumption. Bit 6 PWRDWN/IDLE. Powerdown/Idle. This bit determines the mode entered by the CPU when an IDLE instruction is executed. Changes to this bit can occur only in the privilege mode. 0 = The processor enters an idle mode when the program executes an IDLE instruction. The processor waits at the IDLE instruction until any enabled interrupt occurs. The processor then enters the interrupt routine and returns to the instruction after the IDLE instruction. The idle is not a lowpower mode. 1 = The processor enters a low-power mode when the program executes an IDLE instruction. The HALT/STANDBY bit determines the type of lowpower mode. Bit 5 Reserved. For TMS370CxxxA or 'CxxxB devices, read data is indeterminate and writing to this bit has no effect, and an oscillator fault generates a system reset, regardless of this bit's status. Note: Bit 5 Operation Depends on Device
Bit 5 operates differently for TMS370Cxxx devices than for TMS370CxxxA or TMS370CxxxB devices. Refer to Section A.5, page A-5.
4-16
System Control Registers
Bit 4
BUS STEST. BUS STEST bit. This bit must be cleared (0) to ensure a proper operation.
Bit 3
CPU STEST. CPU STEST bit. This bit is used only during a factory test and has no effect in normal operating modes.
Bit 2
Reserved. For TMS370CxxxA or 'CxxxB devices, read data is indeterminate and writing to this bit has no effect. Note: Bit 2 Operation Depends on Device
Bit 2 operates differently for TMS370Cxxx devices than for TMS370CxxxA or TMS370CxxxB devices. Refer to Section A.5, page A-5. Bit 1 INT1 NMI. Interrupt 1, Nonmaskable Interrupt. This bit determines whether interrupt 1 is maskable or nonmaskable. When interrupt 1 is nonmaskable, it is the second highest priority interrupt (reset is highest) and is unaffected by the interrupt mask described in subsection 5.1.2, on page 5-8. The NMI mode disables the enable and priority select bits of the interrupt 1 control register. The program can change this bit only in the privilege mode. When programming an EEPROM, you must ensure that nonmaskable interrupt routines do not access the EEPROM between an EEPROM write instruction and the point when the EXE bit (DEECTL.0) is set to 1, or data will be corrupted. 0 = Interrupt 1 is maskable. 1 = Interrupt 1 is nonmaskable (NMI). Bit 0 PRIVILEGE DISABLE. Privilege Mode Disable. Many bits controlling the system configuration can be changed only while in the privilege mode. After setting the system configuration bits, write a 1 to the PRIVILEGE DISABLE bit to disable the privilege mode and lock out any changes to the privilege protected bits. Only a reset can clear this bit. 0 = System is operating in privilege mode. 1 = System is not operating in privilege mode.
System and Digital I/O Configuration
4-17
Digital I/O Configuration
4.4 Digital I/O Configuration
On TMS370 devices, the power, reset, MC, and crystal pins are dedicated to one function. The remaining pins can be programmed to be general-purpose input and/or output pins, or special function pins. Some of these pins are associated with the functions of the peripheral modules. The pins are briefly described below and are summarized in Table 4-4.
-
On TMS370Cx0x devices, 13 of a possible 22 I/O pins are dedicated to ports A and D. Port A contains eight pins, and port D contains five pins. On TMS370Cx1x devices, 13 of a possible 22 I/O pins are dedicated to ports A and D. Port A contains eight pins, and port D contains five pins. On TMS370Cx2x devices, 22 of a possible 34 I/O pins are dedicated to ports A, B, C, and D. Ports A and B each have eight pins. Port C contains one pin, and port D contains five pins. On TMS370Cx32 devices, 12 of a possible 23 I/O pins are dedicated to ports A and D. Port A contains eight pins. Port D contains four pins. On TMS370Cx36 devices, 13 of a possible 25 I/O pins are dedicated to ports A and D. Port A contains eight pins. Port D contains five pins. On TMS370Cx4x devices:
J J
On 40-pin devices, 16 of a possible 32 I/O pins are dedicated to ports A, B, and D. Port A contains eight pins, port B contains three pins, and port D contains five pins. On 44-pin devices, 16 of a possible 36 I/O pins are dedicated to ports A, B, and D. Port A contains eight pins, port B contains three pins, and port D contains five pins.
-
On TMS370Cx5x devices:
J J
On 68-pin devices, 32 of a possible 55 I/O pins are dedicated to ports A, B, C, and D; each port has eight pins. On 64-pin devices, 30 of a possible 53 I/O pins are dedicated to ports A, B, C, and D; ports A, B, and C each have eight pins, and port D has six.
4-18
On TMS370Cx6x devices, 29 of a possible 55 I/O pins are dedicated to ports A, B, C, and D; ports A, B, and C each have eight pins, and port D has five pins.
Digital I/O Configuration
-
On TMS370Cx7x devices:
J J
On 68-pin devices, 38 of a possible 55 I/O pins are dedicated to ports A, B, C, D, and G. Ports A, B, C, and D each have eight pins, and port D has six pins. On 64-pin devices, 36 of a possible 53 I/O pins are dedicated to ports A, B, C, D, and G. Ports A, B, and C each have eight pins, and ports D and G each have six pins.
-
On TMS370Cx8x devices:
J J
On 44-pin devices, 29 of a possible 35 I/O pins are dedicated to ports A, B, C, and D; ports A, B, and C each have eight pins, and port D has five pins. On 40-pin devices, 27 of a possible 33 I/O pins are dedicated to ports A, B, C, and D; ports A and B each have eight pins, port C has six pins, and port D has five pins.
-
On TMS370Cx9x devices, 13 of a possible 25 I/O pins are dedicated to ports A and D. Port A contains eight pins, and port D contains five pins. On TMS370CxAx devices, 22 of a possible 34 I/O pins are dedicated to ports A, B, C, and D; ports A and B each have eight pins, port C has one pin, and port D has five pins. On TMS370CxBx devices:
J J
On 68-pin devices, 41 of a possible 55 I/O pins are dedicated to ports A, B, C, D, G, and H; ports A, B, C, D, and G each have eight pins, and port H has one pin. On 64-pin devices, 39 of a possible 53 I/O pins are dedicated to ports A, B, C, D, G, and H; ports A, B, C, and G each have eight pins, port D has six pins, and port H has one pin.
-
On TMS370CxCx devices, 12 of a possible 22 I/O pins are dedicated to ports A and D. Port A contains eight pins, and port D contains four pins.
Frames 2 and 3 of the peripheral file (memory addresses 1020h to103Bh) contain the control registers for reading, writing, and configuring ports A, B, C, D, G, and H. These registers are shown in Figure 4-4 on page 4-21.
System and Digital I/O Configuration
4-19
Digital I/O Configuration
Table 4-4. Digital I/O Pins by Device Family
Maximum Digital General Purpose I/O Device Family TMS370Cx0x TMS370Cx1x TMS370Cx2x TMS370Cx32 TMS370Cx36 TMS370Cx4x TMS370Cx5x TMS370Cx6x TMS370Cx7x TMS370Cx8x TMS370Cx9x TMS370CxAx TMS370CxBx TMS370CxCx Bidirectional 21 21 33 14 16 27 46/44 46 46/44 34/32 16 33 46/44 17 Input Only 1 1 1 9 9
9/5
9 9 9 1 9 1 9 5
5 input pins for 40-pin devices; 9 input pins for 44-pin devices 46 bidirectional pins for 68-pin devices; 44 bidirectional pins for 64-pin devices 34 bidirectional pins for 44-pin devices; 32 bidirectional pins for 40-pin devices
4-20
Digital I/O Configuration
Figure 4-4. Peripheral File Frames 2 and 3: Digital Port Control Registers
Designation APORT1 APORT2 ADATA ADIR BPORT1 BPORT2 BDATA BDIR CPORT1 CPORT2 CDATA CDIR DPORT1 DPORT2 DDATA DDIR ADDR 1020h 1021h 1022h 1023h 1024h 1025h 1026h 1027h 1028h 1029h 102Ah 102Bh 102Ch 102Dh 102Eh 102Fh 1030h to 1035h GDATA GDIR 1036h 1037h 1038h 1039h HDATA HDIR 103Ah 103Bh PF P020 P021 P022 P023 P024 P025 P026 P027 P028 P029 P02A P02B P02C P02D P02E P02F P030 to P035 P036 P037 P038 P039 P03A P03B Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved Port A Control Register 2 Port A Data Port A Direction Reserved Port B Control Register 2 Port B Data Port B Direction Reserved Port C Control Register 2 Port C Data Port C Direction Port D Control Register 1 Port D Control Register 2 Port D Data Port D Direction Reserved Port G Data Port G Direction Reserved Reserved Port H Data Port H Direction
Each port has as many as four associated control registers, as follows:
-
Port x control register 1 (xPORT1) -- found only as DPORT1 in port D) Port x control register 2 (xPORT2) -- found in APORT2, BPORT2, CPORT2, and DPORT2 Port x data (xDATA) -- found in ADATA, BDATA, CDATA, DDATA, GDATA, and HDATA Port x direction (xDIR) -- found in ADIR, BDIR, CDIR, DDIR, GDIR, and HDIR
System and Digital I/O Configuration
4-21
Digital I/O Configuration
The same bit position of each of these registers affects the corresponding bit in the port. For example, bit 0 of registers DPORT1, DPORT2, DDATA, and DDIR control port D, bit 0, as illustrated in Figure 4-5.
Figure 4-5. Typical Control-Register Operation Using Port D
D7 Port D D6 D5 D4 D3 D2 D1 D0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Port D Control Register 1 (DPORT1) Port D Control Register 2 (DPORT2) Port D Data (DDATA) Port D Direction (DDIR)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
DPORT1 and DPORT2 values (00, 01, or 11) set mode (as specified in Table 4-5)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Data bits received or to be sent Direction of general purpose I/O bits
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Bits from the DPORT1 and xPORT2 registers determine the function of the corresponding port pin to be an I/O, data, address, or control signal, depending on the port. The same bit from the xDIR register determines the direction (input or output) if the pin has been defined as an I/O pin. The same bit from the xDATA register is the bit to write to or read from if the pin has been defined as an I/O pin. Table 4-5 shows the function that each pin can serve, depending on which port contains the pin. Memory expansion signals for function A and function B are defined in Table 4-6 on page 4-24.
4-22
Digital I/O Configuration
Table 4-5. Port Configuration Registers Setup
When RESET Goes High MC Pin Low General-Purpose I/O DPORT1 =0 xPORT2 = 0 xDATA = Data In xDIR = 0 = Input Port A B C D D D D D D D D G H Pin 0-7 0-7 0-7 0 1 2 3 4 5 6 7 0-7 0 Data In Modek Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y Data In = y DPORT1 = 0 xPORT2 = 0 xDATA = Data Out xDIR = 1 = Output Data Out Modeh Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Data Out = q Microcomputer Mode DPORT1 = 0 xPORT2 = 1 xDATA (not used) xDIR (not used) Function A DATA BUS LOW ADDR HI ADDR CSE2 CSH3 CSH2 SYSCLK R/W CSPF CSH1 CSE1 DPORT1 = 1 xPORT2 = 1 xDATA (not used) xDIR (not used) Function B DATA BUS LOW ADDR HI ADDR OCF SYSCLK R/W EDS WAIT MC Pin High
Microprocessor Mode DATA BUS LOW ADDR HI ADDR OCF SYSCLK R/W EDS WAIT
Registers DPORT1 and xPORT2 determine whether the port is configured as I/O, data bus, address bus, or control signal. If DPORT1 = 1 and xPORT2 = 0, the function is not valid. The variable x represents port A, B, C, D, G, and H. DPORT1 exists for port D only. These pins can be configured only as general-purpose I/O. Pins D1, D2, D5, G0 - G7, and H0 are not available in microprocessor mode. # Ports vary for each device. See the applicable device pin descriptions in Chapter 2 for ports available on each device. Function A and B signals are defined in Table 4-6 on page 4-24. k y is the value read from the xDATA register. h q is the value written to the xDATA register.
System and Digital I/O Configuration
4-23
Digital I/O Configuration
Table 4-6. Function A and B Signal Definitions
Signal
CSE1
Definition
Chip-select eighth 1. This signal selects a bank of external memory. It has the same timing as EDS. Setting this pin to a high-level general-purpose output disables the external memory bank connected to CSE1. Table 4-7 lists CSE1 external memory accesses for the entire line of TMS370 devices. Chip-select eighth 2. This signal selects a bank of external memory. It has the same timing as EDS. Setting this pin to a high-level general-purpose output disables the external memory bank connected to CSE2. Table 4-7 lists CSE2 external memory accesses for the entire line of TMS370 devices. Chip-select peripheral file. This signal has the same timing as EDS, but it goes active only during an access to the external frames of the peripheral file (locations 10C0h-10FFh). Chip-select half 1. This signal selects a bank of external memory. It has the same timing as EDS. Setting this pin to a high-level general-purpose output disables the external memory bank connected to CSH1. Table 4-7 lists CSH1 external memory accesses for the entire line of TMS370 devices. Chip-select half 2. This signal selects a bank of external memory. It has the same timing as EDS. Setting this pin to a high-level general-purpose output disables the external memory bank connected to CSH2. Table 4-7 lists CSH2 external memory accesses for the entire line of 68-pin TMS370 devices. Chip-select half 3. This signal selects a bank of external memory. It has the same timing as EDS. Setting this pin to a high-level general-purpose output disables the external memory bank connected to CSH3. Table 4-7 lists CSH3 external memory accesses for the entire line of TMS370 devices. System clock. This signal synchronizes external peripherals. It outputs the SYSCLK signal. External data bus. Input and output. External data strobe. This signal goes low during external memory operations. The rising edge of EDS validates the read input data; the write data is available after the falling edge of EDS. Table 4-8 lists EDS external memory accesses for the entire line of TMS370 devices. External memory address bus. Output only.
CSE2
CSPF
CSH1
CSH2
CSH3
SYSCLK DATA BUS EDS
LOW ADDR/ HI ADDR R/W
Read or write operation. Goes high at the beginning of read operations and low during write operations. This line is active during both internal and external accesses.
4-24
Digital I/O Configuration
Table 4-6. Function A and B Signal Definitions (Continued)
Signal OCF Definition Opcode fetch. Goes low at the beginning of a memory read operation that fetches the first byte of an instruction. It then resumes its high level at the end of the opcode fetch(es). Wait input. An external, low signal applied to this pin, when sampled, causes the processor to hold the information on the expansion bus for one or more extra clockout cycles. This pin is sampled during the rising edge of SYSCLK after EDS goes active.
WAIT
Table 4-7. TMS370 Family and Internal Program Memory (64- and 68-pin packages)
Microcomputer-Mode Function-A Chip-Select Signals (64- and 68-pin devices) Signal CSE1 CSE2 CSH1 CSH2 CSH3 'x50 (4K) 2000h- 3FFFh 2000h- 3FFFh 8000h- FFFFh 8000h- FFFFh 8000h- FFFFh 'x52 (8K) 2000h- 3FFFh 2000h- 3FFFh 8000h- FFFFh 8000h- FFFFh 8000h- FFFFh 'x53 (12K) 2000h- 3FFFh 2000h- 3FFFh 8000h- FFFFh 8000h- FFFFh 8000h- FFFFh 'x56 (16K) 2000h- 3FFFh 2000h- 3FFFh 8000h- FFFFh 8000h- FFFFh 8000h- FFFFh 'x67 (24K) A000h- BFFFh A000h- BFFFh C000h- FFFFh C000h- FFFFh C000h- FFFFh 'x58/'x68 (32K) A000h- BFFFh A000h- BFFFh C000h- FFFFh C000h- FFFFh C000h- FFFFh 'x59/'x69 (48K) E000h- EFFFh E000h- EFFFh F000h- FFFFh F000h- FFFFh F000h- FFFFh
The TMS370C150, TMS370C156, TMS370C250, and TMS370C256 devices are ROMless. These devices cannot operate in microcomputer mode function A.
System and Digital I/O Configuration
4-25
Digital I/O Configuration
Table 4-8. TMS370 Family EDS External Memory Accesses
Microcomputer Mode, Function B EDS 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh -- Microprocessor Mode With Internal Program Memory Bit SCCR1.2 = 0 EDS 10C0h-10FFh 2000h-6FFFh 8000h-FFFFh 10C0h-10FFh 2000h-5FFFh 8000h-FFFFh 10C0h-10FFh 2000h-3FFFh 8000h-FFFFh 10C0h-10FFh 8000h-FFFFh 10C0h-10FFh A000h-5FFFh Bit SCCR1.2 = 1 EDS 10C0h-10FFh 2000h-FFFFh 10C0h-10FFh 2000h-FFFFh 10C0h-10FFh 2000h-FFFFh 10C0h-10FFh 2000h-FFFFh 10C0h-10FFh 2000h-FFFFh Microcprocessor Mode Without Internal Memory EDS -- --
TMS370 Device TMS370Cx50
TMS370Cx52
TMS370Cx56
-- --
TMS370Cx67
TMS370Cx58 TMS370Cx68 TMS370C150 TMS370C156 TMS370C250 TMS370C256
-- 1020h-102Fh 10C0h-10FFh 2000h-FFFFh
--
--
The TMS370C150, TMS370C250, TMS370C156, and TMS370C256 devices are ROMless. These devices cannot operate in microcomputer mode function B or microprocessor mode with internal program memory. When clearing the MEMORY DISABLE bit (SCCR1.2 = 0) in the microprocessor mode with internal program memory, the EDS signal cannot access off-chip memory that has the same locations as internal program memory.
4-26
Digital I/O Configuration
4.4.1
Configuration Example
The predecoded chip selects (CSE1, CSE2, and CSH1 to CSH3) allow the TMS370 to access external addresses with a minimum of external logic. In many cases, no external logic is necessary between the TMS370 and the peripheral device, because of the predecoded chip selects, autowait features, and the nonmultiplexed bus. Chip selects also make it easy to do memory bank selection. Without bank selection, the CSH1, CSE1, and CSPF signals can easily access about 40K bytes of memory in the three different areas. With bank selection, the processor can access as many as 112K bytes of memory. To illustrate configuring the digital ports, assume that a TMS370C050 is to operate in an expanded microcomputer mode, and that 2K bytes of memory are needed at 2000h to 27FFh. The top half of Example 4-1 shows the desired port configuration.
-
Port A is set as the external data bus. Port B contains the low-order address bits of the 11 bits necessary to access 2K bytes of memory. Bits 4 through 7 of port C are set as I/O input. In port D, bit 7 is the chip-select signal to access 2000h to 3FFFh, and bit 4 is for external memory control signal R/W. The remaining bits of port D are used as I/O output.
The bottom half of Example 4-1 shows the port control registers set up to establish the configuration shown in the top half. To determine the bits needed to set the registers, use Table 4-5 on page 4-23. For example, to set port A as the data bus in microcomputer mode, function A, find Port A at the left-hand column of Table 4-5. Look across the row to find the data bus, then follow the column up to the bit settings for the desired mode (microcomputer or microprocessor) and function in the column heading:
DPORT1 = 0 xPORT2 = 1 xDATA (not used) xDIR (not used)
The assembly language instructions in the right column of Example 4-1 show one method of setting up the registers to the left. The Pxxx operand indicates peripheral file access (see Chapter 16, Assembly Language Instruction Set, for more information on peripheral file instructions).
System and Digital I/O Configuration
4-27
Digital I/O Configuration
Example 4-1. Digital Port Setup
Bit 7 Port A Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Data Bus
Port B
Address Bus
Port C
I/O In
Address Bus
Port D
CSE1 CS
I/O In
R/W
I/O Out
Port A Control Registers APORT2 ADATA ADIR 1021h 1022h 1023h 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc MOV #0FFh, P021
Port B Control Registers BPORT2 BDATA BDIR 1025h 1026h 1027h 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc 1 dc dc MOV #0FFh, P025
Port C Control Registers CPORT2 CDATA CDIR 1029h 102Ah 102Bh 0 y 0 0 y 0 0 y 0 0 y 0 0 y 0 1 dc dc 1 dc dc 1 dc dc MOV #0, P02B MOV #007h, P029
Port D Control Registers DPORT1 DPORT2 DDATA DDIR 102Ch 102Dh 102Eh 102Fh 0 1 dc dc 0 0 y 0 0 0 y 0 0 1 dc dc 0 0 q 1 0 0 q 1 0 0 q 1 0 0 q 1 MOV #00Fh, P02F MOV #0, P02C MOV #090h, P02D
Legend: dc = y= q=
don't care data value read data value written
When the device operates with internal program memory disabled, any access to the port peripheral frame, 1020h-102Fh, is decoded as an external
4-28
Digital I/O Configuration
address. Memory accesses to this frame can control external hardware that emulates the digital I/O functions.
4.4.2
Microprocessor Mode
Initializing a device with bus expansion to the microprocessor mode forces ports A, B, C, and D to function B as shown in Table 4-5, page 4-23. Port A is the data bus, port B is the low-order address bus, and port C is the high-order address bus in this mode. Devices that are not defined for operation in a memory expansion mode must be powered up in the microcomputer singlechip mode.
4.4.3
Microcomputer Mode
Initializing the device to the microcomputer mode forces ports A, B, C, and D to general-purpose high-impedance inputs. The program can set the control bits to change the function of the port pins to one of four functions: generalpurpose output, general-purpose input, function A, or function B. When you change a pin from a general-purpose input pin to an output pin, write to the data register first to set up the data; then, set the data direction register. This prevents unknown data on the pin from interfering with the external circuitry. The TMS370 in the microcomputer mode can individually reconfigure any address, data, or control signal to use only the necessary signals and leave the other signals on the port for general-purpose I/O operations. Figure 4-6 shows an example of the TMS370C050 interfaced to 112K bytes of external memory (see the TMS370 8-bit Microcontroller Applications Manual [SPNA019] for detailed examples). The function A chip-select signals enable one of three banks of EPROM, an external peripheral device, and one of two banks of static RAM. In this example, all eight bits of port A are the data bus, all eight bits of port B are the address LSbyte, and seven port C bits complete the 15-bit address bus.
System and Digital I/O Configuration
4-29
Digital I/O Configuration
Figure 4-6. System Interface Example
VCC 10 k (All)
U1 R/W CSE2 CSE1 CSPF CSH3 CSH2 CSH1
U2 E G E G
U3 E G
U4
U5
U6
WE
E
CS1
VCC
CS2 OE
A Address 0-14 Data 0-7 MC 15 8
Q VSS
A
Q VSS
A
Q
A
D
A
I/O
VSS
VSS
U1 = TMS370C050 8-bit microprocessor U2, U3, U4 = TMS27C256 32K x 8 bit EEPROM U5 = Unspecified 64-byte peripheral U6, U7 = 8K x 8 bit static RAM
4-30
IIII IIII IIII IIII IIII IIII IIII IIII
U7 WE CS1 CS2 OE A I/O
III III III III III III III III
CCC CCC CCC CCC CCC CCC CCC CCC
Running Title--Attribute Reference
Chapter 5
Interrupts and System Reset
This chapter discusses the internal and external interrupts of the TMS370. Device reset methods are also discussed. This chapter covers the following topics:
Topic
5.1 5.2 5.3 5.4
Page
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Interrupt Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12 Multiple Interrupt Servicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18 Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
Chapter Title--Attribute Reference
5-1
Interrupts
5.1
Interrupts
The TMS370 programmable interrupt structure allows flexible on-chip and external interrupt configurations to meet real-time interrupt-driven application requirements. Whenever an internal or external circuit requests an enabled interrupt, the processor finishes the current instruction and then fetches the address of the appropriate interrupt service routine from the interrupt table. The processor then pushes the contents of the program counter and status register onto the stack and begins execution at the interrupt service routine address found in the interrupt table. When the interrupt service routine completes its execution, the program executes an RTI (return from interrupt) instruction, which pops the previous status register and program counter contents from the stack. The processor resumes execution from the point of interruption. Table 5-1 shows the interrupt and reset vectors by device category.
Table 5-1. Interrupts and Reset Vectors
Device Category TMS370Cx0x TMS370Cx1x TMS370Cx2x TMS370Cx32 TMS370Cx36 TMS370Cx4x TMS370Cx5x TMS370Cx6x TMS370Cx7x TMS370Cx8x TMS370Cx9x TMS370CxAx TMS370CxBx TMS370CxCx Interrupts/Reset External 4 4 4 4 2 4 4 4 4 4 2 4 4 2 Vectors Total 7 6 8 23 22 9 10 11 7 5 4 8 6 6 Sources Total 15 13 16 25 24 22 23 29 19 12 11 21 13 14
Three external interrputs and a reset for all devices except 'x36, 'x9x, and 'xCx which have one external interrupt and a reset.
5-2
Interrupts
5.1.1
Interrupt Operation
The hardware interrupt structure includes two selectable priority levels as shown in Figure 5-1. Interrupt level 1 has a higher priority than interrupt level 2. The two priority levels can be independently masked by clearing the global interrupt enable bits (IE1 and IE2) of the status register (described in subsection 3.2.2, page 3-5. Note: All the peripheral modules are connected in a daisy-chain order, shown running horizontally in the center of Figure 5-1. For the same level (1 or 2), the module connected closest to the CPU (right side of figure) has a higher priority than the modules that are further away. For example, the order of priority shown in the figure is INT1, followed by INT2, INT3, SPI, TIMER 1, SCI, TIMER 2A, PACT, ADC, and TIMER 2B. The devices and their modules are listed in Table 5-2 on page 5-5. During system initialization, the application program can assign system interrupts to either the high or low priority level. The program can reassign priority levels at any time, except for those priority levels that are protected by the privileged mode. Within each level, the hardware determines the interrupt priority. The processor services the pending interrupts after executing the current instructions, depending on the interrupt mask and priority conditions. The processor services all enabled level 1 interrupts before servicing any level 2 interrupts. Within each level, the processor services the highest priority interrupts first. Table 5-2 (page 5-5) shows the hardware priorities (starting at 1 for highest) of the devices at the time of this printing. The TMS370 architecture allows up to 128 independent interrupt vectors, located within the memory addresses 7F00h to 7FFFh. This memory space also contains the trap tables, and 12 bytes are reserved for Texas Instruments' use. If the device does not define this memory for an interrupt vector, it can be used for program memory. Table 5-3 shows the interrupt vector source(s) and corresponding address(es). Note that a system interrupt can have multiple interrupt sources. The application program can individually enable or disable all of the interrupt sources via local interrupt enable control bits in the associated peripheral file. Also, the software can read each interrupt source's flag bit to determine which interrupt source generated the system interrupt.
Interrupts and System Reset
5-3
Interrupts
Figure 5-1. Interrupt Control
EXT INT 3 INT 3 EXT INT 2 INT 2 INT3 PRI
TIMER 2B INT Overflow Compare1 Ext edge Compare2 Input capture 1 Input capture 2
TIMER 2A INT Overflow Compare1 Ext edge Compare2 Input capture 1 Input capture 2
TIMER 1 INT Overflow Compare1 Ext Edge Compare2 Input capture 1 Watchdog
INT2 PRI EXT INT1 INT1 CPU NMI
T2B PRI
T2A PRI
T1 PRI
INT1 PRI STATUS REG IE1 IE2
Priority Logic
Interrupt Daisy Chain
Level 1 INT Level 2 INT SPI INT SPI PRI
ADC INT AD PRI
Enable
SCI INT A/D
PACT 3 PRI Cmd/def entry 0 Cmd/def entry 1 Cmd/def entry 2 Cmd/def entry 3 Cmd/def entry 4 Cmd/def entry 5 Cmd/def entry 6 Cmd/def entry 7 GROUP 3 GROUP 2
SCI RXINT SCI TXINT
PACT INT
PACT 2 PRI PACT 1 PRI
TX TXPRI
RX
SPI
Circular buffer CP6 Edge CP5 Edge CP4 Edge CP3 Edge CP2 Edge CP1 Edge Overflow default timer GROUP 1
TXRDY
RXPRI BRKDT RXRDY
Note:
Figure 5-1 shows the daisy chain order of all peripheral modules. The modules connected closest to the CPU have a higher priority than those further away. For instance, the following are in priority order as shown above: INT1, INT2, INT3, SPI, TIMER 1, SCI (SCI1 or SCI2), TIMER 2A, PACT, ADC (ADC1, ADC2, or ADC3), TIMER 2B. Not all peripheral modules are available on any given device. Refer to Table 5-2 for device module availability and priority for each family.
5-4
Interrupts
The processor acknowledges an interrupt if its flag bit equals 1 and the interrupt is enabled. To avoid immediately re-entering the same interrupt service routine, the interrupt service routine must clear all appropriate flag bits before leaving the routine. For example, clear the INT1 flag bit as shown in Figure 5-2 on page 5-9.
Table 5-2. Module Interrupt Priority in Lowest-to-Highest Order
Vector Start Address 7FBEh 7FECh 7F9Ch Device Module Priority Module Timer 2B ADC|| P Grp3 Grp2 Grp1 7FEEh 7FF0h Timer 2A SCIk TX RX# 7FF4h 7FF6h 7FF8h 7FFAh 7FFCh 7FFEh Timer 1 SPI External INT3 External INT2 External INT1 RESET x0x NA NA NA NA NA NA 7 6 5 NA 4 3 2 1 x1x NA NA NA NA NA NA NA NA 6 5 4 3 2 1 x2x NA NA NA NA NA NA 8 7 6 5 4 3 2 1 x32 NA 8 7 6 5 NA NA NA NA NA 4 3 2 1 x36 NA 7 6 5 4 NA NA NA NA 3 NA NA 2 1 x4x NA 9 NA NA NA 8 7 6 5 NA 4 3 2 1 x5x NA 10 NA NA NA 9 8 7 6 5 4 3 2 1 x6x 11 10 NA NA NA 9 8 7 6 5 4 3 2 1 x7x NA 7 NA NA NA 6 NA NA 5 NA 4 3 2 1 x8x NA NA NA NA NA NA NA NA 5 NA 4 3 2 1 x9x NA 4 NA NA NA NA NA NA 3 NA NA NA 2 1 xAx NA NA NA NA NA 8 7 6 5 NA 4 3 2 1 xBx NA 6 NA NA NA NA NA NA 5 NA 4 3 2 1 xCx NA 6 NA NA NA NA 5 4 3 NA NA NA 2 1 2 2 2 2 2 2 2 4 Module Vector Bytes 2 2 36
Modules are listed in order of lowest priority at the top, highest priority (1) on the bottom. The in-circuit emulator with PACT (TMS370Cx32 and TMS370x36) has the PACT module as the lowest priority interrupt, while the rest of the device family has (depending on the resident modules) timer 2B as the lowest priority, followed by the ADC, timer 2A, and so forth. The priority interrupts are shown in the table from the lowest to the highest priority. PACT module Transmit # Receive || ADC refers to ADC1, ADC2, or ADC3 k SCI refers to SCI1 or SCI2
Interrupts and System Reset
5-5
Interrupts
Table 5-3. Interrupt Vector Sources
Module Timer 2B Vector Address 7FBEh, 7FBFh Interrupt Source Timer 2B Overflow Timer 2B compare 1 Timer 2B compare 2 Timer 2B external edge Timer 2B input capture 1 Timer 2B input capture 2 ADC PACT (Group 3) 7FECh, 7FEDh 7FA0h, 7FA1h 7FA2h, 7FA3h 7FA4h, 7FA5h 7FA6h, 7FA7h 7FA8h, 7FA9h 7FAAh, 7FABh 7FACh, 7FADh 7FAEh, 7FAFh PACT (Group 2) PACT (Group 1) 7F9Eh, 7F9Fh 7F9Ch, 7F9Dh 7FB0h, 7FB1h 7FB2h, 7FB3h 7FB4h, 7FB5h 7FB6h, 7FB7h 7FB8h, 7FB9h 7FBAh, 7FBBh 7FBCh, 7FBDh 7FBEh, 7FBFh ADC conversion complete PACT cmd/def entry 0 PACT cmd/def entry 1 PACT cmd/def entry 2 PACT cmd/def entry 3 PACT cmd/def entry 4 PACT cmd/def entry 5 PACT cmd/def entry 6 PACT cmd/def entry 7 PACT SCI RXINT PACT SCI TXINT PACT circular buffer (half/full) PACT CP6 edge PACT CP5 edge PACT CP4 edge PACT CP3 edge PACT CP2 edge PACT CP1 edge PACT default timer overflow Interrupt Flag T2B OVRFL INT FLAG T2BC1 INT FLAG T2BC2 INT FLAG T2BEDGE INT FLAG T2BIC1 INT FLAG T2BIC2 INT FLAG AD INT FLAG CMD/DEF INT 0 FLAG CMD/DEF INT 1 FLAG CMD/DEF INT 2 FLAG CMD/DEF INT 3 FLAG CMD/DEF INT 4 FLAG CMD/DEF INT 5 FLAG CMD/DEF INT 6 FLAG CMD/DEF INT 7 FLAG PACT RXRDY PACT TXRDY BUFFER HALF/FULL INT FLAG CP6 INT FLAG CP5 INT FLAG CP4 INT FLAG CP3 INT FLAG CP2 INT FLAG CP1 INT FLAG DEFTIM OVRFL INT FLAG ADINT CDINT0 CDINT1 CDINT2 CDINT3 CDINT4 CDINT5 CDINT6 CDINT7 PRXINT PTXINT BUFINT CP6INT CP5INT CP4INT CP3INT CP2INT CP1INT POVRFL INT 1 1 2 3 4 5 6 7 8 1 2 1 2 3 4 5 6 7 8 System Interrupt T2BINT Priority in Group 1
1 is the highest priority. The table, top to bottom, is in lowest to highest priority order. ADC refers to ADC1, ADC2, or ADC3.
5-6
Interrupts
Table 5-3. Interrupt Vector Sources (Continued)
Module Timer 2A Vector Address 7FEEh, 7FEFh Interrupt Source Timer 2A overflow Timer 2A compare 1 Timer 2A compare 2 Timer 2A external edge Timer 2A input capture 1 Timer 2A input capture 2 SCI TX SCI RX 7FF0h, 7FF1h 7FF2h, 7FF3h SCI TX data register empty SCI RX data register full SCI RX break detect Timer 1 7FF4h, 7FF5h Timer 1 overflow Timer 1 compare 1 Timer 1 compare 2 Timer 1 external edge Timer 1 input capture 1 Watchdog overflow SPI External INT 7FF6h, 7FF7h 7FF8h, 7FF9h 7FFAh, 7FFBh 7FFCh, 7FFDh RESET 7FFEh, 7FFFh SPI RX/TX complete External INT3 External INT2 External INT1 External RESET Watchdog overflow Oscillator fault detect Interrupt Flag T2A OVRFL INT FLAG T2AC1 INT FLAG T2AC2 INT FLAG T2AEDGE INT FLAG T2AIC1 INT FLAG T2AIC2 INT FLAG TXRDY FLAG RXRDY FLAG BRKDT FLAG T1 OVRFL INT FLAG T1C1 INT FLAG T1C2 INT FLAG T1EDGE INT FLAG T1IC1 INT FLAG WD OVRFL INT FLAG SPI INT FLAG INT3 FLAG INT2 FLAG INT1 FLAG COLD START WD OVRFL INT FLAG OSC FLT FLAG SPIINT INT3 INT2 INT1 RESET 1 1 1 1 1 T1INT 1 TXINT RXINT 1 1 System Interrupt T2AINT Priority in Group 1
1 is the highest priority. The table, top to bottom, is in lowest to highest priority order. SCI refers to SCI1 or SCI2.
Interrupts are sampled and arbitrated by the CPU during every opcode fetch. If one or more requests are pending (and the appropriate enable bits are set in the status register for maskable interrupts), then at the normal completion of the opcode fetch, the interrupt context switch begins. The new opcode is discarded, and the program counter is rewound to point to the discarded instruction. Moreover, at the completion of the interrupt service routine, the discarded instruction is fetched again.
Interrupts and System Reset
5-7
Interrupts
The context switch routine proceeds as follows: 1) Increments the stack pointer (SP) and stores the contents of the status register (ST) at the location pointed to by the SP. 2) Resets the ST to 00h (disables further interrupt recognition). 3) Obtains the identity of the interrupting peripheral. 4) Rewinds the program counter (PC) to point to the aborted opcode. 5) Increments SP and stores the original PC high byte (PCH) at the location pointed to by the SP. 6) Gets the interrupt-service-routine address (low byte) and stores it in the PC low byte (PCL). 7) Increments SP and stores the original PCL at the location pointed to by SP. 8) Gets the address (high byte) of the interrupt service routine and stores it in the PCH. 9) Resumes instruction execution with the new PC contents. A minimum of 15 cycles is required from the time that an interrupt is triggered until the first instruction of the interrupt service routine is read. The moment at which the interrupt is asserted, and the place in the instruction at which the interrupt is asserted, depend on the instruction in progress. The worst case happens if the interrupt occurs near the start of a divide instruction; the processor may require up to 78 clock cycles to enter the interrupt service routine. If wait states are needed, the appropriate number of cycles must be added. Also, an external interrupt (INT1, INT2, or INT3) requires two extra clock cycles to synchronize before the processor can detect it.
5.1.2
External Interrupts
External pins INT1, INT2, and INT3 allow external devices to interrupt the program and enter a specific interrupt service routine. The INT1, INT2, and INT3 control registers in peripheral file frame 1 govern the software configuration of the external interrupts. Figure 5-2 shows these registers.
5-8
Interrupts
Figure 5-2. Peripheral File Frame 1: External Interrupt Control Registers
Designation INT1 Address PF Bit 7 INT1 FLAG (RC-0) INT2 FLAG (RC-0) INT3 FLAG (RC-0) Bit 6 INT1 PIN DATA (R-0) INT2 PIN DATA (R-0) INT3 PIN DATA (R-0) Bit 5 Bit 4 Bit 3 Bit 2 INT1 POLARITY (RW-0) INT2 POLARITY (RW-0) INT3 POLARITY (RW-0) Bit 1 INT1 PRIORITY (RW-0) INT2 PRIORITY (RW-0) INT3 PRIORITY (RW-0) Bit 0 INT1 ENABLE (RW-0) INT2 ENABLE (RW-0) INT3 ENABLE (RW-0)
1017h
P017
--
-- INT2 DATA DIR (RW-0) INT3 DATA DIR (RW-0)
-- INT2 DATA OUT (RW-0) INT3 DATA OUT (RW-0)
INT2
1018h
P018
--
INT3
1019h
P019
--
The software uses the interrupt polarity bits to individually configure each external interrupt to trigger on either a rising edge or a falling edge. If the interrupt function is not required, the software can configure INT1 to be an input pin, and INT2 and INT3 to be general-purpose input/output pins. INT1 can be programmed as a maskable or nonmaskable interrupt. When INT1 is nonmaskable, it cannot be masked by the individual or global mask bits. Remember that the INT1 NMI bit (SCCR2.1) is protected during nonprivileged operations and should be configured during the system initialization sequence following a reset (see the INT1 NMI bit description in subsection 4.3.3, page 4-17). The nonmaskable interrupt is used for events that you want to respond to immediately. For example, this event could be derived from monitoring the power supply and saving important data to EEPROM whenever a brownout/power loss condition occurs. Notes:
-
When a nonmaskable interrupt (NMI) is used, the interrupt is taken on every active edge of the INT1 pin. This pin should be debounced to avoid multiple interrupts that could cause the stack to overflow. Once the stack overflows, the program may not operate as expected. To provide a method of exiting low-power modes, INT1 is automatically enabled as an NMI during low-power modes when the hard watchdog mode is selected. This means that the NMI is always generated regardless of the interrupt enable flags and the values of the status bits (that is, INT1 PRIORITY bit [INT1.1], INT1 ENABLE bit [INT1.0], INT1 NMI bit [SCCR2.1], and the global interrupt enable flags of the status register [IE1 and IE2]). See subsection 7.7.2.1, page 7-26, for more information.
Interrupts and System Reset
5-9
Interrupts
The application program must configure the following bits for each interrupt to function correctly (refer to Figure 5-3 and Figure 5-4 on page 5-10).
-
The INTx PRIORITY bit configures the interrupt as either a level 1 or a level 2 interrupt. The INTx POLARITY bit selects the trigger as either a falling edge or a rising edge. The INTx ENABLE bit allows the request to be transmitted to the CPU if either the IE1 or IE2 enable bit, whichever is appropriate, is enabled.
Figure 5-3. Interrupt 1 Block Diagram
P017.0 Enable Wake-up P017.6
External pin connection
NMI
Pin Data 1 1 = Rising D
CLR 1 Q 0
P012.1 NMI enable P017.0 Enable ST Level 2 Int request Level 1 Int request
INT 1 0 = Falling P017.2 Polarity
IE2 1 0
CLR
Write Read INT flag
Priority Select P017.7 P017.1 Other Level 2 interrupts Other Level 1 interrupts
IE1
ST Status register Global interrupts Enable bits
This bit is ignored if you are using the hard watchdog option.
5-10
Interrupts
Figure 5-4. Interrupts 2 and 3 Block Diagram
External pin connection
P018.6 P019.6 Input pin data 1
P018.3 P019.3 Data out
Other Level 2 interrupts Other Level 1 interrupts P018.0 P019.0 Enable IE2 ST
Wake-up
INT
(Int 2 or 3 pin)
0
1 1 = Rising
D Q
1 0 IE1 ST Priority select
Level 2 Int request Level 1 Int request
Data dir P018.4 P019.4
0 = Falling Polarity P018.2 P019.2
CLR
Write Read INT flag P018.7 P019.7
P018.1 P019.1
Status register Global interrupts Enable bits
-
The INTx FLAG indicates that the selected edge (rising or falling) has occurred. If the enables are set, an interrupt is requested. This bit remains a 1 until the software or a RESET clears it. The INTx FLAG bit is useful for programs that poll the interrupt flag instead of generating a system interrupt. The INTx PIN DATA bit shows the condition presently on the interrupt pin. On interrupts 2 and 3, the INTx DATA DIR determines whether the pin functions as a general-purpose output pin or as an input/interrupt pin. If you select the general-purpose output function for a pin, then the value written by software to the INTx DATA OUT bit determines the value of the output.
-
All external interrupts can bring the processor out of both the halt and the standby low-power modes if the interrupt enable and the interrupt level mask are enabled. Note that in halt mode, the interrupt is detected on the level and not the edge. For further information, refer to subsection 4.2.3, page 4-10.
Interrupts and System Reset
5-11
Interrupt Control Registers
5.2 Interrupt Control Registers
The interrupt control registers control the configuration of the external interrupts.
5.2.1
Interrupt 1 Control Register (INT1)
The INT1 register controls the interrupt configuration for the INT1 pin. INT1 is available for all TMS370 devices.
Interrupt 1 Control Register (INT1) [Memory Address 1017h]
Bit #
P017
7
INT1 FLAG RC-0
6
INT1 PIN DATA R-0
5
--
4
--
3
--
2
INT1 POLARITY RW-0
1
INT1 PRIORITY RW-0
0
INT1 ENABLE RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bit 7
INT1 FLAG. Interrupt 1 Flag. When set, this bit indicates that the selected transition on INT1 has occurred. An interrupt can occur as long as this bit remains set; as a result, the application program must clear this bit during the interrupt handling routine. This bit is set, even if the INT1 ENABLE bit is cleared. This flag is not set if INT1 is configured as an NMI. 1 = Transition detected 0 = No transition
Bit 6
INT1 PIN DATA. Interrupt 1 Pin Data. This bit displays the current condition of the INT1 pin. 1 = High-level input voltage (VIH) at the INT1 pin 0 = Low-level input voltage (VIL) at the INT1 pin
Bits 5,4,3 Bit 2
Reserved. Read data is indeterminate. INT1 POLARITY. Interrupt 1 Polarity. This bit determines whether INT1 triggers on a rising edge or on a falling edge. 1 = Triggers on a rising edge (low-to-high transition) 0 = Triggers on a falling edge (high-to-low transition)
5-12
Interrupt Control Registers
Bit 1
INT1 PRIORITY. Interrupt 1 Priority. This bit determines the interrupt level of the INT1 pin --either a high, level-1 interrupt or a low, level-2 interrupt. This bit is ignored if INT1 NMI = 1. 1 = Level 2 interrupt (low level) 0 = Level 1 interrupt (high level)
Bit 0
INT1 ENABLE. Interrupt 1 Enable. When set, this bit enables the interrupts for the INT1 pin. This bit is ignored if INT1 NMI = 1. 1 = Enables INT1 interrupts 0 = Disables INT1 interrupts
Interrupts and System Reset
5-13
Interrupt Control Registers
5.2.2
Interrupt 2 Control Register (INT2)
The INT2 register controls the interrupt configuration for the INT2 pin. INT2 is available for all TMS370 devices except 'x36, 'x9x, and 'xCx devices.
Interrupt 2 Control Register (INT2) [Memory Address 1018h]
Bit #
P018
7
INT2 FLAG RC-0
6
INT2 PIN DATA R-0
5
--
4
INT2 DATA DIR RW-0
3
INT2 DATA OUT RW-0
2
INT2 POLARITY RW-0
1
INT2 PRIORITY RW-0
0
INT2 ENABLE RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bit 7
INT2 FLAG. Interrupt 2 Flag. This bit indicates that the selected transition on INT2 has occurred. An interrupt can occur as long as this bit remains set; as a result, the program must clear this bit during the interrupt handling routine. This bit is set, even if the INT2 ENABLE bit is cleared. 1 = Transition detected 0 = No transition
Bit 6
INT2 PIN DATA. Interrupt 2 Pin Data. This bit displays the current value of the INT2 pin. 1 = High-level input voltage (VIH) at the INT2 pin 0 = Low-level input voltage (VIL) at the INT2 pin
Bit 5 Bit 4
Reserved. Read data is indeterminate. INT2 DATA DIR. Interrupt 2 Data Direction. The INT2 pin can be configured as either an output pin or as an input/interrupt pin. 1 = INT2 pin is an output pin 0 = INT2 pin is an input/interrupt pin
Bit 3
INT2 DATA OUT. Interrupt 2 Data Out. If the software configures the INT2 pin as an output pin (INT2 DATA DIR = 1), then the value that the software writes to the INT2 DATA OUT bit determines the value of that output pin.
5-14
Interrupt Control Registers
Bit 2
INT2 POLARITY. Interrupt 2 Polarity. This bit determines whether INT2 triggers on a rising edge or on a falling edge. 1 = Triggers on a rising edge (low-to-high transition) 0 = Triggers on a falling edge (high-to-low transition)
Bit 1
INT2 PRIORITY. Interrupt 2 Priority. This bit determines the interrupt level of the INT2 pin --either a high, level-1 interrupt or a low, level-2 interrupt. 1 = Level 2 interrupt (low level) 0 = Level 1 interrupt (high level)
Bit 0
INT2 ENABLE. Interrupt 2 Enable. When set, this bit enables the interrupts for the INT2 pin. 1 = Enables INT2 interrupts 0 = Disables INT2 interrupts
Interrupts and System Reset
5-15
Interrupt Control Registers
5.2.3
Interrupt 3 Control Register (INT3)
The INT3 register controls the interrupt configuration for the INT3 pin. INT3 is available for all TMS370 devices except 'x36, 'x9x, and 'xCx devices.
Interrupt 3 Control Register (INT3) [Memory Address 1019h]
Bit #
P019
7
INT3 FLAG RC-0
6
INT3 PIN DATA R-0
5
--
4
INT3 DATA DIR RW-0
3
INT3 DATA OUT RW-0
2
INT3 POLARITY RW-0
1
INT3 PRIORITY RW-0
0
INT3 ENABLE RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bit 7
INT3 FLAG. Interrupt 3 Flag. This bit indicates that the selected transition on INT3 has occurred. An interrupt can occur as long as this bit remains set; as a result, the program must clear this bit during the interrupt handling routine. This bit will be set, even if the INT3 ENABLE bit is cleared. 1 = Transition detected 0 = No transition
Bit 6
INT3 PIN DATA. Interrupt 3 Pin Data. This bit displays the current condition of the INT3 pin. 1 = High-level input voltage (VIH) at the INT3 pin 0 = Low-level input voltage (VIL) at the INT3 pin
Bit 5 Bit 4
Reserved. Read data is indeterminate. INT3 DATA DIR. Interrupt 3 Data Direction. The INT3 pin can be configured as either an output pin or as an input/interrupt pin. 1 = INT3 pin is an output pin 0 = INT3 pin is an input/interrupt pin
Bit 3
INT3 DATA OUT. Interrupt 3 Data Out. If software configures the INT3 pin as an output pin (INT3 DATA DIR=1), then the value that the software writes to the INT3 DATA OUT bit determines the value of that output pin.
5-16
Interrupt Control Registers
Bit 2
INT3 POLARITY. Interrupt 3 Polarity. This bit determines whether INT3 triggers on a rising edge or on a falling edge. 1 = Triggers on a rising edge (low-to-high transition) 0 = Triggers on a falling edge (high-to-low transition)
Bit 1
INT3 PRIORITY. Interrupt 3 Priority. This bit determines the interrupt level of the INT1 pin --either a high, level-1 interrupt or a low, level-2 interrupt. 1 = Level-2 interrupt (low level) 0 = Level-1 interrupt (high level)
Bit 0
INT3 ENABLE. Interrupt 3 Enable. This bit enables the interrupts for the INT3 pin. 1 = Enables INT3 interrupts 0 = Disables INT3 interrupts
Interrupts and System Reset
5-17
Multiple Interrupt Servicing
5.3 Multiple Interrupt Servicing
When servicing an interrupt, the processor automatically clears the global interrupt enable bits IE1 and IE2 in the status register. This prevents all other interrupts from being recognized during the execution of the interrupt service routine. Once the service routine is completed by executing the RTI (return from interrupt) instruction, the old status register contents are popped from the stack. This returns bits IE1 and IE2 to their original conditions and allows any pending interrupts to be recognized. An interrupt service routine allows nested interrupts by executing the EINT, EINTL, or EINTH instructions to set the global interrupt enable bits in the status register. This permits other interrupts to be recognized during the service routine execution. When a nested interrupt service routine completes, it returns to the previous interrupt service routine when the RTI instruction executes. Too many nested interrupts could overflow the stack, and cause a program failure.
5-18
Resets
5.4 Resets
The TMS370 has three possible reset sources:
-
A low input to the RESET pin A programmable watchdog timer timeout (described in Section 7.7 and Section 15.2) A programmable oscillator fault failure (described in subsection 4.1.3)
After a reset, the program can interrogate the status bits (shown in Table 5-4) to determine the source of the reset in order to take appropriate action. If none of the sources shown in Table 5-4 caused the reset, then the RESET pin was pulled low by external hardware or the PACT module watchdog. The RESET pin starts the hardware initialization and ensures an orderly software startup. The RESET pin is an input/output pin. A low-level pulse initiates the reset sequence. The processor may detect short reset pulses of a few nanoseconds, but a low level (active) of one SYSCLK cycle is necessary to guarantee that the device sees the reset signal. The microcontroller is held in reset until the RESET pin goes inactive (high). If the reset input signal remains low for less than eight system clock cycles (SYSCLK), the processor holds the external RESET pin low for eight system clock cycles to reset the external system components. The basic operating mode (microcomputer or microprocessor) is determined by the voltage level applied to the MC pin when the RESET pin goes inactive (high). The RESET pin can be pulled low at any time during its operation to start the reset sequence.
Table 5-4. Reset Sources
Register SCCR0 SCCR0 T1CTL2 Address 1010h 1010h 104Ah PF P010 P010 P04A Bit No. 7 4 5 Control Bit COLD START OSC FLT FLAG WD OVRFL INT FLAG Source of Reset Cold or warm start reset Oscillator out of range Watchdog timer timeout
Interrupts and System Reset
5-19
Resets
The sequence of events during reset is as follows: 1) CPU registers are initialized (ST = 00h and SP = 01h). 2) Registers A and B are initialized to 00h (no other RAM is changed). 3) Contents of 7FFFh are read and stored in the PCL (PC low). 4) Contents of 7FFEh are read and stored in the PCH (PC high). 5) Program execution is started with an opcode fetch from the address pointed to by the PC. The reset sequence takes 20 SYSCLK cycles in the microcomputer mode (22 SYSCLK cycles in the microprocessor mode) from the time the reset pulse is released until the first opcode fetch begins. When a watchdog overflow or an oscillator fault detection circuit generates a reset, the RESET pin is pulled low so that it resets other external components in the system. During a reset, RAM contents (except for register A and register B) remain unchanged, and the majority of the peripheral file bits are cleared to 0, with the exception of the control bits shown in Table 5-5.
5.4.1
Simple Reset Circuitry
An application must activate the RESET pin at power-up with an external input to RESET or an RC power-up circuit. The RESET pin must be held low until the clock signal is valid and VCC is within operating range. Figure 5-5 shows a simple reset circuit that holds RESET low during the power-up. The simple reset circuit shown in Figure 5-5 cannot handle short brownouts or power supply glitches. Voltage glitches can occur when a power switch is closed or power wires are connected. If your design is subject to these conditions, refer to the Reset Circuitry with Low-Voltage Detection (subsection 5.4.2, page 5-22). The TMS370 devices are not guaranteed to operate properly when VCC is outside of the recommended voltage range (4.5 to 5.5 volts).
5-20
Resets
Table 5-5. Control-Bit States Following a Reset
Register SCCR0 Control Bit P/C Mode MC PIN DATA COLD START OSC FLT FLAG Power-up Power- p Microcomputer 0 0 1 0 0 0 0 1 1 1 1 Warm Reset Microcomputer 0 0 See Note 1 See Note 1 0 0 See Note 1 1 1 1 1 Microprocessor 1 1 See Note 1 See Note 1 1 1 See Note 1 1 1 1 1
xPORT1 All 8 bits (See Note 2) xPORT2 All 8 bits (See Note 2) T1CTL2 TXCTL ADSTAT PACT
Notes:
WD OVRFL FLAG TX EMPTY TXRDY AD READY PACT TXRDY
1) State determined by cause of reset. See bit descriptions in Section 5.2. 2) Refers to port control registers with x = A, B, C, or D.
Figure 5-5. Simple Reset Circuit
VCC (4.5-5.5V) To other devices' resets
D1
10 k
TMS370
Reset in 2.7 k Manual reset 0.47 mF Reset out
Interrupts and System Reset
5-21
Resets
-
-
The RC network of 10 kW and 0.47mF provides a power-up rise time. If this power-up rise time is not long enough (depending on the rise time of the power supply you are using), you can use a larger capacitor. However, replacing the 10 kW resistor with a larger resistor can cause the voltage at the RESET pin to be less than VIH. The 2.7-kW resistor protects the RESET pin from the capacitor discharging directly into the pin when the pin is pulled low internally. The diode allows the capacitor to discharge quickly during a brownout or power-off situation.
Capacitors should not discharge directly into the RESET pin. Protect this pin from damage by using a resistor such as the 2.7 kW resistor shown in Figure 5-5.
5.4.2
Reset Circuitry With Low-Voltage Detection
It is recommended to have an asserted RESET during low-power or brownout conditions. In these instances, an active reset circuit with a low-voltage detection feature can be connected to the RESET pin. Figure 5-6 shows a typical circuit for using a supply voltage supervisor to assert RESET.
Figure 5-6. Typical Reset Circuit Using a Supply Voltage Supervisor
VCC To other devices' resets
Supply voltage supervisor
10 k
TMS370
Reset in Reset out Reset out
The supply voltage supervisor must not cause a drive conflict with the TMS370 RESET pin. Most importantly, the supply voltage supervisor should not drive
5-22
Resets
RESET high since the TMS370 can drive the pin low. However, a pull-up resistor is needed. To ensure the integrity of the contents of volatile memory (EEPROM, RAM), devices incorporating such memory require that the external RESET pin is active (low) while VCC is below its minimum specified operating level. Active reset circuitry prevents the EEPROM contents from being corrupted by improper instruction execution due to an insufficient VCC supply voltage and ensures that the EEPROM write control register (DEECTL) powers up in the correct state when VCC returns to its specified operating range. To guarantee the retention of RAM data when power is at 3.0 V to 4.5 V, RESET must be externally asserted and released only while VCC is within the recommended operating range of 4.5 V to 5.5 V.
Interrupts and System Reset
5-23
5-24
Running Title--Attribute Reference
Chapter 6
EPROM and EEPROM Modules
This chapter discusses the architecture and programming of the following:
-
Data EEPROM modules of the TMS370 family Program EPROM modules of the TMS370C6xx and TMS370C7xx devices.
Additional information about these modules is included in Chapter 18, Electrical Specifications and Timings, and in the TMS370 Family Applications Book (SPNA017). This chapter covers the following topics:
Topic
6.1 6.2 6.3 6.4
Page
Data EEPROM Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Data EEPROM Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Programming the Data EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 Program EPROM Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10
Chapter Title--Attribute Reference
6-1
Data EEPROM Module
6.1 Data EEPROM Module
The entire TMS370 family (except TMS370CxAx and the TMS370xCx) contains data EEPROM modules. The TMS370 data EEPROM module contains a 256-byte array configured into eight 32-byte blocks. Devices can have multiple 256-byte arrays. Each additional array is also configured with eight 32-byte blocks. The first byte of each 256-byte array is the write protection register (WPR) for that array. This module also contains a voltage generator that provides a special precise programming voltage to the EEPROM array. This special voltage helps increase the reliability of the EEPROM and allows the TMS370 to program the EEPROM with a single VCC source. Reading the EEPROM module is identical to reading other internal memory and takes two system clock cycles. The CPU can fetch data and execute instructions from the EEPROM arrays. The data EEPROM module can be programmed on an array, a byte, or a single-bit basis. The memory can also be protected from inadvertent writing with a write-protect feature. The data EEPROM control register (DEECTL) and the WPR control the data EEPROM. The DEECTL register contains the bits needed to initiate and monitor EEPROM programming. The WPR of the given array contains the write protection bits for each 32-byte block of that data EEPROM array.
6-2
Data EEPROM Control Registers
6.2 Data EEPROM Control Registers
The data EEPROM can be write-protected, block by block (32 bytes), with the WPR(s). The DEECTL register determines the programming mode and when programming is initiated.
6.2.1
Write Protection Register (WPR)
The WPR(s) provide write protection for the data EEPROM contents. The WPR is the first byte of each 256-byte data EEPROM array and is located in BLK0 of this array, generally at address 1x00h (where x is either E or F). This implies that the WPR, for the 256-byte array, is itself protected whenever the BLK0 bit of that array is protected. There are eight blocks of equal size in the data EEPROM array. Each bit in the WPR corresponds to one of the blocks. Setting a bit to a 1 in this register protects the corresponding block. Figure 6-1 shows the block protected by each bit.
Figure 6-1. Write Protection Bits in an EEPROM Array
MSB 1x00h Write protection register BLK7 BLK6 BLK5 BLK4 BLK3 BLK2 BLK1 BLK0 BLK0 1x20h BLK1 1x40h BLK2 1x60h 1x80h 1xA0h BLK5 1xC0h BLK6 1xE0h BLK7 1xFFh BLK3 BLK4 0 = Write access allowed to the associated block 1 = Write protect block (write accesses not allowed to the associated block) Write protection register (WPR) [Memory address 1x00h] LSB
Once block 0 is protected, the write-protect configuration cannot be altered unless write protection is overridden by placing the microcomputer into the writeprotection override mode. (To enter the WPO mode, apply 12 volts to the MC pin while the RESET pin is a logic 1.) There is no write protection during a writeprotection override, and the WPR is considered a normal data location within the data EEPROM array during this time.
EPROM and EEPROM Modules
6-3
Data EEPROM Control Registers
Example 6-1 illustrates one way to program the WPR. In this example, the program protects blocks 0 and 2. Also, assume that the WPR contains the value 00h before the example begins.
Example 6-1. Write Protection Register Programming
DINT MOV MOV MOV EINT MOVW INCW JC MOV . . . #05,A A,&1F00h #3,P01A #2778,R011 #-1,R011 DELAY #0,P01A ;Disable interrupt ;Protect bits for BLK0 and ;BLK2 ;Set DEECTL to program 1's ;Set W1W0 and EXE bits ;Enable interrupt ;10 ms delay loop ;Clear W1W0 and EXE bits
DELAY
See TMS370 Family Applications Book (SPNA017) for more examples of programming the EEPROM module.
6.2.2
Data EEPROM Control Register (DEECTL)
The DEECTL register is located in the peripheral file at address P01A (101Ah), and controls the data EEPROM programming.
Data EEPROM Control Register (DEECTL) [Memory Address 101Ah]
Bit #
P01A
7
BUSY R-*
6
--
5
--
4
--
3
--
2
AP RW-0
1
W1W0 RW-0
0
EXE RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset (-* = see the individual bit description)
Bit 7
BUSY. This bit is set during data EEPROM programming to indicate that an operation is in progress. Reading any location of the EEPROM during programming returns the data being programmed. In order to let the EEPROM voltages stabilize, the BUSY bit is set for 128 SYSCLK cycles:
-
After a reset, After an exit from a low-power mode, and After programming the EEPROM.
6-4
Data EEPROM Control Registers
If an attempt is made to access the EEPROM during this 128-cycle period, the data EEPROM holds the execution of the processor by asserting the WAIT signal until the 128 SYSCLK cycles are complete. 0 = EEPROM array is ready for access 1 = EEPROM array is not ready for access Bit 6-3 Bit 2 Reserved. Read data is indeterminate. AP. Array Program. Note: This bit operates differently for TMS370Cxxx devices (vs. '370CxxxA or '370CxxxB devices). See Section A.6, AP Bit in the DEECTL Register (DEECTL.2) on page A-6. The following applies to devices with a single or a multiple 256-byte array: In a single programming cycle, this bit programs the entire array space with the value specified by the W1W0 bit. However, the device must be in the WPO mode for the array to be programmed. Moreover, there is no write protection during WPO mode; the WPR is considered a normal data location within the data EEPROM array during this time. If the device is not in the WPO mode, the AP bit has no effect on the programming operation, and a single byte is programmed. 0 = Disables array programming 1 = Enables array programming Bit 1 W1W0. Write1/Write0. This bit determines whether to use the ones or zeroes programming mode (see Section 6.3, Programming the Data EEPROM, on page 6-6). This bit is write protected whenever the EXE bit is set. 0 = Write zeros 1 = Write ones Bit 0 EXE. Execute. This bit initiates the write operation defined by the remaining control register bits. When cleared, this bit terminates a programming operation in progress. If the application program reads a data EEPROM location while the EXE bit is set, the processor reads the data being programmed into the EEPROM. If software attempts a write to the EEPROM while the EXE bit is set, the data byte is ignored. 0 = Inactive 1 = Active
EPROM and EEPROM Modules
6-5
Programming the Data EEPROM
6.3 Programming the Data EEPROM
The DEECTL (P01A) register and the associated array's WPR (1x00h) register control the programming of the data EEPROM. Individual bits are programmed to a 1 or 0 under the control of the W1W0 bit and the EXE bit in the DEECTL register.
-
When the W1W0 bit is set, bit positions set to 1 in the data byte are programmed to 1 in the EEPROM byte; zeros are not changed. When the W1W0 bit is cleared, bit positions cleared to 0 in the data byte are programmed to 0 in the EEPROM byte; ones are not changed.
The EXE bit initiates EEPROM programming when set and disables programming when cleared. The WPR (1x00h) registers must have the corresponding protection bit cleared or be in the WPO mode to enable a data EEPROM write operation. (To enter the WPO mode, apply 12 volts to the MC pin while the RESET pin is a logic 1.) To load the data byte into the EEPROM module: 1) Perform a memory-write operation to the EEPROM at the desired address. The data byte is latched in the module, ready for the Execute command (EXE bit = 1). To prevent data corruption, ensure that nonmaskable interrupt routines do not access the EEPROM between the EEPROM write instruction and the point when the EXE bit is set to 1. 2) Following the memory cycle to the EEPROM address, write 03h (for W1W0 = 1) or 01h (for W1W0 = 0) to the DEECTL register to set the W1W0 and EXE bits. The W1W0 and the EXE bits must remain unchanged for the duration of the EEPROM timing parameter of tW(PGM)B to ensure proper programming. 3) When the program time has elapsed, reset the EXE bit with another write operation to the DEECTL register. If W1W0 = 1, the data that now resides in the programmed EEPROM location is the logical OR of the previous data stored in the location and the data written to the location. If W1W0 = 0, the data that now resides in the programmed EEPROM location is the logical AND of the previous data stored in the location and the data written to the location.
6-6
Programming the Data EEPROM
If a data value cannot be programmed by writing only ones or zeros, first perform the write-ones operation and follow it with a write-zeros operation (or write zeros followed by write ones). Figure 6-2 illustrates these operations. In the programming operations, only the EEPROM bits that do not match the data bits are programmed. Therefore, there is no need to read the EEPROM value to determine which bits to program.
Figure 6-2. EEPROM Programming Example
Data Byte (5Ah) 0 1 0 1 1 0 1 0
Write Ones (W1W0 = 1)
EEPROM Byte (1F60h)
X
X
X
X
X
X
X
X
Result (Logical OR)
X
1
X
1
1
X
1
X
Data Byte (5Ah)
0
1
0
1
1
0
1
0
Write Zeros (W1W0 = 0)
EEPROM Byte (1F60h)
X
1
X
1
1
X
1
X
Result (Logical AND)
0
1
0
1
1
0
1
0
The software should end the programming operation before entering a halt or standby state. When the microcomputer is in the halt or standby low-power mode, all operations of the data EEPROM module are stopped, and all DEECTL bits are cleared. Any EEPROM programming operation in progress is aborted when the halt is entered, and the data at the address being programmed is indeterminate. The subroutine in Example 6-2 loads the data byte 5Ah into the data EEPROM location 1F60h. Figure 6-2 illustrates the result of this subroutine.
EPROM and EEPROM Modules
6-7
Programming the Data EEPROM
Example 6-2. Data EEPROM Programming
The following subroutine loads the data byte 5Ah into the data EEPROM location 1F60h.
(a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) (n) (o) (p) DATA DINT MOV MOV MOV EINT MOVW INCW JC MOV DINT MOV MOV MOV EINT MOVW INCW JC MOV . . . #5Ah,A A,&1F60h #03,P01A ; Disable all interrupts ; Write 5A to location 1F60h
DELAY1
DELAY2
; Write Ones: W1W0=1, EXE=1 ; Enable all interrupts #2778,R017 ; Begin tW(PGM)B delay (10 ms) #-1,R017 ; Decrement R017 DELAY1 ; Jump to DELAY1 if R017>0 #0,P01A ; Clear DEECTL. EXE=0 ; Disable all interrupts #5Ah,A ; Write 5A to location 1F60h A,&1F60h #01,P01A ; Write zeros: W1W0=0 EXE=1 ; Enable all interrupts #2778,R017 ; Begin tW(PGM)B delay (10 ms) #-1,R017 ; Decrement R017 DELAY2 ; Jump to DELAY2 if R017>0 #0,P01A ; Clear DEECTL. EXE=0
-
Disable all interrupts. When programming the data EEPROM, you must ensure that nonmaskable interrupt routines do not access the EEPROM between an EEPROM write instruction and the point when the EXE bit is set to 1 (steps a and i in Example 6-2), or data will be corrupted. Load the value 5Ah into the data EEPROM address 1F60h (step b). Begin a write-ones programming sequence (step c) by setting the W1W0 and EXE bits in the DEECTL register to a 1. Re-enable all interrupts (step d). The programming delay parameter, tW(PGM)B, (10 ms for this example--see Chapter 18, Electrical Specifications and Timings, for the required timing) is taken care of with a delay loop (steps f and g).
6-8
Programming the Data EEPROM
-
The number of loops required is 2778 (step e) and is derived in the following manner:
J J J
The delay loop (steps f and g) requires 18 SYSCLK cycles to complete if a jump is taken. An operating frequency of 5-MHz SYSCLK results in a system cycle time of 200 ns. The number of loops required is calculated as follows: loop count = tW(PGM)B / (system cycle time x delay loop cycle count) loop count = 10 ms / (200 ns x 18) = 10 ms / 3.6 s = 2778 Note: As an alternative, a timer can be used for this delay.
-
After the delay, clear the EXE bit (step h), re-enable all interrupts, and continue the write-zeros routine (steps i through p). The value 5Ah has now been programmed into location 1F60h of the data EEPROM.
-
Following an EEPROM write operation, the EEPROM voltage must stabilize before an EEPROM read operation is performed. The BUSY flag indicates the status of the EEPROM voltage. When BUSY is set, the EEPROM is not ready for a read operation. The BUSY flag is cleared to zero (0) by the EEPROM control logic when 128 system clock cycles have elapsed following the time that the EXE bit is cleared to 0.The BUSY bit remains set for 128 SYSCLK cycles: After a reset, After exit from a low-power mode, and After programming the EEPROM.
If an attempt is made to access the EEPROM during this 128 SYSCLK cycle period, the data EEPROM holds execution of the processor by asserting the WAIT signal until the 128 SYSCLK cycles are completed.
To prevent data corruption of the read or write EEPROM location, do not access EEPROM locations between writing data to the EEPROM address and setting the EXE bit to 1. In addition, you should disable interrupts during this time.
EPROM and EEPROM Modules
6-9
Program EPROM Modules
6.4
Program EPROM Modules
The program EPROM modules used in the TMS370 family replace the 2K- and 48K-byte program ROM within the TMS370 families for system prototypes or small production runs. The CPU can fetch data and execute instructions from these memory spaces. These modules consist of either an 8K-byte array or a 16K-byte array of EPROM. The following describes each EPROM device by total memory size:
-
8K- or 16K-byte EPROM devices Address area: 8K-byte array: 6000h - 7FFFh 16K-byte array: 4000h - 7FFFh Arrays controlled by register EPCTLM (address 101Ch, P01C)
J
-
J J
H H
24K-byte EPROM device (one 16K- and one 8K-byte array of EPROM) Address area: First 16K-byte array: 2000h - 5FFFh Next 8K-byte array: 6000h - 7FFFh Arrays controlled by: First 16K-byte array: register EPCTLL (address 101Eh, P01E) Next 8K-byte array: register EPCTLM (address 101Ch, P01C)
-
H H J H H
J
32K-byte EPROM device (two 16K-byte arrays of EPROM) Address area: First 16K-byte array: 2000h - 5FFFh Second 16K-byte array: 6000h - 9FFFh Arrays controlled by: First 16K-byte array: register EPCTLL (address 101Eh, P01E) Second 16K-byte array: register EPCTLM (address 101Ch, P01C)
H H J H H
Note:
EPCTLx Register Differs According to Device
The EPCTLL and EPCTLM registers operate differently for TMS370C758, TMS370C758A, and TMS370C758B. Refer to Section A.7 on page A-7.
-
48K-byte EPROM device (three 16K-byte arrays of EPROM) Address area: First 16K-byte array: 2000h - 5FFFh Second 16K-byte array: 6000h - 9FFFh Third 16K-byte array: A000h - DFFFh
J
H H H
6-10
Program EPROM Modules
J
Arrays are controlled by: H First 16K-byte array: register EPCTLL (address 101Eh, P01E) H Second 16K-byte array: register EPCTLM (address 101Ch, P01C) H Third 16K-byte array: register EPCTLH (address 1014h, P014)
Table 6-1 is a summary of the memory addresses and corresponding control registers for each EPROM size. The CPU accesses the arrays with normal memory read cycles. Write cycles to the program EPROM require a special sequence of events. This sequence is described in subsection 6.4.3, Programming the Program EPROM, page 6-13. An external voltage supply is needed at the MC pin to provide the necessary VPP for programming. The EPCTLL, EPCTLM, and EPCTLH registers in the peripheral file control the programming.
Table 6-1. EPROM Memory Map Summary
Device Parameter EPROM Size Memory Mapped '370C7x2 8K bytes 8K 6000h- 7FFFh '370C7x6 16K bytes 16K 4000h- 7FFFh '370C7x7 24K bytes 16K 2000h- 5FFFh 8K 6000h- 7FFFh EPCTLM P01C '370C7x8 32K bytes First 16K 2000h- 5FFFh EPCTLL P01E Second 16K 6000h- 9FFFh EPCTLM P01C First 16K 2000h- 5FFFh EPCTLL P01E '370C7x9 48K bytes Second 16K 6000h- 9FFFh EPCTLM P01C Third 16K A000h- DFFFh EPCTLH P014
Control EPCTLM EPCTLM EPCTLL Registers P01C P01C P01E Program EPROM control register--low array Program EPROM control register--middle array Program EPROM control register--high array
6.4.1
Erasing the EPROM
Before programming (windowed versions), the EPROM module is erased by exposing the device through the transparent window to high-intensity ultraviolet (UV) light (wavelength of 2537 angstroms). The recommended minimum exposure dose (UV intensity exposure time) is 15 watt-seconds per square centimeter. A typical 12 milliwatt-per-square-centimeter, filterless UV lamp will erase the device in 21 minutes. The lamp should be located about 2.5 centimeters above the chip during erasure. After erasure, the entire array is at logic 1 state. A programmed 0 can be erased to 1 only by exposure to ultraviolet light. Note that normal ambient light contains the correct wavelength for erasure. Therefore, when using a programmed device, you should cover the window with an opaque label. All devices are erased to a logical 1 at the factory.
EPROM and EEPROM Modules
6-11
Program EPROM Modules
Exposing the EPROM module to the ultraviolet light may also cause erasure in any EEPROM module. Any useful data stored in the EEPROM must be reprogrammed after exposure to UV light.
6.4.2
Program EPROM Control Register (EPCTLx)
The EPCTLL, EPCTLM, or EPCTLH (collectively referred to as "EPCTLx" in section 6.4.3) registers at addresses 101Eh, 101Ch, or 1014h, respectively, in the peripheral file control the programming of the program EPROM.
Program EPROM Control Register (EPCTLx) [Memory Addresses 101Eh, 101Ch, or 104Eh]
Bit #
P01C, P01E or P014
7
BUSY R-0
6
VPPS RW-0
5
--
4
--
3
--
2
--
1
W0 RW-0
0
EXE RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
BUSY. This bit reflects the value of the EXE bit.
Bit 6
VPPS. This bit determines whether the programming voltage (VPP) at the MC pin is connected to the EPROM module. 0 = Disables programming 1 = Enables programming
Bit 5-2 Bit 1
Reserved. Read data is indeterminate. W0. Write 0. This bit determines whether the programming of the zero bits (in the byte written) is enabled. 0 = Enables programming of 0 bits 1 = Disables programming of 0 bits
Bit 0
EXE. Execute. This bit initiates the write operation defined by the other control register bits. When cleared, this bit terminates the operation. 0 = Inactive 1 = Active
6-12
Program EPROM Modules
6.4.3
Programming the Program EPROM
Programming zero (0) to the EPROM is controlled by the EPCTLx register via the EXE bit and the VPPS bit.
-
The EXE bit initiates EPROM programming when set and disables programming when cleared. The VPPS bit connects the programming voltage (VPP) at the MC pin to the EPROM module.
VPPS (EPCTLx.6) and EXE (EPCTLx.0) should be set separately, and the VPPS bit should be set at least two microseconds before the EXE bit is set. After programming, the application should wait for four microseconds before any read attempt is made. Perform the programming operation (see Figure 6-3 on page 6-14) in the following sequence: 1) Supply the programming voltage to the MC pin. 2) Set (to 1) bit EPCTLx.6 (VPPS). 3) Write to the target EPROM location. 4) Set bit EPCTLx.0 (EXE). Wait at least two microseconds after step 2. 5) Wait for program time to elapse (250 microsecond). 6) Clear bit EPCTLx.0. Leave VPPS set to 1. 7) Read the byte being programmed; if the correct data is not read, repeat steps 4 through 6 for count (a number of) times to a maximum of 25. 8) Set bit EPCTLx.0 for final programming. 9) Wait for the program time to elapse (2 times count duration). 10) Clear bits EPCTLx.0 and EPCTLx.6.
EPROM and EEPROM Modules
6-13
Program EPROM Modules
Figure 6-3. EPROM Programming Operation
Start
VCC = 6 V MC = 13.2 V
Write to EPCTLx; set both VPPS and EXE bits to 1 Wait for 250 s
Count = 0
Write to EPCTL; clear EXE bit Write to EPCTLx; Set VPPS to 1 Increment Count Write to EPROM location
Count = 25?
Yes
No
Not OK Verify EPROM data OK Program the byte for count x 250 s
Clear both EXE and VPPS Note: VPPS and EXE are bits 6 and 0, respectively, of registers EPCTLx.
Programming operations require an external power supply at VPP (13.2 V), IPP (30 mA). Programming voltage (VPP) is supplied via the MC pin. This also automatically puts the microcontroller in the write protection override (WPO) mode. Programming voltage can be applied via the MC pin anytime after the RESET signal goes inactive high, and the MC pin can remain at VPP after programming (after the EXE bit is cleared). Applying programming voltage while RESET is active will set the microcontroller to reserved mode, where programming operations are inhibited.
6-14
Program EPROM Modules
6.4.4
Write Protection of the Program EPROM
To override the EPROM write protection, the VPP must be applied to the MC pin, and the VPPS bit (EPCTL.6) must be set. This dual requirement ensures that the program EPROM is not accidentally overwritten during data EEPROM operations when VPP is applied to the MC pin. Data EEPROM can be programmed when the VPPS bit is set.
EPROM and EEPROM Modules
6-15
6-16
Running Title--Attribute Reference
Chapter 7
Timer 1 (T1) Module
This chapter discusses the architecture and programming of the T1 module and covers the following topics:
Topic
7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9
Page
T1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 General-Purpose Timer Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Operating Modes of the General-Purpose Timer . . . . . . . . . . . . . . . . 7-10 Edge-Detection Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Clock Prescaler/External Clock Source . . . . . . . . . . . . . . . . . . . . . . . . 7-16 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20 WD Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-29 T1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-30
Chapter Title--Attribute Reference
7-1
T1 Overview
7.1
T1 Overview
The T1 module of the TMS370 family provides enhanced timer resources to perform realtime system control. This module contains a general-purpose timer and a watchdog (WD) timer. Both timers allow the program selection of input clock sources (realtime, external event, or pulse accumulate) with multiple 16-bit registers (input capture and compare) for special timer function control. Table 7-1 shows timer solutions for different system requirements.
Table 7-1. Timer-System Solutions
Requirement Realtime system control Input pulse-width measurement External event synchronization Timer output control PWM output control System integrity Timer Solution Interval timers with interrupts Pulse accumulate or input capture functions Event count function Compare function PWM output function WD function
7.1.1
Physical Description
The T1 module, shown in Figure 7-1, has the following components:
-
A 16-bit general-purpose timer that provides capture, compare, and event functions.
J J J
The capture function latches the counter value to the occurrence of an external input. The event function keeps a cumulative total of the transitions on the T1EVT pin. The compare function triggers when the counter matches the contents of a compare register.
7-2
A 16-bit WD timer that software can reconfigure as a simple counter/timer, an event counter, or a pulse accumulator if the WD feature is not needed. A prescaler/clock source that determines the independent clock sources for the general-purpose timer and for the WD timer. A selectable edge-detection circuitry that senses active transitions on the T1IC/CR pin.
T1 Overview
-
Interrupts The module can be programmed to issue interrupts on the occurrence of the following:
-
J J J J
A capture A compare equal A counter overflow An external edge detect
I/O pins The T1 module has three I/O pins that can be dedicated for counter functions or as general-purpose I/O pins. These are as follows:
J J J
T1EVT, an input to the event counter or the external clock source T1IC/CR, an input to the input capture, counter reset, or PWM circuit T1PWM, the PWM output
Table 7-2 on page 7-4 shows the definitions of these pins, according to operating mode.
Timer 1 (T1) Module
7-3
T1 Overview
Figure 7-1. T1 Block Diagram
External pin connections
T1IC/CR
Edge select
16-bit capt/comp register
External pin connection
MUX
16-bit counter
16
PWM toggle
T1PWM
T1EVT
8-bit prescaler
16-bit compare register
Interrupt logic
MUX
16-bit WD counter (aux. timer)
Interrupt logic
Table 7-2. T1 I/O Pin Definitions
Pin T1IC/CR T1PWM T1EVT Dual Compare Mode Counter reset input PWM output External event input or pulse accumulate input Capture/Compare Mode Input capture 1 input PWM output External event input or pulse accumulate input
7.1.2
Operating Modes
The general-purpose T1 module has the following two modes of operation:
-
Dual compare mode. The timer is configured to provide two compare registers, an external or software timer reset, an internal or external clock source, and a programmable pulse-width modulated (PWM) output. The PWM output can be configured to toggle on specified events. Capture/compare mode. The timer is configured to provide one input capture register and one compare register for use with the general-purpose timer. The compare register can be used to provide periodic interrupts to the TMS370 CPU. The capture register can be configured to capture the current timer value upon either edge of an external input.
7-4
T1 Overview
7.1.3
Control Registers
The T1 control registers are located at addresses 1040h to 104Fh and occupy peripheral file frame 4. The function of each location is shown in Table 7-3.
Table 7-3. T1 and WD Timer Memory Map
Peripheral File Location P040 P041 P042 P043 P044 P045 P046 P047 P048 P049 P04A P04B P04C P04D P04E P04F Symbol T1CNTR T1C T1CC WDCNTR WDRST T1CTL1 T1CTL2 T1CTL3 T1CTL4 T1PC1 T1PC2 T1PRI Name T1 Counter -- MSbyte T1 Counter -- LSbyte Compare Register -- MSbyte Compare Register -- LSbyte Capture/Compare Register -- MSbyte Capture/Compare Register -- LSbyte WD Counter -- MSbyte WD Counter -- LSbyte WD Reset Key T1 Control Register 1 T1 Control Register 2 T1 Control Register 3 T1 Control Register 4 T1 Port Control Register 1 T1 Port Control Register 2 T1 Interrupt Priority Control Register Description 16-bit resettable counter 16-bit compare register 16-bit capture/compare register 16-bit WD counter Resets the WD timer. Controls the prescaler inputs to the WD timer and to the general-purpose timer. Controls the T1 and WD overflow interrupts and contains the T1 software reset bit. Controls the edge-detect and compare interrupts. Controls the mode of operation and various functions of the T1 input and output pins. Controls the I/O functions of the T1 module and T1EVT pin. Controls the I/O functions of the T1 module, T1IC/CR pin, and T1PWM pin. Controls the level of the T1 interrupt.
Timer 1 (T1) Module
7-5
General-Purpose Timer Components
7.2 General-Purpose Timer Components
The general-purpose timer uses a 16-bit counter, a compare register, and a capture/compare register to provide event, compare, and capture functions.
7.2.1
16-Bit Resettable Counter
The free-running, 16-bit counter (T1CNTR) is clocked by the output of the prescaler/clock source. The program can access the 16-bit counter at P040 (T1 counter MSbyte) and P041 (T1 counter LSbyte) in peripheral file frame 4.
-
During initialization, the counter is loaded with the value 0000h and begins its count. If the counter is not reset before reaching FFFFh, the counter rolls over to 0000h and continues counting. Upon counter rollover, the T1 OVRFL INT FLAG bit (T1CTL2.3) is set, and a timer interrupt is generated if the T1 OVRFL INT ENA bit (T1CTL2.4) is set. During counting, the counter can be reset to 0000h by any of the following:
J J J J
A 1 written to the T1 SW RESET bit (T1CTL2.0) A compare equal condition from the dedicated T1 compare function A system reset An external pulse on the T1IC/CR pin (dual compare mode only) if the T1CR RST ENA bit (T1CTL4.1) is set to a 1.
You can select the external-transition direction on the T1IC/CR pin, low-to-high or high-to-low, to reset the counter. To do this, use the T1EDGE POLARITY bit (T1CTL4.2). Special circuitry prevents the contents of the T1CNTR register from changing in the middle of a 16-bit read operation. See the note in Section 7.9 on page 7-30.
7.2.2
Compare Register
The compare register circuit consists of a 16-bit wide, read/write data register (T1C) and logic to compare the counter's current value with the value stored in the compare register. The program can access the 16-bit compare register at P042 (compare register MSbyte) and P043 (compare register LSbyte) in peripheral file frame 4.
7-6
General-Purpose Timer Components
When the counter's value matches the compare register value, then the circuit performs the following actions:
-
Sets the T1C1 INT FLAG bit (T1CTL3.5) to 1. Clocks the output latch to toggle the T1PWM output pin if the T1C1 OUT ENA bit (T1CTL4.6) is set. Generates a T1 interrupt if the T1C1 INT ENA bit (T1CTL3.0) is set. Resets the counter if the T1C1 RST ENA bit (T1CTL4.4) is set (dual compare mode only).
The compare register is initialized to 0000h following a reset. Special circuitry prevents the contents of the T1C register from changing in the middle of a 16-bit read operation. See the note in Section 7.9 on page 7-30. Note: If the counter is programmed to reset when its value equals the contents of the compare register, the reset occurs on the following counter clock cycle (after a prescale). However, the compare flag is set and the interrupt event occurs during the clock cycle that incremented the counter to equal the compare-equal value. As a result, there could be a delay of up to 256 system clock cycles (depending on the prescale tap in use) from the time that the event is recognized by the program until the counter actually resets to zero. If the program writes to the compare register during this interval, the counter cannot be reset during the following counter clock cycle. The compare register value required for a specific timing application can be calculated using the following formula: t Compare Value = PS x 1 SYSCLK -1
where: t= SYSCLK = = PS = desired timer compare period (seconds) CLKIN/4 for divide-by-4 (external clock frequency) CLKIN/1 for divide-by-1 clock 1, 4, 16, 64, or 256, depending on the prescale tap selected
Table 7-4 provides some sample compare register values to achieve the various desired timings using a 5 MHz SYSCLK.
Timer 1 (T1) Module
7-7
General-Purpose Timer Components
Table 7-4. T1 Compare Values: (5 MHz SYSCLK)
Time Seconds 0.0005 0.001 0.002 0.005 0.01 0.02 0.05 0.1 0.2 0.5 1.0 2.0 3.0 mSeconds 0.5 1 2 5 10 20 50 100 200 500 1000 2000 3000 Prescale None None None None None /4 /4 /16 /16 /64 /256 /256 /256 T1 Compare Register Value (N) Decimal 2499 4999 9999 24999 49999 24999 62499 31249 62499 39062 19530 39061 58593 Hex 009C3h 01387h 0270Fh 061A7h 0C34Fh 061A7h 0F423h 07A11h 0F423h 09896h 04C4Ah 09895h 0E4E1h Percent Error (See Note) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.001 0.001
Note: Percent of error induced by the T1 formula. This error margin varies, depending on the desired timer compare period and the minimum timer resolution (PS x (1/SYSCLK)).
7.2.3
Capture/Compare Register
The 16-bit wide capture/compare register (T1CC) serves one of two functions, depending on the operating mode. The T1CC register is located at P044 (capture/compare register MSbyte) and P045 (capture/compare register LSbyte) in peripheral file frame 4. Special circuitry prevents the contents of the T1CC register from changing in the middle of a 16-bit read operation. See the note in Section 7.9 on page 7-30.
7.2.3.1
Dual Compare Mode
In the dual compare mode, the T1CC register acts as a read/write compare register. It functions exactly like the compare register described in subsection 7.2.2 except that T1CC cannot reset the counter. When the counter value matches the capture/compare register value, the circuit performs the following:
7-8
Sets the T1C2 INT FLAG bit (T1CTL3.6) to 1. Clocks the output latch to toggle the T1PWM output pin if the T1C2 OUT ENA bit (T1CTL4.5) is set. Generates a T1 interrupt if the T1C2 INT ENA bit (T1CTL3.1) is set.
General-Purpose Timer Components
7.2.3.2
Capture/Compare Mode
In the capture/compare mode, the edge detection signal captures the current counter content, loads it into the T1CC register, and sets the T1EDGE INT FLAG bit (T1CTL3.7).
Timer 1 (T1) Module
7-9
Operating Modes of the General-Purpose Timer
7.3 Operating Modes of the General-Purpose Timer
The operating mode of the T1 general-purpose timer determines whether the capture/compare register functions as a capture register in the capture/ compare mode or as a compare register in the dual compare mode. The T1 MODE bit (T1CTL4.7) selects the mode as follows: T1 MODE = 0 = dual compare mode T1 MODE = 1 = capture/compare mode
7.3.1
Dual Compare Mode
The dual compare mode provides the following:
-
A 16-bit compare register (called compare 1) A 16-bit capture/compare register that acts as a compare register (called compare 2) A 16-bit external, resettable counter A timer output pin
These components allow the timer to act as an interval timer, a PWM output, simple output toggle, or to perform other timer functions. The dual compare mode is shown in Figure 7-2. The dual compare mode continuously compares the contents of the two compare registers to the current value of the 16-bit counter.
-
If the compare 1 register equals the counter, the circuit conducts the following:
J J J J
Sets the T1C1 INT FLAG bit (T1CTL3.5) to 1. Clocks the output latch to toggle the T1PWM output pin if the T1C1 OUT ENA bit (T1CTL4.6) is set. Generates a timer 1 interrupt if the T1C1 INT ENA bit (T1CTL3.0) is set. Initiates a counter reset if the T1C1 RST ENA bit (T1CTL4.4) is set.
Additionally, you can program an interval timer function by using the compare-equal condition to generate a system interrupt combined with the counter reset function.
7-10
Operating Modes of the General-Purpose Timer
-
If the compare 2 register equals the counter, then the circuit conducts the following:
J J J
Sets the T1C2 INT FLAG bit (T1CTL3.6) to 1. Clocks the output latch to toggle the T1PWM output pin if the T1C2 OUT ENA bit (T1CTL4.5) is set. Generates a T1 interrupt if the T1C2 INT ENA bit (T1CTL3.1) is set.
The compare 2 register can be used as an additional system timing function.
Figure 7-2. Dual Compare Mode
T1CC.15-0
16-bit LSB capture/compare register MSB T1C2 INT FLAG
Prescaler clock source
T1CTL3.6 T1CTL3.1 T1C2 INT ENA
Output enable
T1CNTR.15-0
LSB MSB 16-bit counter Reset T1C1 RST ENA
Compare= 16 Compare=
T1CTL4.5
T1C2 OUT ENA Toggle 1 Level 2 Int
External pin connection
T1PC2.7-4
T1PWM
T1C1 INT FLAG T1CTL3.5
T1CTL4.6
T1C1 OUT ENA
T1C.15-0
16-bit LSB compare register MSB
T1CTL3.0 T1C1 INT ENA
T1CTL4.3
T1CR OUT ENA
External pin connection
T1CTL2.0 T1 SW RESET
T1CTL4.4
T1PC2.3-0
T1IC/CR
T1CTL4.1 T1CR RST ENA
Edge select
T1 OVRFL INT FLAG T1CTL2.3
T1CTL2.4 T1 OVRFL INT ENA
T1EDGE INT FLAG
T1 PRIORITY T1PRI.6 Level 1 Int 0
T1CTL4.0 T1EDGE DET ENA T1CTL4.2 T1EDGE POLARITY
T1CTL3.7 T1CTL3.2 T1EDGE INT ENA
Note:
The annotations on this diagram identify the register and the bit(s) in the peripheral frame. For example, the actual address of T1CTL2.0 is 104Ah, bit 0, in the T1CTL2 register.
Timer 1 (T1) Module
7-11
Operating Modes of the General-Purpose Timer
7.3.1.1
PWM Applications
Either compare register can be used to toggle the T1PWM output pin when a compare-equal condition occurs. Using both compare registers to control the T1PWM pin allows direct PWM generation with minimal CPU software overhead. In typical PWM applications, the compare registers are loaded as follows:
-
The compare 1 register is loaded with the periodic interval and configured to allow a counter reset on a compare-equal condition. The compare 2 (capture/compare) register is loaded with the pulse width to be generated within that interval. The program pulse width can be changed by the application program during the timer operation to alter the PWM output. For high-speed control applications, a minimum pulse width of 200 ns and a period as low as 400 ns can be maintained when a 5-MHz SYSCLK is used.
7.3.1.2
The PWM output can be used to support time-critical control applications. In these applications, an external input (T1IC/CR) is typically used to: Reset the counter. Generate a timer interrupt. Toggle the T1PWM pin to start the PWM output.
The compare function then toggles the output after the programmed pulse width has elapsed.
Input Edge Detect
The input edge detect function is enabled under program control by the T1EDGE DET ENA bit (T1CTL4.0); upon the next occurrence of the selected edge transition, the following occurs:
-
The T1EDGE INT FLAG bit (T1CTL3.7) is set. A timer interrupt is generated (if T1EDGE INT ENA = 1). The T1PWM output pin is toggled (if T1CR OUT ENA = 1).
The T1EDGE POLARITY bit (T1CTL4.2) selects the active input transition. In the dual compare mode, the edge detect function must be re-enabled after each valid edge detect.
7-12
Operating Modes of the General-Purpose Timer
7.3.1.3
Clock Input
The clock input to the 16-bit counter (T1CNTR) is either the internal system clock, with or without prescale, or the external clock (T1EVT). The clock pulse to the counter is always synchronized with the system clock. The counter (T1CNTR) is free-running except when it receives a reset pulse from one of the following sources:
-
A 1 written to the T1 SW RESET (T1CTL2.0) bit A compare equal condition from the dedicated T1 compare function A system reset An external pulse on the T1IC/CR pin (dual compare mode)
The counter rolls over to 0000h if it is not reset before a count of FFFFh. When this rollover occurs, the counter sets the T1 OVRFL INT FLAG (T1CTL2.3), generates an interrupt if the T1 OVRFL INT ENA bit (T1CTL2.4) is set, and continues counting.
7.3.2
Capture/Compare Mode
In the capture/compare mode, T1 provides the following:
-
A 16-bit input capture register for external timing and pulse-width measurement. A 16-bit compare register for use as a programmable interval timer. This register functions the same as compare 1 does in the dual compare mode described in subsection 7.3.1, including the ability to toggle the PWM pin.
The capture/compare mode is shown in Figure 7-3.
Timer 1 (T1) Module
7-13
Operating Modes of the General-Purpose Timer
Figure 7-3. Capture/Compare Mode
T1CC.15-0
Toggle LSB 16-bit capture/compare MSB register T1C1 OUT ENA
External pin connection
T1PC2.7-4
T1PWM
Prescaler clock source
T1CTL4.6
T1CNTR.15-0
LSB MSB 16-bit counter 16 T1C1 INT FLAG Compare= Reset
T1 PRIORITY
T1CTL3.5 T1CTL3.0
T1C.15-0
T1 SW RESET T1C1 T1CTL2.0 RST ENA 16-bit LSB compare register MSB
T1C1 INT ENA
T1 OVRFL INT FLAG
T1CTL4.4
External pin connection
T1CTL2.3 T1CTL2.4
T1 OVRFL INT ENA T1EDGE DET ENA T1EDGE INT FLAG
T1PC2.3-0
T1IC/CR Edge select
T1CTL3.7 T1CTL4.0 T1CTL3.2 T1CTL4.2
T1EDGE POLARITY T1EDGE INT ENA
On the occurrence of valid input on the T1IC/CR pin, the following occurs:
-
The current counter value is loaded into the 16-bit input capture register. The T1EDGE INT FLAG bit (T1CTL3.7) is set. If T1EDGE INT ENA bit (T1CTL3.2) is set, a timer interrupt is generated.
The input detect function is enabled by the T1EDGE DET ENA bit (T1CTL4.0), with the T1EDGE POLARITY bit (T1CTL4.2) selecting the active input transition. In the capture/compare mode, the edge detect function, once enabled, remains enabled following a valid edge detect.
7-14
IIII
Level 1 Int 0 1 Level 2 Int
T1PRI.6
Edge-Detection Circuitry
7.4 Edge-Detection Circuitry
The edge detection circuitry senses active transitions on the T1 input capture/ counter reset pin (T1IC/CR). The T1EDGE POLARITY bit (T1CTL4.2) determines whether the active transition is low-to-high or high-to-low. The module sets the T1EDGE INT FLAG (T1CTL3.7) when an active transition is detected. The program must reset this flag.
7.4.1
Dual Compare Mode
In this mode, the program must set the T1EDGE DET ENA bit (T1CTL4.0) to re-enable the circuit after each edge detection. Writing a 1 to this bit enables the detect circuit to look for the next correct level transition. After this active transition occurs, the T1EDGE DET ENA bit is cleared. When the edge detection circuit is enabled and detects the appropriate edge transition, the T1EDGE INT FLAG bit (T1CTL3.7) is set. When the T1CR RST ENA bit (T1CTL4.1) is set, the selected edge resets the counter. If the T1CR OUT ENA bit (T1CTL4.3) is set, the selected edge toggles the T1PWM output latch. The T1EDGE POLARITY bit (T1CTL4.2) determines which edge polarity (rising or falling) is detected.
7.4.2
Capture/Compare Mode
When the appropriate (rising or falling) transition is detected, the edge detection circuit signals the capture register to load the current counter value if the T1 EDGE DET ENA bit is set. The T1EDGE POLARITY bit determines which edge of the signal on the T1IC/CR pin to detect. The input detect function is enabled by the T1EDGE DET ENA bit, with T1EDGE POLARITY selecting the active input transition. In the capture/ compare mode, the edge detect function, once enabled, remains enabled following a valid edge detect.
Timer 1 (T1) Module
7-15
Clock Prescaler / External Clock Source
7.5 Clock Prescaler/External Clock Source
A prescaler is a circuit that slows the rate of a clocking source to a counter. This block, illustrated in Figure 7-4, allows the selection of the clock inputs (sources) to the general-purpose counter and to the WD counter independently. Each counter has three bits in the T1CTL1 register (see subsection 7.9.1, page 7-32) that determine whether the counter is clocked by one of the prescaled system clock values or by the external clock source (T1EVT).
Figure 7-4. T1 System Clock Prescaler
Event
Accumulation General-purpose counter clock Frequency (SYSCLK)
External pin connection
4
16
64
256 T1 Select
Prescaler WD Select 4 16 64 256
T1EVT
SYNC WD counter clock
Accumulation Event
For the hard WD configuration of the mask-ROM device, the clock source comes only from one of the four taps from the prescaler that provide a system clock divided by 4, 16, 64, or 256.
The counter clock sources can be any of the following:
7-16
A system clock with no prescale No clock (the counter is stopped) An external source that is synchronized with the system clock (event counter operation) A system clock while the external input is high (pulse accumulation) One of four taps from the prescaler that provide a system clock divided by 4, 16, 64, or 256
Clock Prescaler / External Clock Source
The external clock input to the module (T1EVT) must not exceed SYSCLK/2. If the application does not require the external clock, the T1EVT pin can be reconfigured as a digital I/O pin. The event input is not routed through the prescaler, so the T1 module can use different taps of the prescaler for T1 and the WD timer. The maximum counter duration when the internal clock is used is determined by the internal system clock time (SYSCLK) and the prescale tap. These relationships are shown below: Maximum Counter Duration (seconds) Counter Resolution where: SYSCLK PS = = = = = = = = = 216 x PS x (1/SYSCLK) PS x (1/SYSCLK) CLKIN/4 for divide-by-4 clock CLKIN/1 for divide-by-1 clock 1 for no prescale 4 for divide by 4 16 for divide by 16 64 for divide by 64 256 for divide by 256
Table 7-5 gives the real-time counter overflow rates for various crystal and prescaler values. Software can configure the overflow rates for the WD counter as shown in Table 7-5 or as the value shown divided by two if the WD OVRFL TAP SEL bit (T1CTL1.7) is set (see Section 7.7 on page 7-21). This bit configures the WD counter as either a 15-bit counter when set or a 16-bit counter when cleared.
Timer 1 (T1) Module
7-17
Clock Prescaler / External Clock Source
Table 7-5. Counter Overflow Rates
SYSCLK Frequency (MHz) 0.5 Register T1CTL1 Bits SELECT2 0 0 0 0 1 1 1 1 SELECT1 0 0 1 1 0 0 1 1 SELECT0 0 1 0 1 0 1 0 1 Divide By 216 (P.A.) (Event) (Stop) 218 220 222 224 2000 0.131 0.524 2.10 8.39 33.6 1 2.5 5
System Clock Period (ns) 1000 0.066 0.262 1.05 4.19 16.8 400 0.026 0.105 0.419 1.68 6.71 200 0.013 0.052 0.210 0.839 3.355
Time is given in seconds. Not applicable. Divide-by-1 clock can operate only from a minimum of 2 MHz SYSCLK to a maximum of 5 MHz SYSCLK.
7.5.1
Event Counter Mode
When you use the event counter clock source, the 16-bit counter is programmable as a 16-bit event counter. An external high-to-low transition on the T1EVT pin provides the clock for the internal timer.
7.5.2
Pulse Accumulator Mode
When you use the pulse accumulator clock source, the 16-bit counter is programmable as a 16-bit pulse accumulator. An external input on the T1EVT pin is used to gate the internal system clock to the internal timers. While T1EVT input is logic one (high), the timer is clocked at the system clock rate and counts system clock pulses until the T1EVT pin returns to logic zero. The pulse accumulator mode keeps a cumulative count of SYSCLK pulses gated by the T1EVT signal as shown in Figure 7-5.
7-18
Clock Prescaler / External Clock Source
Figure 7-5. Pulse Accumulation
T1EVT
SYSCLK
Counter Value
Timer 1 (T1) Module
7-19
Interrupts
7.6 Interrupts
In dual compare mode, any of the following four separate events can generate an interrupt:
-
Compare equal from compare register 2 if the T1C2 INT ENA bit (T1CTL3.1) is set Compare equal from compare register 1 if the T1C1 INT ENA bit (T1CTL3.0) is set Counter overflow if the T1 OVRFL INT ENA bit (T1CTL2.4) is set Edge detect is set if the T1EDGE INT ENA bit (T1CTL3.2) is set
In the capture/compare mode, any of the following three separate events can generate an interrupt: Compare equal if the T1C1 INT ENA bit (T1CTL3.0) is set Counter overflow if the T1 OVRFL INT ENA bit (T1CTL2.4) is set Input capture acknowledge if the T1EDGE INT ENA bit (T1CTL3.2) is set
Note: All set and enabled interrupt flags must be cleared before the processor exits the T1 interrupt routine. If the flags are not reset, the processor enters the T1 interrupt routine again before continuing with the mainstream program. If the flag bits are never reset, the program continually enters the interrupt service routine.
7-20
WD Timer
7.7
WD Timer
The WD timer can be configured as one of the three different mask options.
-
A standard WD (see note below):
J J J
For ROMless devices with revision A: TMS370C1xxA and TMS370C2xxA For Mask-ROM devices with revision A: TMS370C0xxA, TMS370C3xxA, and TMS370C4xxA For EPROM devices with revision A: TMS370C6xxA, TMS370C7xxA, SE370C6xxA, and SE370C7xxA
-
A hard WD (see note below):
J J
For Mask-ROM devices with revision A: TMS370C0xxA, TMS370C3xxA, and TMS370C4xxA For EPROM devices with revision B: TMS370C7xxB and SE370C7xxB
-
A simple counter (see note below) for mask-ROM devices with revision A: TMS370C0xxA, TMS370C3xxA, and TMS370C4xxA Hard WD and Simple Counter Advantages
Note:
The hard WD and simple counter options provide an improvement to the WD counter circuitry: the hard WD option enables the WD counter reset ability at all times and the simple counter option disables the WD counter reset ability at all times. The additional simple counter option is available only on TMS370CxxxA devices. The hard WD option is available on both TMS370CxxxA and TMS370C7xxB devices. Refer to Section A.1, page A-2, for the differences between each TMS370Cxxx device. ROM devices with revision A can be configured with any of the three options listed above. All ROMless devices with revision A are configured as a standard WD. All EPROM devices with revision A are configured as a standard WD, and EPROM devices with revision B are configured as a hard WD. The WD timer, shown in Figure 7-6, consists of the following blocks:
-
A 16-bit, resettable WD/event counter that provides up to 224 clock cycles between counter overflows, depending on the prescaler tap used. The program can read the contents of this counter at locations P046 (WD counter MSbyte) and P047 (WD counter LSbyte) in the peripheral file.
Timer 1 (T1) Module
7-21
WD Timer
Figure 7-6. WD Timer
A prescaled clock input selection or external clock that functions the same as in the general-purpose timer (see Section 7.2, on page 7-6). A WD reset key that is used to reset the WD counter (WDRST-P048). An overflow flag that is set whenever the WD counter overflows.
WDCNTR.15-0
16-bit WD counter Clock prescaler Reset
WD OVRFL INT FLAG
T1CTL2.5
T1CTL1.7
WD OVRFL TAP SEL WD reset key
WDRST.7-0
7-22
WD Timer
7.7.1
Standard WD Configuration
The standard WD can be configured as either a WD or as a simple counter through setting or clearing the WD OVRFL RST ENA bit (T1CTL2.7) in the software. Figure 7-7 illustrates the block diagram of the standard WD.
Figure 7-7. Standard WD Block Diagram
WDCNTR.15-0
16-bit WD counter WD OVRFL INT FLAG
T1CTL2.6
Interrupt WD OVRFL INT ENA
T1CTL2.5
Reset
Clock Prescaler
T1CTL1.7
WD OVRFL TAP SEL WD reset key
T1CTL2.7
System reset WD OVRFL RST ENA
WDRST.7-0
The standard WD can be configured in one of two modes: WD mode or nonWD mode.
7.7.1.1
WD Mode
In the WD mode (WD OVRFL RST ENA = 1), the WD timer generates a system reset if the counter overflows or if the WD counter is reinitialized by an incorrect value; a system reset pulls the RESET pin low for eight system clock cycles. The required reinitialization frequency is determined by the system clock frequency, the prescaler/clock source selected, and whether the WD OVRFL TAP SEL bit (T1CTL1.7) is set for 15- or 16-bit counter rollover. The WD overflow times are the same as those given in Table 7-5, page 7-18, when the timer is configured as a 16-bit counter (WD OVRFL TAP SEL = 0). Divide the times in Table 7-5 in half when the timer is configured as a 15-bit counter (WD OVRFL TAP SEL =1). With a 5-MHz SYSCLK, the WD-counter overflow times range from 6.55 ms to 3.35 seconds. These values are selected before the timer enters the WD mode because once the software enables the WD reset function (WD OVRFL RST ENA = 1), subsequent writes to these control bits are ignored. Writes to these WD control bits can occur only following a reset.
Timer 1 (T1) Module
7-23
WD Timer
To reinitialize the WD counter, write a predefined value to the WD reset key (WDRST) located in the peripheral file at P048. The correct reset key alternates between 55h and AAh, beginning with 55h following the enable of the WD reset function. Writes of the correct values must occur before the timer overflow period. A write of any value other than the correct predefined value to the WD reset key is interpreted as a lost program, and a system reset is initiated. A WDcounter overflow or incorrect reset key sets the WD OVRFL INT FLAG bit (T1CTL2.5) to 1. The program can read this flag after a reset to determine the source of the reset. WD resets are not prevented when the flag is set. Note: A standard WD is disabled in low-power mode (see Section 7.8 on page 7-29). The routine in Example 7-1 initializes the WD in the standard WD mode to generate a system reset when the counter overflows. The watchdog counter is set to 16 bits in length, and the full 8-bit prescale tap is used.
Example 7-1. Standard WD Initialization
. . ;Set up WD timer for a 24-bit countdown time. ; OR #70h,P049 ; Set the WD overflow tap to 16 bits ; and select the /256 prescale value OR #0C0h,P04A ; WD timer reset is enabled along ; with enabling the WD timer ; interrupt. . . The WD timer has now been initialized to cause a system reset if the counter is not reset before reaching FFFFh. To reset the counter, the code must write an alternating 55h and AAh, starting with 55h, to the WD timer reset key register (P048), such as: . . MOV #55h,P048 ; First write to WD RESET KEY . . MOV #0AAh,P048 ; Next write to WD RESET KEY . . MOV #55h,P048 ; Next write to WD RESET KEY . .
7-24
WD Timer
7.7.1.2
Non-WD Mode
In the non-WD mode (WD OVRFL RST ENA bit = 0), the WD counter can be used as an event counter, a pulse accumulator, or an interval timer. In this mode, the system reset function is disabled; to reinitialize the WD counter, write any value to the WD reset key (WDRST). In realtime control applications, the timer overflow rates are determined by the system clock frequency, the prescaler/clock source value selected, and the value of the WD OVRFL TAP SEL bit. If the WD counter is not reset before overflowing, the counter rolls over to either 0000h or 8000h, as determined by the WD OVRFL TAP SEL bit, and continues counting. Upon counter overflow, the WD OVRFL INT FLAG bit is set, and a timer interrupt is generated if the WD OVRFL INT ENA bit is set. Alternately, an external input on the T1EVT pin can be used with the WD timer to provide an additional 16-bit event counter or pulse accumulator.
7.7.2
Hard WD Configuration
In the hard WD configuration, you can operate the WD timer only as a WD. Upon the powerup reset, the hard WD is enabled, and the WD INPUT SELECT0-1 bits (T1CTL1.4-5) are cleared (system clock/4). Figure 7-8 is a block diagram of the hard WD.
Figure 7-8. Hard WD Block Diagram
WDCNTR.15-0
16-bit WD counter WD OVRFL INT FLAG
T1CTL2.5
Reset
Clock prescaler
T1CTL1.7 WD OVRFL TAP SEL
WD reset key
System reset
WDRST.7-0
The hard WD provides additional system integrity. If the counter overflows or if the WD timer is reinitialized by an incorrect value, the hard WD generates a system reset, which pulls the RESET pin low for eight system clock cycles. The required reinitialization frequency is determined by the system clock freTimer 1 (T1) Module
7-25
WD Timer
quency, WD INPUT SELECT0 and 1 (T1CTL1.4 and T1CTL1.5), the prescaler/clock source selected, and whether the WD OVRFL TAP SEL bit is set for 15- or 16-bit counter rollover. The WD INPUT SELECT2 bit (T1CTL1.6) is functionally interpreted as 1 at all times. The WD INPUT SELECT0-1 bits and WD OVRFL TAP SEL bit can be modified at any time. Your program should reinitialize these bits after a reset, and periodically thereafter, to ensure a corrected counter overflow rate and to protect against any hardware or software corruptions. The WD timer is reinitialized by writing a predefined value to the WD reset key (WDRST) located in the peripheral file at P048. The correct reset key alternates between 55h and AAh, beginning with 55h following a system reset. Writes of the correct value must occur before the timer overflow period, or the WD generates a reset. A write to the WD reset key of any value other than the correct predefined value is interpreted as a lost program, and a system reset is initiated. A WD-counter overflow or incorrect reset key sets the WD OVRFL INT FLAG bit (T1CTL2.5) to 1. After a reset, the program can read this flag to determine the source of the reset. WD resets are not prevented when the flag is set. Note: A hard WD is disabled in low-power mode (see Section 7.8 on page 7-29).
7.7.2.1
INT1 Operation During an Inadvertent Low-Power Mode
When the hard WD mask option is selected, INT1 is enabled as a non-maskable interrupt (NMI) during low-power modes. This NMI is generated regardless of the interrupt enable flags and the values of the following status bits: INT1 PRIORITY bit (INT1.1), INT1 ENABLE bit (INT1.0), INT1 NMI bit (SCCR2.1), and the global interrupt enable flags in the status register (IE1 and IE2). INT1 is configured as an NMI in the hard WD to provide a method of exiting a low-power mode. Normally, when the halt or standby mode is entered, the WD counter clock source is disabled, which disables the ability of the WD counter to generate a reset. Note that an active edge on the NMI INT1 pin brings the device out of the low-power mode, and the WD counter is activated. Additionally, if the halt or standby mode is entered while INT1 pin is active (low if the INT1 POLARITY bit is cleared to 0 or high if the INT1 POLARITY bit is set to 1), an NMI is generated immediately.
7-26
WD Timer
7.7.3
Simple Counter Configuration
In the simple counter configuration, the WD timer can be used as an event counter, a pulse accumulator, or an interval timer (similar to the non-WD mode in the standard WD configuration). However, in this configuration, the system reset function of the WD timer is disabled. Figure 7-9 is a block diagram of a simple counter.
Figure 7-9. Simple Counter Block Diagram
WDCNTR.15-0
16-bit WD counter WD OVFL INT FLAG
T1CTL2.6
Interrupt WD OVRFL INT ENA
T1CTL2.5
Reset Clock prescaler
T1CTL1.7 WD OVRFL TAP SEL
WD reset key
WDRST.7-0
To reinitialize the WD counter, write any value to the WD reset key (WDRST). The timer overflow rates are determined by the system clock frequency, the WD INPUT SELECT0-2 bits (T1CTL1.4-6), and the value of the WD OVRFL TAP SEL bit (T1CTL1.7). If the WD OVRFL RST ENA bit is set to 1, subsequent writes to WD INPUT SELECTs and WD OVRFL TAP SEL bits are ignored. Once the WD OVRFL RST ENA bit is set, these control bits can be changed only after a powerup reset.
Timer 1 (T1) Module
7-27
WD Timer
7.7.4
Summary of WD Options
Table 7-6 summarizes the features of each watchdog option and specifies the options available to ROMless, mask-ROM, and EPROM devices.
Table 7-6. WD Option Summary
Standard WD Option WD OVRFL TAP SEL bit and WD INPUT SELECT0-2 bits WD Once the WD OVRFL RST ENA is set, the values of these bits can be changed only after a system reset. Non-WD These bits can be changed at any time, as long as WD OVRFL RST ENA is not set. Hard WD The values of these WD bits can be changed at any time, even if WD OVRFL RST ENA bit is set. However, the WD INPUT SELECT2 bit is not available. Simple Counter Once the WD OVRFL RST ENA is set, the values of these bits can be changed only after a system reset.
Generates an interrupt when the WD counter overflows? Generates a system reset? WD OVRFL RST ENA bit
No
Yes
No
Yes
Yes Select to be a WD. If bit=1, WD counter does initiate a reset upon overflow. This bit is cleared by any system reset.
No Select to be a nonWD. If bit = 0, WD counter does not initiate reset upon overflow.
Yes This bit is ignored.
No If bit=0, WD bits and WD OVRFL TAP SELECT are not locked. If bit=1, WD bits and WD OVRFL TAP SELECT are locked.
INT1 during low-pow- Controlled by INT1 er modes ENABLE bit (INT1.0) and INT1 NMI bit (SCCR2.1). Available Devices All devices
Controlled by INT1 ENABLE bit (INT1.0) and INT1 NMI bit (SCCR2.1). All devices
Enabled as an NMI.
Controlled by INT1 ENABLE bit (INT1.0) and INT1 NMI bit (SCCR2.1). Mask-ROM devices
Mask-ROM and EPROM devices
7-28
Low-Power Modes
7.8
Low-Power Modes
The T1 module supports low-power (powerdown) modes that aid in reducing power consumption during periods of inactivity. These modes are the halt and the standby modes. For more information on low-power modes, see Section 4.2, page 4-7.
7.8.1
Halt Mode
The halt mode is entered when the CPU executes an IDLE instruction while the HALT/STANDBY bit (SCCR2.7) and the PWRDWN/IDLE bit (SCCR2.6) are set (the SCCR2 register is described in detail in subsection 4.3.3, page 4-16). During the halt mode, all T1 module functions (including the WD timer) hold the prehalt status of all other storage elements. The module holds the state of each external pin constant, regardless of whether the pins are used as timer pins or as dedicated I/O pins. That is, inputs remain inputs, output low levels remain low, and output high levels remain high.
7.8.2
Standby Mode
You can put the timer in standby mode by executing an IDLE instruction when the PWRDWN/IDLE (SCCR2.6) bit is set and the HALT/STANDBY bit (SCCR2.7) is cleared. During the standby mode, the WD counter clock input is halted while the rest of the T1 module remains fully functional.
Timer 1 (T1) Module
7-29
T1 Control Registers
7.9
T1 Control Registers
Seven registers control the configuration of T1 global functions, prescale values, WD timing, optional uses for the associated I/O pins, and other counter functions (refer to Figure 7-10). The bits that are shown in shaded boxes are privilege mode bits; that is, they can be written to only in the privilege mode. Note: 16-bit Register Read/Write Protocol
Special circuitry prevents 16-bit registers from changing in the middle of a 16-bit read or write operation. When you read a 16-bit register, read the least significant byte (LSbyte) first to lock in the value, and then read the most significant byte (MSbyte). When you write to a 16-bit register, write the MSbyte first and then write the LSbyte. The register value does not change between reading and writing the bytes when they are done in this order. While you are reading or writing to a 16-bit register, do not read or write from a second 16-bit register within this module until the process is complete with the first register. Otherwise, the correct value for the first register's MSbyte will not be correct. The 16-bit read/write operation actually occurs when you access the LSbyte. In summary, the order of read/write operations is as follows: Read: Write: LSbyte then MSbyte MSbyte then LSbyte
7-30
T1 Control Registers
Figure 7-10. Peripheral File Frame 4: T1 Control Registers
Designation T1CNTR T1CNTR T1C T1C T1CC T1CC WDCNTR WDCNTR WDRST T1CTL1 ADDR 1040h 1041h 1042h 1043h 1044h 1045h 1046h 1047h 1048h 1049h PF P040 P041 P042 P043 P044 P045 P046 P047 P048 P049
Bit 7
Bit 15 Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 7 WD OVRFL TAP SEL (RP-0) WD OVRFL RST ENA (RS-0)
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Bit 8 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 Bit 0
T1 Counter MSbyte T1 Counter LSbyte Compare Register MSbyte Compare Register LSbyte Capture/Compare Register MSbyte Capture/Compare Register LSbyte WD Counter MSbyte WD Counter LSbyte WD Reset Key WD INPUT SELECT2 (RP-0) WD INPUT SELECT1 (RP-0) WD INPUT SELECT0 (RP-0) T1 OVRFL INT ENA (RW-0) T1 INPUT SELECT2 (RW-0) T1 INPUT SELECT1 (RW-0)
T1CTL2
104Ah
P04A
T1CTL3
104Bh
P04B
T1CTL4
104Ch
P04C
T1PC1
104Dh
P04D -- -- T1PWM DATA OUT (RW-0) T1 PRIORITY (RP-0) -- T1PWM FUNCTION (RW-0) -- -- T1PWM DATA DIR (RW-0) --
T1PC2
104Eh
P04E
T1PRI
104Fh
P04F
IIII IIIIIIIIIIII I I IIII I IIIIIIIIIIII I I IIII III I IIIIIIIIIIII
WD OVRFL INT ENA (RW-0) WD OVRFL INT FLAG (RC-*) T1EDGE INT FLAG (RC-0) T1C2 INT FLAG (RC-0) T1C1 INT FLAG (RC-0) -- T1EDGE INT FLAG (RC-0) -- T1C1 INT FLAG (RC-0) -- T1 MODE = 0 (RW-0) T1C1 OUT ENA (RW-0) T1C2 OUT ENA (RW-0) T1C1 RST ENA (RW-0) T1 MODE = 1 (RW-0) T1C1 OUT ENA (RW-0) -- T1C1 RST ENA (RW-0) T1PWM DATA IN (R-0) T1 STEST (RP-0)
--
T1 INPUT SELECT0 (RW-0) T1 SW RESET (S-0)
T1 OVRFL INT FLAG (RC-0)
--
--
Dual Compare Mode T1EDGE INT ENA (RW-0) T1C2 INT ENA (RW-0) T1C1 INT ENA (RW-0)
--
Capture / Compare Mode T1EDGE INT ENA (RW-0) T1C1 INT ENA (RW-0)
--
--
Dual Compare Mode T1CR OUT ENA (RW-0) T1EDGE POLARITY (RW-0) T1CR RST ENA (RW-0) T1EDGE DET ENA (RW-0)
Capture / Compare Mode -- T1EDGE POLARITY (RW-0) -- T1EDGE DET ENA (RW-0)
T1EVT DATA IN (R-0) T1IC/CR DATA IN (R-0) --
T1EVT DATA OUT (RW-0) T1IC/CR DATA OUT (RW-0) --
T1EVT FUNCTION (RW-0) T1IC/CR FUNCTION (RW-0) --
T1EVT DATA DIR (RW-0) T1IC/CR DATA DIR (RW-0) --
Once the WD OVRFL RST ENA bit is set, these bits cannot be changed until a reset occurs; this applies only to the standard WD and to the simple counter. In the hard WD, these bits can be modified at any time; the WD INPUT SELECT2 bit is ignored.
Timer 1 (T1) Module
7-31
T1 Control Registers
7.9.1
T1 Control Register 1 (T1CTL1)
The T1CTL1 register controls the prescaler inputs to the WD timer and the general-purpose timer.
T1 Control Register 1 (T1CTL1) [Memory Address 1049h]
Bit #
P049
7
WD OVRFL TAP SEL RP-0
6
WD INPUT SELECT2 RP-0
5
WD INPUT SELECT1 RP-0
4
WD INPUT SELECT0 RP-0
3
--
2
T1 INPUT SELECT2 RW-0
1
T1 INPUT SELECT1 RW-0
0
T1 INPUT SELECT0 RW-0
R = Read, W = Write, P = Write protected when WD OVRFL RST ENA=1 (only in standard WD and simple counter configurations), -n = Value of the bit after the register is reset
Bit 7
WD OVRFL TAP SEL. WD Overflow Tap Select This bit determines whether the WD counter operates as a 15-bit or a 16-bit counter in the standard WD, hard WD, and simple counter options. The default is the full 16 bits of the counter. If a shorter WD counter overflow rate is needed, then the most significant bit of the counter can be forced to remain at 1. This, in effect, changes the WD counter to a 15-bit counter with an overflow period half that of a 16-bit counter. This tap select feature, combined with the clock prescaler, allows WD overflow rates from 215 to 224 system clock cycles. Once the WD RST ENA bit is set, this bit can be changed only after a reset (for the non-WD mode of the standard WD and simple counter). In the hard WD, this bit can be changed at any time. 0 = 16-bit WD counter overflow 1 = 15-bit WD counter overflow
Bits 6-4
WD INPUT SELECT2-0. WD Input Select 2-0
Standard WD and simple counter: These three bits select one of eight possible clock sources. Once the WD OVRFL RST ENA bit is set, the values of these three bits can be changed only after a reset; a write to this bit has no effect when the WD OVRFL RST ENA bit is set. Hard WD: The WD INPUT SELECT0 and WD INPUT SELECT1 bits are used to select one of the four possible clock sources. The clock sources come from one of the four taps from the 8-bit prescaler, which provides the system clock divided by 4, 16, 64, or 256. Note that the WD INPUT SELECT2 bit is functionally interpreted as 1. The combinations are shown in Table 7-7.
7-32
T1 Control Registers
Table 7-7. Counter Clock Sources for the WD Input Select 0-2
WD INPUT SELECT2 0 0 0 0 1 1 1 1 WD INPUT SELECT1 0 0 1 1 0 0 1 1 WD INPUT SELECT0 0 1 0 1 0 1 0 1 Counter Clock Source System clock Pulse accumulation Event input No clock input System clock/4 System clock/16 System clock/64 System clock/256
These options are not available for the hard WD
Bit 3 Bit 2-0
Reserved. Read data is indeterminate T1 INPUT SELECT2-0. T1 Input Select 2-0 These three bits select one of eight possible clock sources for the T1 generalpurpose counter. These sources are as follows:
-
The system clock with no prescale (system clock) The system clock when the external input T1EVT is high (pulse accumulation) An external source synchronized with the system clock (event input) No system clock source (no clock input) One of four taps from the 8-bit prescaler, which provides the system clock divided by 4, 16, 64, or 256
The combinations are shown in Table 7-8:
Table 7-8. Clock Sources for the T1 General Purpose Counter
T1 INPUT SELECT2 0 0 0 0 1 1 1 1 T1 INPUT SELECT1 0 0 1 1 0 0 1 1 T1 INPUT SELECT0 0 1 0 1 0 1 0 1 Counter Clock Source System clock Pulse accumulation Event input No clock input System clock/4 System clock/16 System clock/64 System clock/256
Timer 1 (T1) Module
7-33
T1 Control Registers
7.9.2
T1 Control Register 2 (T1CTL2)
The T1CTL2 register controls the T1 and WD overflow interrupts and contains the T1 software reset bit.
T1 Control Register 2 (T1CTL2) [Memory Address 104Ah]
Bit #
P04A
7
WD OVRFL RST ENA RS-0
6
WD OVRFL INT ENA RW-0
5
WD OVRFL INT FLAG RC-*
4
T1 OVRFL INT ENA RW-0
3
T1 OVRFL INT FLAG RC-0
2
--
1
--
0
T1 SW RESET S-0
R = Read, S = Set only, W = Write, C = Clear only, -n = Value of the bit after the register is reset, -* = see bit description
Bit 7
WD OVRFL RST ENA. WD Overflow Reset Enable Note: This bit operates differently for TMS370Cxxx devices than TMS370CxxxA and TMS370C7xxB devices. Refer to Section A.4, page A-5.
Standard WD: This bit controls the ability of a WD timer to generate a reset. The WD timer is a simple counter pulse accumulator when cleared. Once set, this bit can be cleared only by any system reset and locks the values of other WD bits so that they can be changed only after a reset.
0 = WD counter does not initiate a reset upon overflow. 1 = WD counter does initiate a reset upon overflow.
Simple counter: This bit protects the WD INPUT SELECT and WD OVRFL TAP SEL bits. Once set, subsequent writes to these control bits are ignored; they can be changed only after reset.
0 = Other WD bits are not protected 1 = Locks the value of other WD bits
Hard WD: This bit is ignored.
Bit 6 WD OVRFL INT ENA. Watchdog Overflow Interrupt Enable This bit controls the WD overflow interrupting capability. 0 = Disables WD interrupt 1 = Enables WD interrupt
7-34
T1 Control Registers
Bit 5
WD OVRFL INT FLAG. Watchdog Overflow Interrupt Flag Note: This bit operates differently for TMS370Cxxx devices than TMS370CxxxA and TMS370CxxB devices. Refer to Section A.4, page A-5. This bit is set if the last reset is initiated by the WD counter. Setting this bit will not prevent WD resets. This bit is cleared by writing a zero to it or by any system reset that is not initiated by the WD counter. 0 = WD interrupt is inactive. 1 = WD counter has overflowed or the incorrect value is written to the WD reset key register.
Bit 4
T1 OVRFL INT ENA. T1 Overflow Interrupt Enable. This bit controls the T1 overflow interrupting capability. 0 = Disables interrupt 1 = Enables interrupt
Bit 3
T1 OVRFL INT FLAG. T1 Overflow Interrupt Flag This bit indicates the status of the T1 overflow interrupt. 0 = General-purpose overflow interrupt is inactive. 1 = General-purpose overflow interrupt is pending.
Bits 2-1 Bit 0
Reserved. Read values are indeterminate. T1 SW RESET. T1 Software Reset This bit is always read as a 0; however, when a 1 is written to this bit, the counter resets to 0000h on the next system clock cycle. Note: Be careful using the AND, OR, XOR, CMPBIT, SBIT0, or SBIT1 instructions to modify this register. The read/modify/write nature of these instructions can inadvertently clear an interrupt flag that was set between the read and the write cycles. If the state of the interrupt enable bits is known, the MOV #iop8, Pd instruction can be used. If the state of the interrupt enable bits is not known, a sequence similar to the example shown below should be used.
;clearing the T1 OVRFL INT FLAG: MOV P04A,A OR #028H,A AND #0F7H,A MOV A,P04A
Timer 1 (T1) Module
7-35
T1 Control Registers
7.9.3
T1 Control Register 3 (T1CTL3)
The T1CTL3 register controls the edge-detect and compare interrupts. The six active bits in this register serve different functions for each mode, as shown below:
T1 Control Register 3 (T1CTL3) [Memory Address 104Bh] Mode: Dual Compare
Bit #
P04B
7
T1EDGE INT FLAG RC-0
6
T1C2 INT FLAG RC-0
5
T1C1 INT FLAG RC-0
4
--
3
--
2
T1EDGE INT ENA RW-0
1
T1C2 INT ENA RW-0
0
T1C1 INT ENA RW-0
Mode: Compare/Capture
Bit #
P04B
7
T1EDGE INT FLAG RC-0
6
--
5
T1C1 INT FLAG RC-0
4
--
3
--
2
T1EDGE INT ENA RW-0
1
--
0
T1C1 INT ENA RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bit 7
T1EDGE INT FLAG. T1 Edge Interrupt Flag This bit indicates when an external pulse transition of the correct polarity is detected on the T1 input capture/counter reset (T1IC/CR) pin. This bit also indicates an input capture in the capture/compare mode. 0 = No transition 1 = Transition detected
Bit 6
T1C2 INT FLAG. T1 Compare 2 Interrupt Flag
Dual compare mode: This bit is set when the capture/compare register first matches the counter value.
0 = Interrupt inactive 1 = Interrupt pending
Capture/compare mode: Reserved. Read data is indeterminate.
Bit 5 T1C1 INT FLAG. T1 Compare 1 Interrupt Flag This bit is set when the compare register first matches the counter value. 0 = Interrupt inactive 1 = Interrupt pending Bit 4-3
7-36
Reserved. Read data is indeterminate.
T1 Control Registers
Bit 2
T1EDGE INT ENA. T1 Edge Interrupt Enable This bit determines whether or not the active edge input to the T1IC/CR pin generates an interrupt. The T1EDGE DET ENA bit (T1CTL4.0) must be set before an edge can be detected. 0 = Disables interrupt 1 = Enables interrupt
Bit 1
T1C2 INT ENA. T1 Compare 2 Interrupt Enable
Dual compare mode only: This bit determines whether or not the capture/ compare register flag can generate an interrupt.
0 = Disables interrupt 1 = Enables interrupt
Capture/compare mode: Reserved. Read data is indeterminate.
Bit 0 T1C1 INT ENA. T1 Compare 1 Interrupt Enable This bit determines whether or not the compare register flag can generate an interrupt. 0 = Disables interrupt 1 = Enables interrupt Note: Be careful using the AND, OR, XOR, CMPBIT, SBIT0, or SBIT1 instructions to modify this register. The read/modify/write nature of these instructions can inadvertently clear an interrupt flag that was set between the read and the write cycles. If the state of the interrupt enable bits is known, the MOV #iop8, Pd, instruction can be used. If the state of the interrupt enable bits is not known, a sequence similar to the example shown below should be used.
;Clearing the T1C1 INT FLAG MOV P04B,A OR #0E0h,A AND #0DFh,A MOV A,P04B
Timer 1 (T1) Module
7-37
T1 Control Registers
7.9.4
T1 Control Register 4 (T1CTL4)
The T1CTL4 register controls the mode of operation and various functions of the T1 input and output pins. The bits in this register serve different functions, depending on the mode.
T1 Control Register 4 (T1CTL4) [Memory Address 104Ch] Mode: Dual Compare
Bit #
P04C
7
T1 MODE=0 RW-0
6
T1C1 OUT ENA RW-0
5
T1C2 OUT ENA RW-0
4
T1C1 RST ENA RW-0
3
T1CR OUT ENA RW-0
2
T1EDGE POLARITY RW-0
1
T1CR RST ENA RW-0
0
T1EDGE DET ENA RW-0
Mode: Compare/Capture
Bit #
P04C
7
T1 MODE=1 RW-0
6
T1C1 OUT ENA RW-0
5
--
4
T1C1 RST ENA RW-0
3
--
2
T1EDGE POLARITY RW-0
1
--
0
T1EDGE DET ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
T1 MODE. T1 Mode Select This bit selects the general-purpose counter mode. 0 = Dual compare mode 1 = Capture/compare mode
Bit 6
T1C1 OUT ENA. T1 Output-Compare Output Enable 1 When this bit is set and the compare register 1 is equal to the counter, the T1PWM pin toggles (when configured as a PWM pin). 0 = Disables pulse-to-toggle output 1 = Enables pulse-to-toggle output
Bit 5
T1C2 OUT ENA. T1 Output-Compare Output Enable 2
Dual Compare Mode: When this bit is set and compare register 2 is equal to the counter, the T1PWM pin toggles (when configured as a PWM pin).
0 = Disables pulse-to-toggle output 1 = Enables pulse-to-toggle output
Capture/compare mode: Reserved. Read data is indeterminate.
7-38
T1 Control Registers
Bit 4
T1C1 RST ENA. T1 Compare 1 Reset Enable When this bit is set and compare register 1 is equal to the counter, the counter will reset on the next counter increment. 0 = Disables counter reset upon compare equal 1 = Enables counter reset upon compare equal
Bit 3
T1CR OUT ENA. T1 External Edge Output Enable
Dual compare mode: This bit determines whether the input signal on the T1IC/CR pin can toggle the output signal on the T1PWM pin.
0 = Disables pulse-to-toggle output 1 = Enables pulse-to-toggle output
Capture/compare mode: Reserved. Read data is indeterminate.
Bit 2 T1EDGE POLARITY. T1 Edge Polarity This bit determines the transition direction on the T1IC/CR pin to trigger a capture or counter reset, depending on the counter mode selected. 0 = Triggers on a high-to-low transition 1 = Triggers on a low-to-high transition Bit 1 T1CR RST ENA. T1 External Reset Enable
Dual compare mode: This bit determines whether an external signal can reset the counter.
0 = Disables external reset of the counter 1 = Enables external reset of the counter on the next valid edge detect
Capture/compare mode: Reserved. Read data is indeterminate.
Bit 0 T1EDGE DET ENA. T1 Edge Detect Enable
Dual compare mode: This bit enables the edge detection circuit to sense the next level transition on the T1IC/CR pin. This bit is cleared after the selected transition is detected and during a reset.
0 = Disables edge detection 1 = Enables edge detection
Capture/compare mode: This bit enables the input capture circuit to capture the current counter value upon the next level transition on the counter reset/input capture pin, as determined by the T1EDGE POLARITY bit. This bit remains unchanged after the selected transition is detected.
0 = Disables input capture 1 = Enables input capture
Timer 1 (T1) Module
7-39
T1 Control Registers
7.9.5
T1 Port Control Registers (T1PC1 and T1PC2)
Port control registers (PCRs) T1PC1 and T1PC2 are organized to allow all functions for a pin to be programmed in one write cycle. Each module pin is controlled by a nibble in one of the PCRs.
7.9.5.1
T1 Port Control Register 1 (T1PC1)
The T1PC1 register controls the I/O functions of the T1 module, T1EVT pin.
T1 Port Control Register 1 (T1PC1) [Memory Address 104Dh]
Bit #
P04D
7
--
6
--
5
--
4
--
3
T1EVT DATA IN R-0
2
T1EVT DATA OUT RW-0
1
T1EVT FUNCTION RW-0
0
T1EVT DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-4 Bit 3
Reserved. Read data is indeterminate. T1EVT DATA IN. T1EVT Pin Data In This bit contains the data present on the T1EVT pin. A write operation to this bit has no effect.
Bit 2
T1EVT DATA OUT. T1EVT Pin Data Out This bit contains the data to be output on the T1EVT pin if the following conditions are met: a. Bit TIEVT DATA DIR = 1 b. Bit T1EVT FUNCTION = 0
Bit 1
T1EVT FUNCTION. T1EVT Pin Function Select This bit determines the function of the T1EVT pin. 0 = The T1EVT is a general-purpose digital I/O pin. 1 = The T1EVT is the event-input pin.
Bit 0
T1EVT DATA DIR. T1 Event-Pin Data Direction This bit selects the T1EVT pin as an input or output if the T1EVT FUNCTION bit = 0. 0 = Enables T1EVT pin as data input 1 = Enables T1EVT pin as data output
7-40
T1 Control Registers
7.9.5.2
T1 Port Control Register 2 (T1PC2)
The T1PC2 register controls the I/O functions of the T1IC/CR and T1PWM pins.
T1 Port Control Register 2 (T1PC2) [Memory Address 104Eh]
Bit #
P04E
7
T1PWM DATA IN R-0
6
T1PWM DATA OUT RW-0
5
T1PWM FUNCTION RW-0
4
T1PWM DATA DIR RW-0
3
T1IC/CR DATA IN R-0
2
T1IC/CR DATA OUT RW-0
1
T1IC/CR FUNCTION RW-0
0
T1IC/CR DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
T1PWM DATA IN. T1PWM Pin Data In 1 This bit contains the data input on pin T1PWM. A write operation to this bit has no effect.
Bit 6
T1PWM DATA OUT. T1PWM Pin Data Out This bit contains the data to be output on the T1PWM pin if the following conditions are met: a. Bit T1PWM DATA DIR = 1 b. Bit T1PWM FUNCTION = 0
Bit 5
T1PWM FUNCTION. T1PWM Pin Function Select This bit determines the function of the T1PWM pin. 0 = The T1PWM pin is a general-purpose digital I/O pin. 1 = The T1PWM pin is the PWM output.
Bit 4
T1PWM DATA DIR. T1PWM Pin Data Direction This bit selects the T1PWM pin as an input or output if the T1PWM FUNCTION bit = 0. 0 = Enables T1PWM pin data input 1 = Enables T1PWM pin data output
Bit 3
T1IC/CR DATA IN. T1IC/CR Pin Data In This pin contains the data input on pin T1IC/CR. A write operation to this bit has no effect.
Timer 1 (T1) Module
7-41
T1 Control Registers
Bit 2
T1IC/CR DATA OUT. T1IC/CR Pin Data Out This bit contains the data output on pin T1IC/CR if the following conditions are met: a. Bit T1IC/CR DATA DIR = 1 b. Bit T1IC/CR FUNCTION = 0
Bit 1
T1IC/CR FUNCTION. T1IC/CR Pin Function Select This bit determines the function of the T1IC/CR pin. 0 = The T1IC/CR pin is a general-purpose digital I/O pin. 1 = The T1IC/CR pin is the input capture/counter reset pin.
Bit 0
T1IC/CR DATA DIR. T1IC/CR Pin Data Direction This bit selects the T1IC/CR pin as an input or output if the T1IC/CR FUNCTION bit = 0. 0 = Enables T1IC/CR pin data input 1 = Enables T1IC/CR pin data output
7-42
Timer 1 Control Registers
7.9.6
T1 Interrupt Priority Control Register (T1PRI)
The T1PRI register controls the level of the T1 interrupt. You can write to this register only in the privilege mode. During normal operation, this is a read-only register.
T1 Interrupt Priority Control Register (T1PRI) [Memory Address 104Fh]
Bit #
P04F
7
T1 STEST RP-0
6
T1 PRIORITY RP-0
5
--
4
--
3
--
2
--
1
--
0
--
R = Read, P = Privilege write only, -n = Value of the bit after register is reset
Bit 7
T1 STEST. T1 STEST This bit must be cleared (0) to ensure proper operation.
Bit 6
T1 PRIORITY. T1 Interrupt Priority Select This bit determines the level of the interrupt generated by T1. 0 = Interrupts are level 1 (high priority) requests. 1 = Interrupts are level 2 (low priority) requests.
Bits 5-0
Reserved. Read data is indeterminate.
Timer 1 (T1) Module
7-43
7-44
Running Title--Attribute Reference
Chapter 8
Timer 2A (T2A) and Timer 2B (T2B) Modules
This chapter discusses the architecture and programming of the T2A and T2B modules and covers the following topics:
Topic
8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8
Page
T2n Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 T2n Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 Edge-Detection Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-16 Low-Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 T2n Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
Chapter Title--Attribute Reference
8-1
T2n Overview
8.1 T2n Overview
The T2n module (T2A or T2B) is a 16-bit general-purpose timer. Depending on the TMS370 device, there may be 0, 1, or 2 on-chip T2 modules. For devices with one T2 module, the timer is referred to as T2A. Devices ('x6x) with two T2 modules are referred to as T2A and T2B. The term T2n is used to refer to the T2A or T2B timer modules throughout this chapter. The T2n module is composed of a 16-bit resettable counter, a 16-bit compare register with associated compare logic, a 16-bit capture register, and a 16-bit register that functions as a capture register in one mode and as a compare register in the other mode. The T2n module adds an additional timer that provides event count, input capture, and compare functions. The T2n solutions to different system requirements are shown in Table 8-1.
Table 8-1. System-Requirement Solutions Using T2n
Requirement Realtime system control Input pulse-width measurement External event synchronization Timer output control PWM output control Timer Solution Interval timers with interrupts Pulse accumulate or input capture functions Event count function Compare function PWM output function
8.1.1
Physical Description
The T2n module has the following features. The T2n module is shown in Figure 8-1 on page 8-3:
-
A 16-bit resettable counter A 16-bit compare register with associated compare logic A 16-bit capture register A 16-bit capture/compare register Selectable edge-detection circuitry Interrupts The T2n module has maskable interrupts for the following:
J J J J
8-2
Two input captures Two output compares Counter overflow External edge detect
T2n Overview
-
I/O Pins The T2n module has three I/O pins that can be dedicated as timer functions or used as general-purpose I/O pins. The following list describes each I/O pin:
J J J
T2nEVT, which provides for input to the event counter or the external clock source T2nIC1/CR, which provides for input to the counter reset, input capture, or pulse-width modulation (PWM) circuit T2nIC2/PWM, which provides for PWM output or a second input capture
The definitions of these pins are contained in the two port control registers located at addresses P06E and P06D of peripheral file frame 6 for T2A, and P08E and P08D of peripheral file frame 8 for T2B. Table 8-2 on page 8-4 defines the functions of the three T2n I/O pins for both operating modes.
Figure 8-1. T2n Block Diagram
External pin connections
T2nIC1 / CR
Edge detect Edge detect 16-bit capt/comp register
T2nIC2 / PWM (Dual-capture mode)
External pin connection
16-bit capture register
INT logic
PWM toggle
T2nIC2/PWM (Dual-compare mode)
16
T2nEVT
Clock select
16-bit counter
16-bit compare register
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-3
T2n Overview
Table 8-2. T2n I/O Pin Definitions
Pin T2nIC1/CR T2nIC2/PWM T2nEVT Dual Compare Mode Counter reset input PWM output External event input or pulse accumulate input Dual Capture Mode Input capture 1 input Input capture 2 input External event input or pulse accumulate input
8.1.2
Operating Modes
-
Dual compare mode. The timer is configured to provide dual compare registers, an external or software reset of the counter, an internal or external clock source, and a programmable PWM output. The T2nIC2/PWM pin can also be configured to toggle upon an external input edge. The external clock source can be selected for use as an event counter or pulse accumulator. Dual capture mode. The timer is configured to provide dual input capture registers and one compare register for use as a general-purpose timer. The compare register can provide periodic interrupts to the rest of the microcomputer. Each capture register can be configured to capture the current counter value upon either edge of an external input.
-
8.1.3
Control Registers
The T2A control registers are located at addresses 1060h to 106Fh, with locations 1068h and 1069h reserved; T2B control registers are located at 1080h to 108Fh, with locations 1088h and 1089h reserved. The functions of these locations are shown in Table 8-3 on page 8-5.
8-4
T2n Overview
Table 8-3. T2n Memory Map
Peripheral File 6 Location T2A P060 P061 P062 P063 P064 P065 P066 P067 P068 P069 P06A Peripheral File 8 Location T2B P080 P081 P082 P083 P084 P085 P086 P087 P088 P089 P08A T2nCTL1 T2nIC T2nCC T2nC
Symbol T2nCNTR
Name T2n Counter -- MSbyte T2n Counter -- LSbyte Compare Register -- MSbyte Compare Register -- LSbyte Capture/Compare Register -- MSbyte Capture/Compare Register -- LSbyte Capture Register -- MSbyte Capture Register -- LSbyte Reserved Reserved T2n Control Register 1
Description 16-bit resettable counter
16-bit compare register
16-bit capture/compare register
16-bit capture register
Controls the clock input selection, counter overflow interrupts, and counter software reset. Contains interrupt flags and controls the module's capability to issue interrupts. Controls the mode of operation, outputs, active transition polarity, and counter reset. Assigns the I/O function of the T2nEVT pin as either a general-purpose digital I/O or external event input of the module. Assigns the I/O functions of the T2nIC1/CR and T2nIC2/PWM pins as either general-purpose digital I/O pins or the input capture/counter reset and PWM output pins, respectively. Assigns the priority level of interrupts generated by the T2n module.
P06B
P08B
T2nCTL2
T2n Control Register 2
P06C
P08C
T2nCTL3
T2n Control Register 3
P06D
P08D
T2nPC1
T2n Port Control Register 1
P06E
P08E
T2nPC2
T2n Port Control Register 2
P06F
P08F
T2nPRI
T2n Interrupt Priority Control Register
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-5
T2n Components
8.2 T2n Components
The T2n module uses a 16-bit counter, a compare register, a capture register, and a capture/compare register to provide event, compare, and capture functions.
8.2.1
16-Bit Resettable Counter
The 16-bit free-running, read-only counter (T2nCNTR) is clocked by the system clock, the external event, or the system clock during the occurrence of an active external event (pulse accumulate).
-
During initialization, the counter is loaded with 0000h and begins its count. If the counter is not reset before reaching FFFFh, the counter rolls over to 0000h and continues counting. When the counter rolls over, the T2n OVRFL INT FLAG bit (T2nCTL1.3) is set; a timer interrupt is generated if the T2n OVRFL INT ENA bit (T2nCTL1.4) is set. The counter can be reset to 0000h during counting by any of the following:
J J J J
A 1 written to the T2n SW RESET bit (T2CTL1.0) A compare equal condition from the dedicated T2n compare function System reset An external pulse on the T2nIC1/CR pin (dual compare mode only) if the T2nC1 RST ENA bit (T2nCTL3.4) is set.
To reset the counter, you can select the external transition on the T2nIC1/CR pin to be either low-to-high or high-to-low. To do this, use the T2nEDGE1 POLARITY bit (T2nCTL3.2). Special circuitry prevents the contents of the T2nCNTR register from changing in the middle of a 16-bit read operation. See the note in Section 8.8 on page 8-17.
8.2.2
Compare Register
The compare register circuit consists of a 16-bit wide, read/write data register (T2nC) and logic to compare the counter's current value with the value stored in the compare register. When the counter value matches the compare register value, the circuit performs the following:
8-6
Sets the T2nC1 INT FLAG bit (T2CTL2.5) to 1. Generates a T2n interrupt if the T2nC1 INT ENA bit (T2nCTL2.0) is set. Resets the counter if the T2nC1 RST ENA bit (T2nCTL3.4) is set. Toggles the PWM output pin if the T2nC1 OUT ENA bit (T2nCTL3.6) is set (dual compare mode only).
T2n Components
Once the T2nC1 INT FLAG bit is set by a compare-equal condition and then cleared, it will not be set again if the same compare-equal condition still exists (that is, the same compare-equal condition can set the T2nC1 INT FLAG bit only once). This flag causes various events to occur, depending on the mode of operation and on which enable bits are set. Special circuitry prevents the T2nC register from changing in the middle of a 16-bit read or write operation. See the note in Section 8.8. The compare register value required for a specific timing application can be calculated using the following formula:
Compare Value =
t 1 SYSCLK
-1
where: t= SYSCLK = desired timer compare period (seconds) CLKIN/4 for divide-by-4 clock (external clock frequency) CLKIN/1 for divide-by-1 clock
Table 8-4 provides some sample compare register values to achieve various desired timings with a 5-MHz SYSCLK.
Table 8-4. T2n Compare Values: (5-MHz SYSCLK)
Time Seconds 0.0005 0.001 0.002 0.005 0.010 0.013 m Seconds 0.5 1 2 5 10 13 T2n Compare Register Decimal 2499 4999 9999 24999 49999 64999 Hex 009C3h 01387h 0270Fh 061A7h 0C34Fh 0FDE7h % Error (See Note) 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Note: The percent of error induced by the T2n formula varies, depending on the desired timer compare period and the minimum timer resolution (1/SYSCLK).
8.2.3
Capture Register (Dual Capture Mode Only)
The 16-bit capture register (T2nIC) is a read-only data register. This register captures the counter values when an input capture pulse (pin T2nIC2/PWM) is received. The capture register can be read at the addresses shown in Table 8-5. Writes to this register are ignored, so the capture register retains
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-7
T2n Components
the last counter value captured until another input capture pulse loads a new value in the register.
Table 8-5. T2n Capture Register MSbyte and LSbyte Addresses
Timer T2AIC T2BIC MSbyte P066 P086 LSbyte P067 P087
On receipt of a capture pulse, the circuit conducts the following:
-
Loads the value of the 16-bit counter into the capture register. Sets the T2nEDGE2 INT FLAG bit (T2nCTL2.6) to indicate that the capture register has latched the current counter value. If the T2nC2 INT ENA bit (T2nCTL2.1) is set, generates an interrupt.
Special circuitry prevents the T2nIC register from changing in the middle of a 16-bit read or write operation. See the note in Section 8.8 on page 8-17.
8.2.4
Capture/Compare Register
The 16-bit capture/compare register (T2nCC) can serve one of two functions, depending on the operating mode. Table 8-6 shows the T2nCC locations.
Table 8-6. T2n Capture/Compare Register MSbyte and LSbyte Addresses
Timer T2ACC T2BCC MSbyte P064 P084 LSbyte P065 P085
Special circuitry prevents the T2nCC register from changing in the middle of a 16-bit read or write operation. See the note in Section 8.8 on page 8-17.
8.2.4.1
Dual Compare Mode
In the dual compare mode, the T2nCC register becomes a read/write compare register. It functions exactly as the one described in subsection 8.2.2, on page 8-6, except that T2nCC cannot reset the counter. When the 16-bit counter value matches the capture/compare register value, the circuit conducts the following:
8-8
Sets the T2nC2 INT FLAG bit (T2nCTL2.6) to 1.
T2n Components
8.2.4.2
Toggles the PWM output pin if the T2nC2 OUT ENA bit (T2nCTL3.5) is set. Generates a T2n interrupt if the T2nC2 INT ENA bit (T2nCTL2.1) is set.
Dual Capture Mode
In the dual capture mode, the capture/compare register becomes a read-only capture register. When an external pulse appears on pin T2nIC1/CR, the following events occur if the T2nEDGE1 DET ENA bit (T2nCTL3.0) is set:
-
The current counter value is latched into the capture/compare register. The T2nEDGE1 INT FLAG bit (T2nCTL2.7) is set. Generates an interrupt if the T2nEDGE1 INT ENA bit (T2nCTL2.2) is set.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-9
Operating Modes
8.3 Operating Modes
The T2n operating mode is determined by the T2n MODE bit (T2nCTL3.7). T2n MODE = 0 = dual compare mode T2n MODE = 1 = dual capture mode
8.3.1
Dual Compare Mode
The dual compare mode provides the following:
-
A 16-bit compare register (called compare 1) A 16-bit capture/compare register that acts as a compare register (called compare 2) A 16-bit externally resettable counter A timer output pin
These components allow T2n to act as an interval timer, a PWM output, simple output toggle, or many other timer functions. In the dual compare mode, the operation of the T2n module is identical to that of the T1 module, with the exception of the clock sources. The dual compare mode is shown in Figure 8-2.
8-10
Operating Modes
Figure 8-2. Dual Compare Mode
T2nCC.15-0
16-bit LSB capture/compare register MSB T2nC2 INT FLAG
Clock source
Output enable
T2nCTL2.6 T2nCNTR.15-0
LSB MSB 16-Bit counter Reset T2nC1 RST ENA T2nCTL3.4 Compare= 16 Compare=
T2nCTL3.5
T2nC2 OUT ENA External pin connection
T2nCTL2.1 T2nC2 INT ENA
T2nC1 INT FLAG T2nCTL2.5
Toggle
T2nCTL3.6
T2nC1 OUT ENA
T2nPC2.7-4
T2nIC2/ PWM
T2nC.15-0
16-bit LSB compare register MSB
T2nCTL2.0 T2nC1 INT ENA
T2nCTL3.3
T2nEDGE1 OUT ENA
External pin connection
T2nCTL1.0 T2n SW RESET
T2n OVRFL INT FLAG
T2nPC2.3-0
T2nIC1/ CR
T2nCTL3.1 T2nEDGE1 RST ENA
Edge 1 select
T2nCTL1.3 T2nCTL1.4
T2n OVRFL INT ENA T2nEDGE1 INT FLAG T2n PRIORITY
T2nCTL3.0 T2nEDGE1 DET ENA T2nCTL3.2
T2nEDGE1 POLARITY
T2nPRI.6 Level 1 Int 0
1 Level 2 Int
T2nCTL2.7 T2nCTL2.2 T2nEDGE1 INT ENA
Note:
The annotations on the diagram identify the register and the bit (s) in the peripheral frame. For example, the actual address of T2nCTL2.0 is 106Bh (n=A) or 108Bh (n=B), bit 0, in the T2nCTL2 register.
8.3.2
Dual Capture Mode
In the dual capture mode, T2n provides the following:
-
A 16-bit compare register for use as a programmable interval timer A 16-bit capture register 2 for external input time and pulse width measurement A 16-bit capture/compare register 1 that acts as a capture register for external input timing and pulse width measurement
The dual capture mode is shown in Figure 8-3 on page 8-12.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-11
Operating Modes
Figure 8-3. Dual Capture Mode
T2nCC.15-0
16-bit LSB capture/compare register 1 MSB
T2nIC.15-0
16-bit capture register 2 LSB MSB
Clock source
T2nCNTR.15-0
LSB MSB 16-bit counter 16 T2nC1 INT FLAG T2nCTL2.5
T2n PRIORITY T2nPRI.6 Level 1 Int 0 1 Level 2 Int
Compare = Reset
T2nCTL2.0 T2nC.15-0
External pin connections T2n SW RESET T2nCTL1.0 T2nC1 RST ENA 16-bit compare register LSB MSB T2nC1 INT ENA T2n OVRFL INT FLAG T2nCTL1.3
T2nCTL1.4 T2nCTL3.4 T2nCTL3.0 T2nEDGE1 DET ENA
Edge1 select T2n OVRFL INT ENA T2nEDGE1 INT FLAG T2nCTL2.7
T2nPC2.3-0
T2nIC1/CR
T2nCTL3.2 T2nEDGE1 POLARITY T2nCTL3.1 T2nEDGE2 DET ENA
T2nCTL2.2 T2nEDGE1 INT ENA
T2nPC2.7-4
T2nIC2/PWM Edge 2 select
T2nEDGE2 INT FLAG T2nCTL2.6
T2nCTL3.3
T2nEDGE2 POLARITY
T2nCTL2.1
T2nEDGE2 INT ENA
Note: The annotations on the diagram identify the register and the bit (s) in the peripheral frame. For example, the actual address of T2nCTL2.0 is 106Bh (n=A) or 108Bh (n=B), bit 0, in the T2nCTL2 register. Each input capture pin (T2nIC1/CR and T2nIC2/PWM) has an input edge detect function enabled by the associated DET ENA control bit, with the associated POLARITY bit selecting the active input transition. On the occurrence of a valid input on the T2nIC1/CR or T2nIC2/PWM pin, the current counter value is loaded into the 16-bit capture/compare register or 16-bit input capture register, respectively. In addition, the respective input capture INT FLAG bit is set, and a timer interrupt is generated if the respective INT ENA bit is set.
8-12
Edge-Detection Circuitry
8.4 Edge-Detection Circuitry
This edge detection circuitry senses an active pulse transition on the input pins and provides appropriate output transitions to the rest of the module.
8.4.1
Dual Compare Mode
In this mode, the edge detection circuitry is connected to the module's T2nIC1/CR pin. The program must set the T2nEDGE1 DET ENA bit (T2nCTL3.0) to re-enable the T2n module after each edge detection. When the T2n module detects an active transition (while enabled), then the module performs the following:
-
Clears the T2nEDGE1 DET ENA bit. Sets the T2nEDGE1 INT FLAG bit (T2nCTL2.7). Resets the counter if T2nEDGE1 RST ENA bit (T2nCTL3.1) is set. Toggles the output flip-flop if the T2nEDGE1 OUT ENA bit (T2nCTL3.3) is set.
In the dual compare mode, the T2nEDGE1 POLARITY bit (T2nCTL3.2) determines whether the active transition is low-to-high or high-to-low.
8.4.2
Dual Capture Mode
In this mode, the edge detection circuitry is connected to both the T2nIC1/CR pin and the T2nIC2/PWM pin. When the edge 1 detect circuit detects an active edge transition on the T2nIC1/CR pin, the T2n module conducts the following:
-
Loads the capture/compare register with the current counter value. Sets the T2nEDGE1 INT FLAG bit (T2nCTL2.7).
When the edge 2 detect circuit detects an active edge transition on the T2nIC2/PWM pin, the module performs the following: Loads the capture register with the current counter value. Sets the T2nEDGE2 INT FLAG bit (T2nCTL2.6).
The T2nEDGE1 POLARITY bit (T2nCTL3.2) and the T2nEDGE2 POLARITY bit (T2nCTL3.3) determine the transition (rising or falling) to be detected.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-13
Clock Sources
8.5 Clock Sources
The T2n clock sources are shown in Figure 8-4 and can be any of the following:
External pin connection
System clock No clock (the counter is stopped) External clock synchronized to the system clock (event counter) System clock while external input is high (pulse accumulation)
Figure 8-4. T2n Clock Sources
Event T2nEVT Sync Accum Counter clock Frequency (SYSCLK)
Select
The T2n INPUT SELECT0 bit (T2nCTL1.1) and the T2n INPUT SELECT1 bit (T2nCTL1.2) select one of four clock sources (refer to subsection 8.8.1 on page 8-19 ). The maximum counter duration with an internal clock is based on the internal system clock time (SYSCLK) as follows: Maximum Counter Duration Counter Resolution where: SYSCLK = = = = 216 x (1/SYSCLK) 1/SYSCLK CLKIN/4 for divide-by-4 clock CLKIN/1 for divide-by-1 clock
The external event frequency input to the module cannot exceed SYSCLK/2. All external event inputs are synchronized with the system clock. When the timer is using the system clock input, the 16-bit timer generates an overflow rate of 13.1 ms with 200-ns resolution (5-MHz SYSCLK).
8-14
Clock Sources
8.5.1
Event Counter Mode
When you use the event counter clock source, the 16-bit counter is programmable as a 16-bit event counter. An external low-to-high transition on the T2nEVT pin provides the clock for the internal timer. The T2nEVT external clock frequency cannot exceed the system clock frequency divided by 2.
8.5.2
Pulse Accumulator Mode
When you use the pulse accumulator clock source, the 16-bit counter is programmable as a 16-bit pulse accumulator. An external input on the T2nEVT pin is used to gate the internal system clock to the internal timers. While Tn2EVT input is logic one (high), the timer is clocked at the system clock rate and counts system clock pulses until the T2nEVT pin returns to logic zero.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-15
Interrupts
8.6 Interrupts
Interrupts can be enabled to occur upon an output compare equal, counter overflow, and/or an external edge detect ( input capture). In dual compare mode, the following four separate events can generate an interrupt:
-
A compare-equal for the dedicated compare register if the T2nC1 INT ENA bit (T2nCTL2.0) is set A compare-equal for the capture/compare register if the T2nC2 INT ENA bit (T2nCTL2.1) is set A counter overflow if the T2n OVERFL INT ENA bit (T2nCTL1.4) is set An external edge detect if the T2nEDGE1 DET ENA and T2nEDGE1 INT ENA bits are set (T2nCTL3.0 and T2nCTL2.2, respectively)
In dual capture mode, four separate events can generate an interrupt. These events are as follows: A compare-equal for the dedicated compare register if the T2nC1 INT ENA bit (T2nCTL2.0) is set A counter overflow if the T2n OVERFL INT ENA bit (T2nCTL1.4) is set An external edge 1 detect if the T2nEDGE1 DET ENA and T2nEDGE1 INT ENA bits are set (T2nCTL3.0 and T2nCTL2.2) An external edge 2 detect if the T2nEDGE2 DET ENA and T2nEDGE2 INT ENA bits are set (T2nCTL3.1 and T2nCTL2.1)
Note: All set and enabled interrupt flags must be cleared before the processor exits the T2n interrupt routine. If the flags are not reset, the processor will enter the T2n interrupt routine again instead of continuing the mainstream program. If the flag bits are never cleared, the program will continually enter the interrupt service routine.
8-16
Low-Power Modes/T2n Control Registers
8.7 Low-Power Modes
The T2n module supports low-power (powerdown) modes that aid in reducing power consumption during periods of inactivity. These modes are the halt and the standby modes. In both the halt and standby modes, no clocks or external inputs are recognized. If the PWRDWN/IDLE bit (SCCR2.6) is set, the low-power modes are entered when an IDLE instruction is executed by the CPU. During the low-power mode, the T2n module holds the pre-idle status of all storage elements. All external pins are held constant, regardless of the pin function: inputs remain inputs, output low levels remain low, and output high levels remain high. When the idle state is exited, the I/O timer module continues from where it entered the idle state.
8.8 T2n Control Registers
Six registers control the T2n module operating mode selection, interrupt enable, status flags, and output configuration. These registers are shown in Figure 8-5. The bits that are shown in shaded boxes are privilege mode bits; that is, they can be written to only in the privilege mode. Note: Special circuitry prevents 16-bit registers from changing in the middle of a 16-bit read or write operation. When you read a 16-bit register, read the least significant byte (LSbyte) first to lock in the value, and then read the most significant byte (MSbyte). When you write to a 16-bit register, write the MSbyte first and then write the LSbyte. The register value does not change between reading and writing the bytes when they are done in this order. While you access a 16-bit register, do not read or write from a second 16-bit register within this module; if you do, the value for the first register's MSbyte will not be correct. The 16-bit read/write operation actually occurs when you access the LSbyte. In summary, the read/write operation should be conducted in the following order: Read: Write: LSbyte then MSbyte MSbyte then LSbyte
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-17
T2n Control Registers
Figure 8-5. Peripheral File Frames 6 (T2A) and 8 (T2B): T2n Control Registers
Designation T2nCNTR T2nCNTR T2nC T2nC T2nCC T2nCC T2nIC T2nIC ADDR T2A/T2B 1060h/1080h 1061h/1081h 1062h/1082h 1063h/1083h 1064h/1084h 1065h/1085h 1066h/1086h 1067h/1087h 1068h/1088h 1069h/1089h T2nCTL1 106Ah/108Ah PF T2A/T2B P060/P080 P061/P081 P062/P082 P063/P083 P064/P084 P065/P085 P066/P086 P067/P087 P068/P088 P069/P089 P06A/P08A -- -- -- Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 15 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 Bit 8 Bit 0 T2n INPUT SELECT1 (RW-0) T2n INPUT SELECT0 (RW-0) T2n SW RESET (S-0)
T2n Counter MSbyte T2n Counter LSbyte Compare Register MSbyte Compare Register LSbyte Capture/Compare Register MSbyte Capture/Compare Register LSbyte Capture Register 2 MSbyte Capture Register 2 LSbyte Reserved Reserved T2n OVRFL INT ENA (RW-0) T2n OVRFL INT FLAG (RC-0)
In Dual Compare Mode T2nCTL2 106Bh/108Bh P06B/P08B T2nEDGE1 INT FLAG (RC-0) T2nC2 INT FLAG (RC-0) T2nC1 INT FLAG (RC-0) -- -- T2nEDGE1 INT ENA (RW-0) T2nC2 INT ENA (RW-0) T2nC1 INT ENA (RW-0)
In Dual Capture Mode T2EDGE1 INT FLAG (RC-0) T2EDGE2 INT FLAG (RC-0) T2nC1 INT FLAG (RC-0) -- -- T2nEDGE1 INT ENA (RW-0) T2nEDGE2 INT ENA (RW-0) T2nC1 INT ENA (RW-0)
In Dual Compare Mode T2nCTL3 106Ch/108Ch P06C/P08C T2n MODE= 0 (RW-0) T2nC1 OUT ENA (RW-0) T2nC2 OUT ENA (RW-0) T2nC1 RST ENA (RW-0) T2nEDGE1 OUT ENA (RW-0) T2nEDGE1 POLARITY (RW-0) T2nEDGE1 RST ENA (RW-0) T2nEDGE1 DET ENA (RW-0)
In Dual Capture Mode T2n MODE= 1 (RW-0) -- -- T2nC1 RST ENA (RW-0) T2nEDG2 POLARITY (RW-0) T2nEDGE1 POLARITY (RW-0) T2nEDGE2 DET ENA (RW-0) T2nEDGE1 DET ENA (RW-0)
In Dual Compare and Dual Capture Mode T2nPC1 106Dh/108Dh P06D/P08D -- T2nPC2 106Eh/108Eh P06E/P08E T2nIC2/ PWM DATA IN (R-0) T2n STEST (RP-0) --
T2nIC2/PWM
--
T2nIC2/PWM
--
T2nIC2/PWM
T2nEVT DATA IN (R-0) T2nIC1/CR DATA IN (R-0)
T2nEVT DATA OUT (RW-0) T2nIC1/CR DATA OUT (RW-0)
T2nEVT FUNCTION (RW-0) T2nIC1/CR FUNCTION (RW-0)
T2nEVT DATA DIR (RW-0) T2nIC1/CR DATA DIR (RW-0)
DATA OUT (RW-0) T2n PRIORITY (RP-0)
FUNCTION (RW-0)
DATA DIR (RW-0)
T2nPRI
106Fh/108Fh
P06F/P08F
--
--
--
--
--
--
8-18
T2n Control Registers
8.8.1
T2n Control Register 1 (T2nCTL1)
The T2nCTL1 register controls the clock input selection, counter overflow interrupts, and counter software reset.
T2n Control Register 1 (T2nCTL1) [Memory Address 106Ah (T2A) or 108Ah (T2B)]
Bit #
P06A or P08A
7
--
6
--
5
--
4
T2n OVRFL INT ENA RW-0
3
T2n OVRFL INT FLAG RC-0
2
T2n INPUT SELECT1 RW-0
1
T2n INPUT SELECT0 RW-0
0
T2n SW RESET S-0
R = Read, W = Write, S = Set only, C = Clear only, -n = Value of the bit after the register is reset
Bits 7-5 Bit 4
Reserved. Read data is indeterminate. T2n OVRFL INT ENA. T2n Overflow Interrupt Enable This bit controls the T2n overflow interrupting capability. 0 = Disables interrupt 1 = Enables interrupt from overflow
Bit 3
T2n OVRFL INT FLAG. T2n Overflow Interrupt Flag This bit is the T2n counter overflow bit. 0 = Overflow interrupt is inactive. 1 = Overflow interrupt is pending.
Bits 2-1
T2n INPUT SELECT1-0. T2n Input Select These two bits select one of four clock sources as an input to the counter. The four options are:
- System clock with no prescale - System clock when external input is high (pulse accumulation) - External source synchronized with system clock (event input) - No clock
The combinations are shown below:
T2n INPUT SELECT2 0 0 1 1 T2n INPUT SELECT1 0 1 0 1 System clock Pulse accumulation Event input No clock input
Counter Clock Source
Bit 0
T2n SW RESET. T2n Software Reset When a 1 is written to this bit, the counter will reset to 0000h on the next system clock cycle; however, this bit is always read as a zero.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-19
T2n Control Registers
8.8.2
T2n Control Register 2 (T2nCTL2)
The T2nCTL2 register contains interrupt flags and controls the capability of the module to issue interrupts. Each of these registers is paired (P06B/P08B and P06C/P08C) with a T2n control register 3 (described in subsection 8.8.3 on page 8-23). The registers are used in the dual compare mode or in the dual capture mode depending on the mode set in the T2n control register 3, bit 7.
T2n Control Register 2 (T2nCTL2) [Memory Address 106Bh (T2A) or 108Bh (T2B)] Mode: Dual Compare
Bit #
P06B or P08B
7
T2nEDGE1 INT FLAG RC-0
6
T2nC2 INT FLAG RC-0
5
T2nC1 INT FLAG RC-0
4
--
3
--
2
T2nEDGE1 INT ENA RW-0
1
T2nC2 INT ENA RW-0
0
T2nC1 INT ENA RW-0
Mode: Dual Capture
Bit #
P06B or P08B
7
T2nEDGE1 INT FLAG RC-0
6
T2nEDGE2 INT FLAG RC-0
5
T2nC1 INT FLAG RC-0
4
--
3
--
2
T2nEDGE1 INT ENA RW-0
1
T2nEDGE2 INT ENA RW-0
0
T2nC1 INT ENA RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bit 7
T2nEDGE1 INT FLAG. T2n External Edge 1 Interrupt Flag This bit is set when the appropriate edge is detected on the T2nIC1/CR pin. 0 = Interrupt inactive 1 = Interrupt pending from edge 1 detect circuitry Note: Be careful using the AND, OR, XOR, CMPBIT, SBIT0, or SBIT1 instruction to modify this register. The read/modify/write nature of these instructions can inadvertently clear an interrupt flag that was set between the read and the write cycles. If the state of the interrupt enable bits is known, the MOV #iop8, Pd instruction can be used. If the state of the interrupt enable bits is not known, a sequence similar to the example shown below should be used.
; Clearing the T2AC1 INT FLAG MOV P06B,A OR #0E0h,A AND #0DFh,A MOV A,P06B
8-20
T2n Control Registers
Bit 6
Dual Compare Mode:
T2nC2 INT FLAG. T2n Output Compare 2 Interrupt Flag This bit is set when the capture/compare register first matches the counter value. 0 = Interrupt inactive 1 = Interrupt pending from compare 2
Dual Capture Mode: T2nEDGE2 INT FLAG. T2n Edge 2 Interrupt Flag This bit is set when the appropriate edge is detected on T2nIC2/PWM and indicates that the capture register was loaded.
0 = Interrupt inactive 1 = Interrupt pending from edge 2 detect Bit 5 T2nC1 INT FLAG. T2n Output Compare 1 Interrupt Flag This bit is set when the output compare register first matches the counter value. 0 = Interrupt inactive 1 = Interrupt pending from compare 1 Bits 4-3 Bit 2 Reserved. Read data is indeterminate. T2nEDGE1 INT ENA. T2n External Edge 1 Interrupt Enable This bit determines whether or not the active edge input to the T2nIC1/CR pin generates an interrupt. 0 = Disables interrupt 1 = Enables interrupt Bit 1
Dual Compare Mode:
T2nC2 INT ENA. T2n Output Compare 2 Interrupt Enable This bit controls the interrupting capability of the compare 2 register. 0 = Disables interrupt 1 = Enables interrupt from compare 2 register
Dual Capture Mode: T2nEDGE2 INT ENA. T2n External Edge 2 Interrupt Enable This bit determines whether or not the active edge input to the T2nlC2/PWM pin generates an interrupt.
0 = Disables interrupt 1 = Enables interrupt
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-21
T2n Control Registers
Bit 0
T2nC1 INT ENA. T2n Compare 1 Interrupt Enable This bit controls the interrupting capability of the compare 1 register. 0 = Disables interrupt 1 = Enables interrupt from compare 1 register
8-22
T2n Control Registers
8.8.3
T2n Control Register 3 (T2nCTL3)
The T2nCTL3 register controls the T2n module mode of operation (dual compare or dual capture as set by bit 7), outputs, active transition polarity, and counter reset. Each of these registers is paired with a T2n control register 2 (P06B/P08B and P06C/P08C) described in subsection 8.8.2 on page 8-20.
T2n Control Register 3 (T2nCTL3) [Memory Address 106Ch (T2A) or 108Ch (T2B)] Mode: Dual Compare
Bit #
P06C or P08C
7
T2n MODE= 0 RW-0
6
T2nC1 OUT ENA RW-0
5
T2nC2 OUT ENA RW-0
4
T2nC1 RST ENA RW-0
3
T2nEDGE1 OUT ENA RW-0
2
T2nEDGE1 POLARITY RW-0
1
T2nEDGE1 RST ENA RW-0
0
T2nEDGE1 DET ENA RW-0
Mode: Dual Capture
Bit #
P06C or P08C
7
T2n MODE=1 RW-0
6
--
5
--
4
T2nC1 RST ENA RW-0
3
T2nEDGE2 POLARITY RW-0
2
T2nEDGE1 POLARITY RW-0
1
T2nEDGE2 DET ENA RW-0
0
T2nEDGE1 DET ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
T2n MODE. T2n Mode Select This bit selects the operating mode for the counter. 0 = Dual compare mode 1 = Dual capture mode
Bit 6
Dual Compare Mode:
T2nC1 OUT ENA. T2n Output Compare 1 Enable This bit controls whether or not the compare equal pulse from the compare register toggles T2nIC2/PWM pin. 0 = Disables pulse from toggling output 1 = Enables pulse to toggle output
Dual Capture Mode: Reserved. Read data is indeterminate.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-23
T2n Control Registers
Bit 5
Dual Compare Mode: T2nC2 OUT ENA. T2n Output Compare 2 Enable This bit controls whether or not the output compare equal pulse from the capture/compare register toggles the T2nIC2/PWM output pin. 0 = Disables pulse to toggle output 1 = Enables pulse to toggle output Dual Capture Mode: Reserved. Read data is indeterminate.
T2nC1 RST ENA. T2n Output Compare 1 Reset Enable This bit controls whether or not the compare equal pulse from the compare register resets the counter on the next counter increment. 0 = Disables reset upon compare equal 1 = Enables reset upon compare equal
Bit 4
Bit 3
Dual Compare Mode: T2nEDGE1 OUT ENA. T2n Edge 1 Detect Output Enable This bit controls whether or not the pulse indicating an external edge detect toggles the module's output pin. 0 = Disables pulse to toggle output 1 = Enables pulse to toggle output Dual Capture Mode: T2nEDGE2 POLARITY. T2n Edge 2 Polarity Select This bit controls which transition level on the T2nIC2/PWM pin is active. 0 = Triggers on high-to-low transition 1 = Triggers on low-to-high transition
T2nEDGE1 POLARITY. T2n Edge 1 Polarity Select This bit controls which transition level on the T2nIC1/CR pin is active. 0 = Triggers on high-to-low transition 1 = Triggers on low-to-high transition
Bit 2
Bit 1
Dual Compare Mode: T2nEDGE1 RST ENA. T2n Edge 1 Detect Reset Enable This bit controls whether or not an external signal can reset the counter. 0 = Disables external reset of the counter 1 = Enables external reset of the counter Dual Capture Mode: T2nEDGE2 DET ENA. T2n External Edge 2 Detect Enable This bit enables the edge detection circuit to sense the next active level transition on the T2nIC2/PWM pin. This bit remains unchanged after the selected transition is detected and during reset. 0 = Disables edge detect 1 = Enables edge detect
8-24
T2n Control Registers
Bit 0
Dual Compare Mode:
T2nEDGE1 DET ENA. T2n Edge 1 Detect Enable This bit enables the edge detection circuit to sense the next active level transition on the T2nIC1/CR pin. This bit is cleared after the selected transition is detected and during reset. 0 = Disables edge 1 detect 1 = Enables edge 1 detect
Dual Capture Mode: T2nEDGE1 DET ENA. T2n Edge 1 Detect Enable This bit enables the edge detection circuit to sense the next active level transition on the T2nIC1/CR pin. This bit remains unchanged after the selected transition is detected and during reset.
0 = Disables input capture. 1 = Enables input capture.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-25
T2n Control Registers
8.8.4
T2n Port Control Registers (T2nPC1 and T2nPC2)
The port control registers (PCRs) control the functions of the I/O pins. Each module pin is controlled by a nibble in one of the PCRs.
8.8.4.1
T2n Port Control Register 1 (T2nPC1)
The T2nPC1 register assigns the I/O function of the T2nEVT pin as either a general-purpose digital I/O or external event input of the module.
T2n Port Control Register 1 (T2nPC1) [Memory Address 106Dh (T2A) or 108Dh (T2B)]
Bit #
P06D or P08D
7
--
6
--
5
--
4
--
3
T2nEVT DATA IN R-0
2
T2nEVT DATA OUT RW-0
1
T2nEVT FUNCTION RW-0
0
T2nEVT DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-4 Bit 3
Reserved. Read data is indeterminate. T2nEVT DATA IN. T2n Event Pin Data In This bit contains the data to be input from the T2nEVT pin. A write to this bit has no effect.
Bit 2
T2nEVT DATA OUT. T2n Event Pin Data Out This bit contains the data to be output on the T2nEVT pin if the following conditions are met: a. Bit T2nEVT DATA DIR = 1 b. Bit T2nEVT FUNCTION = 0
Bit 1
T2nEVT FUNCTION. T2n Event Pin Function Select This bit selects the function of the T2EVT pin. 0 = T2nEVT is a general-purpose digital I/O pin. 1 = T2nEVT is the event input pin.
Bit 0
T2nEVT DATA DIR. T2n Event Pin Data Direction This bit determines the data direction on the T2nEVT pin if the T2nEVT FUNCTION bit = 0. 0 = T2nEVT is configured as input. 1 = T2nEVT is configured as output.
8-26
T2n Control Registers
8.8.4.2
T2n Port Control Register 2 (T2nPC2)
The T2nPC2 register assigns the I/O functions of the T2nIC1/CR and T2nIC2/PWM pins as either general-purpose digital I/O pins or the input capture/counter reset and PWM output pins, respectively.
T2n Port Control Register 2 (T2nPC2) [Memory Address 106Eh (T2A) or 108Eh (T2B)]
Bit #
P06E or P08E
7
T2nIC2/ PWM DATA IN R-0
6
T2nIC2/ PWM DATA OUT RW-0
5
T2nIC2/ PWM FUNCTION RW-0
4
T2nIC2/ PWM DATA DIR RW-0
3
T2nIC1/CR DATA IN R-0
2
T2nIC1/CR DATA OUT RW-0
1
T2nIC1/CR FUNCTION RW-0
0
T2nIC1/CR DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
T2nIC2/PWM DATA IN. T2n IC2/PWM Data In This bit contains the data input on the T2nIC2/PWM pin. A write to this bit has no effect.
Bit 6
T2nIC2/PWM DATA OUT. T2n IC2/PWM Data Out This bit contains the data output on the T2nIC2/PWM pin if the following conditions are true: a. Bit T2nIC2/PWM DATA DIR = 1 b. Bit T2nIC2/PWM FUNCTION = 0
Bit 5
T2nIC2/PWM FUNCTION. T2n IC2/PWM Function Select This bit determines the function of the T2nIC2/PWM pin. 0 = T2nIC2/PWM is a general-purpose digital I/O pin. 1 = T2nIC2/PWM is the input capture/PWM output pin.
Bit 4
T2nIC2/PWM DATA DIR. T2n IC2/PWM Data Direction This bit determines the direction of data on the T2nIC2/PWM pin if the T2nIC2/PWM FUNCTION bit = 0. 0 = T2nIC1/PWM is an input. 1 = T2nIC2/PWM is an output.
Bit 3
T2nIC1/CR DATA IN. T2n IC1/CR Data In This bit contains the data input on the T2nIC1/CR pin. A write to this bit has no effect.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-27
T2n Control Registers
Bit 2
T2nIC1/CR DATA OUT. T2n IC1/CR Data Out This bit contains the data output on the T2nIC1/CR pin if the following conditions are true: a. Bit T2nIC1/CR DATA DIR = 1 b. Bit T2nIC1/CR FUNCTION = 0
Bit 1
T2nIC1/CR FUNCTION. T2n IC1/CR Function Select This bit determines the function of the T2nIC1/CR pin. 0 = T2nIC1/CR is a general-purpose digital I/O pin. 1 = T2nIC1/CR is the input capture/counter reset pin.
Bit 0
T2nIC1/CR DATA DIR. T2n IC1/CR Data Direction This bit determines the direction of data on the T2nIC1/CR pin if the T2nIC1/CR FUNCTION bit = 0. 0 = T2nIC1/CR is an input. 1 = T2nIC1/CR is an output.
8-28
T2n Control Registers
8.8.5
T2n Interrupt Priority Control Register (T2nPRI)
The T2nPRI register assigns the priority level of interrupts generated by the T2n module. You can write to this register only in the privilege mode. During normal operation, this is a read-only register.
T2n Priority Control Register (T2nPRI) [Memory Address 106Fh (T2A) or 108Fh (T2B)]
Bit #
P06F or P08F
7
T2n STEST RP-0
6
T2n PRIORITY RP-0
5
--
4
--
3
--
2
--
1
--
0
--
R = Read, P = Privilege write only, -n = Value of the bit after the register is reset
Bit 7
T2n STEST. T2n STEST This bit must be cleared to ensure proper operation.
Bit 6
T2n PRIORITY. T2n Interrupt Priority Select This bit determines the level of T2n interrupts. 0 = Interrupts are level 1 (high priority) requests. 1 = Interrupts are level 2 (low priority) requests.
Bits 5-0
Reserved. Read data is indeterminate.
Timer 2A (T2A) and Timer 2B (T2B) Modules
8-29
8-30
Running Title--Attribute Reference
Chapter 9
Serial Communications Interface 1 (SCI1) Module
The SCI is described in Chapter 9 (SCI1: 3 I/O pins, asynchronous and isosynchronous modes) and Chapter 10 (SCI2: 2 I/O pins, asynchronous mode). This chapter describes SCI1 and covers the following topics:
Topic
9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8
Page
SCI1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 SCI1 Programmable Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Multiprocessor Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8 Communications Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 Port Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16 Initialization Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18 SCI1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
Chapter Title--Attribute Reference
9-1
SCI1 Overview
9.1
SCI1 Overview
The serial communications interface 1 (SCI 1) module is a programmable I/O port that facilitates digital communications between the TMS370 device and other asynchronous peripherals and uses the standard NRZ (nonreturn to zero) format. The SCI1 transmits and receives serial data, one bit at a time, at a programmable bit rate. Both the SCI1 receiver and transmitter are doublebuffered and have their own separate enable and interrupt bits. They can be operated independently or simultaneously in the full duplex mode. The SCI1 module is available in the following families: TMS370Cx0x, TMS370Cx2x, TMS370Cx4x, TMS370Cx5x, TMS370Cx6x, and TMS370CxAx.
9.1.1
Physical Description
The three-pin SCI1 module, shown in Figure 9-1, key features:
-
Three I/O pins:
-
J J J
SCIRXD (SCI1 receive data input) SCITXD (SCI1 transmit data output) SCICLK (SCI1 bidirectional serial clock)
Two communications formats:
J J J J
Asynchronous Isosynchronous
Programmable bit rates to over 65,000 different speeds through a 16-bit baud select register Asynchronous:
H H H H
Range at 5 MHz SYSCLK--3 bits/s to 156 Kbits/s Number of bit rates--64K
Isosynchronous: Range at 5 MHz SYSCLK--39 bits/s to 2.5 Mbits/s Number of bit rates--64K
-
Programmable data word length from 1 to 8 bits Programmable stop bits of either 1 or 2 bits in length Error detection flags that ensure data integrity:
J J J J
Parity error Overrun error Framing error Break detect
9-2
SCI1 Overview
-
Two wake-up multiprocessor modes that can be used with either communications format:
J J
Idle line wake-up Address bit wake-up
Full duplex operation Separate transmitter and receiver interrupts for polled or interrupt-driven operation Double-buffered receive and transmit functions Separate enable bits for the transmitter and receiver NRZ (nonreturn to zero) format
Serial Communications Interface 1 (SCI1) Module
9-3
SCI1 Overview
Figure 9-1. SCI1 Block Diagram - Three Pin Configuration
Frame format and mode PARITY EVEN/ ODD ENABLE TXWAKE SCICTL.3 1 WUT 8 TX EMPTY TXCTL.6 TXENA
TXBUF.7 - 0
Transmit data buffer reg. SCI TX Interrupt SCI TX TXRDY INT ENA TXCTL.7
SCITX PRIORITY SCIPRI.6 Level 1 Int
0 1
SCICCR.6 SCICCR.5
TXCTL.0
Level 2 Int
External pin connections
SCIPC2.7 - 4
SCITXD SCITXD
BAUD MSB. 7 - 0
Baud rate MSbyte reg.
TXSHF Reg. CLOCK
SCICTL.1 SCIPC1.3 - 0
SYSCLK
SCICTL.4 BAUD LSB. 7 - 0
Baud rate LSbyte reg. RXSHF reg. RXWAKE RXCTL.1 RXENA RX ERROR SCIRXD SCIRX PRIORITY SCIPRI.5 Level 1 Int
0 1
SCICLK
SCIPC2.3 - 0
SCIRXD
SCI RX interrupt RXRDY RXCTL.6 BRKDT RXCTL.5 SCI RX INT ENA
SCICTL.0
8
RXCTL.7
ERR
RXCTL.4-2
FE OE PE Receive data buffer reg.
RXCTL.0
Level 2 Int
RXBUF.7 - 0
Note: SCI1 registers are described in detail in Section 9.8.1 beginning on page 9-22.
9-4
SCI1 Overview
9.1.2
Architecture
The major elements of the full-duplex SCI1 are shown in Figure 9-1 and include:
-
A transmitter (SCITX)
J J
TXBUF -- the transmitter buffer register that contains data, written by the CPU, to be transmitted TXSHF -- the transmitter shift register that is loaded from TXBUF and shifts data onto the SCITXD pin, one bit at a time
-
A receiver (SCIRX)
J J
RXSHF -- the receiver shift register that shifts data in from the SCIRXD pin, one bit at a time RXBUF -- the receiver buffer register that contains data that is to be read by the CPU and that is received from the remote processor and loaded from RXSHF
-
A programmable baud generator Memory-mapped control and status registers
The SCI1 receiver and transmitter can operate independently and simultaneously. A third port line, SCICLK, is available for an optional synchronizing clock line in the isosynchronous mode.
9.1.3
Communications Modes and Multiprocessing Modes
The SCI1 offers the following universal asynchronous receiver/transmitter (UART) communications modes for interfacing with many popular peripherals:
-
Asynchronous mode (discussed in subsection 9.4.1 on page 9-12) requires two lines to interface with many standard devices such as terminals and printers that use RS-232-C formats. Isosynchronous mode (discussed in subsection 9.4.2 on page 9-13) permits high transmission rates and requires a synchronizing clock signal between the receiver and transmitter.
Data transmission characteristics include: 1 start bit 1 to 8 data bits (SCICCR.0-2) An even/odd parity bit or no parity bit (SCICCR.6) 1 or 2 stop bits (SCICCR.7)
Serial Communications Interface 1 (SCI1) Module
9-5
SCI1 Overview
The SCI1 also has two multiprocessor modes: the idle line multiprocessor mode (see subsection 9.3.1 on page 9-9) and the address bit multiprocessor mode (see subsection 9.3.2 on page 9-10). These modes allow efficient data transfer between multiple processors and can be used with either the isosynchronous or standard asynchronous formats.
9.1.4
Control Registers
The SCI1 control registers are located at addresses 1050h to 105Fh and occupy peripheral file frame 5. The function of each location is shown in Table 9-1.
Table 9-1. SCI1 Memory Map
Peripheral File Location P050 P051 Symbol SCICCR SCICTL Name SCI Communication Control Register SCI Control Register Description Defines the character format, protocol, and communications mode used by the SCI1. Controls the RX/TX enable, TXWAKE and SLEEP functions, internal clock enable, and the SCI1 software reset. Stores the data required to generate the bit rate. See Page 9-22 9-24
P052 P053 P054
BAUD MSB BAUD LSB TXCTL
Baud Select MSbyte Register Baud Select LSbyte Register SCI Transmitter Interrupt Control and Status Register SCI Receiver Interrupt Control and Status Register Reserved
9-27
Contains the transmitter interrupt enable, the transmitter ready flag, and the transmitter empty flag. Contains one interrupt enable bit and seven receiver status flags.
9-28
P055 P056 P057 P058 P059 P05A-P05C P05D P05E P05F
RXCTL
9-29
RXBUF
SCI Receiver Data Buffer Reserved
Contains the current data from the receiver shift register.
9-31
TXBUF
SCI Transmit Data Buffer Reserved
Stores data bits to be transmitted by the SCITX.
9-31
SCIPC1 SCIPC2 SCIPRI
SCI Port Control Register 1 SCI Port Control Register 2 SCI Interrupt Priority Control Register
Controls the SCICLK pin functions. Controls the SCIRXD and SCITXD pin functions. Contains the receiver and transmitter interrupt priority select bits.
9-32 9-33 9-35
9-6
SCI1 Programmable Data Format
9.2 SCI1 Programmable Data Format
SCI1 data, both receive and transmit, is in NRZ (nonreturn to zero) format. The NRZ data format is illustrated in Figure 9-2 and consists of:
-
1 start bit 1 to 8 data bits An even/odd parity bit (optional) 1 or 2 stop bits An optional extra bit to distinguish addresses from data (address bit mode only).
The basic unit of data is called a character and is 1 to 8 bits in length. Each character of data is formatted with a start bit, 1 or 2 stop bits, and optional parity and address bits. A character of data with its formatting information is called a frame and is shown in Figure 9-2.
Figure 9-2. SCI1 Data Formats
Start LSB 2 3 4 5 6 7 MSB Parity Stop
Idle Line Mode (Normal Nonmultiprocessor Communications)
Start
LSB
2
3
4
5
6
7
MSB
Addr/ Data
Parity
Stop
Address Bit Mode
To program the data format, use the SCICCR register (described in subsection 9.8.1 on page 9-22). The bits that you use to program the data format are shown in Table 9-2.
Table 9-2. Programming the Data Format Using SCICCR
Bit Name SCI CHAR0-2 Designation SCICCR.0-2 Function Character length selection. Selects the character (data) length (1 to 8 bits). Refer to the bit listings on page 9-22 for additional information. Enables the parity function if set to 1 or disables the parity function if cleared to 0. If parity is enabled, selects odd parity if cleared to 0 or even parity if set to 1. Determines the number of stop bits transmitted--one stop bit if cleared to 0 or two stop bits if set to 1.
PARITY ENABLE EVEN/ODD PARITY STOP BITS
SCICCR.5 SCICCR.6 SCICCR.7
Serial Communications Interface 1 (SCI1) Module
9-7
Multiprocessor Communications
9.3 Multiprocessor Communications
The multiprocessor communication format allows one processor to efficiently send blocks of data to other processors on the same serial link. You can have only one talker on a serial line at a time. The first byte of a block of information that the talker sends contains an address byte that is read by all listeners. Only listeners with the correct address can be interrupted by the data bytes that follow the address byte. The listeners with an incorrect address remain uninterrupted until the next address byte. All processors on the serial link set their SLEEP bit (SCICTL.2) to 1 so that they are interrupted only when the address byte is detected. When a processor reads a block address that corresponds to the CPU's device address as set by software, your program must clear the SLEEP bit to enable the SCI1 to generate an interrupt on receipt of each data byte. Although the receiver still operates when the SLEEP bit is 1, it does not set RXRDY, RXINT, or the error status bits to 1 unless the address byte is detected and the address bit in the received frame is a 1. The SCI1 does not alter the SLEEP bit; your software must alter the SLEEP bit. A processor recognizes an address byte according to the multiprocessor mode:
-
The idle line mode leaves a quiet space before the address byte. This mode does not have an extra address/data bit and is more efficient than the address bit mode for handling blocks that contain more than 10 bytes of data. The address bit mode adds an extra bit into every byte to distinguish addresses from data. This mode is more efficient in handling many small blocks of data because, unlike the idle mode, it does not have to wait between blocks of data. However, at high transmit speeds, the program is not fast enough to avoid a 10-bit idle in the transmission stream.
You can select the multiprocessor mode via the ADDRESS/IDLE WUP bit (SCICCR.3). Both modes use the TXWAKE flag bit (SCICTL.3), RXWAKE flag bit (RXCTL.1), and the SLEEP flag bit (SCICTL.2) to control the SCITX and SCIRX features of these modes. In both multiprocessor modes, the sequence is: 1) The SCI1 port wakes up (requests an interrupt) at the start of a block and reads the first frame that contains the destination address. 2) A software routine is entered through the interrupt and checks the RXWAKE flag bit. If the RXWAKE bit is a 1, the incoming byte is an address
9-8
Multiprocessor Communications
(otherwise the byte is data) and this address byte is checked against its device address byte stored in memory. 3) If the check shows that the block is addressed to the microcontroller, the CPU clears the SLEEP bit and reads the rest of the block; if not, the software routine exits with the SLEEP bit still set and does not receive SCI interrupts until the next block start.
9.3.1
Idle Line Multiprocessor Mode
In the idle line multiprocessor mode (ADDRESS/IDLE WUP bit = 0), blocks are separated by having a longer idle time between the blocks than between frames in the blocks. An idle time of 10 or more bits after a frame indicates the start of a new block. The idle line multiprocessor communication format is shown in Figure 9-3. (ADDRESS/IDLE WUP bit is SCICCR.3.)
Figure 9-3. Idle Line Multiprocessor Communication Format
Blocks of Frames
RXD/TXD EXPANDED Last data
Sp
St
Addr
Sp St
Data
Sp
St Last data
Sp
St
Addr Sp
Idle period greater than 10 bits
First frame within block is address, it follows idle period of 10 bits or more
Frame within Idle period block less than 10 bits
Idle period greater than 10 bits
Note:
In the figure, "St" = start and "Sp" = stop
There are two ways to send a block start signal.
-
The first method is to deliberately leave an idle time of 10 bits or more by delaying the time between the transmission of the last frame of data in the previous block and the transmission of the address frame of the new block. In the second method, the SCI1 port uses the TXWAKE bit (SCICTL.3) to send an idle time of exactly 11 bits. Thus, the serial communications line is not idle any longer than necessary.
Associated with the TXWAKE bit is the wake-up temporary or WUT flag bit. WUT is an internal flag, double buffered with TXWAKE. When TXSHF is loaded from TXBUF, WUT is loaded from TXWAKE, and the TXWAKE bit is cleared to 0. This arrangement is shown in Figure 9-4.
Figure 9-4. Double-Buffered WUT and TXSHF
TXWAKE TXBUF
WUT
TXSHF
Serial Communications Interface 1 (SCI1) Module
9-9
Multiprocessor Communications
To send out a block start signal of exactly one frame time: 1) Write a 1 to the TXWAKE bit. 2) Write a data word (don't care) to TXBUF. (The first data word written is suppressed while the block start signal is sent out, and ignored after that.) When TXSHF is free again, TXBUF's contents are shifted to TXSHF, the TXWAKE value is shifted to WUT, and then the TXWAKE bit is cleared. If TXWAKE bit was set to a 1, the start, data, and parity bits are replaced by an idle period of 11 bits transmitted following the last stop bit of the previous frame. 3) Write an address value to the TXBUF. The receiver operates regardless of the SLEEP bit. The receiver does not set RXRDY, RXINT, or the error status bits until an address frame is detected.
9.3.2
Address Bit Multiprocessor Mode
In the address bit mode (ADDRESS/IDLE WUP bit = 1), frames have an extra bit, called an address bit, that immediately follows the last data bit. The address bit is set to 1 in the first frame of the block and to 0 in all other frames. The idle period timing is irrelevant (see Figure 9-5). (ADDRESS/IDLE WUP bit is SCICCR.3.) The TXWAKE bit value is placed in the address bit. In SCITX, when the TXBUF and TXWAKE are loaded into TXSHF and WUT, TXWAKE is reset to 0, and WUT is the value of the address bit of the current frame. Thus, to send an address: 1) Set the TXWAKE bit to a 1 and write the appropriate address value to the TXBUF. 2) When this address value is transferred to TXSHF and shifted out, its address bit is sent as a 1, which flags the other processors on the serial link to read the address. 3) Since TXSHF and WUT are both double-buffered, TXBUF and TXWAKE can be written to immediately after TXSHF and WUT are loaded. 4) To transmit nonaddress frames in the block, leave the TXWAKE bit at 0.
9-10
Multiprocessor Communications
Figure 9-5. Address Bit Multiprocessor Communication Format
Blocks of Frames
RXD/TXD EXPANDED Last data 0
Sp
St
Addr 1 Sp St
Data 0
Sp
St Last data 0
Sp
St Addr 1 Sp
Idle period is of no significance
First frame within block is address (ADDR/DATA bit is a 1)
ADDR/DATA Idle period is of no bit is a 0 for frame within significance block
Idle period is of no significance
Note:
In the figure, "St" = start and "Sp" = stop
Serial Communications Interface 1 (SCI1) Module
9-11
Communications Modes
9.4 Communications Modes
The SCIRX/SCITX (receiver/transmitter) has two operating modes: asynchronous and isosynchronous. The ASYNC/ISOSYNC bit (SCICCR.4) determines the mode of operation. Either of these two modes can be used with either of the two forms of multiprocessor protocol: idle line and address bit.
9.4.1
Asynchronous Communications Mode
The SCI1 asynchronous communication mode uses either single-line (oneway) or two-line (two-way) communications. In this mode, the frame consists of a start bit, one to eight data bits, an optional even/odd parity bit, and one or two stop bits. There are 16 SCICLK periods per data bit. The receiver begins operation on receipt of a valid start bit. A valid start bit consists of eight consecutive zero bits. If any bit is not zero, then the processor starts over and begins looking for another start bit. For the bits following the start bit, the processor determines the bit value by making three samples in the middle of the bits. These samples occur on the seventh, eighth, and ninth SCICLK period and are read on a majority (two out of three) basis. Figure 9-6 illustrates the asynchronous communication format, with a start bit showing how edges are found and where a majority vote is taken.
Figure 9-6. Asynchronous Communication Format
Falling Edge Detected SCICLK 1 2 3 4 5 6 7 8 9 10 11 1213 14 15 16 1 2 3 4 5 6 7 8 9 10 11 1213 14 1516 1 RXD Start Bit LSB of Data Majority Vote
Since the receiver synchronizes itself to frames, the external transmitting and receiving devices do not have to use a synchronized serial clock; the clock can be generated locally. If the CLOCK bit (SCICTL.4) and SCICLK FUNCTION bit (SCIPC1.1) are set, then the serial clock is output continuously on the SCICLK pin.
9-12
Communications Modes
9.4.2
Isosynchronous Communications Mode
The SCI1 isosynchronous communication mode uses either two-line (oneway) or three-line (two-way) communications. The extra line (serial clock) in each case is required for data synchronization. In the isosynchronous mode, each bit of data requires only one serial clock pulse for transmission or reception. Thus, the data bit period equals the SCICLK period, and data bits are read on a single sample basis. Since the receiver does not synchronize itself to data bits, the transmitter and receiver must be supplied with a common serial clock. If the internal serial clock is used, it must be output continuously on the SCICLK pin. The arrival of a valid start bit, which consists of a low on the RXD line at the time of a rising SCICLK edge, initiates receiver operation. Figure 9-7 illustrates the isosynchronous communication format. A complete frame consists of a start bit, one to eight data bits, an optional even/odd parity bit, and one or two stop bits.
Figure 9-7. Isosynchronous Communication Format
SCICLK
TXD
Bit Out
Bit Out
Bit Out
RXD
Bit In
Bit In
9.4.3
Receiver Signals in Communications Modes
Figure 9-8 illustrates receiver signal timing that assumes these conditions:
-
Address bit wake-up mode (address bit would not appear in idle line mode) 6 bits per character
Serial Communications Interface 1 (SCI1) Module
9-13
Communications Modes
Figure 9-8. SCI1 RX Signals in Communications Modes
RXENA A RXRDY B SCIRXD Pin STR 0 1 2 3 4 5 C D E STR 0 1 2 F
AD PA
STP
A) RX ENA goes high to enable the receiver. B) Data arrives on the SCIRXD pin; start bit detected. C) RXRDY goes high to signal that a new character has been received; data is shifted to RXBUF; an interrupt is requested. D) The program reads the RXBUF register; RXRDY is automatically cleared. E) The next byte of data arrives on the SCIRXD pin; start bit detected, then cleared. F) RX ENA goes low to disable the receiver; data continues to be assembled in the RXSHF register but is not transferred to the RXBUF register.
9.4.4
Transmitter Signals in Communications Modes
Figure 9-9 illustrates transmitter signal timing that assumes these conditions:
-
Address bit wake-up mode (address bit would not appear in idle line mode) 3 bits per character
Figure 9-9. SCI1 TX Signals in Communications Modes
TXENA A TX EMPTY TXRDY BC SCITXD Pin D E G F
STR
0
1
2
AD PA STP STR 0
1
2
AD PA
ST
A) TX ENA goes high to enable the transmitter to send data. B) Write to TXBUF; TXBUF is no longer empty. C) SCI transfers data to shift register; TXBUF is ready for new character and requests an interrupt. D) Program writes new character to TXBUF after TXRDY goes high (item C). E) Finished transmitting first character; transfer new character to shift register. F) TX ENA goes low to disable transmitter; SCI finishes transmitting current character. G) Finished transmitting character; TXBUF is empty and ready for new character.
9-14
Port Interrupts
9.5 Port Interrupts
The SCI1 provides independent interrupt requests and vectors for the receiver and transmitter.
-
If the SCI RX INT ENA bit (RXCTL.0) is set, the receiver interrupt is asserted when one of the following events occurs:
J J
The SCI1 receives a complete frame and transfers the data in the RXSHF register to the RXBUF register. This action sets the RXRDY flag (RXCTL.6) and initiates an interrupt. A break detect condition occurs (the SCIRXD is low for 10 bit periods following a stop bit). This action sets the BRKDT flag bit (RXCTL.5) and initiates an interrupt.
-
If the SCI TX INT ENA bit (TXCTL.0) is set, the transmitter interrupt is asserted whenever the data in the TXBUF register is transferred to the TXSHF register, indicating that the CPU can write to the TXBUF; this action sets the TXRDY flag bit (TXCTL.7) and initiates an interrupt.
SCI1 interrupts can be programmed onto different priority levels by the SCI RX PRIORITY (SCIPRI.5) and SCI TX PRIORITY (SCIPRI.6) control bits. When both RX and TX interrupt requests are made on the same level, the receiver always has higher priority than the transmitter; this reduces the possibility of receiver overrun.
Serial Communications Interface 1 (SCI1) Module
9-15
Clock Sources
9.6 Clock Sources
The SCI1 port can be driven by an internal or external baud generator. The CLOCK bit (SCICTL.4) configures the SCI1 clock source as either an input or an output:
-
If an external clock source is selected (CLOCK = 0) and the SCICLK FUNCTION bit (SCIPC1.1) is set, the SCICLK pin functions as the highimpedance serial clock input pin. If an internal clock source is selected (CLOCK = 1), the SCICLK pin can be used as a general-purpose I/O pin or as the serial clock output pin. If the serial clock output is selected (SCICLK FUNCTION = 0), a 50-percent duty cycle clock signal is output on the SCICLK pin that makes it a serial clock output pin.
The SCI1 receives data on rising clock edges and transmits data on falling clock edges. The internally generated serial clock is determined by the TMS370 SYSCLK frequency and the baud select registers. The SCI1 uses the 16-bit value of the baud select registers to select one of 64K different serial clock rates for the communication modes in the following manner:
-
Asynchronous Baud = SYSCLK / [(BAUD REG + 1) x 32] BAUD REG = [SYSCLK / (Asynchronous Baud x 32)] - 1 Isosynchronous Baud = SYSCLK / [(BAUD REG + 1) x 2] BAUD REG = [SYSCLK / (Isosynchronous Baud x 2)] - 1 SCICLK frequency = SYSCLK / [(BAUD REG + 1) x 2] BAUD REG = [SYSCLK / (SCICLK frequency x 2)] - 1
where BAUD REG = The 16-bit value in the baud select registers. Refer to Table 9-3. The baud select registers are further defined in subsection 9.8.3 on page 9-27.
9-16
Clock Sources
Table 9-3. Asynchronous Baud Register Values for Common SCI1 Bit Rates
SYSCLK Frequency (MHz) 0.6144 Baud 75 300 600 1200 2400 4800 9600 19200 38400 156000 Baud Reg 255 63 31 15 7 3 1 0 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.8432 Baud Reg 767 191 95 47 23 11 5 2 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 4.9152 Baud Reg 2047 511 255 127 63 31 15 7 3 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 5.0 Baud Reg 2082 520 259 129 64 32 15 7 3 0 % Error 0.02 -0.03 0.16 0.16 0.16 -1.38 1.73 1.73 1.73 0.16
Baud Reg = 16-bit baud register value Divide-by-1 clock can only operate from a minimum of 2 MHz SYSCLK to a maximum of 5 MHz SYSCLK.
Note: When the device is using an externally generated SCICLK in isosynchronous mode, the maximum speed at which the SCICLK can run is limited to SYSCLK/10. This is necessary so that the internal clocks of the SCI1 have time to synchronize with the external clock. For this reason, it is recommended to use the TMS370 to drive the master serial clock in a system where maximum throughput is a major concern. You can determine the current logic level on the SCICLK pin by reading the SCICLK DATA IN bit (SCIPC1.3).
Serial Communications Interface 1 (SCI1) Module
9-17
Initialization Examples
9.7 Initialization Examples
This section contains two examples that initialize the serial port. In each example, the data is moved to and from the buffers in the interrupt routines. 1) The first example shows a typical RS-232 application that connects to a terminal. 2) The second example illustrates the address bit mode in a multiprocessor application. In both examples, assume that the register mnemonics have been equated (EQU) with the corresponding peripheral-file location. For more examples using the TMS370 SCI, consult Using the TMS370 SPI and SCI Modules Application Report.
9.7.1
RS-232-C Example
This example initializes the transmitter and receiver to accept data at 9600 baud with a format of 8 data bits, 1 stop bit, and even parity.
B9600 HI
.EQU .EQU
15 00
AND
#01Fh, SCICTL
MOV MOV MOV MOV MOV MOV MOV MOV MOV EINT MOV
#000h,SCIPRI #005h,SCIPC1 #022h,SCIPC2 #HI,BAUDMSB #B9600,BAUDLSB #077h,SCICCR #033h,SCICTL #001h,TXCTL #001h,RXCTL #00,TXBUF
;Value for counter for 9600 baud ;value = (SYSCLK/32/baud) - 1 = ;(5 MHz/32/9600) - 1 = 15.27 ~ 15 ;1.8 percent error ;Make sure that SCI SW RESET bit is ;clear before writing to the SCI ;configuration registers ;Set TX and RX to high priority ;Set SCLK for general-purpose output ;Set pins for RXD and TXD functions ;Set bit rate for 9600 (MSbyte) ;Set bit rate for 9600 (LSbyte) ;1 stop bit, even parity, ;and enable 8 data bits/char ;Enable Rx, Tx, clock is internal ;Enable TX interrupt ;Enable RX interrupt ;Let the interrupts begin ;Start transmitter by sending null ;character
9-18
Initialization Examples
9.7.2
RS-232-C Multiprocessor Mode Example
This example initializes the transmitter and receiver to accept data at 9600 baud with a format of 8 data bits, 1 stop bit, and even parity. It uses the address bit wake-up mode to implement the multiprocessor protocol.
B9600 HI
.EQU .EQU
15 00
MOV MOV MOV MOV MOV MOV MOV MOV MOV EINT EINT
#000h,SCIPRI #005h,SCIPC1 #022h,SCIPC2 #HI,BAUDMSB #B9600,BAUDLSB #07Fh,SCICCR #037h,SCICTL #001h,TXCTL #001h,RXCTL
;Value for counter for 9600 baud ;value = (SYSCLK/32/baud) - 1 = ;(5 MHz/32/9600) - 1 = 15.27 ~ 15 ;1.8 percent error ;Set TX and RX to high priority ;Set SCLK for general-purpose output ;Set pins for RXD and TXD functions ;Set bit rate for 9600 (MSbyte) ;Set bit rate for 9600 (LSbyte) ;1 stop bit, even parity, ;and enable 8 data bits/char ;Enable Rx, Tx; RX to sleep, ;clock is internal ;Enable TX interrupt ;Enable RX interrupt ;Let the interrupts begin ; ;MAIN ROUTINES ; ;Main line routine; set TXWAKE ;wake bit ;Transmit address stored in ADDR ;INTERRUPT ROUTINES ; ;The locations of the SCI transmitter and ;receiver routines, SENDATA and GETDATA, ;need to be stored in the interrupt vec ;tor table at locations 70F0h and 7FF2h, ;respectively. ;SCI1 TRANSMITTER INTERRUPT ROUTINE
SENDADD
OR MOV RTS
#8,SCICTL ADDR,TXBUF
SENDDATA
PUSH MOV . . . POP RTI
A OUTDATA,TXBUF
A
;Address has already been sent by ;the SENDADD ;Output character that is ;stored in DATA ; ;Other transmitter code ; ;Restore and exit
Serial Communications Interface 1 (SCI1) Module
9-19
Initialization Examples
. GETDATA PUSH BTJZ MOV CMP JNE AND JMP ISDATA MOV . . . POP RTI A #2,RXCTL,ISDATA RXBUF,A #MYADDR,A RXEXIT #0FBh,SCICTL RXEXIT RXBUF,INDATA
;SCI1 RECEIVER INTERRUPT ROUTINE ;Receive a new character ;Is this address or data byte? ;Get new character and clear ;interrupt flag ;Is this my address or ;another processor's address ;Exit if another's; still ;in sleep mode ;If my address get out of sleep mode ;Exit and wait for data ; ;Put incoming data in register ; ;Other receiver code ; ;Restore and exit
RXEXIT
A
9-20
SCI1 Control Registers
9.8
SCI1 Control Registers
The SCI1 is controlled and accessed through registers in peripheral file frame 5. These registers are listed in Figure 9-10 and described in the following subsections. The bits shown in shaded boxes in Figure 9-10 are privilege mode bits; that is, they can only be written to in the privilege mode.
Figure 9-10. Peripheral File Frame 5: SCI1 Control Registers
Designation SCICCR ADDR 1050h PF P050
Bit 7
STOP BITS (RW-0) --
Bit 6
EVEN/ODD PARITY (RW-0) -- BAUDE (RW-0) BAUD6 (RW-0) TX EMPTY (R-1) RXRDY (R-0)
Bit 5
PARITY ENABLE (RW-0) SCI SW RESET (RW-0) BAUDD (RW-0) BAUD5 (RW-0) -- BRKDT (R-0)
Bit 4
ASYNC/ ISOSYNC (RW-0) CLOCK (RW-0) BAUDC (RW-0) BAUD4 (RW-0) -- FE (R-0) Reserved
Bit 3
ADDRESS/ IDLE WUP (RW-0) TXWAKE (RS-0) BAUDB (RW-0) BAUD3 (RW-0) -- OE (R-0)
Bit 2
SCI CHAR2 (RW-0) SLEEP (RW-0) BAUDA (RW-0) BAUD2 (RW-0) -- PE (R-0)
Bit 1
SCI CHAR1 (RW-0) TXENA (RW-0) BAUD9 (RW-0) BAUD1 (RW-0) -- RXWAKE (R-0)
Bit 0
SCI CHAR0 (RW-0) RXENA (RW-0) BAUD8 (RW-0) BAUD0 (LSB) (RW-0) SCI TX INT ENA (RW-0) SCI RX INT ENA (RW-0)
SCICTL
1051h
P051
BAUD MSB
1052h
P052
BAUDF (MSB) (RW-0) BAUD7 (RW-0) TXRDY (R-1) RX ERROR (R-0)
BAUD LSB
1053h
P053
TXCTL
1054h
P054
RXCTL
1055h
P055
1056h RXBUF 1057h 1058h TXBUF 1059h 105Ah 105Bh 105Ch SCIPC1 105Dh
P056 P057 P058 P059 P05A P05B P05C P05D -- -- SCITXD DATA OUT (RW-0) SCITX PRIORITY (RP-0) -- SCITXD FUNCTION (RW-0) SCIRX PRIORITY (RP-0) -- TXDT7 (RW-0) TXDT6 (RW-0) TXDT5 (RW-0) RXDT7 (R-0) RXDT6 (R-0) RXDT5 (R-0)
RXDT4 (R-0)
RXDT3 (R-0)
RXDT2 (R-0)
RXDT1 (R-0)
RXDT0 (R-0)
Reserved TXDT4 (RW-0) TXDT3 (RW-0) TXDT2 (RW-0) TXDT1 (RW-0) TXDT0 (RW-0)
Reserved
SCICLK DATA IN (R-0) SCIRXD DATA IN (R-0) --
SCICLK DATA OUT (RW-0) SCIRXD DATA OUT (RW-0) --
SCICLK FUNCTION (RW-0) SCIRXD FUNCTION (RW-0) --
SCICLK DATA DIR (RW-0) SCIRXD DATA DIR (RW-0) --
SCIPC2
105Eh
P05E
SCITXD DATA IN (R-0) SCI STEST (RP-0)
SCITXD DATA DIR (RW-0) SCI ESPEN (RP-0)
SCIPRI
105Fh
P05F
Note:
Shaded boxes indicate privilege mode.
Serial Communications Interface 1 (SCI1) Module
9-21
SCI1 Control Registers
9.8.1
SCI Communication Control Register (SCICCR)
The SCICCR register defines the character format, protocol, and communications modes used by the SCI1.
SCI Communication Control Register (SCICCR) [Memory Address 1050h]
Bit #
P050
7
STOP BITS RW-0
6
EVEN/ODD PARITY RW-0
5
PARITY ENABLE RW-0
4
ASYNC/ ISOSYNC RW-0
3
ADDRESS/ IDLE WUP RW-0
2
SCI CHAR2 RW-0
1
SCI CHAR1 RW-0
0
SCI CHAR0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
STOP BITS. SCI1 Number of Stop Bits. This bit determines the number of stop bits transmitted. The receiver checks for one stop bit only. 0 = One stop bit 1 = Two stop bits
Bit 6
EVEN/ODD PARITY. SCI1 Parity Enable. If the PARITY ENABLE bit is set, this bit selects odd or even parity (odd or even number of one bits in both transmitted and received characters). 0 = Sets odd parity 1 = Sets even parity
Bit 5
PARITY ENABLE. SCI1 Parity Enable. This bit enables or disables the parity function. When parity is enabled during the address bit multiprocessor mode, the address bit is included in the parity calculation. 0 = Disables parity. No parity bit is generated during transmission or expected during reception. 1 = Enables parity
Bit 4
ASYNC/ISOSYNC. SCI1 communications Mode Control Bit. This bit determines the SCI1 communications mode. 0 = Selects isosynchronous mode. In this mode, the bit period is equal to the SCICLK period; bits are read on a single-sample basis. 1 = Selects asynchronous mode. In this mode, the bit period is 16 times the SCICLK period; bits are read on a two-out-of-three majority basis.
9-22
SCI1 Control Registers
Bit 3
ADDRESS/IDLE WUP. SCI1 Multiprocessor Mode Control Bit. This bit selects the multiprocessor mode. 0 = Selects idle line mode 1 = Selects address bit mode The idle line mode is usually used for normal communications because the address bit mode adds an extra bit to the frame; the idle line mode does not add this extra bit and is compatible with RS-232-type communications. Multiprocessor communication is different from the other communications modes because it uses TXWAKE and SLEEP functions.
Bits 2-0
SCI CHAR2-0. SCI1 Character Length Control Bits 2-0. These bits select the SCI character (data) bit length, from 1 to 8 bits. Characters of less than 8 bits are right-justified in RXBUF and TXBUF, and are padded with leading 0s in RXBUF. TXBUF need not be padded with leading zeros.
Table 9-4. Character Bit Length
SCI CHAR2 0 0 0 0 1 1 1 1 SCI CHAR1 0 0 1 1 0 0 1 1 SCI CHAR0 0 1 0 1 0 1 0 1 Character Length 1 2 3 4 5 6 7 8
Serial Communications Interface 1 (SCI1) Module
9-23
SCI1 Control Registers
9.8.2
SCI Control Register (SCICTL)
The SCICTL register controls the RX/TX enable, TXWAKE and SLEEP functions, internal clock enable, and the SCI1 software reset.
SCI Control Register (SCICTL) [Memory Address 1051h]
Bit #
P051
7
--
6
--
5
SCI SW RESET RW-0
4
CLOCK RW-0
3
TXWAKE RS-0
2
SLEEP RW-0
1
TXENA RW-0
0
RXENA RW-0
R = Read, W = Write, S = Set only, -n = Value of the bit after the register is reset
Bits 7-6 Bit 5
Reserved. Read data is indeterminate. SCI SW RESET. SCI1 Software Reset (Active Low). Writing a 0 to this bit initializes the SCI state machines and operation flags to the reset condition (shown in Table 9-5). The CLOCK bit retains its state prior to the assertion of SCI SW RESET. If SCICLK is configured as an output (by bits SCIPC1.0 and1), the SCICLK resets (low level). All affected logic is held in the reset state until a 1 is written to the SCI SW RESET bit. Thus, after a system reset, you must re-enable the SCI by writing a 1 to this bit. This bit must be cleared after a receiver break detect. SCI SW RESET affects the operating flags of the SCI1. This bit does not affect the configuration bits, nor does it put in the reset values. The flags listed in Table 9-5 are set to the values shown when SCI SW RESET is cleared. The operating flags are frozen until the SCI SW RESET bit is set again.
Table 9-5. Flags Affected by SCI SW RESET
SCI1 Flag TXRDY TXEMPTY RXWAKE PE OE FE BRKDT RXRDY RX ERROR Designation TXCTL.7 TXCTL.6 RXCTL.1 RXCTL.2 RXCTL.3 RXCTL.4 RXCTL.5 RXCTL.6 RXCTL.7 Value After SCI SW RESET 1 1 0 0 0 0 0 0 0
9-24
SCI1 Control Registers
Note:
First Clear SCI SW RESET Bit
The SCI SW RESET bit must be cleared before the SCI1 configuration registers can be set up or altered. The application program should set up all configuration registers before it sets the SCI SW RESET bit. Bit 4 CLOCK. SCI1 Internal Clock Enable. This bit determines the source of the SCICLK. Clearing this bit selects an external SCICLK, which is input on the high-impedance SCICLK line and bypasses the baud generator.
- For isosynchronous transactions, one bit is transmitted or received per SCICLK period. - For asynchronous transactions, one bit is transmitted or received per 16 SCICLK
periods.
The maximum frequency for the externally sourced SCICLK is CLKIN/16. Setting the CLOCK bit selects an internal SCICLK, derived from the baud generator. This signal can be output on the SCICLK line. 0 = External SCICLK 1 = Internal SCICLK Bit 3 TXWAKE. SCI1 Transmitter Wake-up. The TXWAKE bit controls the transmit features of the multiprocessor communication modes. This bit is cleared only by system reset. The SCI hardware clears this bit, once it has been transferred to wake-up temporary (WUT). Bit 2. SLEEP. SCI1 Sleep. This bit controls the receive features of the multiprocessor communication modes. You must clear this bit to bring the SCI1 out of sleep mode. 0 = Disables sleep mode 1 = Enables sleep mode Bit 1 TXENA. SCI1 Transmit Enable. Data transmission through the SCITXD pin occurs only when this bit is set. If this bit is reset, the transmission is not halted until all the data previously written to TXBUF has been sent. 0 = Disables SCI1 transmitter 1 = Enables SCI1 transmitter
Serial Communications Interface 1 (SCI1) Module
9-25
SCI1 Control Registers
Bit 0
RXENA. SCI1 Receive Enable. When this bit is set, received characters are transferred into RXBUF, and the RXRDY flag is set. When cleared, this bit prevents received characters from being transferred into the receiver buffer (RXBUF), and no receiver interrupts are generated. However, the receiver shift register continues to assemble characters. As a result, if RXENA is set during the reception of a character, the complete character is transferred into RXBUF. 0 = Disables SCI1 receiver 1 = Enables SCI1 receive
9-26
SCI1 Control Registers
9.8.3
Baud Select Registers (BAUD MSB and BAUD LSB)
The BAUD MSB and BAUD LSB registers store the value used to generate the bit rate. The SCI1 uses the combined 16-bit value, BAUD REG, of the baud select registers to set the SCI1 clock frequency as follows: SCICLK frequency = SYSCLK / [(BAUD Reg + 1) or BAUD REG where BAUD REG = The 16-bit value in the baud select registers. For example, if the SYSCLK frequency is 5 MHz, the maximum internal SCICLK frequency would be [5 MHz / 2] or 2.5 MHz. SYSCLK ) 1 + 2(SCICLK) 2]
-
For asynchronous mode communication, data is transmitted and received at the rate of one bit for each 16 SCICLK periods. For isosynchronous mode communication, data is transmitted and received at the rate of one bit for each SCICLK period.
The asynchronous and isosynchronous bit rates are calculated as follows: Asynchronous Baud = SYSCLK / [(BAUD REG + 1) Isosynchronous Baud = SYSCLK / [(BAUD REG + 1)
Baud Select Register (BAUD MSB) [Memory Address 1052h]
32] 2]
Bit #
P052
7
BAUDF (MSB) RW-0
6
BAUDE RW-0
5
BAUDD RW-0
4
BAUDC RW-0
3
BAUDB RW-0
2
BAUDA RW-0
1
BAUD9 RW-0
0
BAUD8 RW-0
Baud Select Register (BAUD LSB) [Memory Address 1053h]
Bit #
P053
7
BAUD7 RW-0
6
BAUD6 RW-0
5
BAUD5 RW-0
4
BAUD4 RW-0
3
BAUD3 RW-0
2
BAUD2 RW-0
1
BAUD1 RW-0
0
BAUD0 (LSB) RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Serial Communications Interface 1 (SCI1) Module
9-27
SCI1 Control Registers
9.8.4
SCI Transmitter Interrupt Control and Status Register (TXCTL)
The TXCTL register contains the transmitter interrupt enable bit, the transmitter ready flag, and the transmitter empty flag. The status flags are updated each time a compete character is transmitted.
SCI Transmitter Interrupt Control and Status Register (TXCTL) [Memory Address 1054h]
Bit #
P054
7
TXRDY R-1
6
TX EMPTY R-1
5
--
4
--
3
--
2
--
1
--
0
SCI TX INT ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
TXRDY. SCI1 Transmitter Ready. The TXRDY bit is set by the transmitter to indicate that TXBUF is ready to receive another character. The bit is automatically cleared when a character is loaded into TXBUF. This flag asserts a transmitter interrupt if the interrupt enable bit SCI TX INT ENA (TXCTL.0) is set. TXRDY is a read-only flag. It is set to 1 by an SCI SW RESET (SCICTL.5) or by a system reset. 0 = TXBUF is full. 1 = TXBUF is ready to receive a character.
Bit 6
TX EMPTY. SCI1 Transmitter Empty. This bit indicates the status of the transmitter-shift register and the TXBUF register. TX EMPTY is set to 1 by an SCI SW RESET or by a system reset. 0 = The CPU has written data to the TXBUF register; the data has not been completely transmitted. 1 = TXBUF and TXSHF registers are empty.
Bits 5-1 Bit 0
Reserved. Read data is indeterminate. SCI TX INT ENA. SCI1 Transmitter Ready Interrupt Enable. This bit controls the ability of the TXRDY bit to request an interrupt but does not prevent the TXRDY bit from being set. The SCI TX INT ENA bit (TXCTL.0) is set to 0 by a system reset. 0 = Disables SCI TXRDY interrupt 1 = Enables SCI TXRDY interrupt
9-28
SCI1 Control Registers
9.8.5
SCI Receiver Interrupt Control and Status Register (RXCTL)
The RXCTL register contains one interrupt enable bit and seven receiver status flags (two of which can generate interrupt requests). The status flags are updated each time a complete character is transferred to the RXBUF and are cleared each time RXBUF is read.
SCI Receiver Interrupt Control and Status Register (RXCTL) [Memory Address 1055h]
Bit #
P055
7
RX ERROR R-0
6
RXRDY R-0
5
BRKDT R-0
4
FE R-0
3
OE R-0
2
PE R-0
1
RXWAKE R-0
0
SCI RX INT ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
RX ERROR. SCI1 Receiver Error Flag. The RX ERROR flag indicates that at least one of the error flags (bits 5-2 - BRKDT, FE, OE, PE) in the RXCTL register is set. It is a logical OR of the parity, overrun, framing error, and break detect flags. The bit can be used for fast error condition checking during the interrupt service routine because a negative value of the status register indicates that an error condition has occurred. This error flag cannot be cleared directly but is cleared when no individual error flags are set. This bit is cleared by an SCI SW RESET, by a system reset, or by reading RXBUF. 0 = No error flag set 1 = Error flag(s) set
Bit 6
RXRDY. SCI1 Receiver Ready. The receiver sets this bit to indicate that RXBUF is ready with a new character and clears the bit when the character is read. A receiver interrupt is generated if the SCI RX INT ENA bit is a 1. RXRDY is reset by an SCI1 SW RESET (SCICTL.5) or by a system reset.
Bit 5
BRKDT. SCI1 Break Detect Flag. The SCI1 sets this bit when a break condition occurs. A break condition occurs when the SCIRXD line remains continuously low for at least 10 bits, beginning after a missing first stop bit. The occurrence of a break causes a receiver interrupt to be generated if the SCI RX INT ENA bit is a 1, but it does not cause the receiver buffer to be loaded. A BRKDT interrupt can occur, even if the receiver SLEEP bit is set to 1. 0 = No break condition occurred 1 = Break condition occurred. Set RX ERROR bit BRKDT is cleared by an SCI1 SW RESET or by a system reset. It is not cleared by receipt of a character after the break is detected. To receive more characSerial Communications Interface 1 (SCI1) Module
9-29
SCI1 Control Registers
ters, the SCI1 must be reset by toggling the SCI SW RESET bit or by a system reset. Bit 4 FE. SCI1 Framing Error Flag. The SCI1 sets this bit when it doesn't find an expected stop bit. Only the first stop bit is checked. The missing stop bit indicates that synchronization with the start bit has been lost and that the character is incorrectly framed. It is reset by an SCI1 SW RESET, by a system reset, or by reading RXBUF. 0 = No framing error detected 1 = Framing error detected. Set RX ERROR bit Bit 3. OE. SCI1 Overrun Error Flag. The SCI1 sets this bit when a character is transferred into RXBUF before the previous character has been read out. The previous character is overwritten and lost. The OE flag is reset by an SCI1 SW RESET, by a system reset, or by reading RXBUF. 0 = No Overrun error detected 1 = Overrun error detected. Set RX ERROR bit Bit 2 PE. SCI1 Parity Error Flag. This flag bit is set when a character is received with a mismatch between the number of 1s and its parity bit (SCICCR.6 selects parity). The parity checker includes the address bit in the calculation. If parity generation and detection are not enabled, the PE flag is disabled and read as 0. The PE bit is reset by an SCI1 SW RESET, by a system reset, or by reading RXBUF. 0 = No parity error or parity is disabled. 1 = Parity error detected. Set RX ERROR bit Bit 1 RXWAKE. Receiver Wake-up Detect. The SCI1 sets this bit when a receiver wake-up condition is detected. In the address bit multiprocessor mode (SCICCR.3 = 1), RXWAKE reflects the value of the address bit for the character contained in RXBUF. In the idle line multiprocessor mode, RXWAKE is set if an idle SCIRXD line is detected. RXWAKE, a read-only flag, (SCICCR.3 = 0) is cleared by transfer of the first byte after the address byte to RXBUF, by reading the address character in RXBUF, by an SCI SW RESET, or by a system reset. Bit 0 SCI RX INT ENA. SCI1 Receiver Interrupt Enable. The SCI RX INT ENA bit controls the ability of the RXRDY and the BRKDT bits to request an interrupt but does not prevent these flags from being set. 0 = Disables RXRDY/BRKDT interrupt 1 = Enables RXRDY/BRKDT interrupt
9-30
SCI1 Control Registers
9.8.6
SCI Receiver Data Buffer Register (RXBUF)
The RXBUF register contains current data from the receiver shift register. RXBUF is cleared by a system reset.
SCI Receiver Data Buffer Register (RXBUF) [Memory Address 1057h]
Bit #
P057
7
RXDT7 R-0
6
RXDT6 R-0
5
RXDT5 R-0
4
RXDT4 R-0
3
RXDT3 R-0
2
RXDT2 R-0
1
RXDT1 R-0
0
RXDT0 R-0
R = Read, -n = Value of the bit after the register is reset
9.8.7
SCI Transmitter Data Buffer Register (TXBUF)
The TXBUF register is a read/write register that stores data bits to be transmitted by SCITX. Data written to TXBUF are right-justified because the leftmost bits are ignored for characters less than eight bits long.
SCI Transmit Data Buffer Register (TXBUF) [Memory Address 1059h]
Bit #
P059
7
TXDT7 RW-0
6
TXDT6 RW-0
5
TXDT5 RW-0
4
TXDT4 RW-0
3
TXDT3 RW-0
2
TXDT2 RW-0
1
TXDT1 RW-0
0
TXDT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Serial Communications Interface 1 (SCI1) Module
9-31
SCI1 Control Registers
9.8.8
SCI Port Control Register 1 (SCIPC1)
The SCIPC1 register controls the SCICLK pin functions.
SCI Port Control Register 1 (SCIPC1) [Memory Address 105Dh]
Bit #
P05D
7
--
6
--
5
--
4
--
3
SCICLK DATA IN R-0
2
SCICLK DATA OUT RW-0
1
SCICLK FUNCTION RW-0
0
SCICLK DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-4 Bit 3
Reserved. Read data is indeterminate. SCICLK DATA IN. The SCICLK DATA IN bit contains the current value on the SCICLK pin.
Bit 2
SCICLK DATA OUT. This bit contains the data to be output on the SCICLK pin if the following conditions are met:
- Pin SCICLK is a general-purpose I/O. - Pin SCICLK's data direction is defined as output.
Bit 1
SCICLK FUNCTION. This bit defines the function of the SCICLK pin. 0 = Pin SCICLK is a general-purpose digital I/O pin. 1 = Pin SCICLK is the SCI serial clock pin.
BIT 0
SCICLK DATA DIR. SCICLK Data Direction. This bit determines the data direction on the SCICLK pin if SCICLK has been configured as a general-purpose I/O pin. 0 = Pin SCICLK is a general-purpose input pin. 1 = Pin SCICLK is a general-purpose output pin.
9-32
SCI1 Control Registers
9.8.9
SCI Port Control Register 2 (SCIPC2)
The SCIPC2 register controls the SCIRXD and SCITXD pin functions.
SCI Port Control Register 2 (SCIPC2) [Memory Address 105Eh]
Bit #
P05E
7
SCITXD DATA IN R-0
6
SCITXD DATA OUT RW-0
5
SCITXD FUNCTION RW-0
4
SCITXD DATA DIR RW-0
3
SCIRXD DATA IN R-0
2
SCIRXD DATA OUT RW-0
1
SCIRXD FUNCTION RW-0
0
SCIRXD DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
SCITXD DATA IN. This bit contains the current value on the SCITXD pin.
Bit 6
SCITXD DATA OUT. This bit contains the data to be output on the SCITXD pin if the following conditions are met:
- Pin SCITXD has been defined as a general-purpose I/O pin. - Pin SCITXD's data direction has been defined as output.
Bit 5
SCITXD FUNCTION. This bit defines the function of the SCITXD pin. 0 = Pin SCITXD is a general-purpose digital I/O pin. 1 = Pin SCITXD is the SCI1 transmit pin.
Bit 4
SCITXD DATA DIR. SCITXD Data Direction. This bit determines the data direction on the SCITXD pin if SCITXD has been defined as a general-purpose I/O pin. 0 = Pin SCITXD is a general-purpose input pin. 1 = Pin SCITXD is a general-purpose output pin.
Bit 3
SCIRXD DATA IN. This bit contains the current value on the SCIRXD pin.
Bit 2
SCIRXD DATA OUT. This bit contains the data to be output on the SCIRXD pin if the following conditions are met:
- Pin SCIRXD has been defined as a general-purpose I/O pin. - Pin SCIRXD's data direction has been defined as output.
Serial Communications Interface 1 (SCI1) Module
9-33
SCI1 Control Registers
Bit 1
SCIRXD FUNCTION. This bit defines the function of the SCIRXD pin. 0 = Pin SCIRXD is a general-purpose digital I/O pin. 1 = Pin SCIRXD is the SCI1 receiver pin.
Bit 0
SCIRXD DATA DIR. SCIRXD Data Direction. This bit determines the data direction on the SCIRXD pin if SCIRXD has been defined as a general-purpose I/O pin. 0 = Pin SCIRXD is a general-purpose input pin. 1 = Pin SCIRXD is a general-purpose output pin.
9-34
SCI1 Control Registers
9.8.10 SCI Priority Control Register (SCIPRI)
The SCIPRI register contains the receiver and transmitter interrupt priority select bits. This register is read-only during normal operation but can be written to in the privilege mode.
SCI Priority Control Register (SCIPRI) [Memory Address 105Fh]
Bit #
P05F
7
SCI STEST RP-0
6
SCITX PRIORITY RP-0
5
SCIRX PRIORITY RP-0
4
SCI ESPEN RP-0
3
--
2
--
1
--
0
--
R = Read, W = Privilege write only, -n = Value of the bit after the register is reset
Bit 7
SCI STEST. SCI1 STEST. This bit must be cleared to ensure proper operation.
Bit 6
SCI TX PRIORITY. SCI1 Transmitter Interrupt Priority Select. This bit assigns the interrupt priority level of the SCI1 transmitter interrupts. 0 = Transmitter interrupts are level 1 (high-priority) requests. 1 = Transmitter interrupts are level 2 (low-priority) requests.
Bit 5
SCI RX PRIORITY. SCI1 Receiver Interrupt Priority Select. This bit assigns the interrupt priority level of the SCI1 receiver interrupts. 0 = Receiver interrupts are level 1 (high-priority) requests. 1 = Receiver interrupts are level 2 (low-priority) requests.
Bit 4
SCI ESPEN. SCI1 Emulator Suspend Enable. This bit has no effect except when you are using the XDS emulator to debug a program. Then, this bit determines how the SCI1 operates when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the SCI1 continues to work until the current transmit or receive sequence is complete. 1 = When the emulator is suspended, the SCI1 state machine is frozen so that the state of the SCI1 can be examined at the point that the emulator was suspended.
Bits 3-0
Reserved. Read data is indeterminate.
Serial Communications Interface 1 (SCI1) Module
9-35
9-36
Chapter 10
Serial Communications Interface 2 (SCI2) Module
The SCI is described in Chapter 9 (SCI1: 3 I/O pins, asynchronous and isosynchronous modes) and Chapter 10 (SCI2: 2 I/O pins, asynchronous mode). This chapter describes SCI2 and covers the following topics:
Topic
Page
10.1 SCI2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.2 Programmable Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6 10.3 Multiprocessor Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7 10.4 Asynchronous Communication Mode . . . . . . . . . . . . . . . . . . . . . . . . . 10-10 10.5 Port Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12 10.6 Clock Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13 10.7 Initialization Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14 10.8 SCI2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17
10-1
SCI2 Overview
10.1 SCI2 Overview
The serial communications interface (SCI2) module is a programmable I/O port that facilitates digital communications between the TMS370 device and other asynchronous peripherals and uses the standard NRZ (nonreturn to zero) format. The SCI2 transmits and receives serial data, one bit at a time, at a programmable bit rate. Both the SCI2 receiver and transmitter are doublebuffered and have their own separate enable and interrupt bits. They can be operated independently or simultaneously in the full duplex mode. The SCI2 module is available only in the TMS370CxCx family.
10.1.1 Physical Description
The two-pin SCI2 module, shown in Figure 10-1 key features:
-
Two I/O pins:
J J
SCIRXD (SCI2 receive data input) SCITXD (SCI2 transmit data output)
Asynchronous communications format with programmable bit rates to over 65,000 different speed through a 16-bit baud select register
H H
Range at 5 MHz SYSCLK --3 bits/s to 156 kbits/s Number of bit rates--64K
Programmable data word length from 1 to 8 bits Programmable stop bits of either 1 or 2 bits in length Error detection flags that ensure data integrity:
10-2
J J J J J J
Parity error Overrun error Framing error Break detect
Two wake-up multiprocessor modes that can be used with either communications format: Idle line wake-up Address bit wake-up
Full duplex operation Separate transmitter and receiver interrupts for polled or interrupt-driven operation Double-buffered receive and transmit functions
SCI2 Overview
Frame format and mode PARITY EVEN/ ODD ENABLE
Separate enable bits for the transmitter and receiver NRZ (nonreturn to zero) format
Figure 10-1. SCI2 Block Diagram
TXWAKE SCICTL.3 1 WUT 8 TX EMPTY TXCTL.6 TXENA
TXBUF.7 - 0
Transmit data buffer reg. SCI TX Interrupt SCI TX TXRDY INT ENA TXCTL.7
SCITX PRIORITY SCIPRI.6 Level 1 Int
0 1
SCICCR.6 SCICCR.5
TXCTL.0
Level 2 Int
External pin connections
SCIPC2.7 - 4
SCITXD SCITXD
BAUD MSB. 7 - 0
Baud rate MSbyte reg.
TXSHF Reg. CLOCK ENA
SCICTL.1
SYSCLK
SCICTL.4 BAUD LSB. 7 - 0
Baud rate LSbyte reg. RXSHF reg. RXWAKE RXCTL.1 RXENA RX ERROR SCIRXD SCIRX PRIORITY SCIPRI.5 Level 1 Int
0 1
SCIPC2.3 - 0
SCIRXD
SCI RX interrupt RXRDY RXCTL.6 BRKDT RXCTL.5 SCI RX INT ENA
SCICTL.0
8
RXCTL.7
ERR
RXCTL.4-2
FE OE PE Receive data buffer reg.
RXCTL.0
Level 2 Int
RXBUF.7 - 0
10.1.2 Architecture
The major elements of the full-duplex SCI2 are shown in Figure 10-1 and include:
-
A transmitter (SCITX)
J J
TXBUF -- the transmitter buffer register that contains data, written by the CPU, to be transmitted TXSHF -- the transmitter shift register that is loaded from TXBUF and shifts data onto the SCITXD pin, one bit at a time
Serial Communications Interface 2 (SCI2) Module
10-3
SCI2 Overview
-
A receiver (SCIRX)
J J
RXSHF -- the receiver shift register that shifts data in from the SCIRXD pin, one bit at a time RXBUF -- the receiver buffer register that contains data that is to be read by the CPU and that is received from remote processor and loaded from RXSHF
-
A programmable baud generator Memory-mapped control and status registers
The SCI2 receiver and transmitter can operate independently and simultaneously.
10.1.3 Communications Modes and Multiprocessing Modes
The SCI2 offers the following universal asynchronous receiver/transmitter (UART) communications modes for interfacing with many popular peripherals. Asynchronous mode (discussed in subsection 9.4.1 on page 9-12) requires two lines to interface with many standard devices such as terminals and printers that use RS-232-C formats. This mode can be programmed to contain:
-
1 start bit, 1 to 8 data bits, An even/odd parity bit or no parity bit, and 1 or 2 stop bits.
The SCI2 also has two multiprocessor modes: the idle line multiprocessor mode (see subsection 10.3.1) and the address bit multiprocessor mode (see subsection 10.3.2). These modes allow efficient data transfer between multiple processors.
10.1.4 Control Registers
The SCI2 control registers are located at addresses 1050h to 105Fh and occupy peripheral file frame 5. The function of each location is shown in Table 12-1.
10-4
SCI2 Overview
Table 10-1. SCI2 Memory Map
Peripheral File Location P050 Register Symbol SCICCR See Page 10-18
Name SCI Communication Control Register SCI Control Register
Description Defines the character format, protocol, and asynchronous enable used by the SCI2. Controls the RX/TX enable, TXWAKE and SLEEP functions, internal clock enable, and the SCI2 software reset. Stores the data required to generate the bit rate.
P051
SCICTL
10-20
P052 P053 P054
BAUD MSB BAUD LSB TXCTL
Baud Select MSbyte Register Baud Select LSbyte Register SCI Transmitter Interrupt Control and Status Register SCI Receiver Interrupt Control and Status Register Reserved
10-22
Contains the transmitter interrupt enable, the transmitter ready flag, and the transmitter empty flag. Contains one interrupt enable bit and seven receiver status flags.
10-23
P055 P056 P057 P058 P059 P05A-P05D P05E P05F
RXCTL
10-24
RXBUF
SCI Receiver Data Buffer Reserved
Contains the current data from the receiver shift register.
10-26
TXBUF
SCI Transmit Data Buffer Reserved
Stores data bits to be transmitted by the SCITX.
10-26
SCIPC2 SCIPRI
SCI Port Control Register 2 SCI Interrupt Priority Control Register
Controls the SCIRXD and SCITXD pin functions. Contains the receiver and transmitter interrupt priority select bits.
10-27 10-29
Serial Communications Interface 2 (SCI2) Module
10-5
Programmable Data Format
10.2 Programmable Data Format
SCI2 data, both receive and transmit, is in NRZ (nonreturn to zero) format, which means that in active state the SCIRX and SCITX lines will be held logic one. The NRZ data format is illustrated in Figure 10-2 and consists of:
-
1 start bit 1 to 8 data bits An even/odd parity bit (optional) 1 or 2 stop bits An extra bit to distinguish addresses from data (address bit mode only).
The basic unit of data is called a character and is 1 to 8 bits in length. Each character of data is formatted with a start bit, 1 or 2 stop bits, and optional parity and address bits. A character of data along with its formatting information is called a frame and is shown in Figure 10-2.
Figure 10-2. SCI2 Data Formats
Start LSB 2 3 4 5 6 7 MSB Parity Stop
Idle Line Mode (Normal Nonmultiprocessor Communications)
Start
LSB
2
3
4
5
6
7
MSB
Addr/ Data
Parity
Stop
Address Bit Mode
To program the data format, use the SCICCR register (described in subsection 10.8.1 on page 10-18). The bits that you use to program the data format are shown in Table 10-2:
Table 10-2. Programming the Data Format Using SCICCR
Bit Name SCI CHAR0-2 Designation SCICCR.0-2 Function Select the character (data) length (1 to 8 bits). Refer to the bit listings on page 10-18 and 10-19 for additional information. Enables the parity function if set to 1 or disables the parity function if cleared to 0. If parity is enabled, selects odd parity if cleared to 0 or even parity if set to 1. Determines the number of stop bits transmitted--one stop bit if cleared to 0 or two stop bits if set to 1.
PARITY ENABLE EVEN/ODD PARITY STOP BITS
SCICCR.5 SCICCR.6 SCICCR.7
10-6
Multiprocessor Communications
10.3 Multiprocessor Communications
The multiprocessor communication format allows one processor to efficiently send blocks of data to other processors on the same serial link. You can have only one talker on a serial line at a time. The first byte of a block of information that the talker sends contains an address byte that is read by all listeners. Only listeners with the correct address can be interrupted by the data bytes that follow the address byte. The listeners with an incorrect address remain uninterrupted until the next address byte. All processors on the serial link set their SLEEP bit (SCICTL.2) to 1 so that they are interrupted only when the address byte is detected. When a processor reads a block address that corresponds to the CPU's device address as set by software, your program must clear the SLEEP bit to enable the SCI2 to generate an interrupt on receipt of each data byte. Although the receiver still operates when the SLEEP bit is 1, it does not set RXRDY, RXINT, or the error status bits to 1 unless the address byte is detected and the address bit in the received frame is a 1. The SCI2 does not alter the SLEEP bit; your software must alter the SLEEP bit. A processor recognizes an address byte according to the multiprocessor mode:
-
The idle line mode leaves a quiet space before the address byte. This mode does not have an extra address/data bit and is more efficient than the address bit mode in handling blocks that contain more than 10 bytes of data. The address bit mode adds an extra bit into every byte to distinguish addresses from data. This mode is more efficient in handling many small blocks of data because, unlike the idle mode, it does not have to wait between blocks of data. However, at high transmit speeds, the program is not fast enough to avoid a 10-bit idle in the transmission stream.
You can select the multiprocessor mode via the ADDRESS/IDLE WUP bit (SCICCR.3). Both modes use the TXWAKE flag bit (SCICTL.3), RXWAKE flag bit (RXCTL.1), and the SLEEP flag bit (SCICTL.2) to control the SCITX and SCIRX features of these modes. In both multiprocessor modes, the sequence is: 1) The SCI2 port wakes up (requests an interrupt) at the start of a block and reads the first frame that contains the destination address. 2) A software routine is entered through the interrupt which checks the RXWAKE flag bit. If the RXWAKE flag bit is a 1, the incoming byte is an
Serial Communications Interface 2 (SCI2) Module
10-7
Multiprocessor Communications
address (otherwise the byte is data), and the incoming byte is checked against the device address byte stored in memory. 3) If the check shows that the block is addressed to the microcontroller, the CPU clears the SLEEP bit and reads the rest of the block; if not, the software routine exits with the SLEEP bit still set and does not receive SCI2 interrupts until the next block start.
10.3.1 Idle Line Multiprocessor Mode
In the idle line multiprocessor mode (ADDRESS/IDLE WUP bit = 0), blocks are separated by having a longer idle time between the blocks than between frames in the blocks. An idle time of 10 or more bits after a frame indicates the start of a new block. The idle line multiprocessor communication format is shown in Figure 10-3. (The ADDRESS/IDLE WUP bit is SCICCR.3.)
Figure 10-3. Idle Line Multiprocessor Communication Format
Blocks of Frames
RXD/TXD EXPANDED Last data
Sp
St
Addr
Sp St
Data
Sp
St Last data
Sp
St
Addr Sp
Idle period greater than 10 bits
First frame within block is address, it follows idle period of 10 bits or more
Frame within Idle period block less than 10 bits
Idle period greater than 10 bits
Note:
In the figure, "St" = start and "Sp" = stop
There are two ways to send a block start signal.
-
The first method is to deliberately leave an idle time of 10 bits or more by delaying the time between the transmission of the last frame of data in the previous block and the transmission of the address frame of the new block. In the second method, the SCI2 port uses the TXWAKE bit (SCICTL.3) to send an idle time of exactly 11 bits. Therefore, the serial communications line is not idle any longer than necessary.
Associated with the TXWAKE bit is the wake-up temporary or WUT flag bit. WUT is an internal flag, double buffered with TXWAKE. When TXSHF is loaded form TXBUF, WUT is loaded from TXWAKE, and the TXWAKE bit is cleared to 0. This arrangement is shown in Figure 10-4.
Figure 10-4. Double-Buffered WUT and TXSHF
TXWAKE TXBUF
WUT
TXSHF
10-8
Multiprocessor Communications
To send out a block start signal of exactly one frame time: 1) Write a 1 to the TXWAKE bit. 2) Write a data word (don't care) to TXBUF. (The first data word written is suppressed while the block start signal is sent out, and ignored after that.) When TXSHF is free again, TXBUF's contents are shifted to TXSHF, the TXWAKE value is shifted to WUT, and then the TXWAKE bit is cleared. If TXWAKE bit was set to a 1, the start, data, and parity bits are replaced by an idle period of 11 bits transmitted following the last stop bit of the previous frame. 3) Write an address value to the TXBUF. The receiver operates regardless of the SLEEP bit. The receiver does not set RXRDY, RXINT, or the error status bits until an address frame is detected.
10.3.2 Address Bit Multiprocessor Mode
In the address bit mode (ADDRESS/IDLE WUP bit = 1), frames have an extra bit, called an address bit, that immediately follows the last data bit. The address bit is set to 1 in the first frame of the block and to 0 in all other frames. The idle period timing is irrelevant. (The ADDRESS/IDLE WUP bit is SCICCR.3.) The TXWAKE bit sets the address bit. In SCITX, when the TXBUF and TXWAKE are loaded into TXSHF and WUT, TXWAKE is reset to 0, and WUT is the value of the address bit of the current frame. Thus, to send an address, set the TXWAKE bit to a 1 and write the appropriate address value to the TXBUF. When this address value is transferred to TXSHF and shifted out, its address bit is sent as a 1, which flags the other processors on the serial link to read the address. Since TXSHF and WUT are both double-buffered, TXBUF and TXWAKE can be written to immediately after TXSHF and WUT are loaded. To transmit nonaddress frames in the block, leave the TXWAKE bit at 0.
Figure 10-5. Address Bit Multiprocessor Communication Format
Blocks of Frames
RXD/TXD EXPANDED Last data
1 Sp
St
Addr
1 Sp St Data
0
Sp
St Last data 0
Sp
St Addr 1 Sp
Idle period is of no significance.
First frame within block is address. The ADDR/DATA bit is 1.
ADDR/DATA Idle period is of no sigbit is nificance. 0 for frame within block.
Idle period is of no significance.
Note:
In the figure, "St" = start and "Sp" = stop
Serial Communications Interface 2 (SCI2) Module
10-9
Asynchronous Communications Mode
10.4 Asynchronous Communications Mode
The SCI2 asynchronous communication mode uses either single-line (oneway) or two-line (two-way) communications. In this mode, the frame consists of a start bit, one to eight data bits, an optional even/odd parity bit, and one or two stop bits. The receiver begins operation on receipt of a valid start bit. A valid start bit consists of eight consecutive zero bits. If any bit is not zero, then the processor starts over and begins looking for another start bit.
10.4.1 Receiver Signals in the Communication Mode
Figure 10-6 illustrates receiver signal timing that assumes these conditions:
RXENA
Address bit wake-up mode (address bit would not appear in idle line mode) 6 bits per character
Figure 10-6. SCI2 RX Signals in Communications Modes
A RXRDY B SCIRXD Pin STR 0 1 2 3 4 5 C D E STR 0 1 2 F
AD PA
STP
A) RX ENA goes high to enable the receiver. B) Data arrives on the SCIRXD pin; start bit detected. C) RXRDY goes high to signal that a new character has been received; data is shifted to RXBUF; an interrupt is requested. D) The program reads the RXBUF register; RXRDY is automatically cleared. E) The next byte of data arrives on the SCIRXD pin; start bit detected, then cleared. F) RX ENA goes low to disable the receiver; data continues to be assembled in the RXSHF register but is not transferred to the RXBUF register.
10.4.2 Transmitter Signals in the Communication Mode
Figure 10-7 illustrates transmitter signal timing that assumes these conditions:
10-10
Address bit wake-up mode (address bit would not appear in idle line mode) 3 bits per character
Asynchronous Communications Mode
Figure 10-7. SCI2 TX Signals in the Communication Mode
TXENA A TX EMPTY TXRDY BC SCITXD Pin D E G F
STR
0
1
2
AD PA STP STR 0
1
2
AD PA
ST
A) TX ENA goes high to enable the transmitter to send data. B) Write to TXBUF; TXBUF is no longer empty. C) SCI transfers data to shift register; TXBUF is ready for new character and requests an interrupt. D) Program writes new character to TXBUF after TXRDY goes high (item C). E) Finished transmitting first character; transfer new character to shift register. F) TX ENA goes low to disable transmitter; SCI finishes transmitting current character. G) Finished transmitting character; TXBUF is empty and ready for new character.
Serial Communications Interface 2 (SCI2) Module
10-11
Port Interrupts
10.5 Port Interrupts
The SCI2 provides independent interrupt requests and vectors for the receiver and transmitter.
-
If the SCI RX INT ENA bit (RXCTL.0) is set, the receiver interrupt is asserted when one of the following events occurs:
J J
The SCI2 receives a complete frame and transfers the data in the RXSHF register to the RXBUF register. This action sets the RXRDY flag (RXCTL.6) and initiates an interrupt. A break detect condition occurs (the SCIRXD is low for 10 bit periods following a stop bit). This action sets the BRKDT flag bit (RXCTL.5) and initiates an interrupt.
-
If the SCI TX INT ENA bit (TXCTL.0) is set, the transmitter interrupt is asserted whenever the data in the TXBUF register is transferred to the TXSHF register, indicating that the CPU can write to the TXBUF; this action sets the TXRDY flag bit (TXCTL.7) and initiates an interrupt.
SCI2 interrupts can be programmed onto different priority levels by the SCI RX PRIORITY (SCIPRI.5) and SCI TX PRIORITY (SCIPRI.6) control bits. When both RX and TX interrupt requests are made on the same level, the receiver always has higher priority than the transmitter; this reduces the possibility of receiver overrun.
10-12
Clock Sources
10.6 Clock Source
The SCI2 port can be driven by an internal or external baud generator. The internally generated serial clock is determined by the TMS370 SYSCLK frequency and the baud select registers. The SCI2 uses the 16-bit value of the baud select registers to select one of 64K different serial clock rates for the asynchronous communication mode in the following manner:
-
Asynchronous Baud = SYSCLK / [(BAUD REG + 1) x 32] BAUD REG = [SYSCLK / (Asynchronous Baud x 32)] - 1
where BAUD REG = The 16-bit value in the baud select registers. Refer to Table 10-3.
Table 10-3. Asynchronous Baud Register Values for Common SCI2 Bit Rates
SYSCLK Frequency (MHz) 0.6144 Baud 75 300 600 1200 2400 4800 9600 19200 38400 156000 Baud Reg 255 63 31 15 7 3 1 0 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.8432 Baud Reg 767 191 95 47 23 11 5 2 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 4.9152 Baud Reg 2047 511 255 127 63 31 15 7 3 % Error 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 5.0 Baud Reg 2082 520 259 129 64 32 15 7 3 0 % Error 0.02 -0.03 0.16 0.16 0.16 -1.38 1.73 1.73 1.73 0.16
Baud Reg = 16-bit baud register value Divide-by-1 clock can only operate from a minimum of 2 MHz SYSCLK to a maximum of 5 MHz SYSCLK.
Serial Communications Interface 2 (SCI2) Module
10-13
Initialization Examples
10.7 Initialization Examples
This section contains two examples that initialize the serial port. In each example, the data is moved to and from the buffers in the interrupt routines. 1) The first example shows a typical RS-232 application that connects to a terminal. 2) The second example illustrates the address bit mode in a multiprocessor application. In both examples, assume that the register mnemonics have been equated (EQU) with the corresponding peripheral-file location. For more examples using the TMS370 SCI, consult Using the TMS370 SPI and SCI Modules Application Report.
10.7.1 RS-232-C Example
This example initializes the transmitter and receiver to accept data at 9600 baud with a format of 8 data bits, 1 stop bit, and even parity.
B9600 HI .EQU .EQU 15 00 ;Value for counter. For 9600 baud ;value = (SYSCLK/32/baud) - 1 = ;(5 MHz/32/9600) - 1 = 15.27 ~ 5 ;1.8 percent error ;Make sure that SCI SW RESET bit is ;clear before writing to the SCI ;configuration registers ;Set TX and RX to high priority ;Set pins for RXD and TXD functions ;Set bit rate for 9600 (MSbyte) ;Set bit rate for 9600 (LSbyte) ;1 stop bit, even parity, enable ;asynchronous, and enable 8 data bits/char ;Enable Rx and Tx, enable internal clock ;Enable TX interrupt ;Enable RX interrupt ;Let the interrupts begin ;Start transmitter by sending null ;character
AND
#01Fh, SCICTL
MOV MOV MOV MOV MOV MOV MOV MOV EINT MOV
#000h,SCIPRI #022h,SCIPC2 #HI,BAUDMSB #B9600,BAUDLSB #077h,SCICCR #033h,SCICTL #001h,TXCTL #001h,RXCTL #00,TXBUF
10-14
Initialization Examples
10.7.2 RS-232-C Multiprocessor Mode Example
This example initializes the transmitter and receiver to accept data at 9600 baud with a format of 8 data bits, 1 stop bit, and even parity. It uses the address bit wake-up mode to implement the multiprocessor protocol.
B9600 HI .EQU .EQU 15 00 ;Value for counter for 9600 baud ;value = (SYSCLK/32/baud) - 1 = ;(5 MHz/32/9600) - 1 = 15.27 ~ 15 ;1.8 percent error ;Set TX and RX to high priority ;Set pins for RXD and TXD functions ;Set bit rate. For 9600 (MSbyte) ;Set bit rate for 9600 (LSbyte) ;1 stop bit, even parity, enable ;asynchronous, and enable 8 data bits/char ;Enable Rx, Tx; RX to sleep, enable ;internal clock ;Enable TX interrupt ;Enable RX interrupt ;Let the interrupts begin ; ;MAIN ROUTINES ; ;Main line routine; set TXWAKE ;wake bit ;Transmit address stored in ADDR ;INTERRUPT ROUTINES ; ;The locations of the SCI transmitter and ;receiver routines, SENDATA and GETDATA, ;need to be stored in the interrupt vector ;table at locations 70F0h and 7FF2h, ;respectively.
MOV MOV MOV MOV MOV MOV MOV MOV EINT
#000h,SCIPRI #022h,SCIPC2 #HI,BAUDMSB #B9600,BAUDLSB #07Fh,SCICCR #037h,SCICTL #001h,TXCTL #001h,RXCTL
SENDADD
OR MOV RTS
#8,SCICTL ADDR,TXBUF
Serial Communications Interface 2 (SCI2) Module
10-15
Initialization Examples
;SCI2 TRANSMITTER INTERRUPT ROUTINE SENDDATA PUSH MOV . . . POP RTI . GETDATA PUSH BTJZ MOV CMP JNE AND JMP ISDATA MOV . . . POP RTI A OUTDATA,TXBUF ;Address has already been sent by ;the SENDADD ;Output character that is ;stored in DATA ; ;Other transmitter code ; ;Restore and exit ;SCI2 RECEIVER INTERRUPT ROUTINE A #2,RXCTL,ISDATA RXBUF,A #MYADDR,A RXEXIT #0FBh,SCICTL RXEXIT RXBUF,INDATA ;Receive a new character ;Is this address or data byte? ;Get new character and clear ;interrupt flag ;Is this my address or ;another processor's address ;Exit if another's; still ;in sleep mode ;If my address get out of sleep mode ;Exit and wait for data ; ;Put incoming data in register ; ;Other receiver code ; ;Restore and exit
A
RXEXIT
A
10-16
SCI2 Control Registers
10.8 SCI2 Control Registers
The SCI2 is controlled and accessed through registers in peripheral file frame 5. These registers are listed in Table 10-4 and described in the following subsections. The bits shown in shaded boxes in Table 10-4 are privilege mode bits; that is, they can only be written to in the privilege mode.
Table 10-4. Peripheral File Frame 5: SCI2 Control Registers
Designation SCICCR ADDR 1050h PF P050
Bit 7
STOP BITS (RW-0) --
Bit 6
EVEN/ODD PARITY (RW-0) -- BAUDE (RW-0) BAUD6 (RW-0) TX EMPTY (R-1) RXRDY (R-0)
Bit 5
PARITY ENABLE (RW-0) SCI SW RESET (RW-0) BAUDD (RW-0) BAUD5 (RW-0) -- BRKDT (R-0)
Bit 4
ASYNC ENABLE (RW-0) CLOCK ENABLE (RW-0) BAUDC (RW-0) BAUD4 (RW-0) -- FE (R-0) Reserved
Bit 3
ADDRESS/ IDLE WUP (RW-0) TXWAKE (RS-0) BAUDB (RW-0) BAUD3 (RW-0) -- OE (R-0)
Bit 2
SCI CHAR2 (RW-0) SLEEP (RW-0) BAUDA (RW-0) BAUD2 (RW-0) -- PE (R-0)
Bit 1
SCI CHAR1 (RW-0) TXENA (RW-0) BAUD9 (RW-0) BAUD1 (RW-0) -- RXWAKE (R-0)
Bit 0
SCI CHAR0 (RW-0) RXENA (RW-0) BAUD8 (RW-0) BAUD0 (LSB) (RW-0) SCI TX INT ENA (RW-0) SCI RX INT ENA (RW-0)
SCICTL
1051h
P051
BAUD MSB
1052h
P052
BAUDF (MSB) (RW-0) BAUD7 (RW-0) TXRDY (R-1) RX ERROR (R-0)
BAUD LSB
1053h
P053
TXCTL
1054h
P054
RXCTL
1055h
P055
1056h RXBUF 1057h 1058h TXBUF 1059h 105Ah 105Bh 105Ch 105Dh SCIPC2 105Eh
P056 P057 P058 P059 P05A P05B P05C P05D P05E SCITXD DATA IN (R-0) SCI STEST (RP-0) SCITXD DATA OUT (RW-0) SCITX PRIORITY (RP-0) SCITXD FUNCTION (RW-0) SCIRX PRIORITY (RP-0) TXDT7 (RW-0) TXDT6 (RW-0) TXDT5 (RW-0) RXDT7 (R-0) RXDT6 (R-0) RXDT5 (R-0)
RXDT4 (R-0)
RXDT3 (R-0)
RXDT2 (R-0)
RXDT1 (R-0)
RXDT0 (R-0)
Reserved TXDT4 (RW-0) TXDT3 (RW-0) TXDT2 (RW-0) TXDT1 (RW-0) TXDT0 (RW-0)
Reserved
SCITXD DATA DIR (RW-0) SCI ESPEN (RP-0)
SCIRXD DATA IN (R-0) --
SCIRXD DATA OUT (RW-0) --
SCIRXD FUNCTION (RW-0) --
SCIRXD DATA DIR (RW-0) --
SCIPRI
105Fh
P05F
Serial Communications Interface 2 (SCI2) Module
10-17
SCI2 Control Registers
10.8.1 SCI Communication Control Register (SCICCR)
The SCICCR register defines the character format, protocol, and communications modes used by the SCI2.
SCI Communication Control Register (SCICCR) [Memory Address 1050h]
Bit #
P050
7
STOP BITS RW-0
6
EVEN/ODD PARITY RW-0
5
PARITY ENABLE RW-0
4
ASYNC ENABLE
3
ADDRESS/ IDLE WUP RW-0
2
SCI CHAR2 RW-0
1
SCI CHAR1 RW-0
0
SCI CHAR0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
STOP BITS. SCI2 Number of Stop Bits. This bit determines the number of stop bits transmitted. The receiver checks for one stop bit only. 0 = One stop bit. 1 = Two stop bits.
Bit 6
EVEN/ODD PARITY. SCI2 Parity Enable. If the PARITY ENABLE bit is set, this bit selects odd or even parity (odd or even number of one bits in both transmitted and received characters). 0 = Sets odd parity. 1 = Sets even parity.
Bit 5
PARITY ENABLE. SCI2 Parity Enable. This bit enables or disables the parity function. When parity is enabled during the address bit multiprocessor mode, the address bit is included in the parity calculation. 0 = Disables parity. No parity bit is generated during transmission or expected during reception. 1 = Enables parity.
Bit 4
ASYNC ENABLE. SCI2 Asynchronous Mode Enable. This bit enables the asynchronous mode function. For SCI2 operation, this bit must be written as a 1 when you write to the SCICCR register. 0 = Disables asynchronous mode (SCI2 will not operate). 1 = Enables asynchronous mode (SCI2 operates).
10-18
SCI2 Control Registers
Bit 3
ADDRESS/IDLE WUP. SCI2 Multiprocessor Mode Control Bit. This bit selects the multiprocessor mode. 0 = Selects idle line mode. 1 = Selects address bit mode. The idle line mode is usually used for normal communications because the address bit mode adds an extra bit to the frame; the idle line mode does not add this extra bit and is compatible with RS-232-type communications. Multiprocessor communication is different from the other communications modes because it uses TXWAKE and SLEEP functions.
Bits 2-0
SCI CHAR2-0. SCI2 Character Length Control Bits 2-0. These bits select the SCI2 character (data) bit length, from 1 to 8 bits. Characters of less than 8 bits are right-justified in RXBUF and TXBUF, and are padded with leading 0s in RXBUF. TXBUF need not be padded with leading zeros.
Table 10-5. Character Bit Length
SCI CHAR2 0 0 0 0 1 1 1 1 SCI CHAR1 0 0 1 1 0 0 1 1 SCI CHAR0 0 1 0 1 0 1 0 1 Character Length 1 2 3 4 5 6 7 8
Serial Communications Interface 2 (SCI2) Module
10-19
SCI2 Control Registers
10.8.2 SCI Control Register (SCICTL)
The SCICTL register controls the RX/TX enable, TXWAKE and SLEEP functions, internal clock enable, and the SCI2 software reset.
SCI Control Register (SCICTL) [Memory Address 1051h]
Bit #
P051
7
--
6
--
5
SCI SW RESET RW-0
4
CLOCK ENABLE
3
TXWAKE RS-0
2
SLEEP RW-0
1
TXENA RW-0
0
RXENA RW-0
R = Read, W = Write, S = Set only, -n = Value of the bit after the register is reset
Bits 6-7 Bit 5
Reserved. Read data is indeterminate. SCI SW RESET. SCI2 Software Reset (Active Low). Writing a 0 to this bit initializes the SCI2 state machines and operation flags to the reset condition. All affected logic is held in the reset state until a 1 is written to the SCI SW RESET bit. Thus, after a system reset, you must re-enable the SCI2 by writing a 1 to this bit. This bit must be cleared after a receiver break detect. SCI SW RESET affects the operating flags of the SCI2. This bit does not affect the configuration bits, nor does it put in the reset values. The flags listed in Table 10-6 are set to the values shown when SCI SW RESET is cleared. The operating flags are frozen until the SCI SW RESET bit is set again.
Table 10-6. Flags Affected by SCI SW RESET
SCI Flag TXRDY TXEMPTY RXWAKE PE OE FE BRKDT RXRDY RX ERROR Designation TXCTL.7 TXCTL.6 RXCTL.1 RXCTL.2 RXCTL.3 RXCTL.4 RXCTL.5 RXCTL.6 RXCTL.7 Value After SCI SW RESET 1 1 0 0 0 0 0 0 0
Note: The SCI SW RESET bit must be cleared before the SCI2 configuration registers can be set up or altered. The application program should set up all configuration registers before it sets the SCI SW RESET bit.
10-20
SCI2 Control Registers
Bit 4
CLOCK ENABLE. SCI2 Internal Clock Enable. This bit enables or disables the SCI2 internal clock. For SCI2 operation, this bit must be written as a 1 when you write to the SCICTL register. 0 = Disables SCI2 internal clock (stops SCI2 operation). 1 = Enables SCI2 internal clock (SCI2 operates).
Bit 3
TXWAKE. SCI2 Transmitter Wake-up. The TXWAKE bit controls the transmit features of the multiprocessor communication modes. This bit is cleared only by system reset. The SCI2 hardware clears this bit, once it has been transferred to wake-up temporary (WUT).
Bit 2
SLEEP. SCI2 Sleep. This bit controls the receive features of the multiprocessor communication modes. You must clear this bit to bring the SCI2 out of sleep mode. 0 = Disables sleep mode. 1 = Enables sleep mode.
Bit 1
TXENA. SCI2 Transmit Enable. Data transmission through the SCITXD pin occurs only when this bit is set. If this bit is reset, the transmission is not halted until all the data previously written to TXBUF has been sent. 0 = Disables SCI2 transmitter. 1 = Enables SCI2 transmitter.
Bit 0
RXENA. SCI2 Receive Enable. When this bit is set, received characters are transferred into RXBUF, and the RXRDY flag is set. When cleared, this bit prevents received characters from being transferred into the receiver buffer (RXBUF), and no receiver interrupts are generated. However, the receiver shift register continues to assemble characters. As a result, if RXENA is set during the reception of a character, the complete character is transferred into RXBUF. 0 = Disables SCI2 receiver. 1 = Enables SCI2 receiver.
Serial Communications Interface 2 (SCI2) Module
10-21
SCI2 Control Registers
10.8.3 Baud Select Registers (BAUD MSB and BAUD LSB)
The BAUD MSB and BAUD LSB registers store the data required to generate the bit rate. The asynchronous bit rates are calculated as follows: Asynchronous Baud = SYSCLK/ [(BAUD REG + 1)
Baud Select Register (BAUD MSB) [Memory Address 1052h]
32]
Bit #
P052
7
BAUDF (MSB) RW-0
6
BAUDE RW-0
5
BAUDD RW-0
4
BAUDC RW-0
3
BAUDB RW-0
2
BAUDA RW-0
1
BAUD9 RW-0
0
BAUD8 RW-0
Baud Select Register (BAUD LSB) [Memory Address 1053h]
Bit #
P053
7
BAUD7 RW-0
6
BAUD6 RW-0
5
BAUD5 RW-0
4
BAUD4 RW-0
3
BAUD3 RW-0
2
BAUD2 RW-0
1
BAUD1 RW-0
0
BAUD0 (LSB) RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
10-22
SCI2 Control Registers
10.8.4 SCI Transmitter Interrupt Control and Status Register (TXCTL)
The TXCTL register contains the transmitter interrupt enable bit, the transmitter ready flag, and the transmitter empty flag. The status flags are updated each time a compete character is transmitted.
SCI Transmitter Interrupt Control and Status Register (TXCTL) [Memory Address 1054h]
Bit #
P054
7
TXRDY R-1
6
TX EMPTY R-1
5
--
4
--
3
--
2
--
1
--
0
SCI TX INT ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
TXRDY. SCI2 Transmitter Ready. The TXRDY bit is set by the transmitter to indicate that TXBUF is ready to receive another character. The bit is automatically cleared when a character is loaded into TXBUF. This flag asserts a transmitter interrupt if the interrupt enable bit SCI TX INT ENA (TXCTL.0) is set. TXRDY is a read-only flag. It is set to 1 by an SCI SW RESET or by a system reset. 0 = TXBUF is full. 1 = TXBUF is ready to receive a character.
Bit 6
TX EMPTY. SCI2 Transmitter Empty. This bit indicates the status of the transmitter-shift register and the TXBUF register. TX EMPTY is set to 1 by an SCI SW RESET or by a system reset. 0 = The CPU has written data to the TXBUF register; the data has not been completely transmitted. 1 = TXBUF and TXSHF registers are empty.
Bits 5-1 Bit 0
Reserved. Read data is indeterminate. SCI TX INT ENA. SCI2 Transmitter Ready Interrupt Enable. This bit controls the ability of the TXRDY bit to request an interrupt but does not prevent the TXRDY bit from being set. The SCI TX INT ENA bit is set to 0 by a system reset. 0 = Disables SCI TXRDY interrupt. 1 = Enables SCI TXRDY interrupt.
Serial Communications Interface 2 (SCI2) Module
10-23
SCI2 Control Registers
10.8.5 SCI Receiver Interrupt Control and Status Register (RXCTL)
The RXCTL register contains one interrupt enable bit and seven receiver status flags (two of which can generate interrupt requests). The status flags are updated each time a complete character is transferred to the RXBUF. They are cleared each time RXBUF is read.
SCI Receiver Interrupt Control and Status Register (RXCTL) [Memory Address 1055h]
Bit #
P055
7
RX ERROR R-0
6
RXRDY R-0
5
BRKDT R-0
4
FE R-0
3
OE R-0
2
PE R-0
1
RXWAKE R-0
0
SCI RX INT ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
RX ERROR. SCI2 Receiver Error Flag. The RX ERROR flag indicates that one of the error flags in the receiver status register is set. It is a logical OR of the parity, overrun, framing error, and break detect flags. The bit can be used for fast error condition checking during the interrupt service routine because a negative value of the status register indicates that an error condition has occurred. This error flag cannot be cleared directly but is cleared if no individual error flags are set. This bit is cleared by an SCI SW RESET, by a system reset, or by reading RXBUF.
Bit 6
RXRDY. SCI2 Receiver Ready. The receiver sets this bit to indicate that RXBUF is ready with a new character and clears the bit when the character is read. A receiver interrupt is generated if the SCI RX INT ENA bit is a 1. RXRDY is reset by an SCI SW RESET or by a system reset.
Bit 5
BRKDT. SCI2 Break Detect Flag. The SCI2 sets this bit when a break condition occurs. A break condition occurs when the SCIRXD line remains continuously low for at least 10 bits, beginning after a missing first stop bit. The occurrence of a break causes a receiver interrupt to be generated if the SCI RX INT ENA bit is a 1, but it does not cause the receiver buffer to be loaded. A BRKDT interrupt can occur, even if the receiver SLEEP bit is set to 1. BRKDT is cleared by an SCI SW RESET or by a system reset. It is not cleared by receipt of a character after the break is detected. In order to receive more characters, the SCI2 must by reset through toggling the SCI SW RESET bit or by a system reset. 0 = No parity error or parity is disabled. 1 = Parity error detected.
10-24
SCI2 Control Registers
Bit 4
FE. SCI2 Framing Error Flag. The SCI2 sets this bit when it doesn't find a stop bit that it expects. Only the first stop bit is checked. The missing stop bit indicates that synchronization with the start bit has been lost and that the character is incorrectly framed. It is reset by an SCI SW RESET, by a system reset, or by reading RXBUF. 0 = No framing error detected. 1 = Framing error detected.
Bit 3
OE. SCI2 Overrun Error Flag. The SCI2 sets this bit when a character is transferred into RXBUF before the previous character has been read out. The previous character is overwritten and lost. The OE flag is reset by an SCI SW RESET, by a system reset, or by reading RXBUF. 0 = No Overrun error detected. 1 = Overrun error detected.
Bit 2
PE. SCI2 Parity Error Flag. This flag bit is set when a character is received with a mismatch between the number of 1s and its parity bit. The parity checker includes the address bit in the calculation. If parity generation and detection are not enabled, the PE flag is disabled and read as 0. The PE bit is reset by an SCI SW RESET, by a system reset, or by reading RXBUF.
Bit 1
RXWAKE. Receiver Wake-Up Detect. The SCI2 sets this bit when a receiver wake-up condition is detected. In the address bit multiprocessor mode, RXWAKE reflects the value of the address bit for the character contained in RXBUF. In the idle line multiprocessor mode, RXWAKE is set if an idle SCIRXD line is detected. RXWAKE is a read-only flag. It is cleared by transfer of the first byte after the address byte to RXBUF, by reading the address character in RXBUF, by an SCI SW RESET, or by a system reset.
Bit 0
SCI RX INT ENA. SCI2 Receiver Interrupt Enable. The SCI RX INT ENA bit controls the ability of the RXRDY and the BRKDT bits to request an interrupt but does not prevent these flags from being set. 0 = Disables RXRDY/BRKDT interrupt. 1 = Enables RXRDY/BRKDT interrupt.
Serial Communications Interface 2 (SCI2) Module
10-25
SCI2 Control Registers
10.8.6 SCI Receiver Data Buffer Register (RXBUF)
The RXBUF register contains current data from the receiver shift register. RXBUF is cleared by a system reset.
SCI Receiver Data Buffer Register (RXBUF) [Memory Address 1057h]
Bit #
P057
7
RXDT7 R-0
6
RXDT6 R-0
5
RXDT5 R-0
4
RXDT4 R-0
3
RXDT3 R-0
2
RXDT2 R-0
1
RXDT1 R-0
0
RXDT0 R-0
R = Read, -n = Value of the bit after the register is reset
10.8.7 SCI Transmitter Data Buffer Register (TXBUF)
The TXBUF register is a read/write register that stores data bits to be transmitted by SCITX. Data written to TXBUF must be right-justified because the left-most bits are ignored for characters less than eight bits long.
SCI Transmit Data Buffer Register (TXBUF) [Memory Address 1059h]
Bit #
P059
7
TXDT7 RW-0
6
TXDT6 RW-0
5
TXDT5 RW-0
4
TXDT4 RW-0
3
TXDT3 RW-0
2
TXDT2 RW-0
1
TXDT1 RW-0
0
TXDT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
10-26
SCI2 Control Registers
10.8.8 SCI Port Control Register 2 (SCIPC2)
The SCIPC2 register controls the SCIRXD and SCITXD pin functions.
SCI Port Control Register 2 (SCIPC2) [Memory Address 105Eh]
Bit #
P05E
7
SCITXD DATA IN R-0
6
SCITXD DATA OUT RW-0
5
SCITXD FUNCTION RW-0
4
SCITXD DATA DIR RW-0
3
SCIRXD DATA IN R-0
2
SCIRXD DATA OUT RW-0
1
SCIRXD FUNCTION RW-0
0
SCIRXD DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
SCITXD DATA IN. This bit contains the current value on the SCITXD pin.
Bit 6
SCITXD DATA OUT. This bit contains the data to be output on the SCITXD pin if the following conditions are met:
- SCITXD pin has been defined as a general-purpose I/O pin. - SCITXD pin data direction has been defined as output.
Bit 5
SCITXD FUNCTION. This bit defines the function of the SCITXD pin. 0 = SCITXD pin is a general-purpose digital I/O pin. 1 = SCITXD pin is the SCI transmit pin.
Bit 4
SCITXD DATA DIR. SCITXD Data Direction. This bit determines the data direction on the SCITXD pin if SCITXD has been defined as a general-purpose I/O pin. 0 = SCITXD pin is a general-purpose input pin. 1 = SCITXD pin is a general-purpose output pin.
Bit 3
SCIRXD DATA IN. This bit contains the current value on the SCIRXD pin.
Bit 2
SCIRXD DATA OUT. This bit contains the data to be output on the SCIRXD pin if the following conditions are met:
- SCIRXD pin has been defined as a general-purpose I/O pin. - SCIRXD pin data direction has been defined as output.
Serial Communications Interface 2 (SCI2) Module
10-27
SCI2 Control Registers
Bit 1
SCIRXD FUNCTION. This bit defines the function of the SCIRXD pin. 0 = SCIRXD pin is a general-purpose digital I/O pin. 1 = SCIRXD pin is the SCI receiver pin.
Bit 0
SCIRXD DATA DIR. SCIRXD Data Direction. This bit determines the data direction on the SCIRXD pin if SCIRXD has been defined as a general-purpose I/O pin. 0 = Pin SCIRXD is a general-purpose input pin. 1 = Pin SCIRXD is a general-purpose output pin.
10-28
SCI2 Control Registers
10.8.9 SCI Priority Control Register (SCIPRI)
The SCIPRI register contains the receiver and transmitter interrupt priority select bits. This register is read-only during normal operation but can be written to in the privilege mode.
SCI Priority Control Register (SCIPRI) [Memory Address 105Fh]
Bit #
P05F
7
SCI STEST RP-0
6
SCITX PRIORITY RP-0
5
SCIRX PRIORITY RP-0
4
SCI ESPEN RP-0
3
--
2
--
1
--
0
--
R = Read, W = Privilege write only, -n = Value of the bit after the register is reset
Bit 7
SCI STEST. SCI2 STEST. This bit must be cleared to ensure proper operation.
Bit 6
SCI TX PRIORITY. SCI2 Transmitter Interrupt Priority Select. This bit assigns the interrupt priority level of the SCI2 transmitter interrupts. 0 = Transmitter interrupts are level 1 (high-priority) requests. 1 = Transmitter interrupts are level 2 (low-priority) requests.
Bit 5
SCI RX PRIORITY. SCI2 Receiver Interrupt Priority Select. This bit assigns the interrupt priority level of the SCI2 receiver interrupts. 0 = Receiver interrupts are level 1 (high-priority) requests. 1 = Receiver interrupts are level 2 (low-priority) requests.
Bit 4
SCI ESPEN. SCI2 Emulator Suspend Enable. This bit has no effect except when you are using the XDS emulator to debug a program. Then, this bit determines how the SCI2 operates when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the SCI2 continues to work until the current transmit or receive sequence is complete. 1 = When the emulator is suspended, the SCI2 state machine is frozen so that the state of the SCI2 can be examined at the point that the emulator was suspended.
Bits 3-0
Reserved. Read data is indeterminate.
Serial Communications Interface 2 (SCI2) Module
10-29
10-30
Running Title--Attribute Reference
Chapter 11
Serial Peripheral Interface (SPI) Module
This chapter discusses the architecture and programming of the serial peripheral interface module and covers the following topics:
Topic
Page
11.1 SPI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 11.2 Communications Between the Master and the Slave . . . . . . . . . . . . 11-5 11.3 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6 11.4 Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8 11.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-9 11.6 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10 11.7 Initialization Upon Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11 11.8 SPI Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12 11.9 SPI Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13
Chapter Title--Attribute Reference
11-1
SPI Overview
11.1 SPI Overview
The SPI module is a high-speed synchronous serial I/O port that allows a serial bit stream of programmed length (one to eight bits) to be shifted into and out of the device at a programmed bit-transfer rate. The SPI is normally used for communications between the microcontroller and external peripherals or another microcontroller. Typical applications include external I/O or peripheral expansion using devices such as shift registers, display drivers, and A/D converters. Multiprocessor communications are also supported by the master/ slave operation of the SPI.
11.1.1 Physical Description
The SPI module, as shown in Figure 11-1, consists of:
-
Three I/O pins:
J J J
SPISIMO--SPI slave in, master out SPISOMI--SPI slave out, master in SPICLK--SPI clock
SPIBUF--the buffer register that contains the data received from the network that is ready for the CPU to read SPIDAT--the data shift register that serves as the transmit/receive shift register State control logic Memory-mapped control and status registers
11-2
SPI Overview
Figure 11-1.SPI Block Diagram
SPIBUF.7-0
SPIBUF buffer register RECEIVER OVERRUN
SPICTL.7
SPIPRI.6
8 SPI INT FLAG
SPICTL.0
LeveI 1 INT 0 1
SPICTL.6
SPIINT ENA
External pin connections
Level 2 INT
SPIDAT data register
SPIPC2.7-4
SPISIMO
SPIDAT.7-0
SPICTL.1 SPIPC2.3-0
TALK SPISOMI
State control
SPI CHAR
SPICCR.2-0
2 System Clock 1 0
MASTER/SLAVE
SPICTL.2 SPIPC1.3-0
SPICCR.5-3
5 4 3
SPICCR.6
CLOCK POLARITY
SPICLK
SPI BIT RATE The diagram is shown in slave mode.
Serial Peripheral Interface (SPI) Module
11-3
SPI Overview
11.1.2 Control Registers
The SPI control registers are located at addresses 1030h to 103Fh and occupy peripheral file frame 3. The function of each location is shown in Table 11-1.
Table 11-1. SPI Memory Map
Peripheral File Location P030 P031 P032-P036 P037 P038 P039 P03A-P03C P03D P03E P03F SPIPC1 SPIPC2 SPIPRI SPIDAT SPIBUF Symbol SPICCR SPICTL
Name SPI Configuration Control Register SPI Operation Control Register Reserved Serial Input Buffer Reserved Serial Data Register Reserved SPI Port Control Register 1 SPI Port Control Register 2 SPI Interrupt Priority Control Register Controls the SPICLK pin functions. Controls the SPISOMI and SPISIMO pin functions. Selects the interrupt priority level of the SPI interrupt. Serves as the transmit/receive shift register. Contains the data received from the network that is ready for the CPU to read. Description Controls the setup of the SPI for operation. Controls data transmission, the SPI's ability to generate interrupts, and the operating mode (slave or master).
11-4
Communications Between the Master and the Slave
11.2 Communications Between the Master and the Slave
Figure 11-2 shows a typical connection of the SPI for communications between two microcontrollers: the master and the slave. The master initiates data transfer by sending the SPICLK signal. For both the slave and the master, data is shifted out of the shift registers on one edge of the clock and latched into the shift register on the opposite clock edge. As a result, both controllers send and receive data at the same time. The application software determines whether the data is meaningful or dummy data. There are three possible cases for data transmission:
-
Master sends data, and slave sends dummy data Master sends data, and slave sends data Master sends dummy data, and slave sends data
The master can initiate data transfer at any time because it controls the SPICLK. However, the software protocol determines how the master detects when the slave is ready to broadcast data.
Figure 11-2.SPI Master/Slave Connection
SPI master (MASTER/SLAVE = 1) SIMO Slave in/ Master out SPI slave (MASTER/SLAVE = 0) SIMO
SPIBUF.7-0
Serial input buffer (SPIBUF)
SPIBUF.7-0
Serial input buffer (SPIBUF)
Shift register (SPIDAT) MSB
SOMI LSB SPICLK
Slave out/ Master in Serial clock
SOMI MSB SPICLK
Shift register (SPIDAT)
SPIDAT.7-0
Processor 1
SPIDAT.7-0
Processor 2
LSB
Note: SIMO = Slave In, Master Out; SOMI = Slave Out, Master In
Serial Peripheral Interface (SPI) Module
11-5
Operating Modes
11.3 Operating Modes
The MASTER/SLAVE bit (SPICTL.2) selects the operating mode and the source of SPICLK. The SPI module can operate as a master or a slave.
11.3.1 Master Mode
In the master mode (MASTER/SLAVE = 1), the SPI provides the serial clock on the SPICLK pin for the entire serial communications network. Data is output on the SPISIMO pin on the first SPICLK edge and latched from the SPISOMI pin on the opposite edge of SPICLK. The SPI BIT RATE0-2 bits of the SPICCR register determine the bit transfer rate for the network, both transmit and receive. Eight data transfer rates can be selected by these control bits as shown in Table 11-2 on page 11-10. Data written to the SPIDAT register initiates data transmission on the SPISIMO pin, MSB first. Simultaneously, received data is shifted in the SPISOMI pin into the SPIDAT register. When the selected number of bits have been transmitted, the data is transferred to the SPIBUF (double-buffered receiver) for reading by the CPU to permit new transactions to take place. Data is shifted into the SPI MSB first. It is stored right-justified in SPIBUF. To initiate a character transaction when the SPI is operating as a master, data must be written to the SPIDAT. When the specified number of data bits have been shifted through the SPIDAT register, the following events occur:
-
The SPI INT FLAG bit (SPICTL.6) is set, The SPIDAT register contents transfer to the SPIBUF register, and If the SPI INT ENA bit (SPICTL.1) is set to 1, an interrupt is asserted.
Writing to the SPIDAT register before transmission is complete corrupts the current transmission.
11.3.2 Slave Mode
In the slave mode (MASTER/SLAVE = 0), data shifts out on the SPISOMI pin and in on the SPISIMO pin. The SPICLK pin is used as the input for the serial shift clock, which is supplied from the external network master. The transfer rate is defined by this clock. The SPICLK input frequency should be no greater than the SYSCLK frequency divided by 8.
11-6
Operating Modes
Data written to the SPIDAT register is transmitted to the network when the SPICLK is received from the network master. To receive data, the SPI waits for the network master to send SPICLK and then shifts the data on the SPISIMO pin into the SPIDAT register. If data is to be transmitted by the slave simultaneously, it must be written to the SPIDAT register before the beginning of SPICLK. When the TALK bit (SPICTL.1) is cleared, data transmission is disabled, and the output line is put into a high-impedance state. This allows many slave devices to be tied together on the network, but only one slave at a time is allowed to talk.
Serial Peripheral Interface (SPI) Module
11-7
Data Format
11.4 Data Format
Three character-length bits (SPICCR.2-0) specify the number of bits in the data character (1-8 bits). This information directs the state control logic to count the number of bits received or transmitted to determine when a complete character has been processed. For characters with fewer than 8 bits:
-
Data must be written left-justified to the SPIDAT register. Data must be read back right-justified from the SPIBUF register. The SPIBUF register contains the most recently received character, rightjustified, plus any bits that remain from previous transmission(s) and have been shifted to the MSB position.
Example 11-1. Register Values in an SPI Character-Write Operation
For example: If the character length = 1 bit, and the value written into SPIDAT = 07Bh, then:
SPIDAT (before transmission) 0 1 1 1 1 0 1 1
SPIDAT (after transmission) (transmitted) 0 1 1 1 1 0 1 1 x
(received)
SPIBUF (after transmission) 1
Note:
1
1
1
0
1
1
x
x = 1 if SOMI is held high; x = 0 if SOMI is held low
11-8
Interrupts
11.5 Interrupts
The interrupt for the SPI is controlled by bits in two registers:
-
The SPI INT ENA bit (SPICTL.0), when set, allows assertion of an interrupt request when an interrupt condition occurs. The SPI PRIORITY bit (SPIPRI.6) determines whether SPI interrupts are level 1 or level 2 priority requests.
-
When a complete character has been shifted into or out of the SPIBUF register, the SPI interrupt flag (SPI INT FLAG) of the SCICTL register is set, and an interrupt is generated if enabled by SPI INT ENA bit (SPICTL.0). The interrupt flag remains set until it is cleared by one of the following four events: The CPU reads the SPI receiver buffer (SPIBUF), The CPU enters the halt or standby mode with an IDLE instruction, Software sets the SPI SW RESET bit (SPICCR.7), or A system reset occurs.
An interrupt request must be explicitly cleared by one of the four methods listed above to avoid generating another interrupt. An interrupt request can be temporarily disabled by clearing the SPI INT ENA bit. However, unless the SPI INT FLAG itself is cleared, the interrupt request will be reasserted when the enable bit (SPI INT ENA) is again set to 1. The priority level of the SPI interrupt is specified by the SPI PRIORITY bit (SPIPRI.6). If SPI PRIORITY = 0, a level 1 priority interrupt is generated. If SPI PRIORITY = 1, a level 2 priority interrupt is generated.
-
When the SPI INT FLAG bit is set, a character has been placed into the SPIBUF register and is ready to be read. If the CPU does not read the character by the time the next complete character has been received, the new character is written into the SPIBUF, and the RECEIVER OVERRUN bit (SPICTL.7) is set. This indicates that the last character of data has been overwritten with new data before the previous character could be read.
Serial Peripheral Interface (SPI) Module
11-9
Clock Sources
11.6 Clock Sources
The CLOCK POLARITY bit (SPICCR.6) selects the active edge of the clock, either rising or falling.
-
In the slave mode, the SPI clock is received from an external source and can be no greater than the SYSCLK frequency divided by 8. In the master mode, the SPI clock is generated by the SPI and is output on the SPICLK pin.
The SPI BIT RATE0-2 bits (SPICCR.5-3) determine the bit transfer rate for sending and receiving the data. This transfer rate is defined by: SPI BAUD RATE = SYSCLK / (2 x 2b) where b = bit rate in SPICCR.5 -3 (range 0 -7). Table 11-2 shows the bit rates for common crystal frequencies versus the SPI bit rate values.
Table 11-2. Common SPI Bit Rates
SPI Value 0 1 2 3 4 5 6 7 Divide by 2 4 8 16 32 64 128 256 SYSCLK Frequency (MHz) 0.5 250 125 62.5 31.25 15.625 7.8125 3.90625 1.953125 1.25 625 312.5 156.25 78.125 39.0625 19.53125 9.765625 4.882813 2.5 1250 625 312.5 156.25 78.125 39.0625 19.53125 9.765625 3 1500 750 375 187.5 93.75 46.875 23.4375 11.71875 5 2500 1250 625 312.5 156.25 78.125 39.0625 19.53125 Bit Rate kbps kbps kbps kbps kbps kbps kbps kbps
Divide-by-1 clock can only operate from a minimum of 2 MHz SYSCLK to a maximum of 5 MHz SYSCLK. kbps = kilobits/second.
11-10
Initialization Upon Reset
11.7 Initialization Upon Reset
A system reset forces the SPI peripheral module into the following default configuration:
-
The unit is configured as a slave module (MASTER/SLAVE = 0). The transmit capability is disabled (TALK = 0). Data is latched at the input on the falling edge of SPICLK. Character length is assumed to be 1 bit. The SPI interrupts are disabled. Data in the SPI data register is set to 00h.
To change this SPI configuration: Set the SPI SW RESET bit (SPICCR.7) to 1, Make any changes that you want in the configuration described above, and Clear the SPI SW RESET bit.
Using the above procedure prevents unwanted and unforeseen events from occurring during or as a result of a mode change.
Serial Peripheral Interface (SPI) Module
11-11
SPI Example
11.8 SPI Example
The following timing diagrams illustrate an SPI data transfer between two TMS370 devices using a character length of five bits. The lettered notes following the first diagram are keyed to the letter labels in the diagram.
5 Bits per Character Master SPI int flag Slave SPI int flag AB SPI SOMI from slave 7 SPI SIMO from master 7 Clock polarity = 0 Clock polarity = 1 A. B. C. D. E. F. G. H. I. Slave writes 0D0h to SPIDAT and waits for the master to shift out the data. Master writes 058h to SPIDAT, which starts the transmission procedure. First byte is finished and sets the interrupt flags. Slave reads 0Bh from its SPIBUF register (right justified). Slave writes 04Ch to SPIDAT and waits for the master to shift out the data. Master writes 06Ch to SPIDAT, which starts the transmission procedure. Master reads 01Ah from the SPIBUF register (right justified). Second byte is finished and sets the interrupt flags. Master receives 89h, and the slave receives a 8Dh (right justified). Caution should be taken because the SPIBUF register not only contains the five new data (right justified) received, but also the three LSBs of data left over from the previous SPIBUF register (value written to SPInDAT). The user's software routine should mask-off the unused bits. 6 5 4 3 7 6 5 4 3 6 5 4 3 7 6 5 4 3 C DEF G H I
Signals Connecting to Master Processor SPI SIMO output SPI SOMI input sampled SPICLK out (clock polarity = 0) SPICLK out (clock polarity = 1) Bit 4 Bit 3 Bit 2
11-12
SPI Control Registers
11.9 SPI Control Registers
The SPI is controlled and accessed through registers in peripheral file frame 3. These registers are listed in Figure 11-3 and described in the following subsections. The bits shown in shaded boxes in Figure 11-3 are privilege mode bits; that is, they can be written to only in the privilege mode.
Figure 11-3.Peripheral File Frame 3: SPI Control Registers
Designation SPICCR ADDR 1030h PF P030 Bit 7 SPI SW RESET (RW-0) RECEIVER OVERRUN (R-0) Bit 6 CLOCK POLARITY (RW-0) SPI INTFLAG (R-0) Bit 5 SPI BIT RATE2 (RW-0) -- Bit 4 SPI BIT RATE1 (RW-0) -- Bit 3 SPI BIT RATE0 (RW-0) -- Bit 2 SPI CHAR2 (RW-0) MASTER/ SLAVE (RW-0) Bit 1 SPI CHAR1 (RW-0) TALK (RW-0) Bit 0 SPI CHAR0 (RW-0) SPI INT ENA (RW-0)
SPICTL
1031h
P031
1032h to 1036h SPIBUF 1037h 1038h SPIDAT 1039h 103Ah to 103Ch SPIPC1 103Dh
P032 to P036 P037 P038 P039 P03A to P03C P03D -- -- SPISIMO DATA OUT (RW-0) SPI PRIORITY (RP-0) -- SPISIMO FUNCTION (RW-0) SPI ESPEN (RP-0) -- SPISIMO DATA DIR (RW-0) -- SPICLK DATA IN (R-0) SPISOMI DATA IN (R-0) -- SPICLK DATA OUT (RW-0) SPISOMI DATA OUT (RW-0) -- SPICLK FUNCTION (RW-0) SPISOMI FUNCTION (RW-0) -- SPICLK DATA DIR (RW-0) SPISOMI DATA DIR (RW-0) -- Reserved SDAT7 (RW-0) SDAT6 (RW-0) SDAT5 (RW-0) RCVD7 (R-0) RCVD6 (R-0) RCVD5 (R-0) RCVD4 (R-0) RCVD3 (R-0) RCVD2 (R-0) RCVD1 (R-0) RCVD0 (R-0) Reserved
Reserved SDAT4 (RW-0) SDAT3 (RW-0) SDAT2 (RW-0) SDAT1 (RW-0) SDAT0 (RW-0)
SPIPC2
103Eh
P03E
SPISIMO DATA IN (R-0) SPI STEST (RP-0)
SPIPRI
103Fh
P03F
Serial Peripheral Interface (SPI) Module
11-13
SPI Control Registers
11.9.1 SPI Configuration Control Register (SPICCR)
The SPICCR register controls the setup of the SPI for operation.
SPI Configuration Control Register (SPICCR) [Memory Address 1030h]
Bit #
P030
7
SPI SW RESET RW-0
6
CLOCK POLARITY RW-0
5
SPI BIT RATE2 RW-0
4
SPI BIT RATE1 RW-0
3
SPI BIT RATE0 RW-0
2
SPI CHAR2 RW-0
1
SPI CHAR1 RW-0
0
SPI CHAR0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
- Writing a 1 to this bit initializes the SPI circuitry and operating flags to the
SPI SW RESET. SPI Software Reset.
- When a 0 is written to SPI SW RESET, the SPI is ready to transmit or re-
reset condition. Specifically, the RECEIVER OVERRUN and SPI INT FLAG flags are cleared. The SPI configuration remains unchanged. If the module is operating as a master, the SPICLK output level returns to its inactive level. ceive the next character. A character written to the transmitter when SPI SW RESET is a 1 will not be shifted out when the SPI SW RESET bit is cleared. A new character must be written to the serial data register. Use this bit to change any configuration bits (see Section 11.7).
Bit 6
CLOCK POLARITY. Shift Clock Polarity. The CLOCK POLARITY bit controls the polarity of the SPICLK signal. 0 = The inactive level is low; data is output by the rising edge of SPICLK; input data is latched by the falling edge of SPICLK. 1 = The inactive level is high; data is output by the falling edge of SPICLK; input data is latched by the rising edge of SPICLK.
11-14
SPI Control Registers
Bits 5-3
SPI BIT RATE2-0. SPI Bit Rate Control Bits 2-0. These bits determine the bit transfer rate if the SPI is the network master. Eight data transfer rates (each a function of the system clock) can be selected. The system clock is divided by an 8-bit, free-running prescaler from which eight taps are available for use as the shift clock. One data bit is shifted per SPICLK cycle.
SPI BIT RATE2 SPI BIT RATE1 SPI BIT RATE0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 SPI Clock Frequency SYSCLK/2 SYSCLK/4 SYSCLK/8 SYSCLK/16 SYSCLK/32 SYSCLK/64 SYSCLK/128 SYSCLK/256
If the SPI is a network slave, then the module receives a clock on the SPICLK pin from
the network master, and these bits have no effect on SPICLK. The frequency of the input clock should be no greater than the SYSCLK frequency divided by 8.
Bits 2-0
SPI CHAR2-0. Character Length Control Bits 2-0. These three bits determine the number of bits to be shifted in or out as a single character during one shift sequence. The value of these bits is represented in the following table.
SPI CHAR2 0 0 0 0 1 1 1 1 SPI CHAR1 0 0 1 1 0 0 1 1 SPI CHAR0 0 1 0 1 0 1 0 1 Character Length 1 2 3 4 5 6 7 8
Serial Peripheral Interface (SPI) Module
11-15
SPI Control Registers
11.9.2 SPI Operation Control Register (SPICTL)
The SPI operation control register controls data transmission, the SPI's ability to generate interrupts, and the operating mode (slave or master).
SPI Operation Control Register (SPICTL) [Memory Address 1031h]
Bit #
P031
7
RECEIVER OVERRUN R-0
6
SPI INT FLAG R-0
5
--
4
--
3
--
2
MASTER/ SLAVE RW-0
1
TALK RW-0
0
SPI INT ENA RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
RECEIVER OVERRUN. This bit is a read-only flag that the SPI hardware sets when a receive or transmit operation completes before the previous character is read from the receive buffer. It indicates that the last received character has been overwritten and, therefore, has been lost. RECEIVER OVERRUN is cleared when the receiver buffer is read. It is also cleared by SPI SW RESET or by a system reset.
Bit 6
SPI INT FLAG. Serial Peripheral Interrupt Flag. The SPI hardware sets this bit to indicate that it has completed sending or receiving the last bit and is ready to be serviced. A character received is placed in the receiver buffer at the time the SPI INT FLAG bit is set. The SPI INT FLAG is cleared when the receiver buffer is read. It is also cleared by an SPI software reset (SPI SW RESET) or by a system reset.
Bits 5-3 Bit 2
Reserved. Read data is indeterminate. MASTER/SLAVE. SPI Network Mode Control. This bit determines whether the SPI is a network master or slave. During reset initialization, the SPI is automatically configured as a slave. 0 = SPI configured as a slave 1 = SPI configured as a master
Bit 1
TALK. Master/Slave Transmit Enable. This bit disables data transmission (master or slave) by placing the serial data output in a high-impedance state. TALK is cleared (disabled) by a system reset. 0 = Disables transmission; if not programmed as a general-purpose I/O pin, the SPI serial output is in a high-impedance state. 1 = Enables transmission
11-16
SPI Control Registers
Bit 0
SPI INT ENA. SPI Interrupt Enable. This bit controls the SPI's ability to generate an interrupt. The SPI INT FLAG is unaffected by this bit. 0 = Disables interrupt 1 = Enables interrupt
Serial Peripheral Interface (SPI) Module
11-17
SPI Control Registers
11.9.3 Serial Input Buffer (SPIBUF)
The SPIBUF register contains the data received from the network ready for the CPU to read.
Serial Input Buffer (SPIBUF) [Memory Address 1037h]
Bit #
P037
7
RCVD7 (MSB) R-0
6
RCVD6 R-0
5
RCVD5 R-0
4
RCVD4 R-0
3
RCVD3 R-0
2
RCVD2 R-0
1
RCVD1 R-0
0
RCVD0 (LSB) R-0
R = Read, -n = Value of the bit after the register is reset
Once the serial data register has received the complete character, the character is then transferred to the SPIBUF register, where it can be read. The SPI INT FLAG bit (SPICTL.6) is set to indicate that the data is available when the received character is transferred. Since data is shifted into the SPI most significant bit first, it is stored, right-justified, in the SPIBUF while the previous LSB(s) data occupies the remaining MSB(s). The user's software routine should mask off the unused bits.
11.9.4 Serial Data Register (SPIDAT)
The SPIDAT register is the transmit/receive shift register. Data written to the SPIDAT is shifted out on subsequent SPICLK cycles. For every bit shifted out of the SPI, a bit is shifted into the other end of the shift register.
Serial Data Register (SPIDAT) [Memory Address 1039h]
Bit #
P039
7
SDAT7 RW-0
6
SDAT6 RW-0
5
SDAT5 RW-0
4
SDAT4 RW-0
3
SDAT3 RW-0
2
SDAT2 RW-0
1
SDAT1 RW-0
0
SDAT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset Writing to the SPIDAT performs two functions: It provides data to be output on the serial output pin if the TALK bit is set. It initiates a transaction when the SPI is operating as a master.
-
A receiver sequence is initiated when dummy data is written to the register. Since the data is not hardware justified for characters that are shorter than eight bits, transmit data must be written in left-justified form and received data read in right-justified form.
11-18
SPI Control Registers
11.9.5 SPI Port Control Registers (SPIPC1 and SPIPC2)
Two port control registers (SPIPC1 and SPIPC2) allow you to control all of the functions for a SPI port pin in one write cycle. Each module pin is controlled by a nibble in one of the SPIPCs.
11.9.5.1
SPI Port Control Register 1 (SPIPC1)
This register controls the SPICLK pin.
Port Control Register 1 (SPIPC1) [Memory Address 103Dh]
Bit #
P03D
7
--
6
--
5
--
4
--
3
SPICLK DATA IN R-0
2
SPICLK DATA OUT RW-0
1
SPICLK FUNCTION RW-0
0
SPICLK DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-4
Reserved. Read data is indeterminate. Note: SPICLK Pin in Slave Mode
The SPICLK pin always functions as the SPICLK input pin in the slave mode (i.e., SPICTL.2 = 0), even if SPICLK FUNCTION = 0. Bit 3 SPICLK DATA IN. SPICLK Pin Port Data In. This bit contains the current value on the SPICLK pin, regardless of the mode. A write to this bit has no effect. Bit 2 SPICLK DATA OUT. SPICLK Port Data Out. This bit contains the data to be output on the SPICLK pin if both the following conditions are met:
-
SPICLK pin has been defined as a general-purpose I/O pin. SPICLK pin data direction has been defined as output.
Bit 1
SPICLK FUNCTION. SPICLK Pin Function Select. This bit defines the function of the SPICLK pin. 0 = SPICLK pin is a general-purpose digital I/O pin. 1 = SPICLK pin contains the SPI clock.
Bit 0
SPICLK DATA DIR. SPICLK Data Direction. This bit determines the data direction on the SPICLK pin if SPICLK has been defined as a general-purpose I/O pin. 0 = SPICLK pin is a general-purpose input pin. 1 = SPICLK pin is a general-purpose output pin.
Serial Peripheral Interface (SPI) Module
11-19
SPI Control Registers
11.9.5.2
SPI Port Control Register 2 (SPIPC2)
The SPIPC2 register controls the SPISOMI and SPISIMO pin functions.
Port Control Register 2 (SPIPC2) [Memory Address 103Eh]
Bit #
P03E
7
SPISIMO DATA IN R-0
6
SPISIMO DATA OUT RW-0
5
SPISIMO FUNCTION RW-0
4
SPISIMO DATA DIR RW-0
3
SPISOMI DATA IN R-0
2
SPISOMI DATA OUT RW-0
1
SPISOMI FUNCTION RW-0
0
SPISOMI DATA DIR RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
SPISIMO DATA IN. SPISIMO Pin Data In. This bit contains the current value on the SPISIMO pin, regardless of the mode. A write to this bit has no effect.
Bit 6
SPISIMO DATA OUT. SPISIMO Pin Data Out. This bit contains the data to be output on the SPISIMO pin if both the following conditions are met:
- SPISIMO pin has been defined as a general-purpose I/O pin. - SPISIMO pin data direction has been defined as output.
Bit 5 SPISIMO FUNCTION. SPISIMO Pin Function Select. This bit defines the function of the SPISIMO pin. 0 = SPISIMO pin is a general-purpose digital I/O pin. 1 = SPISIMO pin contains the SPI data. Bit 4 SPISIMO DATA DIR. SPISIMO Data Direction.
This bit determines the data direction on the SPISIMO pin if SPISIMO has been defined as a general-purpose I/O pin. 0 = SPISIMO pin is a general-purpose input pin. 1 = SPISIMO pin is a general-purpose output pin. Bit 3 SPISOMI DATA IN. SPISOMI Pin Data In. This bit contains the current value on the SPISOMI pin, regardless of the mode. A write to this bit has no effect. Bit 2 SPISOMI DATA OUT. SPISOMI Pin Data Out. This bit contains the data to be output on the SPISOMI pin if both the following conditions are met:
- The SPISOMI pin has been defined as a general-purpose I/O pin. - The SPISOMI pin data direction has been defined as output.
11-20
SPI Control Registers
Bit 1
SPISOMI FUNCTION. SPISOMI Pin Function Select. This bit defines the function of the SPISOMI pin. When SPISOMI is an input and SPISOMI FUNCTION and SPISOMI DATA DIR are disabled, SPICLK still clocks the internal circuitry. 0 = SPISOMI pin is a general-purpose digital I/O pin. 1 = SPISOMI pin contains the SPI data.
Bit 0
SPISOMI DATA DIR. SPISOMI Data Direction. This bit determines the data direction on the SPISOMI pin if SPISOMI has been defined as a general-purpose I/O pin. 0 = SPISOMI pin is a general-purpose input pin. 1 = SPISOMI pin is a general-purpose output pin.
Serial Peripheral Interface (SPI) Module
11-21
SPI Control Registers
11.9.6 SPI Interrupt Priority Control Register (SPIPRI)
The SPIPRI register selects the interrupt priority level of the SPI interrupt. The register is read only during normal operation but can be written to in the privilege mode.
SPI Interrupt Priority Control Register (SPIPRI) [Memory Address 103Fh]
Bit #
P03F
7
SPI STEST RP-0
6
SPI PRIORITY RP-0
5
SPI ESPEN RP-0
4
--
3
--
2
--
1
--
0
--
R = Read, P = Privilege write only, -n = Value of the bit after the register is reset
Bit 7
SPI STEST. SPI STEST. This bit must be cleared to ensure proper operation.
Bit 6
SPI PRIORITY. Interrupt Priority Select. 0 = Interrupts are level 1 (high-priority) requests. 1 = Interrupts are level 2 (low-priority) requests.
Bit 5
SPI ESPEN. Emulator Suspend Enable. This bit has no effect, except when you are using the XDS emulator to debug a program; then, this bit determines SPI operation when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the SPI continues to work until the current transmit/receive sequence is complete. 1 = When the emulator is suspended, the the state of the SPI is frozen so that it can be examined at the point that the emulator was suspended.
Bits 4-0
Reserved. Read data is indeterminate.
11-22
Running Title--Attribute Reference
Chapter 12
Analog-To-Digital Converter 1 (ADC1) Module
The TMS370 family contains three different ADC modules (ADC1, ADC2, and ADC3). This chapter discusses the architecture and programming of the analog-to-digital converter 1 (ADC1) module and covers the following topics:
Topic
Page
12.1 Analog-to-Digital Converter 1 (ADC1) Overview . . . . . . . . . . . . . . . . 12-2 12.2 ADC1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5 12.3 ADC1 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9 12.4 ADC1 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
Chapter Title--Attribute Reference
12-1
Analog-to-Digital Converter 1 (ACD1) Overview
12.1 Analog-to-Digital Converter 1 (ADC1) Overview
The analog-to-digital converter 1 module is an 8-bit, successive approximation converter with internal sample-and-hold circuitry. The module has eight multiplexed analog input channels that allow the processor to convert the voltage levels from up to eight different sources. The ADC1 module is available in the following families: TMS370Cx32, TMS370Cx36, TMS370Cx4x, TMS370Cx5x, TMS370Cx6x, TMS370Cx7x, and TMS370CxBx.
12.1.1 Physical Description
The ADC1 module, shown in Figure 12-1, consists of:
-
The ADC1 conversion block An ADC1 input selector (INPUT)
J J
For all family devices (except the TMS370Cx4x 40-pin device), eight analog input channels (AN0-AN7), any of which can be software-configured as digital inputs (E0-E7) if not needed as analog channels For the TMS370Cx4x 40-pin device, four analog input channels (AN2, AN3, AN6, and AN7), any of which can be software-configured as digital inputs (E2, E3, E6, and E7) if not needed as analog channels
-
A +VREF input selector (+VREF)
J J
For all family devices except the TMS370Cx4x 40-pin device, eight positive input voltage references (AN1-AN7 and VCC3). For the TMS370Cx4x 40-pin device, five positive input voltage references (AN2, AN3, AN6, AN7, and VCC3)
-
The ADDATA register, which contains the digital value of a completed conversion ADC1 module control registers
The input channels can be routed through either the channel selector or the positive voltage selector. The ADC1 converter then processes these signals and puts the result in the ADDATA register. The ADC1 interrupt circuit informs the rest of the system when a conversion is completed.
For the TMS370Cx4x 40 pin device, the ADC1 module has four multiplexed analog input channels and five positive input voltage references.
12-2
Analog-to-Digital Converter 1 (ACD1) Overview
Figure 12-1. Analog-to-Digital Converter1 (ADC1) Block Diagram
External pin connections
Port E input ENA 0
Port E data AN 0
ADENA.0
AN0
Port E input ENA 1
ADIN.0
2
1
0
SAMPLE START
CONVERT START
ADCTL.2 - 0
Port E data AN 1 AD INPUT SELECT
ADCTL.6
ADCTL.7
ADENA.1
AN1 Port E input ENA 2
ADIN.1
ADENA.2 AN2
Port E input ENA 3
Port E data AN 2
ADIN.2
ADENA.3 AN3
Port E input ENA 4
Port E data AN 3 ADIN.3
AD
ADENA.4 AN4
Port E input ENA 5
Port E data AN 4 ADIN.4
ADDATA.7 - 0
ADC data register AD READY
ADENA.5 AN5
Port E input ENA 6
Port E data AN 5 ADIN.5
ADSTAT.2
AD PRIORITY
Port E data AN 6
ADENA.6 AN6
Port E input ENA 7
ADIN.6
5
4
3
ADPRI.6 Level 1 Int 0
1 Level 2 Int
ADCTL.5 - 3
Port E data AN 7 REF VOLTS SELECT
ADENA.7 AN7 VCC3 VSS3
ADIN.7
AD INT FLAG
ADSTAT.1 ADSTAT.0
AD INT ENA These pins are not implemented in the TMS370Cx4x 40-pin device.
Analog-to-Digital Converter 1 (ADC1) Module
12-3
Analog-to-Digital Converter 1 (ACD1) Overview
12.1.2 Control Registers
The ADC1 control registers are located at addresses 1070h to 107Fh and occupy peripheral file frame 7, as shown in Table 12-1.
Table 12-1. ADC1 Memory Map
Peripheral File Location P070 Symbol
ADCTL
Name Analog Control Register
Description Controls the input selection, reference voltage selection, sample start, and conversion start. Indicates the converter and interrupt status. Contains the digital result of the last ADC1 conversion.
P071 P072 P073-P07C P07D
ADSTAT
Analog Status and Interrupt Register Analog Conversion Data Register Reserved
ADDATA
ADIN
Analog Port E Data Input Register
Contains digital input data when one or more of the AN0-AN7 pins are used as digital ports. Controls the function of the AN0-AN7 pins. Selects the interrupt priority level of the ADC1 interrupt.
P07E P07F
ADENA
Analog Port E Input Enable Register Analog Interrupt Priority Register
ADPRI
12-4
ADC1 Operation
12.2 ADC1 Operation
The following subsections describe the functions and options of the ADC1 module.
12.2.1 Input/Output Pins
The ADC1 module contains up to ten pins.
-
The TMS370Cx32, TMS370Cx36, 44-pin TMS370Cx4x, TMS370Cx5x, TMS370Cx6x, TMS370Cx7x, and TMS370CxBx use 10 pins: eight analog channels, VCC3, and VSS3. These pins are described below:
J J J
Eight (AN0-AN7) of the ten pins are analog channels and can be individually configured as general-purpose input pins (E0-E7) when not used as analog inputs. Seven (AN1-AN7) of the eight analog channels are also available as the positive input voltage reference. This feature allows a weighted measurement or ratio of one channel to another. The analog voltage supply pins, VCC3 and VSS3, isolate the ADC1 module from digital switching noise that can be present on the other power supply pins. This isolation provides a more accurate conversion.
-
The TMS370Cx4x 40-pin device uses 6 pins: four analog channels, VCC3, and VSS3. These pins are described below:
J J J
Four (AN2, AN3, AN6, and AN7) of the six pins are analog channels and can be individually configured as general-purpose input pins when not used as analog inputs. Four (AN2, AN3, AN6, and AN7) analog channels are also available as the positive input voltage reference. This feature allows a weighted measurement or ratio of one channel to another. The analog voltage supply pins, VCC3 and VSS3, isolate the ADC1 module from digital switching noise that can be present on the other power supply pins. This isolation provides a more accurate conversion. To further reduce noise and produce a more accurate conversion, you should run the power to the VCC3 and VSS3 pins on separate conductors from the other power lines. Additionally, the power conductors to the VCC3 and VSS3 should be as short as possible, and the two lines should be properly decoupled. Use other standard noise-reduction techniques to help provide a more accurate conversion.
Analog-to-Digital Converter 1 (ADC1) Module
12-5
ADC1 Operation
Note that you can select the VREF pin to be either VCC3 or one of the analog input channels AN1 to AN7. VCC3 must provide power to the ADC1 module even if it does not provide the voltage reference. A channel configured as the +VREF for one conversion can be changed to an analog input channel for the next conversion.
12.2.2 Sampling Time
The application program controls the length of the sample time, which provides the flexibility to optimize the conversion process for both high- and lowimpedance sources. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low-impedance sources.
12.2.3 ADC1 Conversion
The digital result of the conversion process is given in the following formula. digital result = 255 x input voltage reference voltage
The conversion process requires 164 SYSCLK cycles and results in a conversion time of 32.8 microseconds at 5 MHz SYSCLK. A maximum of 27,600 conversions per second is possible at 5 MHz SYSCLK, including setting up the conversion, sampling, converting, and saving the results. In ratiometric conversions, the conversion value is a ratio of the VREF source to the analog input. As VREF is increased, the input voltage that is required in order to produce a certain conversion value changes; however, all conversion values keep the same relationship to VREF. That is, one half of VREF always results in the value 080h, regardless of the value of VREF (assuming that VREF is in the range of 2.5 to 5.5 volts above VSS3).
12-6
ADC1 Operation
Figure 12-2 shows an example of ratiometric conversion. In this example, the digital result of the conversion indicates the position of the potentiometer wiper, even if the battery loses voltage over time. The ADC1 conversion always gives the ratio of the resistor values on either side of the wiper, even if VREF drops from 5.0 to 2.5 volts.
Figure 12-2. Ratiometric Conversion Example
2.5-5 V +VREF
+ Battery - VSS3 Analog In
12.2.4 Interrupts
The ADC1 module sets the AD INT FLAG bit (ADSTAT.1) at the end of the conversion process. If both the AD INT FLAG and the AD INT ENA bit (ADSTAT.0) are set, then the module generates an interrupt request. This interrupt request can be asserted on either high-priority level 1 or the lower-priority level 2, depending on the AD PRIORITY bit (ADPRI.6). The program must clear the AD INT FLAG bit before exiting the interrupt service routine (ISR), or else the same interrupt will cause the CPU to enter the interrupt routine again. If the AD INT ENA bit is cleared without clearing the flag, the interrupt is reasserted when the AD INT ENA bit is again set.
Analog-to-Digital Converter 1 (ADC1) Module
12-7
ADC1 Operation
12.2.5 Programming Considerations
Follow these steps to obtain data from the ADC1: 1) Write to the ADCTL register (described on page 12-12) to: a) Select the analog channel (ADCTL.2- 0). b) Select the VREF source (ADCTL.5 -3). c) Set the SAMPLE START bit to 1 (ADCTL.6) to begin sampling. 2) Wait for the sample time to elapse. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low impedance sources. 3) When the sample time completes, set the CONVERT START bit (ADCTL.7); leave the SAMPLE START bit (ADCTL.6) set. 4) Wait for either the interrupt flag to be set or the ADC1 interrupt to occur. 5) Read the conversion data register (ADDATA). 6) Clear the interrupt flag bit (ADSTAT.1). Eighteen SYSCLK cycles after the program sets the CONVERT START bit, the ADC1 module clears both the SAMPLE START and CONVERT START bits to signify the end of the internal sampling phase. After these bits are cleared, the program can change the input channel without affecting the conversion process. The voltage reference source VREF should remain constant throughout the conversion. To stop a conversion in progress, set the SAMPLE START (ADCTL.6) bit to 1 anytime after the ADC1 clears this bit. The entire conversion process requires 164 SYSCLK cycles after the program sets the CONVERT START bit (ADCTL.7).
12-8
ADC1 Example Program
12.3 ADC1 Example Program
This example program (next page) samples and converts data from all eight channels and stores the digital results into a table beginning at ATABLE. The routine stops interrupting the main program after it finishes all eight channels. If the main program wants more recent data, it needs to execute only the code at RESTART, and the ADC1 routine will again sample and convert all eight channels of data. The AD INT ENA bit (ADSTAT.0) is cleared by the ADC1 interrupt routine as a signal to the main program that all eight channels have been processed. The address of the label ATOD must be placed into the interrupt vector table located at 7FECh and 7FEDh.
Analog-to-Digital Converter 1 (ADC1) Module
12-9
ADC1 Example Program
ADCTL ADSTAT ADDATA ADENA
.EQU .EQU .EQU .EQU .REG .REG MOV CALL
P070 P071 P072 P07E ADCHANL ATABLE,8 #0,ADENA RESTART
;ADC1 control register ;ADC1 status register ;ADC1 conversion results ;ADC1 input enable ;keeps current channel number ;8 byte table that stores ; channel data, LSB first ;all channels to ADC1 inputs ; (reset condition) ;start taking data
; INIT ; ; ; ;
; ; ; ; ; SUBROUTINE SECTION RESTART CLR ADCHANL MOV #001h,ADSTAT MOV MOV RTS ; ; ATOD #040h,ADCTL #0C0h,ADCTL
MAIN PROGRAM GOES HERE . . CALL RESTART ;start taking more data . . MORE MAIN PROGRAM ;initialize channel ;enable interrupts, clear ; any flag ;start sampling (approx. 2 s ; delay) ;start converting now; enter ; main program
INTERRUPT ROUTINE FOR ANALOG TO DIGITAL CONVERTER1 PUSH A ;save registers PUSH B MOV ADCHANL,B ;get channel number MOV ADDATA,A ;get ADC1 conversion value MOV A,*ATABLE[B] ;store in a table according to ; channel number INC B ;point to next channel BTJZ #8,B,GOCNVRT ;stop when all channels sampled ;(bit3 =1) CLR ADCHANL ;reset the ADC1 channel MOV #0,ADSTAT ;turn off interrupt and ; clear flag JMP EXITA2D ;all 8 channels taken, enable ;set to 0 now ; GOCNVRT MOV B,ADCHANL ;store current ADC1 channel MOV #01h,ADSTAT ;clear interrupt flag OR #040h,B ;set up sample bit in value MOV B,ADCTL ;start sampling channel data OR #080h,ADCTL ;start converting data ; EXITA2D POP B ;Restore data POP A RTI
12-10
ADC1 Control Registers
12.4 ADC1 Control Registers
The ADC1 module control registers occupy peripheral file frame 7, as shown in Figure 12-3. The bits shown in shaded boxes in Figure 12-3 are privilege mode bits; that is, they can be written only to in the privilege mode.
Figure 12-3. Peripheral File Frame 7: ADC1 Converter Control Registers
Designation ADCTL ADDR 1070h PF P070
Bit 7
CONVERT START (RW-0) --
Bit 6
SAMPLE START (RW-0) --
Bit 5
REF VOL SELECT2 (RW-0) --
Bit 4
REF VOL SELECT1 (RW-0) --
Bit 3
REF VOL SELECT0 (RW-0) --
Bit 2
AD INPUTSELECT2 (RW-0) AD READY (R-0)
Bit 1
AD INPUTSELECT1 (RW-0) AD INT FLAG (RC-0)
Bit 0
AD INPUTSELECT0 (RW-0) AD INT ENA (RW-0)
ADSTAT
1071h
P071
ADDATA
1072h 1073h to 107Ch
P072 P073 to P07C P07D P07E P07F AD STEST (RP-0) AD PRIORITY (RP-0) AD ESPEN (RP-0)
A-to-D Conversion Data Register (R-0) Reserved Port E Data Input Register (R-0) Port E Input Enable Register (RW-0) -- -- -- -- --
ADIN ADENA ADPRI
107Dh 107Eh 107Fh
Analog-to-Digital Converter 1 (ADC1) Module
12-11
ADC1 Control Registers
12.4.1 Analog Control Register (ADCTL)
The ADCTL register controls the input selection, reference voltage selection, sample start, and conversion start.
Analog Control Register (ADCTL) [Memory Address 1070h]
Bit #
P070
7
CONVERT START RW-0
6
SAMPLE START RW-0
5
REF VOLT SELECT2 RW-0
4
REF VOLT SELECT1 RW-0
3
REF VOLT SELECT0 RW-0
2
AD INPUT SELECT2 RW-0
1
AD INPUT SELECT1 RW-0
0
AD INPUT SELECT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset Bit 7 CONVERT START. Conversion Start.
Setting this bit starts the conversion. This bit is cleared by the ADC1 18 system clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any conversion in progress. Bit 6 SAMPLE START. Sample Start. Setting this bit stops any ongoing conversion and starts sampling the selected input channel to begin a new conversion. This bit is cleared by the ADC1 module 18 system-clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any sampling in progress. Bits 5-3 REF VOLT SELECT2-0. Reference Voltage (+VREF) Select Bits 2-0. These bits select the channel the ADC1 uses for the positive voltage reference. The REF VOLT SELECT bits must not change during the entire conversion.
REF VOLT SELECT2 0 0 0 0 1 1 1 1 REF VOLT SELECT1 0 0 1 1 0 0 1 1 REF VOLT SELECT0 0 1 0 1 0 1 0 1 +VREF Source
VCC3 AN1 AN2 AN3 AN4 AN5 AN6 AN7
Pin AN0 cannot be selected as positive voltage reference. AN0, AN1, AN4, and AN5 are not implemented on the 40-pin TMS370Cx4x device; thus, they cannot be used as positive voltage references.
12-12
ADC1 Control Registers
Bits 2-0
AD INPUT SELECT2-0. Analog Input Channel Select Bits 2-0. These bits select the channel used for conversion. Channels should be changed only after the ADC1 has cleared the SAMPLE START and CONVERT START bits. Changing the channel while either the SAMPLE START bit or the CONVERT START bit is 1 invalidates the conversion in progress.
AD INPUT SELECT2 0 0 0 0 1 1 1 1 AD INPUT SELECT1 0 0 1 1 0 0 1 1 AD INPUT SELECT0 0 1 0 1 0 1 0 1
Channel AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7
AN0, AN1, AN4, and AN5 are not implemented on the 40-pin TMS370Cx4x device.
Analog-to-Digital Converter 1 (ADC1) Module
12-13
ADC1 Control Registers
12.4.2 Analog Status and Interrupt Register (ADSTAT)
The ADSTAT register indicates the converter and interrupt status.
Analog Status and Interrupt Register (ADSTAT) [Memory Address 1071h]
Bit #
P071
7
--
6
--
5
--
4
--
3
--
2
AD READY R-0
1
AD INT FLAG RC-0
0
AD INT ENA RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bits 7-3 Bit 2
Reserved. Read data is indeterminate. AD READY. ADC1 Converter Ready. The ADC1 module sets this bit whenever a conversion is not in progress and the ADC1 is ready for a new conversion to start. Writing to this bit has no effect on its state. 0 = Conversion in process. 1 = Converter ready.
Bit 1
AD INT FLAG. ADC1 Interrupt Flag. The ADC1 module sets this bit at the end of an ADC1 conversion. If this bit is set while the AD INT ENA bit is set, an interrupt request is generated. Clearing this flag clears pending ADC1 interrupt requests. This bit is cleared by the system reset. Software cannot set this bit.
Bit 0
AD INT ENA. ADC1 Interrupt Enable. This bit controls the ADC1 module's ability to generate an interrupt. 0 = Disables ADC1 interrupt. 1 = Enables ADC1 interrupt.
12-14
ADC1 Control Registers
12.4.3 Analog Conversion Data Register (ADDATA)
The ADDATA register contains the digital result of the last ADC1 conversion.
Analog Conversion Data Register (ADDATA) [Memory Address 1072h]
Bit #
P072
7
DATA7 R-0
6
DATA6 R-0
5
DATA5 R-0
4
DATA4 R-0
3
DATA3 R-0
2
DATA2 R-0
1
DATA1 R-0
0
DATA0 R-0
R = Read, -n = Value of the bit after the register is reset
The analog-to-digital conversion data is loaded into this register at the end of a conversion and remains there until replaced through another conversion.
12.4.4 Analog Port E Data Input Register (ADIN)
The ADIN register contains digital input data when one or more of the AN0 through AN7 pins are used as digital ports.
Analog Port E Data Input Register (ADIN) [Memory Address 107Dh]
Bit #
P07D
7
PORT E DATA AN 7 R-0
6
PORT E DATA AN 6 R-0
5
PORT E DATA AN 5 R-0
4
PORT E DATA AN 4 R-0
3
PORT E DATA AN 3 R-0
2
PORT E DATA AN 2 R-0
1
PORT E DATA AN 1 R-0
0
PORT E DATA AN 0 R-0
R = Read, -n = Value of the bit after the register is reset
The ADIN register shows the data present at the AN0-AN7 pins when they are configured for general-purpose input instead of for ADC1 channels. A bit is configured as a general-purpose input if the corresponding bit of the port enable register is a 1. Pins configured as ADC1 channels are read as 0s. Writing to this address has no effect.
Analog-to-Digital Converter 1 (ADC1) Module
12-15
ADC1 Control Registers
12.4.5 Analog Port E Input Enable Register (ADENA)
The ADENA register controls the function of the AN0 through AN7 pins.
Analog Port E Data Input Enable Register (ADENA) [Memory Address 107Eh]
Bit #
P07E
7
PORT E INPUT ENA 7 RW-0
6
PORT E INPUT ENA 6 RW-0
5
PORT E INPUT ENA 5 RW-0
4
PORT E INPUT ENA 4 RW-0
3
PORT E INPUT ENA 3 RW-0
2
PORT E INPUT ENA 2 RW-0
1
PORT E INPUT ENA 1 RW-0
0
PORT E INPUT ENA 0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
The ADENA register individually configures the AN0-AN7 pins as either analog input channels or as general-purpose input pins. 0 = For pins AN1-AN7, the pin becomes an analog input or reference channel for the ADC1; for pin AN0, the pin becomes an analog input channel for the ADC1. When the bit is 0, the corresponding bit in the ADIN register reads as a 0. 1 = Enables the pin as a general-purpose input pin; its digital value can be read from the corresponding bit in the port E data input register.
12-16
ADC1 Control Registers
12.4.6 Analog Interrupt Priority Register (ADPRI)
The ADPRI register selects the interrupt priority level of the ADC1 interrupt.
Analog Interrupt Priority Register (ADPRI) [Memory Address 107Fh]
Bit #
P07F
7
AD STEST RP-0
6
AD PRIORITY RP-0
5
AD ESPEN RP-0
4
--
3
--
2
--
1
--
0
--
R = Read, P = Privilege write only, -n = Value of the bit after the register is reset
Bit 7 Bit 6
AD STEST. This bit must be cleared (0) to ensure proper operation. AD PRIORITY. ADC1 Interrupt Priority Select. This bit selects the priority level of the ADC1 interrupt. 0 = ADC1 interrupt is a higher priority (level 1) request. 1 = ADC1 interrupt is a lower priority (level 2) request.
Bit 5
AD ESPEN. Emulator Suspend Enable. Normally, this bit has no effect. However, when you are using the XDS emulator to debug a program, this bit determines what happens to the ADC1 when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the ADC1 continues to work until the current conversion is complete. 1 = When the emulator is suspended, the ADC1 is frozen so that its state can be examined at the point that the emulator was suspended. The conversion data is indeterminate upon restart.
Bits 4-0
Reserved. Read data is indeterminate.
Analog-to-Digital Converter 1 (ADC1) Module
12-17
12-18
Running Title--Attribute Reference
Chapter 13
Analog-To-Digital Converter 2 (ADC2) Module
The TMS370 family contains three different ADC modules (ADC2, ADC2, and ADC3). This chapter discusses the architecture and programming of the analog-to-digital converter 2 (ADC2) module and covers the following topics:
Topic
Page
13.1 Analog-to-Digital Converter 2 (ADC2) Overview . . . . . . . . . . . . . . . . 13-2 13.2 ADC2 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.3 ADC2 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8 13.4 ADC2 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10
Chapter Title--Attribute Reference
13-1
Analog-to-Digital Converter 2 (ACD2) Overview
13.1 Analog-to-Digital Converter 2 (ADC2) Overview
The analog-to-digital converter 2 module is an 8-bit, successive approximation converter with internal sample-and-hold circuitry. The module has four multiplexed analog input channels that allow the processor to convert the voltage levels from up to four different sources. Note: ADC2 Module Availability
The ADC2 module is available for the TMS370CxCx family.
13.1.1 Physical Description
The ADC2 module, shown in Figure 13-1, consists of:
-
The ADC2 conversion block Four analog input channels (AN0-AN3), any of which can be softwareconfigured as digital inputs (E0-E3) if not needed as analog channels An ADC2 input selector (INPUT) A +VREF input selector (+VREF) The ADDATA register, which contains the digital value of a completed conversion ADC2 module control registers
The input channels can be routed through either the channel selector or the positive voltage selector. The ADC2 converter then processes these signals and puts the result in the ADDATA register. The ADC2 interrupt circuit informs the rest of the system when a conversion is completed.
13-2
Analog-to-Digital Converter 2 (ACD2) Overview
Figure 13-1. Analog-to-Digital Converter 2 (ADC2) Block Diagram
External pin connections
Port E input ENA 0
Port E data AN 0
ADENA.0 AN0
Port E input ENA 1
ADIN.0
1
0
SAMPLE START
CONVERT START
ADCTL.1- 0
Port E data AN 1 AD INPUT SELECT
ADCTL.6
ADCTL.7
ADENA.1 AN1
Port E input ENA 2
ADIN.1
Port E data AN 2
ADENA.2 AN2
Port E input ENA 3
ADIN.2
Port E data AN 3
AD
ADENA.3 AN3
ADIN.3 ADDATA.7 - 0
ADC data register 4 3 AD READY
ADCTL.4 - 3
REF VOLTS SELECT
ADSTAT.2
AD PRIORITY
VCC VSS
ADPRI.6 Level 1 Int 0
1 Level 2 Int
AD INT FLAG
ADSTAT.1 ADSTAT.0
AD INT ENA
Analog-to-Digital Converter 2 (ADC2) Module
13-3
Analog-to-Digital Converter 2 (ACD2) Overview
13.1.2 Control Registers
The ADC2 control registers are located at addresses 1070h to 107Fh and occupy peripheral file frame 7, as shown in Table 13-1.
Table 13-1. ADC2 Memory Map
Peripheral File Location P070 P071 P072 P073-P07C P07D P07E P07F
ADIN
Symbol
ADCTL
Name Analog Control Register Analog Status and Interrupt Register Analog Conversion Data Register Reserved Analog Port E Data Input Register Analog Port E Input Enable Register Analog Interrupt Priority Register
Description Controls the input selection, reference voltage selection, sample start, and conversion start. Indicates the converter and interrupt status. Contains the digital result of the last ADC2 conversion. Contains digital input data when one or more of the AN0-AN3 pins are used as digital ports. Controls the function of the AN0-AN3 pins. Selects the interrupt priority level of the ADC2 interrupt.
ADSTAT ADDATA
ADENA ADPRI
13-4
ADC2 Operation
13.2 ADC2 Operation
The following subsections describe the functions and options of the ADC2 module.
13.2.1 Input/Output Pins
The ADC2 module uses six pins to connect itself to the external world: AN0-AN3, VCC and VSS. These pins are described below:
-
Four pins (AN0-AN3) are analog channels and can be individually configured as general-purpose input pins (E0-E3) when not used as analog inputs. Three (AN1-AN2) of the four analog channels are also available as the positive input voltage reference. This feature allows a weighted measurement or ratio of one channel to another.
Note that you can select the VREF pin to be either VCC or one of the analog input channels AN1 to AN3. A channel configured as the +VREF for one conversion can be changed to an analog input channel for the next conversion.
13.2.2 Sampling Time
The application program controls the length of the sample time, which provides the flexibility to optimize the conversion process for both high- and lowimpedance sources. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low-impedance sources.
13.2.3 ADC2 Conversion
The digital result of the conversion process is given in the following formula: digital result = 255 x input voltage reference voltage
The conversion process requires 164 SYSCLK cycles and results in a conversion time of 32.8 microseconds at 5 MHz SYSCLK. A maximum of 27,600 conversions per second is possible at 5 MHz SYSCLK, including setting up the conversion, sampling, converting, and saving the results. In ratiometric conversions, the conversion value is a ratio of the VREF source to the analog input. As VREF is increased, the input voltage that is required in order to produce a certain conversion value changes; however, all conversion
Analog-to-Digital Converter 2 (ADC2) Module
13-5
ADC2 Operation
values keep the same relationship to VREF. That is, one half of VREF always results in the value 080h, regardless of the value of VREF (assuming that VREF is in the range of 2.5 to 5.5 volts above VSS). Figure 13-2 shows an example of ratiometric conversion. In this example, the digital result of the conversion indicates the position of the potentiometer wiper, even if the battery loses voltage over time. The ADC2 conversion always gives the ratio of the resistor values on either side of the wiper, even if VREF drops from 5.0 to 2.5 volts.
Figure 13-2. Ratiometric Conversion Example
2.5-5 V +VREF
+ Battery - VSS Analog In
13.2.4 Interrupts
The ADC2 module sets the AD INT FLAG bit (ADSTAT.1) at the end of the conversion process. If both the AD INT FLAG and the AD INT ENA bit (ADSTAT.0) are set, then the module generates an interrupt request. This interrupt request can be asserted on either high-priority level 1 or the lower-priority level 2, depending on the AD PRIORITY bit (ADPRI.6). The program must clear the AD INT FLAG bit before exiting the interrupt service routine (ISR), or else the same interrupt will cause the CPU to enter the interrupt routine again. If the AD INT ENA bit is cleared without clearing the flag, the interrupt is reasserted when the AD INT ENA bit is again set.
13-6
ADC2 Operation
13.2.5 Programming Considerations
Follow these steps to obtain data from the ADC2: 1) Write to the ADCTL register (described on page 13-11) to: a) Select the analog channel (ADCTL.1- 0). b) Select the VREF source (ADCTL.4-3). c) Set the SAMPLE START bit to 1 (ADCTL.6) to begin sampling. 2) Wait for the sample time to elapse. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low impedance sources. 3) When the sample time completes, set the CONVERT START bit (ADCTL.7); leave the SAMPLE START bit (ADCTL.6) set. 4) Wait for either the interrupt flag to be set or the ADC2 interrupt to occur. 5) Read the conversion data register (ADDATA). 6) Clear the interrupt flag bit (ADSTAT.1). Eighteen SYSCLK cycles after the program sets the CONVERT START bit, the ADC2 module clears both the SAMPLE START and CONVERT START bits to signify the end of the internal sampling phase. After these bits are cleared, the program can change the input channel without affecting the conversion process. The voltage reference source VREF should remain constant throughout the conversion. To stop a conversion in progress, set the SAMPLE START (ADCTL.6) bit to 1 anytime after the ADC2 clears this bit. The entire conversion process requires 164 SYSCLK cycles after the program sets the CONVERT START bit (ADCTL.7).
Analog-to-Digital Converter 2 (ADC2) Module
13-7
ADC2 Example Program
13.3 ADC2 Example Program
This example program (next page) samples and converts data from all four channels and stores the digital results into a table beginning at ATABLE. The routine stops interrupting the main program after it finishes all four channels. If the main program wants more recent data, it needs to execute only the code at RESTART, and the ADC2 routine will again sample and convert all four channels of data. The AD INT ENA bit (ADSTAT.0) is cleared by the ADC2 interrupt routine as a signal to the main program that all four channels have been processed. The address of the label ATOD must be placed into the interrupt vector table located at 7FECh and 7FEDh.
13-8
ADC2 Example Program
ADCTL ADSTAT ADDATA ADENA
.EQU .EQU .EQU .EQU .REG .REG MOV CALL
P070 P071 P072 P07E ADCHANL ATABLE,8 #0,ADENA RESTART
;ADC2 control register ;ADC2 status register ;ADC2 conversion results ;ADC2 input enable ;keeps current channel number ;8 byte table that stores ; channel data, LSB first ;all channels to ADC2 inputs ; (reset condition) ;start taking data
; INIT ; ; ; ;
; ; ; ; ; SUBROUTINE SECTION RESTART CLR ADCHANL MOV #001h,ADSTAT MOV MOV RTS ; ; ATOD #040h,ADCTL #0C0h,ADCTL
MAIN PROGRAM GOES HERE . . CALL RESTART ;start taking more data . . MORE MAIN PROGRAM ;initialize channel ;enable interrupts, clear ; any flag ;start sampling (approx. 2 s ; delay) ;start converting now; enter ; main program
INTERRUPT ROUTINE FOR ANALOG TO DIGITAL CONVERTER2 PUSH A ;save registers PUSH B MOV ADCHANL,B ;get channel number MOV ADDATA,A ;get ADC2 conversion value MOV A,*ATABLE[B] ;store in a table according to ; channel number INC B ;point to next channel BTJZ #4,B,GOCNVRT ;stop when all channels sampled ;(bit3 =1) CLR ADCHANL ;reset the ADC2 channel MOV #0,ADSTAT ;turn off interrupt and ; clear flag JMP EXITA2D ;all four channels taken, enable ;set to 0 now ; GOCNVRT MOV B,ADCHANL ;store current ADC2 channel MOV #01h,ADSTAT ;clear interrupt flag OR #040h,B ;set up sample bit in value MOV B,ADCTL ;start sampling channel data OR #080h,ADCTL ;start converting data ; EXITA2D POP B ;Restore data POP A RTI
Analog-to-Digital Converter 2 (ADC2) Module
13-9
ADC2 Control Registers
13.4 ADC2 Control Registers
The ADC2 module control registers occupy peripheral file frame 7, as shown in Figure 13-3. The bits shown in shaded boxes in Figure 13-3 are privilege mode bits; that is, they can be written only to in the privilege mode.
Figure 13-3. Peripheral File Frame 7: ADC2 Converter Control Registers
Designation ADCTL ADDR 1070h PF P070
Bit 7
CONVERT START (RW-0) --
Bit 6
SAMPLE START (RW-0) --
Bit 5
--
Bit 4
REF VOLT SELECT1 (RW-0) --
Bit 3
REF VOLT SELECT0 (RW-0) --
Bit 2
-- AD READY (R-0)
Bit 1
AD INPUT SELECT1 (RW-0) AD INT FLAG (RC-0)
Bit 0
AD INPUT SELECT0 (RW-0) AD INT ENA (RW-0)
ADSTAT
1071h
P071 --
ADDATA
1072h 1073h to 107Ch
P072 P073 to P07C P07D P07E P07F -- -- AD STEST (RP-0) -- -- AD PRIORITY (RP-0) -- --
A-to-D Conversion Data Register (R-0) Reserved -- -- -- -- Port E Data Input Register (R-0) Port E Input Enable Register (RW-0) -- -- --
ADIN
107Dh 107Eh 107Fh
ADENA ADPRI
AD ESPEN (RP-0)
13-10
ADC2 Control Registers
13.4.1 Analog Control Register (ADCTL)
The ADCTL register controls the input selection, reference voltage selection, sample start, and conversion start.
Analog Control Register (ADCTL) [Memory Address 1070h]
Bit #
P070
7
CONVERT START RW-0
6
SAMPLE START RW-0
5
-
4
REF VOLT SELECT1 RW-0
3
REF VOLT SELECT0 RW-0
2
-
1
AD INPUT SELECT1 RW-0
0
AD INPUT SELECT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset Bit 7 CONVERT START. Conversion Start.
Setting this bit starts the conversion. This bit is cleared by the ADC2 18 system clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any conversion in progress. Bit 6 SAMPLE START. Sample Start. Setting this bit stops any ongoing conversion and starts sampling the selected input channel to begin a new conversion. This bit is cleared by the ADC2 module 18 system-clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any sampling in progress. Bit 5 Bits 4-3 Reserved. Read data is indeterminate. REF VOLT SELECT1-0. Reference Voltage (+VREF) Select Bits 1-0. These bits select the channel the ADC2 uses for the positive voltage reference. The REF VOLT SELECT bits must not change during the entire conversion.
REF VOLT SELECT1 0 0 1 1 REF VOLT SELECT0 0 1 0 1 +VREF Source VCC AN1 AN2 AN3
Pin AN0 cannot be selected as positive voltage reference.
Bit 2
Reserved. Read data is indeterminate
Analog-to-Digital Converter 2 (ADC2) Module
13-11
ADC2 Control Registers
Bits 1-0
AD INPUT SELECT1-0. Analog Input Channel Select Bits 1-0. These bits select the channel used for conversion. Channels should be changed only after the ADC2 has cleared the SAMPLE START and CONVERT START bits. Changing the channel while either the SAMPLE START bit or the CONVERT START bit is 1 invalidates the conversion in progress.
AD INPUT SELECT1 0 0 1 1 AD INPUT SELECT0 0 1 0 1 Channel AN0 AN1 AN2 AN3
13-12
ADC2 Control Registers
13.4.2 Analog Status and Interrupt Register (ADSTAT)
The ADSTAT register indicates the converter and interrupt status.
Analog Status and Interrupt Register (ADSTAT) [Memory Address 1071h]
Bit #
P071
7
--
6
--
5
--
4
--
3
--
2
AD READY R-0
1
AD INT FLAG RC-0
0
AD INT ENA RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bits 7-3 Bit 2
Reserved. Read data is indeterminate. AD READY. ADC2 Converter Ready. The ADC2 module sets this bit whenever a conversion is not in progress and the ADC2 is ready for a new conversion to start. Writing to this bit has no effect on its state. 0 = Conversion in process. 1 = Converter ready.
Bit 1
AD INT FLAG. ADC2 Interrupt Flag. The ADC2 module sets this bit at the end of an ADC2 conversion. If this bit is set while the AD INT ENA bit is set, an interrupt request is generated. Clearing this flag clears pending ADC2 interrupt requests. This bit is cleared by the system reset. Software cannot set this bit.
Bit 0
AD INT ENA. ADC2 Interrupt Enable. This bit controls the ADC2 module's ability to generate an interrupt. 0 = Disables ADC2 interrupt. 1 = Enables ADC2 interrupt.
13.4.3 Analog Conversion Data Register (ADDATA)
The ADDATA register contains the digital result of the last ADC2 conversion.
Analog Conversion Data Register (ADDATA) [Memory Address 1072h]
Bit #
P072
7
DATA7 R-0
6
DATA6 R-0
5
DATA5 R-0
4
DATA4 R-0
3
DATA3 R-0
2
DATA2 R-0
1
DATA1 R-0
0
DATA0 R-0
R = Read, -n = Value of the bit after the register is reset
The ADC2 data is loaded into this register at the end of a conversion and remains until replaced by another conversion.
Analog-to-Digital Converter 2 (ADC2) Module
13-13
ADC2 Control Registers
13.4.4 Analog Port E Data Input Register (ADIN)
The ADIN register contains digital input data when one or more of the AN0 through AN3 pins are used as digital ports.
Analog Port E Data Input Register (ADIN) [Memory Address 107Dh]
Bit #
P07D
7
- R-0
6
- R-0
5
- R-0
4
- R-0
3
PORT E DATA AN 3 R-0
2
PORT E DATA AN 2 R-0
1
PORT E DATA AN1 R-0
0
PORT E DATA AN 0 R-0
R = Read, -n = Value of the bit after the register is reset
The ADIN register shows the data present at the AN0-AN3 pins when they are configured for general-purpose input instead of for ADC2 channels. A bit is configured as a general-purpose input if the corresponding bit of the port enable register is a 1. Pins configured as ADC2 channels are read as 0s. Writing to this address has no effect.
13.4.5 Analog Port E Input Enable Register (ADENA)
The ADENA register controls the function of the AN0 through AN3 pins.
Analog Port E Data Input Enable Register (ADENA) [Memory Address 107Eh]
Bit #
P07E
7
- RW-0
6
- RW-0
5
- RW-0
4
- RW-0
3
PORT E INPUT ENA 3 RW-0
2
PORT E INPUT ENA 2 RW-0
1
PORT E INPUT ENA 1 RW-0
0
PORT E INPUT ENA 0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
The ADENA register individually configures the AN0-AN3 pins as either analog input channels or as general-purpose input pins. 0 = For pins AN1-AN3, the pin becomes an analog input or reference channel for the ADC2; for pin AN0, the pin becomes an analog input channel for the ADC2. When the bit is 0, the corresponding bit in the ADIN register reads as a 0. 1 = Enables the pin as a general-purpose input pin; its digital value can be read from the corresponding bit in the port E data input register.
13-14
ADC2 Control Registers
13.4.6 Analog Interrupt Priority Register (ADPRI)
The ADPRI register selects the interrupt priority level of the ADC2 interrupt.
Analog Interrupt Priority Register (ADPRI) [Memory Address 107Fh]
Bit #
P07F
7
AD STEST RP-0
6
AD PRIORITY RP-0
5
AD ESPEN RP-0
4
--
3
--
2
--
1
--
0
--
R = Read, P = Privilege write only, -n = Value of the bit after the register is reset
Bit 7 Bit 6
AD STEST. This bit must be cleared (0) to ensure proper operation. AD PRIORITY. ADC2 Interrupt Priority Select. This bit selects the priority level of the ADC2 interrupt. 0 = ADC2 interrupt is a higher priority (level 1) request. 1 = ADC2 interrupt is a lower priority (level 2) request.
Bit 5
AD ESPEN. Emulator Suspend Enable. Normally, this bit has no effect. However, when you are using the XDS emulator to debug a program, this bit determines what happens to the ADC2 when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the ADC2 continues to work until the current conversion is complete. 1 = When the emulator is suspended, the ADC2 is frozen so that its state can be examined at the point that the emulator was suspended. The conversion data is indeterminate upon restart.
Bits 4-0
Reserved. Read data is indeterminate.
Analog-to-Digital Converter 2 (ADC2) Module
13-15
13-16
Running Title--Attribute Reference
Chapter 14
Analog-To-Digital Converter 3 (ADC3) Module
The TMS370 family contains three different ADC modules (ADC1, ADC2, and ADC3). This chapter discusses the architecture and programming of the analog-to-digital converter 3 (ADC3) module and covers the following topics:
Topic
Page
14.1 Analog-to-Digital Converter 3 (ADC3) Overview . . . . . . . . . . . . . . . . 14-2 14.2 ADC3 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5 14.3 ADC3 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9 14.4 ADC3 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11
Analog-to-Digital Converter 3 (ADC3) Module
14-1
Analog-to-Digital Converter 3 (ACD3) Overview
14.1 Analog-to-Digital Converter 3 (ADC3) Overview
The analog-to-digital converter 3 module is an 8-bit, successive approximation converter with internal sample-and-hold circuitry. The module has 15 analog input channels that allow the processor to convert the voltage levels from up to 15 different sources. Note: ADC3 Module Availability
The ADC3 module is available for the TMS370Cx9x family.
14.1.1 Physical Description
The ADC3 module, shown in Figure 14-1, consists of:
-
Fifteen analog input channels (AN0-AN14), eight (AN0-AN7) of which can be software-configured as digital inputs (E0-E7) if not needed as analog channels The ADC3 conversion block An ADC3 conversion rate selector An ADC3 input selector (INPUT) A +VREF input selector (+VREF) The ADDATA register, which contains the digital value of a completed conversion ADC3 module control registers
The input channels can be routed through either the channel selector or the positive voltage selector. The ADC3 converter then processes these signals and puts the result in the ADDATA register. The ADC3 interrupt circuit informs the rest of the system when a conversion is completed.
14-2
Analog-to-Digital Converter 3 (ACD3) Overview
Figure 14-1. Analog-to-Digital Converter 3 (ADC3) Block Diagram
External pin connections
Port E input ENA 0
Port E data AN 0
ADENA.0
ADIN.0
AN0
Port E input ENA 1 Port E data AN 1
3
2
1
0
SAMPLE START
CONVERT START
ADCTL.3 - 0
AD INPUT SELECT
ADCTL.6
ADCTL.7
ADENA.1 AN1
ADIN.1
1 0
ADPRI.1 - 0
AD RATE SELECTS Port E input ENA 5
Port E data AN 5
AD
ADENA.5 AN5
Port E input ENA 6
ADIN.5 ADDATA.7 - 0
ADC data register AD READY
Port E data AN 6
ADENA.6 AN6
Port E input ENA 7
ADIN.6
Port E data AN 7
ADENA.7 AN7 AN8 AN9
ADSTAT.2
AD PRIORITY
ADIN.7 ADPRI.6 Level 1 Int 0
5 4 1 Level 2 Int
ADCTL.5 - 4
REF VOLTS SELECT
AN14 VCC3 VSS3
AD INT FLAG
ADSTAT.1 ADSTAT.0
AD INT ENA
Analog-to-Digital Converter 3 (ADC3) Module
14-3
Analog-to-Digital Converter 3 (ADC3) Overview
14.1.2 Control Registers
The ADC3 control registers are located at addresses 1070h to 107Fh and occupy peripheral file frame 7, as shown in Table 14-1.
Table 14-1. ADC3 Memory Map
Peripheral File Location P070
Symbol
ADCTL
Name Analog Control Register
Description Controls the input selection, reference voltage selection, sample start, and conversion start. Indicates the converter and interrupt status. Contains the digital result of the last ADC3 conversion.
P071 P072 P073-P07C P07D
ADSTAT
Analog Status and Interrupt Register Analog Conversion Data Register Reserved
ADDATA
ADIN
Analog Port E Data Input Register
Contains digital input data when one or more of the AN0-AN7 pins are used as digital ports. Controls the function of the AN0-AN7 pins. Selects the interrupt priority level of the ADC3 interrupt and the conversion rate selects.
P07E P07F
ADENA
Analog Port E Input Enable Register Analog Interrupt Priority Register
ADPRI
14-4
ADC3 Operation
14.2 ADC3 Operation
The following subsections describe the functions and options of the ADC3 module.
14.2.1 Input/Output Pins
The ADC3 module contains 17 pins: AN0-AN14, VCC3, and VSS3. These pins are described below:
-
Fifteen (AN0-AN14) of the 17 pins are analog channels. Eight (AN0-AN7) of the 15 analog channels can be individually configured as general-purpose input pins (E0-E7) when not used as analog inputs. Two (AN6-AN7) of the fifteen analog channels are also available as the positive input voltage reference. This feature allows a weighted measurement or ratio of one channel to another. The analog voltage supply pins, VCC3 and VSS3, isolate the ADC3 module from digital switching noise that can be present on the other power supply pins. This isolation provides a more accurate conversion. To further reduce noise and produce a more accurate conversion, you should run the power to the VCC3 and VSS3 pins on separate conductors from the other power lines. Additionally, the power conductors to the VCC3 and VSS3 should be as short as possible, and the two lines should be properly decoupled. Use other standard noise-reduction techniques to help provide a more accurate conversion.
Note that you can select the VREF pin to be either VCC3 or one of the analog input channels AN6 to AN7. A VCC3 must provide power to the ADC3 module even if it does not provide the voltage reference. A channel configured as the +VREF for one conversion can be changed to an analog input channel for the next conversion.
14.2.2 Sampling Time
The application program controls the length of the sample time, which provides the flexibility to optimize the conversion process for both high- and lowimpedance sources. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low-impedance sources.
Analog-to-Digital Converter 3 (ADC3) Module
14-5
ADC3 Operation
14.2.3 ADC3 Conversion
The digital result of the conversion process is given in the following formula: digital result = 255 x input voltage reference voltage
The number of SYSCLK cyles required to complete a conversion is programmable through the AD RATE SELECT0-1 bits (P07F.0-1). For example, the conversion process requires 164 SYSCLK cycles and results in a conversion time of 32.8 microseconds at a SYSCLK frequency of less than or equal 5 MHz and greater than 2.5 MHz (5 MHz SYSCLK > 2.5 MHz). A maximum of 27,600 conversions per second is possible at a SYSCLK frequency within the range above, including setting up the conversion, sampling, converting, and saving the results. In ratiometric conversions, the conversion value is a ratio of the VREF source to the analog input. As VREF is increased, the input voltage that is required in order to produce a certain conversion value changes; however, all conversion values keep the same relationship to VREF. That is, one half of VREF always results in the value 080h, regardless of the value of VREF (assuming that VREF is in the range of 2.5 to 5.5 volts above VSS3).
14-6
ADC3 Operation
Figure 14-2 shows an example of ratiometric conversion. In this example, the digital result of the conversion indicates the position of the potentiometer wiper, even if the battery loses voltage over time. The ADC3 conversion always gives the ratio of the resistor values on either side of the wiper, even if VREF drops from 5.0 to 2.5 volts.
Figure 14-2. Ratiometric Conversion Example
2.5-5 V +VREF
+ Battery - VSS3 Analog In
14.2.4 Interrupts
The ADC3 module sets the AD INT FLAG bit (ADSTAT.1) at the end of the conversion process. If both the AD INT FLAG and the AD INT ENA bit (ADSTAT.0) are set, then the module generates an interrupt request. This interrupt request can be asserted on either high-priority level 1 or the lower-priority level 2, depending on the AD PRIORITY bit (ADPRI.6). The program must clear the AD INT FLAG bit before exiting the interrupt service routine (ISR), or else the same interrupt will cause the CPU to enter the interrupt routine again. If the AD INT ENA bit is cleared without clearing the flag, the interrupt is reasserted when the AD INT ENA bit is again set.
Analog-to-Digital Converter 3 (ADC3) Module
14-7
ADC3 Operation
14.2.5 Programming Considerations
Follow these steps to obtain data from the ADC3: 1) Write to the two bits (AD RATE SELECT 1-0) on the ADPRI register (subsection 14.4.6 on page 14-16). 2) Write to the ADCTL register (subsection 14.4.1 on page 14-12) to: a) Select the analog channel (ADCTL.3- 0). b) Select the VREF source (ADCTL.5-4). c) Set the SAMPLE START bit to 1 (ADCTL.6) to begin sampling. 3) Wait for the sample time to elapse. The program should wait 1 s for each kilohm of source output impedance or a minimum of 1 s for low impedance sources. 4) When the sample time completes, set the CONVERT START bit (ADCTL.7) and leave the SAMPLE START bit (ADCTL.6) set. 5) Wait for either the interrupt flag to be set or the ADC3 interrupt to occur. 6) Read the conversion data register (ADDATA, subsection 14.4.3 on page 14-15). 7) Clear the interrupt flag bit (ADSTAT.1). Eighteen SYSCLK cycles after the program sets the CONVERT START bit, the ADC3 module clears both the SAMPLE START and CONVERT START bits to signify the end of the internal sampling phase. After these bits are cleared, the program can change the input channel without affecting the conversion process. The voltage reference source VREF should remain constant throughout the conversion. To stop a conversion in progress, set the SAMPLE START (ADCTL.6) bit to 1 anytime after the ADC3 clears this bit. For SYSCLK frequencies less than or equal to 5MHz and greater than 2.5MHz, the entire conversion process requires 164 SYSCLK cycles after the program sets the CONVERT START bit (ADCTL.7).
14-8
ADC3 Example Program
14.3 ADC3 Example Program
This example program samples and converts data from all 15 channels at 1.0 MHz SYSCLK frequency and stores the digital results into a table beginning at ATABLE. The routine stops interrupting the main program after it finishes all 15 channels. If the main program wants more recent data, it needs to execute only the code at RESTART, and the ADC3 routine will again sample and convert all 15 channels of data. The AD INT ENA bit (ADSTAT.0) is cleared by the ADC3 interrupt routine as a signal to the main program that all 15 channels have been processed. The address of the label ATOD must be placed into the interrupt vector table located at 7FECh and 7FEDh.
Analog-to-Digital Converter 3 (ADC3) Module
14-9
ADC3 Example Program
ADCTL ADSTAT ADDATA ADENA
.EQU .EQU .EQU .EQU .REG .REG MOV CALL
P070 P071 P072 P07E ADCHANL ATABLE,8 #0,ADENA RESTART
INIT ; ; ; ; ;
;
;ADC3 control register ;ADC3 status register ;ADC3 conversion results ;ADC3 input enable ;keeps current channel number ;8 byte table that stores ; channel data, LSB first ;all channels to ADC3 inputs ; (reset condition) ;start taking data
MAIN PROGRAM GOES HERE . CALL RESTART ;start taking more data . MORE MAIN PROGRAM ;initialize channel ;select the conversion rate of ; 44 SYSCLK cycles and ADC3 ; interrupt-request priority ; level 1 ;enable interrupts, clear ; any flag ;start sampling (approx. 2 s ; delay) ;start converting now; enter ; main program
; SUBROUTINE SECTION RESTART CLR ADCHANL MOV #002h,ADPRI
MOV MOV MOV RTS
;
#001h,ADSTAT #040h,ADCTL #0C0h,ADCTL
INTERRUPT ROUTINE FOR ANALOG TO DIGITAL CONVERTER3 PUSH A ;save registers PUSH B MOV ADCHANL,B ;get channel number MOV ADDATA,A ;get ADC3 conversion value MOV A,*ATABLE[B] ;store in a table according to ; channel number INC B ;point to next channel BTJZ #15,B,GOCNVRT ;stop when all channels sampled ;(bit3 =1) CLR ADCHANL ;reset the ADC3 channel MOV #0,ADSTAT ;turn off interrupt and ; clear flag JMP EXITA2D ;all 8 channels taken, enable ;set to 0 now
;
; ATOD
GOCNVRT MOV B,ADCHANL MOV #01h,ADSTAT OR #040h,B ;set up sample bit in value MOV B,ADCTL OR #080h,ADCTL
;
;store current ADC3 channel ;clear interrupt flag ;start sampling channel data ;start converting data ;Restore data
EXITA2D POP POP RTI
B A
14-10
ADC3 Control Registers
14.4 ADC3 Control Registers
The ADC3 module control registers occupy peripheral file frame 7, as shown in Figure 14-3. The bits shown in shaded boxes in Figure 14-3 are privilege mode bits; that is, they can be written only to in the privilege mode.
Figure 14-3. Peripheral File Frame 7: ADC3 Converter Control Registers
Designation ADCTL ADDR 1070h PF P070
Bit 7
CONVERT START (RW-0) --
Bit 6
SAMPLE START (RW-0) --
Bit 5
REF VOL SELECT1 (RW-0) --
Bit 4
REF VOL SELECT0 (RW-0) --
Bit 3
AD INPUT SELECT3 (RW-0) --
Bit 2
AD INPUT SELECT2 (RW-0) AD READY (R-0)
Bit 1
AD INPUT SELECT1 (RW-0) AD INT FLAG (RC-0)
Bit 0
AD INPUT SELECT0 (RW-0) AD INT ENA (RW-0)
ADSTAT
1071h
P071
ADDATA
1072h 1073h to 107Ch
P072 P073 to P07C P07D P07E P07F AD STEST (RP-0) AD PRIORITY (RP-0) AD ESPEN (RP-0)
A-to-D Conversion Data Register (R-0) Reserved Port E Data Input Register (R-0) Port E Input Enable Register (RW-0) -- -- -- AD RATESELECT1 (RW-0) AD RATESELECT0 (RW-0)
ADIN ADENA ADPRI
107Dh 107Eh 107Fh
Analog-to-Digital Converter 3 (ADC3) Module
14-11
ADC3 Control Registers
14.4.1 Analog Control Register (ADCTL)
The ADCTL register controls the input selection, reference voltage selection, sample start, and conversion start.
Analog Control Register (ADCTL) [Memory Address 1070h]
Bit #
P070
7
CONVERT START RW-0
6
SAMPLE START RW-0
5
REF VOLT SELECT1 RW-0
4
REF VOLT SELECT0 RW-0
3
AD INPUT SELECT3 RW-0
2
AD INPUT SELECT2 RW-0
1
AD INPUT SELECT1 RW-0
0
AD INPUT SELECT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset Bit 7 CONVERT START. Conversion Start.
Setting this bit starts the conversion. This bit is cleared by the ADC3 18 system clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any conversion in progress. Bit 6 SAMPLE START. Sample Start. Setting this bit stops any ongoing conversion and starts sampling the selected input channel to begin a new conversion. This bit is cleared by the ADC3 module 18 system-clock cycles after the program sets the CONVERT START bit. Entering halt or standby mode clears this bit and aborts any sampling in progress. Bits 5-4 REF VOLT SELECT1-0. Reference Voltage (+VREF) Select Bits 1-0. These bits select the channel the ADC3 uses for the positive voltage reference. The REF VOLT SELECT bits must not change during the entire conversion.
REF VOLT SELECT1 0 0 1 REF VOLT SELECT0 0 1 0 +VREF Source VCC3 AN6 AN7
Pins AN0-AN5 and AN8-AN14 cannot be selected as positive voltage reference.
14-12
ADC3 Control Registers
Bits 3-0
AD INPUT SELECT3-0. Analog Input Channel Select Bits 3-0. These bits select the channel used for conversion. Channels should be changed only after the ADC3 has cleared the SAMPLE START and CONVERT START bits. Changing the channel while either the SAMPLE START bit or the CONVERT START bit is 1 invalidates the conversion in progress.
AD INPUT SELECT3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 AD INPUT SELECT2 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 AD INPUT SELECT1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 AD INPUT SELECT0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 AD INPUT CHANNEL AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 AN8 AN9 AN10 AN11 AN12 AN13 AN14
Analog-to-Digital Converter 3 (ADC3) Module
14-13
ADC3 Control Registers
14.4.2 Analog Status and Interrupt Register (ADSTAT)
The ADSTAT register indicates the converter and interrupt status.
Analog Status and Interrupt Register (ADSTAT) [Memory Address 1071h]
Bit #
P071
7
--
6
--
5
--
4
--
3
--
2
AD READY R-0
1
AD INT FLAG RC-0
0
AD INT ENA RW-0
R = Read, W = Write, C = Clear only, -n = Value of the bit after the register is reset
Bits 7-3 Bit 2
Reserved. Read data is indeterminate. AD READY. ADC3 Converter Ready. The ADC3 module sets this bit whenever a conversion is not in progress and the ADC3 is ready for a new conversion to start. Writing to this bit has no effect on its state. 0 = Conversion in process. 1 = Converter ready.
Bit 1
AD INT FLAG. ADC3 Interrupt Flag. The ADC3 module sets this bit at the end of an ADC3 conversion. If this bit is set while the AD INT ENA bit is set, an interrupt request is generated. Clearing this flag clears pending ADC3 interrupt requests. This bit is cleared by the system reset. Software cannot set this bit.
Bit 0
AD INT ENA. ADC3 Interrupt Enable. This bit controls the ADC3 module's ability to generate an interrupt. 0 = Disables ADC3 interrupt. 1 = Enables ADC3 interrupt.
14-14
ADC3 Control Registers
14.4.3 Analog Conversion Data Register (ADDATA)
The ADDATA register contains the digital result of the last ADC3 conversion.
Analog Conversion Data Register (ADDATA) [Memory Address 1072h]
Bit #
P072
7
DATA7 R-0
6
DATA6 R-0
5
DATA5 R-0
4
DATA4 R-0
3
DATA3 R-0
2
DATA2 R-0
1
DATA1 R-0
0
DATA0 R-0
R = Read, -n = Value of the bit after the register is reset
The ADC3 data is loaded into this register at the end of a conversion and remains until replaced by another conversion.
14.4.4 Analog Port E Data Input Register (ADIN)
The ADIN register contains digital input data when one or more of the AN0 through AN7 pins are used as digital ports.
Analog Port E Data Input Register (ADIN) [Memory Address 107Dh]
Bit #
P07D
7
PORT E DATA AN 7 R-0
6
PORT E DATA AN 6 R-0
5
PORT E DATA AN 5 R-0
4
PORT E DATA AN 4 R-0
3
PORT E DATA AN 3 R-0
2
PORT E DATA AN 2 R-0
1
PORT E DATA AN 1 R-0
0
PORT E DATA AN 0 R-0
R = Read, -n = Value of the bit after the register is reset
The ADIN register shows the data present at the AN0-AN7 pins when they are configured for general-purpose input instead of for ADC3 channels. A bit is configured as a general-purpose input if the corresponding bit of the port enable register is a 1. Pins configured as ADC3 channels are read as 0s. Writing to this address has no effect.
Analog-to-Digital Converter 3 (ADC3) Module
14-15
ADC3 Control Registers
14.4.5 Analog Port E Input Enable Register (ADENA)
The ADENA register controls the function of the AN0 through AN7 pins.
Analog Port E Data Input Enable Register (ADENA) [Memory Address 107Eh]
Bit #
P07E
7
PORT E INPUT ENA 7 RW-0
6
PORT E INPUT ENA 6 RW-0
5
PORT E INPUT ENA 5 RW-0
4
PORT E INPUT ENA 4 RW-0
3
PORT E INPUT ENA 3 RW-0
2
PORT E INPUT ENA 2 RW-0
1
PORT E INPUT ENA 1 RW-0
0
PORT E INPUT ENA 0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
The ADENA register individually configures the AN0-AN7 pins as either analog input channels or as general-purpose input pins. 0 = For pins AN1-AN7, the pin becomes an analog input or reference channel for the ADC3; for pin AN0, the pin becomes an analog input channel for the ADC3. When the bit is 0, the corresponding bit in the ADIN register reads as a 0. 1 = Enables the pin as a general-purpose input pin; its digital value can be read from the corresponding bit in the port E data input register.
14.4.6 Analog Interrupt Priority Register (ADPRI)
The ADPRI register selects the interrupt priority level of the ADC3 interrupt.
Analog Interrupt Priority Register (ADPRI) [Memory Address 107Fh]
Bit #
P07F
7
AD STEST RP-0
6
AD PRIORITY RP-0
5
AD ESPEN RP-0
4
--
3
--
2
--
1
AD RATE SELECT1
0
ADD RATE SELECT0
R = Read, P = Privilege write only, -n = Value of the bit after the register is reset
Bit 7 Bit 6
AD STEST. This bit must be cleared (0) to ensure proper operation. AD PRIORITY. ADC3 Interrupt Priority Select. This bit selects the priority level of the ADC3 interrupt. 0 = ADC3 interrupt is a higher priority (level 1) request. 1 = ADC3 interrupt is a lower priority (level 2) request.
14-16
ADC3 Control Registers
Bit 5
AD ESPEN. Emulator Suspend Enable. Normally, this bit has no effect. However, when you are using the XDS emulator to debug a program, this bit determines what happens to the ADC3 when the program is suspended by an action such as a hardware or software breakpoint. 0 = When the emulator is suspended, the ADC3 continues to work until the current conversion is complete. 1 = When the emulator is suspended, the ADC3 is frozen so that its state can be examined at the point that the emulator was suspended. The conversion data is indeterminate upon restart.
Bits 4-2 Bits 1-0
Reserved. Read data is indeterminate. AD RATE SELECT1-0 ADC3 Conversion Rate Select Bits 1-0. These bits determine the conversion rate of the ADC3 as a function of the system clock frequency. Note in Table 14-2 that only the default selection (0,0) provides full SYSCLK frequency range together with 8-bit precision. Other selections allow maintaining minimum conversion time at lower system clock rates.
Table 14-2.
Conversion Rate Selection
AD RATE SELECT1 AD RATE SELECT0 0 1 0 1
Conversion Time (number (n mber of system clock cycles) Max SYSCLK Frequency 164 84 44 24 5 MHz SYSCLK > 2.5 MHz 2.5 MHz SYSCLK > 1.25 MHz 1.25 MHz SYSCLK > 0.625 MHz 0.625 MHz SYSCLK 0.5 MHz
0 0 1 1
If selections different from (0,0) are used at SYSCLK frequencies higher than specified in the above table the 8-bit precision of the ADC3 is not guaranteed.
Analog-to-Digital Converter 3 (ADC3) Module
14-17
14-18
Running Title--Attribute Reference
Chapter 15
Programmable Acquisition and Control Timer (PACT)
This chapter discusses the architecture and programming of the programmable acquisition and control timer (PACT) module. Even if you have extensive experience with microcontroller timers, you should read this chapter to fully understand how to use the TMS370 PACT module. The chapter covers the following topics:
Topic
Page
15.1 PACT Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 15.2 PACT Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.3 Dual-Port RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9 15.4 Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-12 15.5 Control and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15 15.6 Command/Definition Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-21 15.7 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-29 15.8 WD Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-31 15.9 Mini-Serial Communications Interface (SCI) . . . . . . . . . . . . . . . . . . . 15-32 15.10 PWM Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-33 15.11 PACT Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-36
Chapter Title--Attribute Reference
15-1
PACT Overview
15.1 PACT Overview
The PACT module acts as a timer coprocessor by gathering timing information on input signals and controlling output signals with little or no intervention by the CPU. The coprocessor nature of this module allows for levels of flexibility and power not found in traditional microcontroller timers. The PACT module is available in the TMS370Cx32 and TMS370Cx36 families.
15.1.1 Physical Description
The PACT module, shown in Figure 15-1, consists of:
-
Input capture functions on up to six input pins, four of which (CP3-CP6) may have a programmable prescaler Timer-driven outputs on eight pins Configurable timer overflow rates for different functions One 8-bit event counter driven by CP6 Timer capability of up to 20 bits Interaction between event counter and timer activity Register-based organization, allowing single-cycle accesses to parameters Eighteen independent interrupt vectors with two priority levels Integrated, configurable watchdog (WD) timer with selectable time-out period Mini-serial communications interface with independent setup of bit rate (baud) for receive and transmit lines
15-2
PACT Overview
Figure 15-1. PACT Block Diagram
PACT prescaled clock
External pin connections
20-bit timer/counter 8-bit event counter
Prescale WD timer Reset
CP1 CP2
Dedicated capture register 1 Dedicated capture register 2 Dedicated capture register 3 Dedicated capture register 4 3-bit prescaler
CP3 CP4 CP5 CP6
Mode
Circular buffer (32-bit captures)
External pin connections
Event only
Command/definition area OP1 Outputs Command analyzer and output controller OP8 Int level 1 Int level 2
SCIRXD
Mini-SCI
SCITXD
Programmable Acquisition and Control Timer (PACT)
15-3
PACT Overview
15.1.2 Control Registers
The PACT control registers are located at addresses 1040h to 104Fh and occupy peripheral file frame 4. The function of each register is shown in Table 15-1.
Table 15-1. PACT Peripheral Frame
Peripheral File Location P040
Symbol PACT SCR
Name Setup Control Register
Description Determines the time base for the PACT module, enables the command/definition area, and controls the default timer overflow Defines the starting address of the command/definition area and enables the interrupts for that area Defines the end address of the command/definition area Defines the address of the buffer pointer
P041 P042 P043 P044 P045 P046 P047 P048 P049 P04A P04B P04C P04D P04E P04F
CDSTART CDEND BUFPTR
Command/Definition Area Start Register Command/Definition Area End Register Buffer Pointer Register Reserved
SCICTLP RXBUFP TXBUFP OPSTATE CDFLAGS CPCTL1 CPCTL2 CPCTL3 CPPRE WDRST PACTPRI
PACT-SCI Control Register PACT-SCI RX Data Register PACT-SCI TX Data Register Output Pins 1-8 State Register Command/Definition Entry Flags Register Setup CP Control Register 1 Setup CP Control Register 2 Setup CP Control Register 3 CP Input Control Register WD Reset Key Global Function Control Register
Controls the functions of the mini-SCI Contains the data received by the SCI Contains the data to be transmitted by the SCI Contains information about the current state of the output pins Contains information about the command/definition interrupts Controls the functions of the CP1 and CP2 pins Controls the functions of the CP3 and CP4 pins Controls the functions of the CP5 and CP6 pins Controls input and output functions Location that is written to when serving the WD Controls the WD time-out rate, the PACT interrupt priority levels, and the PACT operating mode
The PACT module is controlled not only by the peripheral file but also by the defined areas of the dual-port RAM. Refer to Section 15.3 on page 15-9 for more information on the dual-port RAM.
15-4
PACT Operation
15.2 PACT Operation
The following subsections describe the functions and options of the PACT module.
15.2.1 Hardware Pins
The PACT module has 16 external hardware pins allocated to its functions. There are three groups of pins:
-
Input Pins. The input or capture pins are CP1 to CP6. The function of these pins depends on the mode selected:
Mode A CP1-2 CP3-6 CP6 Dedicated capture Circular buffer capture Event pin CP1-4 CP5-6 CP6 Mode B Dedicated capture Circular buffer capture Event pin
-
Output pins. There are eight output pins: OP1-OP8. SCI receive/transmit pins. The PACT module has two pins for the miniSCI: SCIRXD (receive data) and SCITXD (transmit data).
In the TMS370Cx32 devices, the input pins CP3, CP4, and CP5 are internally bonded with I/O pins D4, D6, and D7 respectively. In the TMS370Cx36 devices, the input pins CP1, CP4, CP5, and CP6 are internally bonded with I/O pins D5, D4, D7, and D6 respectively, giving you a software-governed choice of function. Output pins (OP1-8) are initialized to a logic low on reset.
15.2.2 Memory Organization
To use the PACT module, you must set up three distinct areas of memory:
-
128 bytes of dual-port RAM contain the capture registers, the circular buffer, and a command/definition area. Dual-port RAM is described in Section 15.3 on page 15-9. Peripheral file frame 4 contains the hardware registers used for initial setup. These registers are described in Section 15.11 on page 15-36. Three groups of interrupt vectors are available. To use interrupts, you must set up the interrupt vectors. Interrupts are described in Section 15.7 on page 15-29.
The memory map in Figure 15-2 is a typical implementation of the PACT module.
Programmable Acquisition and Control Timer (PACT)
15-5
PACT Operation
Figure 15-2. TMS370 Memory Map Highlighting PACT Areas of the 'Cx36 and 'Cx32
TMS370Cx36
256 bytes register (0000h-00FFh) 128 bytes dual ported (0180h-01FFh) 256 bytes standby RAM (0200h-02FFh) 0000h RAM (0000h-0FFFh) 0FFFh 1000h 10FFh 1100h 1FFFh 2000h
TMS370Cx32
128 bytes register (0000h-007Fh) 128 bytes dual ported (0080h-00FFh) Peripheral frame (1040h-104Fh)
Peripheral file frame Data EEPROM
Peripheral frame (1040h-104Fh)
Expansion
3FFFh 4000h
Internal program memory
PACT interrupt vectors (7F9Ch-7FBFh)
7F9Bh 7F9Ch 7FFFh 8000h
PACT interrupt vectors
. . .
PACT interrupt vectors (7F9Ch-7FBFh)
FFFFh
15-6
PACT Operation
15.2.3 Time Base
The time-base section of PACT is similar to that used in traditional timers. The microcontroller system clock is routed to a prescaler that feeds a hardware counter. The prescale section consists of a 4-bit prescaler and an optional divide-by-8 circuit, as shown in Figure 15-3. The hardware counter is 20 bits wide.
Figure 15-3. Prescaler Circuit
Divide by 8
System clock
Prescaler (4 bits)
PACT time base
The divide rate is the binary value of the 4-bit prescaler plus one except for the value zero which, by hardware, provides a divide rate of two. The five bits that control the prescaler are located in the PACTSCR register at address 1040h. Refer to subsection 15.11.1, on page 15-38, for more information.
PACT PRESCALE SELECT Bits 3210 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Divide Rate FAST MODE SELECT Bit Value =1 2 2 3 4 5 6 7 8 =0 16 16 24 32 40 48 56 64 PACT PRESCALE SELECT Bits 3210 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Divide Rate FAST MODE SELECT Bit Value =1 9 10 11 12 13 14 15 16 =0 72 80 88 96 104 112 120 128
15.2.4 Command/Definition File Format
All entries in the command/definition area are 32 bits in length. Normally, commands are executed sequentially starting with entry zero (0), the entry next to the circular buffer. Each entry requires a specified number of time slots (the command/definition descriptions in Section 15.6, on page 15-21, explain the number of time slots required for each command).
15.2.5 Available Time Slots
The number of time slots available to you, and thus the number of definitions/ commands allowed, is controlled by the crystal frequency and the resolution
Programmable Acquisition and Control Timer (PACT)
15-7
PACT Operation
required by PACT functions. Therefore, you must balance these factors to suit your application. The PACT prescaler value determines the number of slots available. The prescaler gives the ratioed crystal frequency against resolution achievable by the PACT. Table 15-2 defines the maximum number of time slots available for all prescaler options.
Table 15-2. Number of Time Slots Available for Each Prescale Setting
Divide Rate -- 2 3 4 5 6 7 8 9 10 Time Slots -- 2 5 9 12 15 19 21 25 29 Divide Rate 11 12 13 14 15 16 24 32 40 48 Time Slots 31 35 38 41 45 48 74 101 127 153 Divide Rate 56 64 72 80 88 96 104 112 120 128 Time Slots 179 205 231 257 283 309 336 362 389 415
If your application requires a prescaler value that does not provide sufficient time slots, you can use the STEP command to cut in half the resolution of all commands later in the command/definition area. The STEP command affects the second entry after the entry that contains the command. (An example of PACT.H commands is in Section I.3 in Appendix I on page I-5). For example, if 10 entries exist in the command file and entry 2 contains a STEP instruction, then commands 0-3 run at full resolution, but 4-9 run at half resolution. Note that this use of the STEP command affects all operations, including the clocking of virtual and offset timers. Repeated use of the STEP instruction within a command file is not necessary--the commands run at either full or half speed (no slower). Note: Consideraton Using STEP Command
When you use STEP, the end address of the command/definition area must be programmed as the next to last address that will be executed.
15-8
Dual-Port RAM
15.3 Dual-Port RAM
The PACT is a RAM-based module that occupies an area of the internal RAM. The size of the RAM is determined by the functions that you select, according to the end device. For the TMS370Cx32 devices, the dual-port RAM is located in the register file from 0080h to 00FFh. This gives the CPU maximum speed in accessing the registers in the register file when you use the register address mode. For the TMS370Cx36 devices, the dual-port RAM is located in the memory map from 0180h to 01FFh. The dual-port RAM contains the following major areas:
-
Command/definition area. The length of the command/definition area (described in Section 15.6 on page 15-21) is defined in the software. Four bits define the start, and five bits define the end of the command area. The two least significant bits (LSBs) are not defined, because this area must start and finish on a 32-bit boundary. The start address of the command area also defines the length of the circular buffer because the buffer resides between the last dedicated storage location and the start of the command area. For the TMS370Cx32 devices, all RAM at lower addresses than the end of the command area can be used for general purposes such as registers, stack, etc. However, since all of the RAM locations above the end (0080h-00FFh) are also within the register file, the data in these locations can be directly manipulated with normal register-based instructions. For the TMS370Cx36 devices, all RAM between 0180h and the end of the command area can be used for data memory storage, program instructions, or a general purpose register. However, all of the RAM locations above the end (0180h-01FFh) can be used only as data memory storage.
-
Circular buffer. The circular buffer is an area in memory that stores the value of a PACT timer when a capture request is made. As new values are captured, they are put into successive locations in the buffer. When the buffer is full, the oldest captures are replaced with newer captures. The length of the circular buffer is defined in the software. The circular buffer resides between the command/definition area and the capture registers.
-
Capture registers. One of the major differences between the PACT module and standard timers is the location of the 32-bit capture registers in dual-port RAM. These locations can be read from or written to by the CPU.
Programmable Acquisition and Control Timer (PACT)
15-9
Dual-Port RAM
They are automatically written to by PACT when the appropriate feature is enabled. The capture registers reside between the circular buffer and the timer and event counter images. For more information about the input capture pins, refer to Section 15.4 on page 15-12. The addresses 00FCh-00FFh (TMS370Cx32 devices) and 01FCh-01FFh (TMS370Cx36 devices) of the dual-port memory contain an image of the 20-bit default timer and an image of the 8-bit event counter. Since they are images or copies of the actual hardware registers, they can be overwritten by the application software. However, they are rewritten every time the PACT module receives another prescaled clock. The dual-port RAM is 128 bytes long as shown in Figure 15-4.
Figure 15-4. Dual-Port RAM Organization
Mode A 0x80h General-purpose RAM Command end Command/definition area Command start Circular buffer Circular buffer Command/definition area 0x80h General-purpose RAM Mode B
0xE8h 0xECh 0xF0h 0xF4h 0xF8h 0xFCh 0xF3h 0xF7h 0xFBh 0xFFh 0xF0h 0xF4h 0xF8h 0xFCh
EVT CNT EVT CNT EVT CNT EVT CNT EVT Image
Capture by CP4 Capture by CP3 Capture by CP2 Capture by CP1 20-bit timer image
0xEBh 0xEFh 0xF3h 0xF7h 0xFBh 0xFFh
EVT CNT EVT CNT EVT Image
Capture by CP2 Capture by CP1 20-bit timer image
For TMS370Cx32 devices, the dual-port RAM is located at addresses 0080h-00FFh. For TMS370Cx36 devices, the dual-port RAM is located at addresses 0180h-01FFh.
Mode A provides two, and Mode B provides four dedicated 32-bit storage locations, which follow a circular storage buffer. Modes A and B are described in Section 15.4 on page 15-12.
15-10
Dual-Port RAM
The PACT module uses memory starting from the highest address going to lower addresses. For the TMS370Cx32 devices, the highest address of the PACT module's dual-port RAM is 00FFh. For TMS370Cx36 devices, the highest address of the PACT module's dual-port RAM is 01FFh. The first 32-bit block always contains an image of the 20-bit default timer, a copy of the flag bits for capture pins 3 to 6, and an image of the 8-bit event counter. Thereafter, allocation depends on the mode selected.
Programmable Acquisition and Control Timer (PACT)
15-11
Inputs
15.4 Inputs
The PACT module has six input capture pins (CP1 through CP6) that cause data to be stored into fixed locations. Each location is defined by the pin that triggers the capture. When triggered directly from the pin, capture values are 32 bits long and consist of the 20-bit hardware timer, the 8-bit event counter, and four extra bits that identify the pin that caused the capture in the circular buffer:
Event counter
D31
Pin ID
D23 D19
20-bit default timer triggered by input pin CPx
D0
The pin ID is set according to which input caused the capture. Only one of these bits will be set:
Bit D20 = 1 D21 = 1 D22 = 1 D23 = 1 Transition on Pin CP3 CP4 CP5 CP6 Result Causes the capture Causes the capture Causes the capture Causes the capture
Each input capture pin has a rising edge select bit, a falling edge select bit, and an interrupt enable bit, along with a fourth bit that acts as a flag to cause an interrupt. Table 15-3 lists these bits for each of the pins; the bits are described in Section 15.11 on page 15-36.
Table 15-3. Bits That Control Functions on the Input Capture Pins
Pin CP1 CP2 CP3 CP4 CP5 CP6 Rising Edge Select Bit CP1 CAPT RISING EDGE (CPCTL1.1) CP2 CAPT RISING EDGE (CPCTL1.5) CP3 CAPT RISING EDGE (CPCTL2.1) CP4 CAPT RISING EDGE (CPCTL2.5) CP5 CAPT RISING EDGE (CPCTL3.1) CP6 CAPT RISING EDGE (CPCTL3.5) Falling Edge Select Bit CP1 CAPT FALLING EDGE (CPCTL1.0) CP2 CAPT FALLING EDGE (CPCTL1.4) CP3 CAPT FALLING EDGE (CPCTL2.0) CP4 CAPT FALLING EDGE (CPCTL2.4) CP5 CAPT FALLING EDGE (CPCTL3.0) CP6 CAPT FALLING EDGE (CPCTL3.4) Interrupt Enable Bit CP1 INT ENA (CPCTL1.3) CP2 INT ENA (CPCTL1.7) CP3 INT ENA (CPCTL2.3) CP4 INT ENA (CPCTL2.7) CP5 INT ENA (CPCTL3.3) CP6 INT ENA (CPCTL3.7) Interrupt Flag Bit CP1 INT FLAG (CPCTL1.2) CP2 INT FLAG (CPCTL1.6) CP3 INT FLAG (CPCTL2.2) CP4 INT FLAG (CPCTL2.6) CP5 INT FLAG (CPCTL3.2) CP6 INT FLAG (CPCTL3.6)
When you select the rising or falling edge, or both, the capture function for that pin is enabled, and the timer value captured is stored in the location that is determined by the mode of operation.
15-12
Inputs
Two operating modes are available for the PACT module: mode A and mode B. You can select between these modes according to the capture functions that you need (refer to Figure 15-5):
-
Mode A offers two dedicated capture locations (associated with pins CP1 and CP2) plus four other pins (CP3-CP6), each with a programmable prescaler to store 32-bit data in the circular buffer. The prescaler rate is the same for all of the four pins (CP3-CP6). Pin CP6 also clocks the 8-bit event counter. Mode B offers four dedicated capture locations (associated with pins CP1-CP4). Pins CP3-CP6 have a programmable prescaler. Pin CP5 can capture 32-bit data in the circular buffer when the software defined edge occurs. The remaining capture pin, CP6, clocks the 8-bit event counter and can capture 32-bit data in the circular buffer.
-
Figure 15-5. Input Capture Block Diagram
PACT prescaled clock
External pin connections
20-bit timer/counter 8-bit event counter
CP1 CP2
Dedicated capture register 1 Dedicated capture register 2 Dedicated capture register 3 Dedicated capture register 4
CP3 CP4 CP5 CP6 Event only 3-bit prescaler Circular buffer (32-bit captures)
Mode
Captures can be set to occur on the falling, rising, or both edges of the input signal. Capture pins CP3 through CP6 can be prescaled with a divide value from 1 to 8. Each of these four pins has its own edge counter, but the maximum count value (1- 8) before an actual capture occurs must be the same for all four pins.
Programmable Acquisition and Control Timer (PACT)
15-13
Inputs
Since it takes several system clock periods for the CPU to read a 20-bit timer capture value, an additional capture could occur while the original capture is being read. Your program can detect this situation by clearing the capture flag in the peripheral file before the read and then verifying that the flag has not been set again after the read is complete. If the flag was set again, the value read may be invalid and should be reread. The buffer pointer (BUFPTR register) is available to tell the program when the last capture value was stored. You can modify the buffer pointer under processor control. Note: Circular-Buffer Area Captures
The 16-bit captures in the circular buffer area are available when triggered by commands in the command/definition area. A 32-bit capture can overwrite the last 16-bit capture if the 16-bit capture is located at the two higher addresses (address bit1 = 1) of a 32-bit block.
15-14
Control and Outputs
15.5 Control and Outputs
The control and outputs section of PACT is, perhaps, the most unique and most powerful part of this timer. Figure 15-6 shows the output control section of the PACT block diagram.
-
The controller acts like a state machine and starts when it receives a rising edge from the PACT prescaled clock. The controller reads its commands (or state microcode) from the command definition part of the dual-port RAM. The 8-bit event counter and the 16 LSBs of the 20-bit default counter are also input into the controller for use in comparisons. The outputs from the controller set or clear the eight output pins (OP1-8). The prescaled clock from the PACT time base is used only to start the controller.
The controller steps through its commands, using the system clock phases for synchronization. The controller must step through all of the commands in the command/definition area before the next rising edge of the prescaled clock. The next prescaled clock increments the 20-bit default counter and restarts the whole process.
Figure 15-6. Output Control Section
PACT prescaled clock 20-bit timer/counter Command/defintion area
8-bit event counter
16
Crystal clock
Command analyzer and output controller
Outputs Int level 1 Int level 2
Programmable Acquisition and Control Timer (PACT)
15-15
Control and Outputs
15.5.1 Standard Compare Command
To use the controller, you should understand the commands that it can execute. All of the commands or definitions in the command/definition area are 32 bits long. The simplest command is the standard compare command. The standard compare command sets or clears an output pin whenever the timer/ counter is equal to a certain value. As shown in Figure 15-7, the standard compare command consists of the following:
-
A 16-bit compare value Three bits to select one of the eight output pins Bits to select what action to take Bits to distinguish this command from the others
For more information or actual bit definitions, refer to subsection 15.6.4 on page 15-25.
Figure 15-7. Standard Compare Command
20-bit timer/counter Command/definition area Standard compare command Action Pin Timer compare selection value (16 bits)
8-bit event counter
STD compare CMD STD compare CMD
16
Outputs OP1
Command analyzer and output controller
Int level 1 Int level 2
OP8
Actions
Pin select
Timer compare value
The standard compare command can:
15-16
Set or clear the chosen output pin when the counter matches the compare value, Execute the opposite action (clear or set) when the 16 LSBs of the counter are equal to zero, or Generate an interrupt when the compare value is reached.
Control and Outputs
Therefore, you can make a pulse-width modulated (PWM) output of limited usefulness using a standard compare command. Assume that you want a PWM output with an initial duty cycle of 75 percent. Using the standard compare command, conduct the following:
15.5.2 Virtual Timers
Set the timer compare value to 4000h (1/4 the overflow rate) Set the actions to cause an output pin to go high when the count is equal to the compare value, and then low again when the 16 LSBs of the counter are zero. Vary the duty cycle by changing the 16-bit compare value. Invert the signal by selecting clear on compare equal, as opposed to set on compare equal.
You cannot use this command to vary the period of the PWM.
You can vary the period of the PWM by using a virtual timer. Remember that the command/definition area is implemented in RAM. Figure 15-8 shows the virtual timer definition and its implementation. The virtual timer definition consists of the following:
-
16 bits that are read, incremented, and rewritten on each tic of the PACT clock. 13 bits that define a maximum value. When the virtual timer reaches this maximum value, it is reset to zero.
Figure 15-8. Virtual Timer Implementation
20-bit timer/counter Command/definition area STD compare CMD STD compare CMD virtual timer STD compare CMD 16 Virtual timer definition Max virtual timer VAL 9-bits Outputs OP1 Command analyzer and output controller Max VAL 3-bits Virtual timer value 16-bits
8-bit event counter
Int level 1 Int level 2
OP8
Maximum virtual timer value
Virtual timer value
Programmable Acquisition and Control Timer (PACT)
15-17
Control and Outputs
For more information about the actual bit definitions, refer to subsection 15.6.1 on page 15-22. The command/definition area in Figure 15-8 shows two standard compare commands, a virtual timer definition, and a third standard compare command. Assume that you are using a microcontroller with a 200-ns (5-MHz) internal system clock and that you are prescaling the PACT clock with divide by five so that each PACT clock tic is one microsecond.
-
The first two standard compare commands generate PWM signals of variable duty cycle with a period of 65 536 prescaled clock tics (65.536 ms). If you want the third PWM to have a period of one millisecond, set up the virtual timer with a maximum value of 1000. When the controller sees the timer definition, it increments the virtual timer and then uses the virtual timer value for future comparisons. The third standard compare command generates a PWM of variable duty cycle with a period of one millisecond.
You can use combinations of standard compare commands and virtual timers to create complex repeating waveforms. Multiple standard compare commands can be used on a single output pin to create multiple pulses of different duration. You can use virtual timers to provide periodic interrupts to the processor.
15.5.3 Double Event Compare Command
Actions can also be taken as determined by comparisons to the 8-bit event counter. Since all commands are 32 bits wide, the double event compare command actually defines two event compare values and the actions that can be performed based on each value. The actions that are allowed according to the event 1 compare value matching the event counter are as follows:
15-18
Setting or resetting the selected output pin (OP1-OP8), Generating an interrupt, or Generating a 32-bit capture into the circular buffer.
The actions that are allowed according to the event 2 compare value matching the event counter are as follows: Setting or resetting the selected output pin (OP1-OP8), Generating an interrupt, Generating a 32-bit capture into the circular buffer, or Resetting the 20-bit default timer.
Control and Outputs
Because of synchronization, these actions occur two or three prescaled clock cycles after the input edge that incremented the event counter. A block diagram of the double-event compare command is shown below. This diagram shows the information contained in the command. For more information or actual bit definitions, refer to subsection 15.6.5 on page 15-26.
Event 1 actions Event 2 actions Pin select Event 2 compare value Event 1 compare value
So far, you can manipulate output lines depending on time values or the number of external events. An additional virtual timer definition allows you to manipulate output lines according to a combination of the event counter and time.
15.5.4 Offset Timer Definition--Time From the Last Event
The offset timer definition--time from the last event--creates a 16-bit virtual timer that is cleared on each occurrence of an event on pin CP6. This definition also sets an event counter maximum, so that the event counter is reset after reaching this maximum value. The offset timer definition can perform the following actions:
-
Generate an interrupt when the maximum event count is reached, Store the 16-bit virtual timer in the circular buffer on each event, Store the 20-bit default timer and 8-bit event counter in the circular buffer when the maximum event count is reached, or Reset the 20-bit hardware default timer when the maximum event count is reached.
A block diagram of the offset timer definition is shown below. This diagram shows the information contained in the command. For more information or actual bit definitions, refer to subsection 15.6.2 on page 15-23.
Maximum event value Actions Virtual timer value
Programmable Acquisition and Control Timer (PACT)
15-19
Control and Outputs
15.5.5 Conditional Compare Command
A special compare command, conditional compare, has a timer compare value and an event compare value. Both of these values must match for the defined action to take place. Usually, a series of these commands follows an offset-timer definition time from the last event, and provides output pulses on different pins, based on the event count and an elapsed time from the event. The conditional compare command generates the following actions:
-
Generates an interrupt when both the following two conditions are met:
J J
The event compare value equals the event counter. The timer compare value equals the last defined timer.
Sets or clears one of seven output pins (OP1-OP7) when the following two conditions are met:
J J
The event compare value equals the event counter. The timer compare value equals the last defined timer.
The actions described above can be enabled on the event counter reaching the event compare value plus one, regardless of the timer compare value. This allows for when the next event occurs before the delay period (specified by the timer compare value ) is reached. A block diagram of the conditional compare command is shown below. This diagram shows the information contained in the command. For more information or actual bit definitions, refer to subsection 15.6.6 on page 15-28.
Event compare value Actions Pin select Timer compare value
15.5.6 Baud Rate Timer Definition
The last item that can be put into the command/definition area of the PACT module is a baud rate virtual timer. This virtual timer runs the serial communications port built into the PACT module. Set up the maximum timer value for one-quarter bit period of the desired bit rate. Separate timers can be defined for transmit and receive. For more information on the baud rate timer definition, see subsection 15.6.3 on page 15-24. For more information about the SCI, see subsection 15.9 on page 15-32.
One quarter bit rate value Virtual timer value
15-20
Command/Definition Area
15.6 Command/Definition Area
All commands/definitions are 32 bits long. They are stored in memory with the most significant byte (MSbyte) first. If byte 3 is stored at location N, then byte 0 would be at location N+3. The bits are referenced as D0-D31. This section summarizes the available commands and the number of time slots required for each command. Definitions Virtual timer definition Offset timer definition Baud rate timer definition Commands Standard Compare command Conditional Compare command Double Event Compare command Time Slots 2 2/3 2 Time Slots 1 1 1
Programmable Acquisition and Control Timer (PACT)
15-21
Command/Definition Area
15.6.1 Virtual Timer Definition
Max virtual timer value D31 D22 D19 0 D15 Virtual timer value 0 D0
Requires two time slots. D31-23 Sets the radical of the maximum value of the virtual timer. Used with D20-D22 to specify the maximum value of the virtual timer. The maximum virtual timer value is equal to the desired period minus 2. For example, if you want a timer with a period of 100 PACT prescaled clocks, set the maximum virtual timer value to 98. The virtual timer increments from 0 to 99 and is then reset to 0. Define a further three bits of the maximum value of the virtual timer. Either the MSBs (bits 15-13) of the maximum value if the range bit = 1, or the LSBs (bits 3-1) if the range bit = 0. The undefined bits of the maximum value for the virtual timer are set to 0. Range Bit Used in conjunction with D22-D20 to define the maximum value (see illustration below).
D22-20
D19
Maximum Value Format (D19=0)
0 0 0 D31-D23 = 9-bit radical D22 D21 D20 0
Maximum Value Format (D19=1)
D22 D21 D20 D31-D23 = 9-bit radical 0 0 0 0
D18
Enable--Active = 1 Enables the timer update, and stops or starts the timer.
D17
Interrupt on 0--Active = 1 Sets the interrupt flag when the virtual timer (D15-D1) overflows to zero.
D16 D15-1
This bit must be written as a 0 for this command to be valid. Virtual Timer Value These are the 15 MSBs of a 16-bit virtual timer. This timer is resident at this location, so any write to this address by the CPU modifies the timer value. Because of hardware limitations, the LSB of the virtual timer cannot be read from or written to by the CPU, but it is used by PACT commands such as the Standard Compare command.
D0
15-22
This bit must be written as a 0 for this definition to be valid.
Command/Definition Area
15.6.2 Offset Timer Definition--Time From Last Event
Maximum event counter value D31 0 D19 Virtual timer value 1 D0
Requires two time slots if bit D21 = 0; requires three time slots if bit D21 = 1. D31-24 Event Maximum Value Specifies a maximum for the event counter. Upon reaching this value, the event counter will be reset to zero by the next event on CP6. Interrupt on Event--Active = 1 Sets the interrupt flag when an event on pin CP6 occurs. Default Capture--Active = 1 Captures 32-bit data into the circular buffer when the event counter reaches the maximum value (D31-D24). Virtual Capture--Active = 1 Stores the 16-bit virtual offset timer (defined by this definition) in the circular buffer on every event on CP6 before it is cleared. Reset Default Timer--Active = 1 Clears the default timer when the event counter reaches the maximum value (D31-D24). This bit must be written as a 0 for this definition to be valid. Enable--Active = 1 Enables the timer update. Used to stop and start the timer. Interrupt on Maximum Event--Active = 1 Sets the interrupt flag when the event counter reaches the maximum value (D31-D24). Step--Active = 1 Allows lower resolution on the following commands in this definition area (see subsection 15.2.5, on page 15-7, for details on the use of this function). Virtual Timer Value These are the 15 MSBs of a 16-bit virtual timer. This timer is resident at this location, so any write to this address by the CPU modifies the timer value. Because of hardware limitations, the LSB of the virtual timer cannot be read from or written to by the CPU, but it is used by the PACT commands such as the standard compare command. This bit must be written as a 1 for this definition to be valid.
Programmable Acquisition and Control Timer (PACT)
15-23
D23
D22
D21
D20
D19 D18
D17
D16
D15-1
D0
Command/Definition Area
15.6.3 Baud Rate Timer Definition
Max virtual timer value D31 D22 D19 1 D15 Virtual timer value 0 D0
Requires two time slots. D31-23 Set the radical of the maximum value of the virtual timer. Used with D22-D20 to specify the maximum value of the virtual timer. When the virtual timer reaches the defined value, the next prescaler clock cycle causes the timer to be cleared. The maximum virtual timer value should be set to one quarter of the desired bit time minus 2. For more details, see Section 15.9 on page 15-32. Define a further three bits of the maximum value of the virtual timer. Either the MSBs (bits 13-15) of the maximum value if range bit = 1, or the LSBs (bits 3-1) if range bit = 0. The undefined bits of the maximum value for the virtual timer are set to 0. Range Bit Used in conjunction with D20-D22 (see the illustration below).
D22-20
D19
Maximum Value Format (D19 = 0)
0 0 0 D31-D23 = 9-bit radical D22 D21 D20 0
Maximum Value Format (D19 = 1)
D22 D21 D20 D31-D23 = 9-bit radical 0 0 0 0
D18
RXselect--Active = 1 Selects this timer definition to use for the receive baud-rate generator.
D17
TXselect--Active = 1 Selects this timer definition to use for the transmit baud-rate generator.
D16 D15-1
This bit must be written as a 1 for this definition to be valid. Baud Rate Timer These are the 15 MSBs of a 16-bit virtual timer used as the baud-rate generator. The timer is resident at this location, so any write to this address modifies its value.
D0
This bit must be written as a 0 for this definition to be valid.
15-24
Command/Definition Area
15.6.4 Standard Compare Command
Reserved D31 00 D24 D23 Pin select D20 D17 D15 Timer compare value D0
Requires one time slot. D31-D28 D27 Reserved. Enable Pin--Active = 1 Enables output pin actions on this command. D26 Interrupt on Reset--Active = 1 Sets the interrupt flag when the referred timer is reset to zero. D25 Reset Action Sets or resets the pin defined by D20-D18 when the referred timer is reset to zero. 0 = No action when the referred timer is zero. 1 = When the referred timer is zero, execute the opposite action. D24-23 D22 These bits must be both written as 0s for this definition to be valid. Step--Active = 1 Allows lower resolution on the following commands in this definition area (see subsection 15.2.5, on page 15-7, for details on the use of this function). D21 Compare Action--Set = 1, Clear = 0 Sets or resets the pin defined by D20-D18 when the compare value is matched by the referred timer. D20-18 Pin Selection Select an output pin whose state is modified when the compare value is matched. The pin number is the binary value of D20-D18 (20 = MSB,18 = LSB) plus one. D17 Interrupt on Compare--Active = 1 Sets the interrupt flag when the compare value is matched by the referred timer. D16 Next Command Is a Definition--Active = 1 Indicates that the following entry in the command/definition area is a definition. D15-0 Timer Compare Value These 16 bits provide a timer-compare value. The timer, to which this value is compared, is either the last virtual timer defined above this command or, if no virtual timer has been defined, the default timer.
Programmable Acquisition and Control Timer (PACT)
15-25
Command/Definition Area
15.6.5 Double Event Compare Command
10 D31 D24 D23 Pin select D20 D17 Event 2 compare value D15 Event 1 compare value D0
D8 D7
Requires one time slot. D31 D30 Reserved. Event 2 Default Timer Capture--Active = 1 Stores a 32-bit data capture in the circular buffer when event 2 occurs. D29 Event 1 Default Timer Capture--Active = 1 Stores a 32-bit data capture in the circular buffer when event 1 occurs. D28 Event 2 Default Timer Reset--Active = 1 Resets the default timer when event 2 occurs. D27 Enable pin--Active = 1 Enables the output pin actions for this command. D26 Interrupt on Compare 2--Active = 1 Sets the interrupt flag when event 2 occurs. D25 Compare Action 2--No Action = 0 Inverted Action = 1 Sets or resets the pin defined by pin selection when the event 2 compare value (D8-D15) is matched by the event counter. D24 D23 D22 This bit must be written as a 1 for this command to be valid. This bit must be written as a 0 for this command to be valid. Step--Active = 1 Allows lower resolution on the following commands (see subsection 15.2.5, on page 15-7, for details on the use of this function). D21 Compare Action 1--Set = 1, Clear = 0 Sets or resets the pin defined by pin selection when the event 1 compare value (D7-D0) is matched by the event counter. D20-18 Pin Selection Selects an output pin whose state is modified when the compare value is matched. The pin number is the binary value of D20-D18 (20 = MSB,18 = LSB) + 1 (OP1-OP8).
15-26
Command/Definition Area
D17
Interrupt on Compare 1--Active = 1 Sets the interrupt flag when the event 1 compare value is matched by the event counter.
D16
Next Command Is a Definition--Active = 1 Indicates that the following entry in the command/definition area is a definition.
D15-8
Event 2 Sets an 8-bit value that, when matched by the 8-bit event counter, causes the action defined by D25, D26, D28, and D30.
D7-0
Event 1 Sets an 8-bit value that, when matched by the 8-bit event counter, causes the action defined by D17, D21, and D29.
Programmable Acquisition and Control Timer (PACT)
15-27
Command/Definition Area
15.6.6 Conditional Compare Command
Event counter compare value D31 1 D23 Pin select D20 D17 D15 Timer compare value D0
Requires one time slot. D31-24 Event Compare Value Sets an 8-bit value that is compared with the 8-bit event counter. The actions selected by this command occur under either of the following conditions:
- The event compare value matches the value of the event counter, and the timer compare value matches the referred timer value, or - The same action active bit is set, and the event counter matches the event
compare value + 1. D23 D22 This bit must be written as a 1 for this command to be valid. Same Action--Active = 1 Indicates the same action as compare action when the event counter reaches the event compare value plus one. This allows an action on the next event if the next event occurs before the time value is reached. If Same Action = 0, then there will be no action on event compare + 1. Compare Action--Set = 1, Clear = 0 Sets or resets the pin defined by pin selection when both compare values are matched by the referred timer and the event counter.
D21
D20-18
Pin Selection Select an output pin whose state will be modified when the compare value is matched. The pin number is the binary value of D20-D18 (20 = MSB,18 = LSB) plus one, except the binary value 111, which disables any pin action. Therefore, OP8 is not available for this command. Interrupt on Compare--Active = 1 Sets the interrupt flag when the timer compare value (D0-D15) is matched by the referred timer, and the event compare value (D24-D31) is matched by the event counter. Next Command is a Definition Active = 1 Indicates that the following entry in the command/definition area is a definition. Timer Compare Value These 16 bits provide a timer compare value. The timer, to which this value is compared, is either the last virtual timer defined above this command or, if no virtual timer has been defined, the default timer. This is called the referred timer. The value that you write must be greater than one.
D17
D16 D15-0
15-28
Interrupts
15.7 Interrupts
This section discusses interrupts that are specific to the PACT module. There are three groups of interrupt vectors.
-
The first group is associated with the events on a particular capture pin. The second group is associated with the SCI interrupts, such as the receive buffer full. The third group of interrupts is associated with the absolute position of the command or definition within the RAM area.
The 18 vectors available for PACT functions are located immediately after the trap vectors in the TMS370 address space. Refer to the memory map in Figure 15-9.
Figure 15-9. Interrupt Vector Memory Map
7F9Ch PACT vectors 7FBFh 7FC0h Trap vectors 7FDFh 7FE0h Reserved for factory 7FEBh 7FECh Hardware interrupt vectors 7FFDh 7FFEh 7FFFh Reset vector
As is standard in the TMS370, two levels of priority (1 and 2) exist for each of the three groups of interrupts described above. These interrupt groups can be allocated to one of two interrupt levels:
-
A priority that determines the order in which multiple interrupts within a level are serviced (see Table 15-4). An order for servicing groups on the same level (see Table 5-2, page 5-5).
Interrupts are enabled either in peripheral frame 4 or within the command/definition line. The service routine must clear the flag associated with the interrupt to prevent multiple servicing of the same interrupt.
Programmable Acquisition and Control Timer (PACT)
15-29
Interrupts
Table 15-4. Interrupt Vector Sources
Module PACT (Group 2) PACT (Group 3) Vector Address 7F9Ch, 7F9Dh 7F9Eh, 7F9Fh 7FA0h, 7FA1h 7FA2h, 7FA3h 7FA4h, 7FA5h 7FA6h, 7FA7h 7FA8h, 7FA9h 7FAAh, 7FABh 7FACh, 7FADh 7FAEh, 7FAFh PACT (Group 1) 7FB0h, 7FB1h 7FB2h, 7FB3h 7FB4h, 7FB5h 7FB6h, 7FB7h 7FB8h, 7FB9h 7FBAh, 7FBBh 7FBCh, 7FBDh 7FBEh, 7FBFh 1 is the highest priority. Interrupt Source PACT SCI TXINT PACT SCI RXINT PACT Cmd/Def Entry 0 PACT Cmd/Def Entry 1 PACT Cmd/Def Entry 2 PACT Cmd/Def Entry 3 PACT Cmd/Def Entry 4 PACT Cmd/Def Entry 5 PACT Cmd/Def Entry 6 PACT Cmd/Def Entry 7 PACT Circular Buffer (Half/ Full) PACT CP6 Edge PACT CP5 Edge PACT CP4 Edge PACT CP3 Edge PACT CP2 Edge PACT CP1 Edge PACT Default Timer Overflow Interrupt Flag PACT TXRDY PACT RXRDY CMD/DEF INT 0 FLAG CMD/DEF INT 1 FLAG CMD/DEF INT 2 FLAG CMD/DEF INT 3 FLAG CMD/DEF INT 4 FLAG CMD/DEF INT 5 FLAG CMD/DEF INT 6 FLAG CMD/DEF INT 7 FLAG BUFFER HALF/FULL INT FLAG CP6 INT FLAG CP5 INT FLAG CP4 INT FLAG CP3 INT FLAG CP2 INT FLAG CP1 INT FLAG DEFTIM OVRFL INT FLAG System Interrupt PTXINT PRXINT CDINT0 CDINT1 CDINT2 CDINT3 CDINT4 CDINT5 CDINT6 CDINT7 BUFINT CP6INT CP5INT CP4INT CP3INT CP2INT CP1INT POVRFL INT Priority in Group 2 1 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
Notes: 1) CP1-6 interrupts are caused by the software edge(s) selected for that particular pin in peripheral frame 4. Also, the associated interrupt enable bit in frame 4 must be set for that particular pin. Interrupts set in a command/definition line relate to their position in that area. 2) The entry address is derived from bits 2, 3, and 4 of the address. If the command or definition is at address 006Ch, 006Dh, 006Eh, or 006Fh (32 bits), then 0110 11xx is the binary value of the address. The entry address comes from bits 4-3-2 = 011 = Entry 3. Thus, the vector associated with entry address 3 is used when this command or definition causes an interrupt. For command/definition areas that contain more than eight entries, the entry vectors become overlaid, and the program must determine the correct source. Entry 0 has the same vector as entry 8, so the command/definition at addresses 04Ch, 04Dh, 04Eh, or 04Fh has the same interrupt vector as the command/ definition located at addresses 06Ch, 06Dh, 06Eh, or 06Fh; both are entry 3.
15-30
WD Timer
15.8 WD Timer
At powerup, the WD timer is enabled with the shortest time-out period (bit 9 of default timer). A WD-originated reset is generated when a software-selected bit of the default timer toggles. Three options determine the WD time-out period and a disable WD code. These options are specified according to how bits 0 and 1 of the global function control register (PACTPRI) are configured:
PACT WD PRESCALE SELECT 1 (PACTPRI.1) 0 0 1 1 PACT WD PRESCALE SELECT 0 (PACTPRI.0) 0 1 0 1
Option Selected Reset when bit 9 of default timer toggles Reset when bit 15 of default timer toggles Reset when bit 19 of default timer toggles Disable WD
These bits are described in subsection 15.11.14, on page 15-59. They are available only in privilege mode immediately after powerup. Once a time-out period has been selected as shown above, the alternate key bytes, 55h (first) and AAh must be written to the WDRST register (peripheral frame 4, 104Eh) to avoid issuing a WD-originated reset. The only exception to this occurs when the default counter is cleared by the PACT module. In this case, a WD-originated reset occurs, unless the correct keyword (55h/AAh) has been written since the previous clear. The WD timer is stopped in standby mode and halt mode.
Programmable Acquisition and Control Timer (PACT)
15-31
Mini-Serial Communications Interface (SCI)
15.9 Mini-Serial Communications Interface (SCI)
The mini-SCI works as a simplified full duplex UART by transmitting 8-bit words with a fixed format of one start bit and one stop bit.
-
If parity transmission is required, the parity bit must be calculated by the CPU and placed in the transmit buffer as part of the 8-bit word. Parity reception is facilitated by the parity result bit. This bit allows the processor to check for parity errors by comparing the PACT PARITY bit (SCICTLP.5) against 0 or 1 for even or odd parity. Hence, there is no parity error bit to be checked by the processor. There is no overrun detection. The PACT SCI has a shift register and a buffer register. This gives the program a full data byte reception time to read the previous byte before it is overwritten.
-
During reception, the start bit is detected on the falling edge and then sampled again in the center of the bit to avoid false detection. All other bits are sampled once at their centers. If at least one stop bit is not detected when it is expected, the framing error flag (PACT FE bit, P045.3) is set. This bit remains set until cleared by reset, by SCI software reset, or by writing a zero to it. The bit rate (baud) is determined by setting the maximum virtual timer value to one quarter of the desired bit time minus 2. For example, if the system clock period is 200 ns and the prescale value is 5, then the PACT resolution is 1 s. If a baud of 9600 is desired, the maximum virtual timer value should be: Max Virtual Timer Value 1 + (Baud) (4) (PACT Resolution) * 1 + (9600) (4) (10 ) - 2 + 24
-6
-2
*Where PACT Resolution = SYSCLK x Prescale Value The software selectable bauds (RX and TX can be different) are set up as shown in subsection 15.6.3 on page 15-24. Receive and transmit operations can be stopped or started by using the control bits within the baud rate definition command. The data being received and transmitted is accessed in the same peripheral frame (4) as the control bits are. Received data is held at 1046h; transmitted data at 1047h.
15-32
PWM Example
15.10 PWM Example
The following three-part routine provides an example of how to set up a pulsewidth-modulated signal with the PACT module:
-
The first part defines the bytes that make up the command/definition area. The second part copies the command/definition area bytes from ROM to the dual-port RAM. The third part sets up the PACT peripheral file.
Refer to Example 15-1, on page 15-34, as you read the following subsections.
15.10.1 Defining the Command/Definition Area
The macro file PACT.H (Example 15-1, page 15-34) simplifies the task of setting up the command/definition area. (Appendix I of this manual further describes PACT.H macros.) Since this file is subject to change as improvements are found, TI recommends that you download the latest version of this file from the microcontroller bulletin board. To set up the PWM signal,
-
A virtual timer definition must establish the timer period. A standard compare command must follow to determine the period and the polarity of the signal. An additional standard compare command must be inserted at the beginning with only the D16 bit set. This is because the PACT command/definition area cannot start with a definition. Line 8 of the routine causes the bytes that will become the commands and definitions to be located in a separate section. In this example, this section starts at location 7800h. Line 10 is the dummy standard compare command. Line 11 defines the virtual timer. The period is set to 1000 s, and the virtual timer enabled. Note that the macro takes care of subtracting two from the maximum count value as it creates the proper byte sequence. Line 12 is the standard compare command that sets the period to 800 s or 80%, and selects output pin 1. The default value sets the pin high on a compare equal and opp_act is selected to cause the pin to go low when the timer is reset. Notice how multiple actions are concatenated with the | operator in this command.
Programmable Acquisition and Control Timer (PACT)
15-33
PWM Example
Example 15-1. Routine to Perform a PWM FOR 'X32
0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0001 0011 0001 0012 0001 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 ;This is an example program to do PWM using the PACT module .include "PACT.H" ;MACRO DESCRIPTION ;stdcmp ,, ;virtmr ,, .sect "pact",7800h ;PACT instructions to do PWM table stdcmp 0,0,nxt_def # .byte 0,0,1,0 virtmr 1000,enable # .byte 0,0,52,31 stdcmp 800,op1,opp_act|enable # .byte 32,3,0,10 len .equ $-table .text cmd_st .equ 6000h 0EBh
;dummy cmd, next line = def ;period = 1000 uSec ;80% duty, pin 1
start mov #7,P04F ;copy PACT commands/def. into ram mov #len,b movw #(cmd_st-len+1),r3 loop mov table-1[b],a mov a,*r3 inc r3 djnz b,loop
;for 'x36 device, replace 0EBh with 1EBH ;disable the WD ;length of cmd/def area ;R2:R3 points to area
;set up the peripheral file mov #07,p04f ;set to mode B mov #cmd_st,p041 ;cmd/def start at 0ebh mov #(cmd_st-len+1),p042 ;cmd/def end = 0E0h ;set prescale to 5, 1 usec res, enable cmd/def area mov #034h,p040 ;PWM running without processor intervention idle .end
15.10.2 Copying the Command/Definition Area to Dual-Port RAM
Since the dual-port RAM must be initialized after powerup, and the initial values for the command/definition area were defined in nonvolatile memory; they must be copied from the nonvolatile memory to the dual-port RAM. Since the PACT module works through memory from high addresses to lower addresses, and the assembler works through memory from low addresses to higher addresses, this routine flips the memory table as it is copied into the dual-port RAM. This makes the table easier to read.
15-34
PWM Example
Two variables must be defined before this routine is used.
-
The first variable, cmd_st, is the start of the command/definition area (the largest address in that area). Its value is dependent on the mode used and on the size of the desired circular buffer. cmd_st is defined in line 16 of this routine (Example 15-1). The second variable, len, is defined in line 13 as the number of bytes in the command/ definition area.
15.10.3 Initializing the PACT Peripheral Frame
The last part of the PWM routine sets up the PACT peripheral frame. 1) Line 27 chooses the mode (Example 15-1). 2) Line 28 chooses the command/definition start, and line 29 chooses the command/definition end. 3) The timer resolution is set to one microsecond, and the command/definition area is enabled in line 31. This line causes the PWM signal to start. You should always verify that the PACT clock prescale value allows enough time slots for the entire command/definition area. In this example, four time slots are required--one for each standard compare command and two for the virtual timer definition. The prescale value of 5 provides 12 time slots, which is more than enough for this application.
Programmable Acquisition and Control Timer (PACT)
15-35
PACT Control Registers
15.11 PACT Control Registers
The PACT module is controlled and accessed through registers in peripheral frame 4. These registers are listed in Figure 15-10 and described in the following subsections. The bits shown in shaded boxes in Figure 15-10 are privilege mode bits; they can be written to only in the privilege mode. Note: Inadvertent Modification of an Interrupt Flag
Be careful using the AND, OR, XOR, CMPBIT, SBIT0, or SBIT1 instructions to modify any registers that contain status flags. The read/modify/write nature of these instructions can inadvertently clear an interrupt flag that was set between the read and the write cycles. If the state of the nonflag bits is known, use the MOV #iop8,Pd instruction. If the state of the non-flag bits is not known, use a sequence similar to the example shown below.
; Clearing an interrupt flag MOV P04n,A OR #flag_mask,A ; set all flag bits to one AND #desired_flag,A ; clear the desired flag bit MOV A,P04n
15-36
PACT Control Registers
Figure 15-10. Peripheral File Frame 4: PACT Control Registers
Designation ADDR PF Bit 7 DEFTIM OVRFL INT ENA (RW-0) CMD/DEF AREA INT ENA (RW-0) Bit 6 DEFTIM OVRFL INT FLAG (RC-0) Bit 5 CMD/DEF AREA ENA (RW-0) CMD/DEF AREA START BIT 5 (RW-0) CMD/DEF AREA END BIT 5 (RW-0) BUFFER POINTER BIT 5 (R-1) Bit 4 FAST MODE SELECT (RP-0) CMD/DEF AREA START BIT 4 (RW-0) CMD/DEF AREA END BIT 4 (RW-0) BUFFER POINTER BIT 4 (R-1) Bit 3 PACT PRESCALE SELECT 3 (RP-0) CMD/DEF AREA START BIT 3 (RW-0) CMD/DEF AREA END BIT 3 (RW-0) BUFFER POINTER BIT 3 (R-0) Reserved PACT RXRDY (RC-0) PACT RXDT7 (R-0) PACT TXDT7 (RW-0) PACT OP8 STATE (RW-0) CMD/DEF INT 7 FLAG (RC-0) CP2 INT ENA (RW-0) CP4 INT ENA (RW-0) CP6 INT ENA (RW-0) BUFFER HALF/FULL INT ENA (RW-0) PACT TXRDY (R-1) PACT RXDT6 (R-0) PACT TXDT6 (RW-0) PACT OP7 STATE (RW-0) CMD/DEF INT 6 FLAG (RC-0) CP2 INT FLAG (RC-0) CP4 INT FLAG (RC-0) CP6 INT FLAG (RC-0) BUFFER HALF/FULL INT FLAG (RC-0) PACT PARITY (R-0) PACT RXDT5 (R-0) PACT TXDT5 (RW-0) PACT OP6 STATE (RW-0) CMD/DEF INT 5 FLAG (RC-0) CP2 CAPT RISING EDGE (RW-0) CP4 CAPT RISING EDGE (RW-0) CP6 CAPT RISING EDGE (RW-0) INPUT CAPT PRESCALE SELECT 3 (RW-0) PACT FE (RC-0) PACT RXDT4 (R-0) PACT TXDT4 (RW-0) PACT OP5 STATE (RW-0) CMD/DEF INT 4 FLAG (RC-0) CP2 CAPT FALLING EDGE (RW-0) CP4 CAPT FALLING EDGE (RW-0) CP6 CAPT FALLING EDGE (RW-0) INPUT CAPT PRESCALE SELECT 2 (RW-0) PACT SCI RX INT ENA (RW-0) PACT RXDT3 (R-0) PACT TXDT3 (RW-0) PACT OP4 STATE (RW-0) CMD/DEF INT 3 FLAG (RC-0) CP1 INT ENA (RW-0) CP3 INT ENA (RW-0) CP5 INT ENA (RW-0) INPUT CAPT PRESCALE SELECT 1 (RW-0) PACT SCI TX INT ENA (RW-0) PACT RXDT2 (R-0) PACT TXDT2 (RW-0) PACT OP3 STATE (RW-0) CMD/DEF INT 2 FLAG (RC-0) CP1 INT FLAG (RC-0) CP3 INT FLAG (RC-0) CP5 INT FLAG (RC-0) CP6 EVENT ONLY (RW-0) -- PACT RXDT1 (R-0) PACT TXDT1 (RW-0) PACT OP2 STATE (RW-0) CMD/DEF INT 1 FLAG (RC-0) CP1 CAPT RISING EDGE (RW-0) CP3 CAPT RISING EDGE (RW-0) CP5 CAPT RISING EDGE (RW-0) EVENT COUNTER SW RESET (RW-0) PACT SCI SW RESET (RW-0) PACT RXDT0 (R-0) PACT TXDT0 (RW-0) PACT OP1 STATE (RW-0) CMD/DEF INT 0 FLAG (RC-0) CP1 CAPT FALLING EDGE (RW-0) CP3 CAPT FALLING EDGE (RW-0) CP5 CAPT FALLING EDGE (RW-0) OP SET/CLR SELECT (RW-0) Bit 2 PACT PRESCALE SELECT 2 (RP-0) CMD/DEF AREA START BIT 2 (RW-0) CMD/DEF AREA END BIT 2 (RW-0) BUFFER POINTER BIT 2 (R-0) Bit 1 PACT PRESCALE SELECT 1 (RP-0) Bit 0 PACT PRESCALE SELECT 0 (RP-0)
PACTSCR
1040h
P040
CDSTART
1041h
P041
--
--
--
CDEND
1042h
P042
--
CMD/DEF AREA END BIT 6 (RW-0) 1 (R-1)
--
--
BUFPTR
1043h
P043
1 (R-1)
BUFFER POINTER BIT 1 (R-0)
--
1044h SCICTLP 1045h
P044 P045
RXBUFP
1046h
P046
TXBUFP
1047h
P047
OPSTATE
1048h
P048
CDFLAGS
1049h
P049
CPCTL1
104Ah
P04A
CPCTL2
104Bh
P04B
CPCTL3
104Ch
P04C
CPPRE
104Dh
P04D
WDRST
104Eh
P04E PACT STEST (RP-0) PACT GROUP 1 PRIORITY (RP-0)
WD Reset Key PACT GROUP 2 PRIORITY (RP-0) PACT GROUP 3 PRIORITY (RP-0) PACT MODE SELECT (RP-0) PACT WD PRESCALE SELECT 1 (RP-0) PACT WD PRESCALE SELECT 0 (RP-0)
PACTPRI
104Fh
P04F
--
Programmable Acquisition and Control Timer (PACT)
15-37
PACT Control Registers
15.11.1 Setup Control Register (PACTSCR)
The PACTSCR register determines the time base for the PACT module, enables the command/definition area, and controls the default timer overflow.
Setup Control Register (PACTSCR) [Memory Address 1040h]
Bit #
P040
7
DEFTIM OVRFL INT ENA RW-0
6
DEFTIM OVRFL INT FLAG RC-0
5
CMD/DEF AREA ENA RW-0
4
FAST MODE SELECT RP-0
3
PACT PRESCALE SELECT3 RP-0
2
PACT PRESCALE SELECT2 RP-0
1
PACT PRESCALE SELECT1 RP-0
0
PACT PRESCALE SELECT0 RP-0
R = Read, W = Write, P = Privilege write only, C = Clear, -n = Value of the bit after the register is reset
Bit 7
DEFTIM OVRFL INT ENA. Default Timer Overflow Interrupt Enable. This bit controls the default timer overflow interrupting capability. 0 = Disables interrupt 1 = Enables interrupt
Bit 6
DEFTIM OVRFL INT FLAG. Default Timer Overflow Interrupt Flag. This bit indicates the status of the PACT default timer overflow interrupt. This bit is cleared by reset or when a zero is written to it; it is set by overflow. 0 = Default timer overflow interrupt inactive 1 = Default timer overflow interrupt pending
Bit 5
CMD/DEF AREA ENA. Command and Definition Area Enable. This bit determines if the command/definition area of the dual-port RAM is enabled. This allows the PACT module to use this area for commands and definitions. 0 = Command/definition area is ignored 1 = Enables the commands and definitions
15-38
PACT Control Registers
Bit 4
FAST MODE SELECT. This bit determines if the system clock is divided by 8 before entering into the 4-bit prescale. This bit, as well as the PACT PRESCALE SELECT 0-3 bits, determines the time base for the PACT module. The possible combinations are shown below.
Table 15-5. Bits Determining PACT-Module Time Base
Divide Rate PACT PRESCALE SELECTn Bits 3210 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 FAST MODE SELECT Bit Value =1 2 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 =0 16 16 24 32 40 40 56 64 72 82 88 96 104 112 120 128
Bits 3-0
PACT PRESCALE SELECT3-0. These four bits select a prescaler divide rate for the PACT module. The bits specify the divide of the system clock from /2 to /16, giving 15 possible choices. The actual divide rate is also determined by the value of the FAST MODE SELECT bit. The possible combinations for a FAST MODE SELECT bit in either 1 or 0 are shown in the right half of Table 15-5.
Programmable Acquisition and Control Timer (PACT)
15-39
PACT Control Registers
15.11.2 Command/Definition Area Start Register (CDSTART)
The CDSTART register defines the starting address of the command/definition area and enables the interrupts for that area.
Command/Definition Area Start Register (CDSTART) [Memory Address 1041h]
Bit #
P041
7
CMD/DEF AREA INT ENA RW-0
6
--
5
CMD/DEF AREA START BIT 5 RW-0
4
CMD/DEF AREA START BIT 4 RW-0
3
CMD/DEF AREA START BIT 3 RW-0
2
CMD/DEF AREA START BIT 2 RW-0
1
--
0
--
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7
CMD/DEF AREA INT ENA. Command and Definition Area Interrupt Enable. This bit enables interrupts from the command/definition area. 0 = Disables interrupt 1 = Enables interrupt
Bit 6 Bits 5-2
Reserved. Read data is indeterminate. CMD/DEF AREA START BIT 5-2. Command and Definition Area Start Bits 5-2. These bits define the start address of the Command/Definition Area. There are 16 possible locations for this area to start. The address is the same if bits 7, 6, 1, and 0 of this register are set to 1. A table of the bits and their corresponding addresses is shown in Table 15-6.
Bits 1-0
Reserved. Read data is indeterminate.
15-40
PACT Control Registers
Table 15-6. Bits Defining the Command/Definition Area Start Addresses
CMD/DEF AREA START Bits 5 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 4 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 3 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 CMD/DEF Area Start Addresses TMS370Cx36 Address 01C3h 01C7h 01CBh 01CFh 01D3h 01D7h 01DBh 01DFh 01E3h 01E7h 01EBh 01EFh 01F3h 01F7h 01FBh 01FFh TMS370Cx32 Address 00C3h 00C7h 00CBh 00CFh 00D3h 00D7h 00DBh 00DFh 00E3h 00E7h 00EBh 00EFh 00F3h 00F7h 00FBh 00FFh Register R0C3 R0C7 R0CB R0CF R0D3 R0D7 R0DB R0DF R0E3 R0E7 R0EB R0EF R0F3 R0F7 R0FB R0FF invalid invalid invalid Notes
Invalid in Mode B.
Programmable Acquisition and Control Timer (PACT)
15-41
PACT Control Registers
15.11.3 Command/Definition Area End Register (CDEND)
The CDEND register defines the end address of the command/definition area.
Command/Definition Area End Register (CDEND) [Memory Address 1042h]
Bit #
P042
7
--
6
CMD/DEF AREA END BIT 6 RW-0
5
CMD/DEF AREA END BIT 5 RW-0
4
CMD/DEF AREA END BIT 4 RW-0
3
CMD/DEF AREA END BIT 3 RW-0
2
CMD/DEF AREA END BIT 2 RW-0
1
--
0
--
R = Read, W = Write, -n = Value of the bit after the register is reset
Bit 7 Bits 6-2
Reserved. Read data is indeterminate. CMD/DEF AREA END BIT 6-2. Command/Definition Area End Bits 6-2. These bits define the end address of the command/definition area. There are 32 possible locations for the command/definition area end. The address is the same if bit 7 of this register is set to 1, and bit 1 and bit 0 are set to 0. Table 15-7 lists the bits and their corresponding addresses. Reserved. Read data is indeterminate.
Bits 1-0
15-42
PACT Control Registers
Table 15-7. Bits Defining the Command/Definition Area End Addresses
CMD/DEF Area End Addresses CMD/DEF AREA END BIT 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 4 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 3 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 TMS370Cx36 Address 0180h 0184h 0188h 018Ch 0190h 0194h 0198h 019Ch 01A0h 01A4h 01A8h 01ACh 01B0h 01B4h 01B8h 01BCh 01C0h 01C4h 01C8h 01CCh 01D0h 01D4h 01D8h 01DCh 01E0h 01E4h 01E8h 01ECh 01F0h 01F4h 01F8h 01FCh TMS370Cx32 Address 0080h 0084h 0088h 008Ch 0090h 0094h 0098h 009Ch 00A0h 00A4h 00A8h 00ACh 00B0h 00B4h 00B8h 00BCh 00C0h 00C4h 00C8h 00CCh 00D0h 00D4h 00D8h 00DCh 00E0h 00E4h 00E8h 00ECh 00F0h 00F4h 00F8h 00FCh Register R080h R084h R088h R08Ch R090h R094h R098h R09Ch R0A0h R0A4h R0A8h R0ACh R0B0h R0B4h R0B8h R0BCh R0C0h R0C4h R0C8h R0CCh R0D0h R0D4h R0D8h R0DCh R0E0h R0E4h R0E8h R0ECh R0F0h R0F4h R0F8h R0FCh
Programmable Acquisition and Control Timer (PACT)
15-43
PACT Control Registers
15.11.4 Buffer Pointer Register (BUFPTR)
The BUFPTR register defines the address of the buffer pointer.
Buffer Pointer Register (BUFPTR) [Memory Address 1043h]
Bit #
P043
7
1 R-1
6
1 R-1
5
BUFFER POINTER BIT 5 R-1
4
BUFFER POINTER BIT 4 R-1
3
BUFFER POINTER BIT 3 R-0
2
BUFFER POINTER BIT 2 R-0
1
BUFFER POINTER BIT 1 R-0
0
0 R-0
R = Read, -n = Value of the bit after the register is reset
Bits 7-6 Bits 5-1
Reserved. BUFFER POINTER BIT 5-1. These bits define the address of the buffer pointer that points to the next available address out of 32 possible locations in the circular buffer. These addresses are the same if bit 7 and bit 6 of this register are set to 1, and bit 0 is set to 0. A table of the bits and their corresponding addresses are listed in Table 15-8. Reserved.
Bit 0
15-44
PACT Control Registers
Table 15-8. Buffer Pointer Address Generation
Buffer Pointer Buffer Pointer Bits 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 3 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 2 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 TMS370Cx36 Address 01C0h 01C2h 01C4h 01C6h 01C8h 01CAh 01CCh 01CEh 01D0h 01D2h 01D4h 01D6h 01D8h 01DAh 01DCh 01DEh 01E0h 01E2h 01E4h 01E6h 01E8h 01EAh 01ECh 01EEh 01E0h 01F2h 01F4h 01F6h 01F8h 01FAh 01FCh 01FEh TMS370Cx32 Address 00C0h 00C2h 00C4h 00C6h 00C8h 00CAh 00CCh 00CEh 00D0h 00D2h 00D4h 00D6h 00D8h 00DAh 00DCh 00DEh 00E0h 00E2h 00E4h 00E6h 00E8h 00EAh 00ECh 00FEh 00F0h 00F2h 00F4h 00F6h 00F8h 00FAh 00FCh 00FEh Register R0C0h R0C2h R0C4h R0C6h R0C8h R0CAh R0CCh R0CEh R0D0h R0D2h R0D4h R0D6h R0D8h R0DAh R0DCh R0DEh R0E0h R0E2h R0E4h R0E6h R0E8h R0EAh R0ECh R0EEh R0F0h R0F2h R0F4h R0F6h R0F8h R0FAh R0FCh R0FEh
Programmable Acquisition and Control Timer (PACT)
15-45
PACT Control Registers
15.11.5 PACT-SCI Control Register (SCICTLP)
The SCICTLP register controls the functions of the mini-SCI.
PACT-SCI Control Register (SCICTLP) [Memory Address 1045h]
Bit #
P045
7
PACT RXRDY RC-0
6
PACT TXRDY R-1
5
PACT PARITY R-0
4
PACT FE RC-0
3
PACT SCI RX INT ENA RW-0
2
PACT SCI TX INT ENA RW-0
1
--
0
PACT SCI SW RESET RW-0
R = Read, W = Write, C = Clear, -n = Value of the bit after the register is reset
Bit 7
PACT RXRDY. PACT Receive Ready. This bit shows when the receive buffer is full. This bit is cleared by a system reset, by the PACT SCI software reset, when a zero is written to it, or when the SCI RX DATA register is read. 0 = Receive buffer is empty 1 = Receive buffer is full
Bit 6
PACT TXRDY. PACT Transmit Ready. This bit shows when the transmit buffer is empty. This bit is set by a system reset, by the PACT SCI software reset, or when the SCI TX DATA register has been shifted out. 0 = Transmit buffer is full 1 = Transmit buffer is empty
Bit 5
PACT PARITY. PACT Receive Data Parity Bit. This bit is set as the result of the incoming parity calculation. To perform a parity check on incoming data, this bit is compared to a 0 or 1 for even or odd parity respectively. 0 = Received data was even parity 1 = Received data was odd parity
Bit 4
PACT FE. PACT Framing Error. This flag bit shows the detection of a framing error. This bit remains set until cleared by a PACT SCI software reset, by a system reset, or by writing a zero to it. 0 = No framing error 1 = Framing error was detected
15-46
PACT Control Registers
Bit 3
PACT SCI RX INT ENA. PACT SCI Receive Interrupt Enable. This bit enables the interrupt to occur when the receive buffer is full. 0 = Does not generate an interrupt when the receive buffer is full 1 = Generates an interrupt when the receive buffer is full
Bit 2
PACT SCI TX INT ENA. PACT SCI Transmit Interrupt Enable. This bit enables the interrupt to occur when the transmit buffer is empty. 0 = Does not generate an interrupt when the transmit buffer is empty 1 = Generates an interrupt when the transmit buffer is empty
Bit 1 Bit 0
Reserved. Read data is indeterminate. PACT SCI SW RESET. PACT SCI Software Reset. When set, this bit puts the SCI into a software reset state so that the parameters of the SCI can be set up. This bit must be cleared to allow the SCI to function. 0 = SCI in operating mode 1 = SCI in software reset mode
Programmable Acquisition and Control Timer (PACT)
15-47
PACT Control Registers
15.11.6 PACT-SCI RX Data Register (RXBUFP)
This register contains the data received by the SCI.
PACT-SCI RX Data Register (RXBUFP) [Memory Address 1046h]
Bit #
P046
7
PACT RXDT7 R-0
6
PACT RXDT6 R-0
5
PACT RXDT5 R-0
4
PACT RXDT4 R-0
3
PACT RXDT3 R-0
2
PACT RXDT2 R-0
1
PACT RXDT1 R-0
0
PACT RXDT0 R-0
R = Read, -n = Value of the bit after the register is reset
Bits 7-0
PACT RXDT 7-0. PACT Receive Data 7-0.
15.11.7 PACT-SCI TX Data Register (TXBUFP)
This register contains the data to be transmitted by the SCI.
PACT-SCI TX Data Register (TXBUFP) [Memory Address 1047h]
Bit #
P047
7
PACT TXDT7 RW-0
6
PACT TXDT6 RW-0
5
PACT TXDT5 RW-0
4
PACT TXDT4 RW-0
3
PACT TXDT3 RW-0
2
PACT TXDT2 RW-0
1
PACT TXDT1 RW-0
0
PACT TXDT0 RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-0
PACT TXDT 7-0. PACT Transmit Data 7-0.
15-48
PACT Control Registers
15.11.8 Output Pins 1-8 State Register (OPSTATE)
The OPSTATE register contains information about the current state of the output pins.
Output Pin 1-8 State Register (OPSTATE) [Memory Address 1048h]
Bit #
P048
7
PACT OP8 STATE RW-0
6
PACT OP7 STATE RW-0
5
PACT OP6 STATE RW-0
4
PACT OP5 STATE RW-0
3
PACT OP4 STATE RW-0
2
PACT OP3 STATE RW-0
1
PACT OP2 STATE RW-0
0
PACT OP1 STATE RW-0
R = Read, W = Write, -n = Value of the bit after the register is reset
Bits 7-0
PACT OP8-1 STATE. PACT Output Pins 8-1 State Bits. These bits reflect the current state of the output pins OP8 to OP1. Each bit is the actual state of the corresponding pin. Writing a 1 to any bit in this register modifies the corresponding output pin as determined by the OP SET/CLR SELECT bit (P04D.0).
Bit OPx Write 1 1 0 OP SET/CLR SELECT 1 0 x Result PACT OPx STATE = 1 PACT OPx STATE = 0 PACT OPx STATE remains unchanged
Upon reset, all pins are initialized to the low state.
Example 15-2. Example 1, if OP SET/CLR SELECT = 1
11001011 OP STATE Register 11110000 Write to OP STATE Register ---------- 11111011 New value in OP STATE Register.
Example 15-3. Example 2, if OP SET/CLR SELECT = 0
11001011 OP STATE Register 11110000 Write to OP STATE Register ---------- 00001011 New value in OP STATE Register.
Programmable Acquisition and Control Timer (PACT)
15-49
PACT Control Registers
15.11.9 Command/Definition Entry Flags Register (CDFLAGS)
The CDFLAGS register contains information about the command/definition interrupts.
Command/Definition Entry Flags Register (CDFLAGS) [Memory Address 1049h]
Bit #
P049
7
CMD/DEF INT 7 FLAG RC-0
6
CMD/DEF INT 6 FLAG RC-0
5
CMD/DEF INT 5 FLAG RC-0
4
CMD/DEF INT 4 FLAG RC-0
3
CMD/DEF INT 3 FLAG RC-0
2
CMD/DEF INT 2 FLAG RC-0
1
CMD/DEF INT 1 FLAG RC-0
0
CMD/DEF INT 0 FLAG RC-0
R = Read, C = Clear, -n = Value of the bit after the register is reset
Bits 7-0
CMD/DEF INT 7-0 FLAG. Command/Definition Interrupt 7-0 Flag. These bits are the interrupt flags for the command/definition area. If an interrupt has been enabled in a 4-byte command or definition, then the appropriate bit in this register will be set when the interrupt conditions are met. The actual bit set is determined by the command or definition's entry address. The entry address is derived from bits 2, 3, and 4 of the address. If the command or definition is at address 006Ch, 006Dh, 006Eh, or 006Fh (32 bits), then 0110 11xx is the binary value of the address. The entry address comes from bits 4-3-2 = 011 = Entry 3. Thus, the flag associated with entry address 3 is used when this command or definition causes an interrupt. These flags are not affected by the CMD/DEF AREA INT ENA bit (CDSTART.7).
CMD/DEF INT FLAG Set CMD/DEF INT 0 FLAG CMD/DEF INT 1 FLAG CMD/DEF INT 2 FLAG CMD/DEF INT 3 FLAG CMD/DEF INT 4 FLAG CMD/DEF INT 5 FLAG CMD/DEF INT 6 FLAG CMD/DEF INT 7 FLAG Command or Definition Entry That Generated Interrupt Request (Entry Address >> 2) ENTRY mod 8 = 0 (Entry Address >> 2) ENTRY mod 8 = 1 (Entry Address >> 2) ENTRY mod 8 = 2 (Entry Address >> 2) ENTRY mod 8 = 3 (Entry Address >> 2) ENTRY mod 8 = 4 (Entry Address >> 2) ENTRY mod 8 = 5 (Entry Address >> 2) ENTRY mod 8 = 6 (Entry Address >> 2) ENTRY mod 8 = 7
15-50
PACT Control Registers
15.11.10 Setup CP Control Register 1 (CPCTL1)
The CPCTL1 register controls the functions of the CP1 and CP2 pins.
Setup CP Control Register 1 (CPCTL1) [Memory Address 104Ah]
Bit #
P04A
7
CP2 INT ENA RW-0
6
CP2 INT FLAG RC-0
5
CP2 CAPT RISING EDGE RW-0
4
CP2 CAPT FALLING EDGE RW-0
3
CP1 INT ENA RW-0
2
CP1 INT FLAG RC-0
1
CP1 CAPT RISING EDGE RW-0
0
CP1 CAPT FALLING EDGE RW-0
R = Read, W = Write, C = Clear, -n = Value of the bit after the register is reset
Bit 7
CP2 INT ENA. CP2 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP2. 0 = Disables interrupt 1 = Enables interrupt
Bit 6
CP2 INT FLAG. CP2 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP2. This bit must be cleared by the program during an interrupt routine when CP2 INT ENA is set. 0 = Capture interrupt from selected edge of CP2 inactive 1 = Capture interrupt from selected edge of CP2 pending
Bit 5
CP2 CAPT RISING EDGE. CP2 Capture Rising Edge. This bit selects the rising edge on pin CP2 to cause a timer capture. Table 15-9 describes all possible combinations.
Table 15-9. Rising/Falling Edge Capture Bits
CPx CAPT RISING EDGE 0 0 1 1 CPx CAPT FALLING EDGE 0 1 0 1 Capture on Selected Edges Disables captures Captures on falling edges only Captures on rising edges only Captures on both rising and falling edges
Bit 4
CP2 CAPT FALLING EDGE. CP2 Capture Falling Edge. This bit selects the falling edge on pin CP2 to cause a timer capture. Table 15-9 describes all possible combinations.
Programmable Acquisition and Control Timer (PACT)
15-51
PACT Control Registers
Bit 3
CP1 INT ENA. CP1 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP1. 0 = Disables interrupt 1 = Enables interrupt
Bit 2
CP1 INT FLAG. CP1 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP1. This bit must be cleared by the program during an interrupt routine when CP1 INT ENA is set. 0 = Capture interrupt from selected edge of CP1 inactive 1 = Capture interrupt from selected edge of CP1 pending
Bit 1
CP1 CAPT RISING EDGE. CP1 Capture Rising Edge. This bit selects the rising edge on pin CP1 to cause a timer capture. Table 15-9 describes all possible combinations.
Bit 0
CP1 CAPT FALLING EDGE. CP1 Capture Falling Edge. This bit selects the falling edge on pin CP1 to cause a timer capture. Table 15-9 describes all possible combinations.
15-52
PACT Control Registers
15.11.11 Setup CP Control Register 2 (CPCTL2)
The CPCTL2 register controls the functions of the CP3 and CP4 pins.
Setup CP Control Register 2 (CPCTL2) [Memory Address 104Bh]
Bit #
P04B
7
CP4 INT ENA RW-0
6
CP4 INT FLAG RC-0
5
CP4 CAPT RISING EDGE RW-0
4
CP4 CAPT FALLING EDGE RW-0
3
CP3 INT ENA RW-0
2
CP3 INT FLAG RC-0
1
CP3 CAPT RISING EDGE RW-0
0
CP3 CAPT FALLING EDGE RW-0
R = Read, W = Write, C = Clear, -n = Value of the bit after the register is reset
Bit 7
CP4 INT ENA. CP4 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP4. 0 = Disables interrupt 1 = Enables interrupt
Bit 6
CP4 INT FLAG. CP4 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP4. This bit must be cleared by the program during an interrupt routine when CP4 INT ENA is set. 0 = Capture interrupt from selected edge of CP4 inactive 1 = Capture interrupt from selected edge of CP4 pending
Bit 5
CP4 CAPT RISING EDGE. CP4 Capture Rising Edge. This bit selects the rising edge on pin CP4 to cause a timer capture. Table 15-10 describes all possible combinations.
Table 15-10. Rising/Falling Edge Capture Bits
CPx CAPT RISING EDGE 0 0 1 1 CPx CAPT FALLING EDGE 0 1 0 1 Capture on Selected Edges Disables captures Captures on falling edges only Captures on rising edges only Captures on both rising and falling edges
Bit 4
CP4 CAPT FALLING EDGE. CP4 Capture Falling Edge. This bit selects the falling edge on pin CP4 to cause a timer capture. Table 15-10 describes all possible combinations.See the table following the bit 1 description for all possible combinations.
Programmable Acquisition and Control Timer (PACT)
15-53
PACT Control Registers
Bit 3
CP3 INT ENA. CP3 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP3. 0 = Disables interrupt 1 = Enables interrupt
Bit 2
CP3 INT FLAG. CP3 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP3. This bit must be cleared by the program during an interrupt routine when CP3 INT ENA is set. 0 = Capture interrupt from selected edge of CP3 inactive 1 = Capture interrupt from selected edge of CP3 pending
Bit 1
CP3 CAPT RISING EDGE. CP3 Capture Rising Edge. This bit selects the rising edge on pin CP3 to cause a timer capture. Table 15-10 describes all possible combinations.
Bit 0
CP3 CAPT FALLING EDGE. CP3 Capture Falling Edge. This bit selects the falling edge on pin CP3 to cause a timer capture. Table 15-10 describes all possible combinations.
15-54
PACT Control Registers
15.11.12 Setup CP Control Register 3 (CPCTL3)
The CPCTL3 register controls the functions of the CP5 and CP6 pins.
Setup CP Control Register 3 (CPCTL3) [Memory Address 104Ch]
Bit #
P04C
7
CP6 INT ENA RW-0
6
CP6 INT FLAG RC-0
5
CP6 CAPT RISING EDGE RW-0
4
CP6 CAPT FALLING EDGE RW-0
3
CP5 INT ENA RW-0
2
CP5 INT FLAG RC-0
1
CP5 CAPT RISING EDGE RW-0
0
CP5 CAPT FALLING EDGE RW-0
R = Read, W = Write, C = Clear, -n = Value of the bit after the register is reset
Bit 7
CP6 INT ENA. CP6 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP6. 0 = Disables interrupt 1 = Enables interrupt
Bit 6
CP6 INT FLAG. CP6 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP6. This bit must be cleared by the program during an interrupt routine when CP6 INT ENA is set. 0 = Capture interrupt from selected edge of CP6 inactive 1 = Capture interrupt from selected edge of CP6 pending
Bit 5
CP6 CAPT RISING EDGE. CP6 Capture Rising Edge. This bit selects the rising edge on pin CP6 to cause a timer capture. Table 15-11 describes all possible combinations.
Table 15-11. Rising/Falling Edge Capture Bits
CPx CAPT RISING EDGE 0 0 1 1 CPx CAPT FALLING EDGE 0 1 0 1 Capture on Selected Edges Disables captures Captures on falling edges only Captures on rising edges only Captures on both rising and falling edges
Bit 4
CP6 CAPT FALLING EDGE. CP6 Capture Falling Edge. This bit selects the falling edge on pin CP6 to cause a timer capture. Table 15-11 describes all possible combinations.
Programmable Acquisition and Control Timer (PACT)
15-55
PACT Control Registers
Bit 3
CP5 INT ENA. CP5 Interrupt Enable. If set, this bit enables the interrupt when the selected edge occurs on pin CP5. 0 = Disables interrupt 1 = Enables interrupt
Bit 2
CP5 INT FLAG. CP5 Interrupt Flag. This bit indicates that the selected edge has occurred on pin CP5. This bit must be cleared by the program during an interrupt routine when CP5 INT ENA is set. 0 = Capture interrupt from selected edge of CP5 inactive 1 = Capture interrupt from selected edge of CP5 pending
Bit 1
CP5 CAPT RISING EDGE. CP5 Capture Rising Edge. This bit selects the rising edge on pin CP5 to cause a timer capture. Table 15-11 describes all possible combinations.
Bit 0
CP5 CAPT FALLING EDGE. CP5 Capture Falling Edge. This bit selects the falling edge on pin CP5 to cause a timer capture. Table 15-11 describes all possible combinations.
15-56
PACT Control Registers
15.11.13 CP Input Control Register (CPPRE)
The CPPRE register controls input and output functions.
CP Input Control Register (CPPRE) [Memory Address 104Dh]
Bit #
7
BUFFER HALF/FULL INT ENA RW-0
6
BUFFER HALF/FULL INT FLAG RC-0
5
INPUT CAPT PRESCALE SELECT3 RW-0
4
INPUT CAPT PRESCALE SELECT2 RW-0
3
INPUT CAPT PRESCALE SELECT1 RW-0
2
CP6 EVENT ONLY RW-0
1
EVENT COUNTER SW RESET RW-0
0
OP SET/CLR SELECT RW-0
P04D
R = Read, W = Write, C = Clear, -n = Value of the bit after the register is reset
Bit 7
BUFFER HALF/FULL INT ENA. Buffer Half/Full Interrupt Enable. This bit determines whether or not the circular buffer can generate an interrupt on the half full and full buffer boundaries. 0 = Disables interrupt 1 = Enables interrupt
Bit 6
BUFFER HALF/FULL INT FLAG. Buffer Half/Full Interrupt Flag. This bit is set when the circular buffer becomes half or completely full. It is cleared when a zero is written to this bit or during RESET. 0 = Interrupt inactive 1 = Interrupt pending
Bits 5-3
INPUT CAPT PRESCALE SELECT3-1. Input Capture Prescale Select 3-1. These bits set the prescaler rate for pins CP3 to CP6. The bits allow a divide rate of /1 to /8 as shown in the table below. The prescale rate does not affect the event counter.
INPUT CAPT PRESCALE SELECTx Bits 3 0 0 0 0 1 1 1 1 2 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1
Divide Rate /1 /2 /3 /4 /5 /6 /7 /8
Programmable Acquisition and Control Timer (PACT)
15-57
PACT Control Registers
Bit 2
CP6 EVENT ONLY. CP6 8-Bit Event Counter Input Only. This bit must be cleared to allow 32-bit captures triggered by CP6. This bit does not disable the 16-bit captures on event (CP6) when triggered by a command/ definition area command. 0 = CP6 increments event counter and causes 32-bit captures 1 = CP6 increments event counter only
Bit 1
EVENT COUNTER SW RESET. 8-Bit Event Counter Software Reset. This bit resets the 8-bit event counter. When set, the 8-bit counter is continuously cleared. This bit must be cleared to enable the event counter to operate. 0 = Event counter operating 1 = Event counter cleared
Bit 0
OP SET/CLR SELECT. Output Pin Set/Clear Write Function Select. This bit controls how the outputs OP1 to OP8 are set or cleared by software.
- When OP SET/CLR = 1, a write to P048 causes the output pins corre- When OP SET/CLR = 0, a write to P048 causes the output pins corre-
sponding to the locations that were written as 1 to be set in the high state. The output pins corresponding to the locations that were written as 0 remain unchanged.
sponding to the locations that were written as 1 to be set in the low state. The output pins corresponding to the locations that were written as 0 remain unchanged. Refer to the following table and to the examples in subsection 15.11.8 on page 15-49.
OPx WRITE Bit 1 1 0 OP SET/CLR SELECT Bit 1 0 x Result PACT OPx STATE = 1 PACT OPx STATE = 0 PACT OPx STATE remains unchanged
15-58
PACT Control Registers
15.11.14 Global Function Control Register (PACTPRI)
The PACTPRI register controls the WD time-out rate, the PACT interrupt priority levels, and the PACT operating mode.
Global Function Control Register (PACTPRI) [Memory Address 104Fh]
Bit #
P04F
7
PACT STEST RP-0
6
--
5
PACT GROUP 1 PRIORITY RP-0
4
PACT GROUP 2 PRIORITY RP-0
3
PACT GROUP 3 PRIORITY RP-0
2
PACT MODE SELECT RP-0
1
PACT WD PRESCALE SELECT1 RP-0
0
PACT WD PRESCALE SELECT0 RP-0
R = Read, P = Privileged write only, C = Clear, -n = Value of the bit after the register is reset
Bit 7
PACT STEST. This bit must be cleared to ensure proper operation.
Bit 6 Bit 5
Reserved. Read data is indeterminate PACT GROUP 1 PRIORITY. PACT Group 1 Priority Select. This bit assigns the interrupt priority level of the PACT group 1 interrupt vectors. 0 = PACT group 1 interrupts are level 1 (high-priority) requests. 1 = PACT group 1 interrupts are level 2 (low-priority) requests.
Bit 4
PACT GROUP 2 PRIORITY. PACT Group 2 Priority Select. This bit assigns the interrupt priority level of the PACT group 2 interrupt vectors. 0 = PACT group 2 interrupts are level 1 (high-priority) requests. 1 = PACT group 2 interrupts are level 2 (low-priority) requests.
Bit 3
PACT GROUP 3 PRIORITY. PACT Group 3 Priority Select. This bit assigns the interrupt priority level of the PACT group 3 interrupt vectors. 0 = PACT group 3 interrupts are level 1 (high-priority) requests. 1 = PACT group 3 interrupts are level 2 (low-priority) requests.
Bit 2
PACT MODE SELECT. PACT Mode Select. This bit selects the mode for the PACT module to operate in. 0 = PACT operates in mode A 1 = PACT operates in mode B
Bit 1-0
PACT WD PRESCALE SELECT1-0. PACT WD Prescale Select 1-0.
Programmable Acquisition and Control Timer (PACT)
15-59
PACT Control Registers
These bits select the WD time-out rate. You can write to these bits only during privilege mode (after reset).
PACT WD PRESCALE SELECT1 Bit 0 0 1 1 PACT WD PRESCALE SELECT0 Bit 0 1 0 1 Options WD reset on bit 9 of default timer WD reset on bit 15 of default timer WD reset on bit 19 of default timer Disable WD
15-60
Running Title--Attribute Reference
Chapter 16
Assembly Language Instruction Set
An assembly language instruction set is a symbolic language that presents binary machine code in a more readable form. The TMS370 family is supported by a 73-function instruction set that uses a wide variety of addressing modes. This chapter includes the following topics:
Topic
Page
16.1 Instruction Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2 16.2 Symbol Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3 16.3 Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4 16.4 Instruction Set Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-23 16.5 Instruction Set Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-32
Chapter Title--Attribute Reference
16-1
Instruction Operation
16.1 Instruction Operation
The assembly language instruction set provides a convenient method of programming the CPU. Each TMS370 assembly language instruction converts directly to one machine operation and consists of the following elements:
-
A function mnemonic. The mnemonic specifies the type of CPU operation. Zero to three operands. The operands indicate where the CPU can find or store data during an instruction execution. The type and combination of operands determine the actual opcode(s) for an instruction. The MOV instruction, for example, has 27 different options, each with its own opcode.
A typical two-operand instruction is shown below:
Mnemonic ADD Source #9, Destination R3
The example above can be read as follows: add the value 9 to the contents of register number 3 and place the result back into register number 3. The destination serves as a second source as well as the final address of the result; moreover, registers can be directly manipulated without having to use intermediate registers. Note that this instruction form differs from the mnemonicdestination-source arrangement that some microprocessors use. The following example shows how the instruction above might appear in a complete program line.
Label XXXXX Instruction ADD Operands #9,R3 Comment ;comment
There should be at least one space between each entry type. The label and comment entries are optional. The 73 instructions are supported by 246 opcodes that provide flexible control of CPU program flow. Some instructions, such as CLRC and TEST A, share the same opcode to help you understand all of the functions of an opcode. Some instructions use 16-bit opcodes, depending on the type of instruction and/or the addressing mode used. The assembler constructs several bit manipulation instructions from other instructions to simplify writing the instructions and to enhance the readability of the program.
16-2
Symbol Definitions
16.2 Symbol Definitions
To understand the instructions described in this chapter, you must know what the symbols in the syntax descriptions represent. Table 16-1 lists the instruction set symbols.
Table 16-1. TMS370 Symbols Defined
Symbol A B C cnd d/D iop8 iop16 label LSB LSbyte MSB MSbyte N name PC PCN Definition Register A or R0 in register file Register B or R1 in register file Carry flag/no borrow flag Condition Destination operand (8-bit/16-bit) 8-bit immediate operand 16-bit immediate operand 16-bit label Least significant bit Least significant byte Most significant bit Most significant byte Sign flag Symbol-defined for a bit Program counter 16-bit address of next instruction (program counter next) Destination register in peripheral file (0 d 255) Register n of peripheral file (0 Symbol-defined peripheral bit Source register in peripheral file (0 s 255) 8-bit signed offset 16-bit signed offset Symbol Rd Rn Rname Rp Rpd Rps Rs s SP ST V XADDR Z (x) ((x)) <> Definition Destination register in register file (0 n 255) Register n of register file (0 n 255) Symbol-defined register bit Register pair Destination register pair Source register pair Source register in register file (0 s 255) Source operand Stack pointer Status register Overflow 16-bit address Zero flag Contents of memory at address x Contents of memory location designated by contents at address x Indicates an entry that must be typed in. For example,


▲Up To Search▲   

 
Price & Availability of SPNU127A

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

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


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